summaryrefslogtreecommitdiff
path: root/app/tests/windows/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/windows/main.cpp')
-rw-r--r--app/tests/windows/main.cpp31
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")});
}
}