diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-12 14:29:38 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-12 14:29:38 +0200 |
| commit | 88d45641e8c06936635034cd83c8c7df1bd59439 (patch) | |
| tree | 04bb5c3f83f68edb021b09876242c6493683ebb2 /app/tests/windows | |
| parent | 0e2b0878e4c344d1fdbadfb37350bded783789f3 (diff) | |
| download | turns-88d45641e8c06936635034cd83c8c7df1bd59439.tar.xz turns-88d45641e8c06936635034cd83c8c7df1bd59439.zip | |
turns: add basic i18n
Diffstat (limited to 'app/tests/windows')
| -rw-r--r-- | app/tests/windows/main.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/app/tests/windows/main.cpp b/app/tests/windows/main.cpp index d2ad60e..53c9386 100644 --- a/app/tests/windows/main.cpp +++ b/app/tests/windows/main.cpp @@ -1,20 +1,24 @@ #include "turns/app/windows/main.hpp" #include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> #include <string> #include <adwaita.h> +#include <glibmm/i18n.h> +#include <glibmm/ustring.h> #include <gtkmm/builder.h> #include <gtkmm/widget.h> -using namespace std::string_literals; - namespace turns::app::windows::tests { TEST_CASE("Newly constructed main window", "[windows]") { + auto locale = GENERATE("en_US.UTF-8", "de_CH.UTF-8"); + setlocale(LC_ALL, locale); + auto builder = Gtk::Builder::create_from_resource("/turns/windows/main_window.ui"); auto instance = Gtk::Builder::get_widget_derived<main>(builder, "main_window"); @@ -23,11 +27,32 @@ namespace turns::app::windows::tests REQUIRE(instance); } + SECTION("the window sub-title is not empty") + { + auto widget = builder->get_widget<Gtk::Widget>("title"); + auto adw = ADW_WINDOW_TITLE(widget->gobj()); + REQUIRE(adw_window_title_get_subtitle(adw)); + } + + SECTION("the window sub-title is set according to the active language") + { + auto widget = builder->get_widget<Gtk::Widget>("title"); + auto adw = ADW_WINDOW_TITLE(widget->gobj()); + REQUIRE(adw_window_title_get_subtitle(adw) == Glib::ustring{_("No active turn-order")}); + } + SECTION("the window title is not empty") { auto widget = builder->get_widget<Gtk::Widget>("title"); auto adw = ADW_WINDOW_TITLE(widget->gobj()); - REQUIRE(adw_window_title_get_subtitle(adw) != ""s); + REQUIRE(adw_window_title_get_title(adw)); + } + + SECTION("the window title is set according to the active language") + { + auto widget = builder->get_widget<Gtk::Widget>("title"); + auto adw = ADW_WINDOW_TITLE(widget->gobj()); + REQUIRE(adw_window_title_get_title(adw) == Glib::ustring{_("Turns")}); } } |
