#include "turns/app/windows/main.hpp" #include #include #include #include #include #include #include #include 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
(builder, "main_window"); SECTION("construction via builder succeeds") { REQUIRE(instance); } SECTION("the window sub-title is not empty") { auto widget = builder->get_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("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("title"); auto adw = ADW_WINDOW_TITLE(widget->gobj()); REQUIRE(adw_window_title_get_title(adw)); } SECTION("the window title is set according to the active language") { auto widget = builder->get_widget("title"); auto adw = ADW_WINDOW_TITLE(widget->gobj()); REQUIRE(adw_window_title_get_title(adw) == Glib::ustring{_("Turns")}); } } } // namespace turns::app::windows::tests