Skip to content

Commit 0fd488e

Browse files
committed
Add test for Text::getLineWidth without a font
1 parent 1a3d55e commit 0fd488e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/Text.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2424

2525
#include "TGUI/Color.hpp"
26+
#include "TGUI/TextStyle.hpp"
2627
#include "Tests.hpp"
2728

2829
TEST_CASE("[Text]")
@@ -165,5 +166,13 @@ TEST_CASE("[Text]")
165166
text3.setFont("resources/DejaVuSans.ttf");
166167
REQUIRE(text.getSize().y == text3.getSize().y);
167168
}
169+
170+
SECTION("Line width without font")
171+
{
172+
REQUIRE(text.getLineWidth("Foo", nullptr, 0, {}) == 0.0f);
173+
REQUIRE(text.getLineWidth("Bar", nullptr, 1, tgui::TextStyle::Underlined) == 0.0f);
174+
REQUIRE(text.getLineWidth("Baz", nullptr, 42, {}) == 0.0f);;
175+
REQUIRE(text.getLineWidth("FooBar", nullptr, 666, tgui::TextStyle::StrikeThrough) == 0.0f);
176+
}
168177
}
169178
}

0 commit comments

Comments
 (0)