diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index 1591490bc1..8b2444cf6f 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -617,66 +617,4 @@ void TextLayout::recalculateSize() } } -//============================================================================== -#if JUCE_UNIT_TESTS - -struct TextLayoutTests : public UnitTest -{ - TextLayoutTests() - : UnitTest ("Text Layout", UnitTestCategories::text) - {} - - static TextLayout createLayout (StringRef text, float width) - { - Font fontToUse (12.0f); - - AttributedString string (text); - string.setFont (std::move (fontToUse)); - - TextLayout layout; - layout.createLayout (std::move (string), width); - - return layout; - } - - void testLineBreaks (const String& line, float width, const StringArray& expected) - { - const auto layout = createLayout (line, width); - - beginTest ("A line is split into expected pieces"); - { - expectEquals (layout.getNumLines(), expected.size()); - - const auto limit = jmin (layout.getNumLines(), expected.size()); - - for (int i = 0; i != limit; ++i) - expectEquals (substring (line, layout.getLine (i).stringRange), expected[i]); - } - } - - void runTest() override - { - const String shortLine ("hello world"); - testLineBreaks (shortLine, 1.0e7f, { shortLine }); - - testLineBreaks ("this line should be split", - 60.0f, - { "this line ", - "should be ", - "split" }); - - testLineBreaks ("these\nlines \nhave\n weird \n spacing ", - 80.0f, - { "these\n", - "lines \n", - "have\n", - " weird \n", - " spacing " }); - } -}; - -static TextLayoutTests textLayoutTests; - -#endif - } // namespace juce