mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Removed a leaking UnitTest
This commit is contained in:
parent
cd38d44d86
commit
c6a4bb567e
1 changed files with 0 additions and 62 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue