From c8aa34d749a44f8b652dc163a1110c4b940424fd Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 1 Jun 2026 03:36:08 +0200 Subject: [PATCH 1/2] Add trivial tests for the last few functions in FileDialogIconLoader.cpp There's not much to test in these base class functions, but let's test what can be tested. --- tests/Widgets/FileDialog.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Widgets/FileDialog.cpp b/tests/Widgets/FileDialog.cpp index 147f17555..856c4e942 100644 --- a/tests/Widgets/FileDialog.cpp +++ b/tests/Widgets/FileDialog.cpp @@ -22,10 +22,14 @@ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TGUI/Texture.hpp" #include "Tests.hpp" +#include "catch.hpp" #include +#include + TEST_CASE("[FileDialog]") { const tgui::FileDialog::Ptr dialog = tgui::FileDialog::create(); @@ -148,6 +152,9 @@ TEST_CASE("[FileDialog]") REQUIRE(!iconLoader->update()); REQUIRE(!iconLoader->supportsSystemIcons()); REQUIRE(!iconLoader->hasGenericIcons()); + REQUIRE(iconLoader->getGenericFileIcon({}) == tgui::Texture{}); + REQUIRE_NOTHROW(iconLoader->requestFileIcons({})); + REQUIRE(iconLoader->retrieveFileIcons() == std::vector{}); } testWidgetRenderer(dialog->getRenderer()); From 57bf876f69fc718c2a75cc8b1852b89e34a4a163 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 1 Jun 2026 15:41:04 +0200 Subject: [PATCH 2/2] Test a few more ways to call ToggleButton::create --- tests/Widgets/ToggleButton.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Widgets/ToggleButton.cpp b/tests/Widgets/ToggleButton.cpp index a42d8f35a..5f87e874a 100644 --- a/tests/Widgets/ToggleButton.cpp +++ b/tests/Widgets/ToggleButton.cpp @@ -27,6 +27,9 @@ TEST_CASE("[ToggleButton]") { const tgui::ToggleButton::Ptr button = tgui::ToggleButton::create(); + const tgui::ToggleButton::Ptr buttonWithText = tgui::ToggleButton::create("Button text"); + const tgui::ToggleButton::Ptr buttonWithTextDown = tgui::ToggleButton::create("Button text down", true); + const tgui::ToggleButton::Ptr buttonWithoutTextDown = tgui::ToggleButton::create("", true); button->getRenderer()->setFont("resources/DejaVuSans.ttf"); SECTION("Signals") @@ -59,6 +62,11 @@ TEST_CASE("[ToggleButton]") REQUIRE(button->getText().empty()); button->setText("SomeText"); REQUIRE(button->getText() == "SomeText"); + REQUIRE(!buttonWithText->getText().empty()); + REQUIRE(buttonWithText->getText() == "Button text"); + REQUIRE(!buttonWithTextDown->getText().empty()); + REQUIRE(buttonWithTextDown->getText() == "Button text down"); + REQUIRE(buttonWithoutTextDown->getText().empty()); } SECTION("Down") @@ -72,6 +80,9 @@ TEST_CASE("[ToggleButton]") REQUIRE(!button->isDown()); REQUIRE_NOTHROW(button->setDown(false)); REQUIRE(!button->isDown()); + REQUIRE(!buttonWithText->isDown()); + REQUIRE(buttonWithTextDown->isDown()); + REQUIRE(buttonWithoutTextDown->isDown()); } SECTION("TextSize")