#include "turns/app/windows/main.hpp" #include "turns/lang/messages.hpp" #include #include #include #include #include #include #include #include #include #include namespace turns::app::windows::tests { using namespace turns::lang; 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("/ch/arknet/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{_(labels::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{_(labels::turns)}); } SECTION("the add_participant button has the correct tooltip") { auto widget = builder->get_widget("add_participant"); REQUIRE(widget->get_tooltip_text() == Glib::ustring{_(tooltips::add_a_participant)}); } SECTION("the open_main_menu button has the correct tooltip") { auto widget = builder->get_widget("open_main_menu"); REQUIRE(widget->get_tooltip_text() == Glib::ustring{_(tooltips::main_menu)}); } } } // namespace turns::app::windows::tests