Skip to content

Commit 72e2b73

Browse files
committed
Add test for Text::getLineWidth without a font
1 parent 2b2c56e commit 72e2b73

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/Text.cpp

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

25+
#include "TGUI/TextStyle.hpp"
2526
#include "Tests.hpp"
2627

2728
TEST_CASE("[Text]")
@@ -137,5 +138,13 @@ TEST_CASE("[Text]")
137138
text3.setFont("resources/DejaVuSans.ttf");
138139
REQUIRE(text.getSize().y == text3.getSize().y);
139140
}
141+
142+
SECTION("Line width without font")
143+
{
144+
REQUIRE(text.getLineWidth("Foo", nullptr, 0, {}) == 0.0f);
145+
REQUIRE(text.getLineWidth("Bar", nullptr, 1, tgui::TextStyle::Underlined) == 0.0f);
146+
REQUIRE(text.getLineWidth("Baz", nullptr, 42, {}) == 0.0f);;
147+
REQUIRE(text.getLineWidth("FooBar", nullptr, 666, tgui::TextStyle::StrikeThrough) == 0.0f);
148+
}
140149
}
141150
}

0 commit comments

Comments
 (0)