From 4e555fdbda6b9f5ea6c3dc29e16b992a0fe6e556 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 29 May 2025 12:31:54 +0200 Subject: gui: reintroduce basic testing skeleton --- gui/tests/gtk-test.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++ gui/tests/gtk_test_init.cpp | 46 -------------------------------------------- gui/tests/intl_test_init.cpp | 31 ----------------------------- 3 files changed, 46 insertions(+), 77 deletions(-) create mode 100644 gui/tests/gtk-test.cpp delete mode 100644 gui/tests/gtk_test_init.cpp delete mode 100644 gui/tests/intl_test_init.cpp (limited to 'gui/tests') diff --git a/gui/tests/gtk-test.cpp b/gui/tests/gtk-test.cpp new file mode 100644 index 0000000..4eea74a --- /dev/null +++ b/gui/tests/gtk-test.cpp @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2025 Felix Morgner + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "turnsmm/init.hpp" + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include + +namespace turns::ui::tests +{ + + struct gtk_test : Catch::EventListenerBase + { + using Catch::EventListenerBase::EventListenerBase; + + auto testRunStarting(Catch::TestRunInfo const &) -> void override + { + setlocale(LC_ALL, ""); + bindtextdomain("turns", TESTLOCALEDIR); + bind_textdomain_codeset("turns", "UTF-8"); + textdomain("turns"); + + m_app = Adwaita::Application::create("ch.arknet.turns.tests.ui"); + Turns::init(); + } + + private: + Glib::RefPtr m_app{}; + }; + + CATCH_REGISTER_LISTENER(gtk_test); + +} // namespace turns::ui::tests \ No newline at end of file diff --git a/gui/tests/gtk_test_init.cpp b/gui/tests/gtk_test_init.cpp deleted file mode 100644 index fdefa74..0000000 --- a/gui/tests/gtk_test_init.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Felix Morgner - * SPDX-License-Identifier: LGPL-2.1-only - */ - -#include "turns/core/init.hpp" -#include "turns/ui/init.hpp" - -#include -#include - -#include - -#include - -#include -#include - -#include - -#include - -namespace turns::ui::tests -{ - - struct gtk_test_init : Catch::EventListenerBase - { - using Catch::EventListenerBase::EventListenerBase; - - auto testRunStarting(Catch::TestRunInfo const &) -> void override - { - setlocale(LC_ALL, ""); - bindtextdomain("turns", TESTLOCALEDIR); - bind_textdomain_codeset("turns", "UTF-8"); - textdomain("turns"); - - [[maybe_unused]] auto app = Adwaita::Application::create("ch.arknet.turns.tests.ui"); - - core::register_types(); - ui::register_types(); - } - }; - - CATCH_REGISTER_LISTENER(gtk_test_init); - -} // namespace turns::ui::tests \ No newline at end of file diff --git a/gui/tests/intl_test_init.cpp b/gui/tests/intl_test_init.cpp deleted file mode 100644 index e7b7c0f..0000000 --- a/gui/tests/intl_test_init.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Felix Morgner - * SPDX-License-Identifier: LGPL-2.1-only - */ - -#include -#include - -#include - -#include - -namespace turns::lang::tests -{ - - struct intl_test_init : Catch::EventListenerBase - { - using Catch::EventListenerBase::EventListenerBase; - - auto testRunStarting(Catch::TestRunInfo const &) -> void override - { - setlocale(LC_ALL, ""); - bindtextdomain("turns", TESTLOCALEDIR); - bind_textdomain_codeset("turns", "UTF-8"); - textdomain("turns"); - } - }; - - CATCH_REGISTER_LISTENER(intl_test_init); - -} // namespace turns::lang::tests \ No newline at end of file -- cgit v1.2.3