From ad3457434ee3785e2c2d362849886c8daefe5a7c Mon Sep 17 00:00:00 2001 From: Anthony Nicholls Date: Wed, 18 Dec 2024 15:54:48 +0000 Subject: [PATCH] SimpleShapedText: Prevent running tests when no default typefaces can be found --- modules/juce_graphics/fonts/juce_SimpleShapedText.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp b/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp index 02d9612f60..0124a3b680 100644 --- a/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp +++ b/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp @@ -1495,9 +1495,18 @@ struct SimpleShapedTextTests : public UnitTest void runTest (const char* text, float maxWidth) { + const auto defaultTypeface = Font::getDefaultTypefaceForFont (FontOptions{}); + + if (defaultTypeface == nullptr) + { + DBG ("Skipping test: No default typeface found!"); + return; + } + String testString { text }; - SimpleShapedText st { &testString, ShapedTextOptions{}.withMaxWidth (maxWidth) }; + SimpleShapedText st { &testString, ShapedTextOptions{}.withFont (FontOptions { defaultTypeface }) + .withMaxWidth (maxWidth) }; auto success = true;