summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/CMakeLists.txt33
-rw-r--r--gui/src/main.cpp4
-rw-r--r--gui/tests/gtk-test.cpp (renamed from gui/tests/gtk_test_init.cpp)18
-rw-r--r--gui/tests/intl_test_init.cpp31
4 files changed, 35 insertions, 51 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 3753979..928ff1a 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -74,8 +74,17 @@ target_include_directories("gui_impl" PUBLIC
target_link_libraries("gui_impl" PUBLIC
"resources"
+
"adwaitamm::adwaitamm"
+
"turns::mm"
+
+ "PkgConfig::glib"
+ "PkgConfig::glibmm"
+
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wl,--whole-archive>"
+ "resources"
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wl,--no-whole-archive>"
)
target_compile_definitions("gui_impl" PUBLIC
@@ -100,15 +109,6 @@ target_include_directories("gui" PUBLIC
target_link_libraries("gui" PUBLIC
"gui_impl"
-
- "adwaitamm::adwaitamm"
- "PkgConfig::glib"
- "PkgConfig::glibmm"
- "turns::mm"
-
- "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wl,--whole-archive>"
- "resources"
- "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wl,--no-whole-archive>"
)
set_target_properties("gui" PROPERTIES
@@ -139,3 +139,18 @@ install(FILES
)
install(TARGETS "gui")
+
+# Tests
+
+add_executable("gui-tests"
+ "tests/gtk-test.cpp"
+)
+
+target_link_libraries("gui-tests" PRIVATE
+ "gui_impl"
+ "Catch2::Catch2WithMain"
+)
+
+target_compile_definitions("resources" PUBLIC
+ "TESTLOCALEDIR=\"${CMAKE_CURRENT_BINARY_DIR}/locale>\""
+) \ No newline at end of file
diff --git a/gui/src/main.cpp b/gui/src/main.cpp
index 8c20b31..c8830bf 100644
--- a/gui/src/main.cpp
+++ b/gui/src/main.cpp
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#include "settings.hpp"
+#include "turnsmm/init.hpp"
#include <giomm/application.h>
@@ -22,7 +22,7 @@ auto main(int argc, char ** argv) -> int
auto app = Adwaita::Application::create("ch.arknet.Turns", Gio::Application::Flags::HANDLES_OPEN);
- [[maybe_unused]] auto settings = Turns::gui::get_settings();
+ Turns::init();
return app->run(argc, argv);
}
diff --git a/gui/tests/gtk_test_init.cpp b/gui/tests/gtk-test.cpp
index fdefa74..4eea74a 100644
--- a/gui/tests/gtk_test_init.cpp
+++ b/gui/tests/gtk-test.cpp
@@ -3,14 +3,13 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#include "turns/core/init.hpp"
-#include "turns/ui/init.hpp"
+#include "turnsmm/init.hpp"
#include <catch2/reporters/catch_reporter_event_listener.hpp>
#include <catch2/reporters/catch_reporter_registrars.hpp>
#include <glibmm/i18n.h>
-
+#include <glibmm/refptr.h>
#include <gtkmm/init.h>
#include <adwaitamm/application.hpp>
@@ -23,7 +22,7 @@
namespace turns::ui::tests
{
- struct gtk_test_init : Catch::EventListenerBase
+ struct gtk_test : Catch::EventListenerBase
{
using Catch::EventListenerBase::EventListenerBase;
@@ -34,13 +33,14 @@ namespace turns::ui::tests
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();
+ m_app = Adwaita::Application::create("ch.arknet.turns.tests.ui");
+ Turns::init();
}
+
+ private:
+ Glib::RefPtr<Adwaita::Application> m_app{};
};
- CATCH_REGISTER_LISTENER(gtk_test_init);
+ CATCH_REGISTER_LISTENER(gtk_test);
} // 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 <felix.morgner@gmail.com>
- * SPDX-License-Identifier: LGPL-2.1-only
- */
-
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
-
-#include <libintl.h>
-
-#include <clocale>
-
-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