From 37738f6afad0cf302bf19c6a1f3149df51f8dd98 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 5 Mar 2026 10:34:09 +0100 Subject: [PATCH 1/4] Add tests for Font::isSmooth & Font::getFontHeight when backendFont is nullptr --- tests/Font.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Font.cpp b/tests/Font.cpp index 177897929..4bdf7b830 100644 --- a/tests/Font.cpp +++ b/tests/Font.cpp @@ -27,6 +27,7 @@ TEST_CASE("[Font]") { tgui::Font font("resources/DejaVuSans.ttf"); + tgui::Font nullFont(nullptr); SECTION("Constructor") { @@ -43,6 +44,11 @@ TEST_CASE("[Font]") REQUIRE(!font.isSmooth()); font.setSmooth(true); REQUIRE(font.isSmooth()); + REQUIRE(nullFont.isSmooth()); + nullFont.setSmooth(false); + REQUIRE(nullFont.isSmooth()); + nullFont.setSmooth(true); + REQUIRE(nullFont.isSmooth()); } SECTION("Font height") @@ -53,5 +59,6 @@ TEST_CASE("[Font]") REQUIRE((fontHeight >= 33 && fontHeight <= 39)); REQUIRE((ascent >= 27 && ascent <= 30)); REQUIRE((descent >= -9 && descent <= -6)); + REQUIRE(nullFont.getFontHeight(42) == 0); } } From 948d1ce9d07121725c570d51ca76aa93abc47841 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 5 Mar 2026 10:48:43 +0100 Subject: [PATCH 2/4] Expand Down test for ToggleButton slightly --- tests/Widgets/ToggleButton.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Widgets/ToggleButton.cpp b/tests/Widgets/ToggleButton.cpp index ee63e82a7..a3055357a 100644 --- a/tests/Widgets/ToggleButton.cpp +++ b/tests/Widgets/ToggleButton.cpp @@ -66,8 +66,12 @@ TEST_CASE("[ToggleButton]") REQUIRE(!button->isDown()); button->setDown(true); REQUIRE(button->isDown()); + REQUIRE_NOTHROW(button->setDown(true)); + REQUIRE(button->isDown()); button->setDown(false); REQUIRE(!button->isDown()); + REQUIRE_NOTHROW(button->setDown(false)); + REQUIRE(!button->isDown()); } SECTION("TextSize") From 6365f00a3691f2e7da2dfda33ee8bd602a2ece51 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 5 Mar 2026 10:58:05 +0100 Subject: [PATCH 3/4] Test Panel::[get/set]EventBubbling --- tests/Widgets/Panel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Widgets/Panel.cpp b/tests/Widgets/Panel.cpp index a4d38b033..b21549bd7 100644 --- a/tests/Widgets/Panel.cpp +++ b/tests/Widgets/Panel.cpp @@ -145,6 +145,15 @@ TEST_CASE("[Panel]") REQUIRE(mouseEnteredCount == 1); REQUIRE(mouseLeftCount == 1); } + + SECTION("event bubbling") + { + REQUIRE(!panel->getEventBubbling()); + panel->setEventBubbling(true); + REQUIRE(panel->getEventBubbling()); + panel->setEventBubbling(false); + REQUIRE(!panel->getEventBubbling()); + } } testWidgetRenderer(panel->getRenderer()); From 5530faec2d80608c45e9eb593c470b9a38a77d57 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 5 Mar 2026 12:25:12 +0100 Subject: [PATCH 4/4] Expand test for MenuBar::changeMenuItem --- tests/Widgets/MenuBar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Widgets/MenuBar.cpp b/tests/Widgets/MenuBar.cpp index c8ad20749..d8a75303a 100644 --- a/tests/Widgets/MenuBar.cpp +++ b/tests/Widgets/MenuBar.cpp @@ -244,6 +244,7 @@ TEST_CASE("[MenuBar]") // We can't rename something that doesn't exist REQUIRE(!menuBar->changeMenuItem({"This", "won't", "work"}, "Just testing")); + REQUIRE(!menuBar->changeMenuItem({}, "Testing")); } SECTION("Disabling menus")