summaryrefslogtreecommitdiff
path: root/gui/tests/tracker.cpp
blob: 3d0b5a0c8823198e18c911395755bfe53ed17ff7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com>
 * SPDX-License-Identifier: LGPL-2.1-only
 */

#include "turns/ui/tracker.hpp"

#include "turns/core/settings.hpp"
#include "turns/lang/messages.hpp"

#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>

#include <glibmm/i18n.h>
#include <glibmm/wrap.h>

#include <gtkmm/builder.h>
#include <gtkmm/button.h>
#include <gtkmm/menubutton.h>
#include <gtkmm/widget.h>

#include <adwaitamm/application.hpp>
#include <adwaitamm/windowtitle.hpp>

#include <clocale>
#include <memory>

namespace turns::ui::tests
{

  TEST_CASE("A freshly constructed tracker window", "[windows]")
  {
    auto locale = GENERATE("en_US.UTF-8", "de_CH.UTF-8");
    setlocale(LC_ALL, locale);

    auto app = Adwaita::Application::create("ch.arknet.Turns.test");
    auto instance = std::make_shared<Tracker>(app, core::get_settings());

    SECTION("was successfully constructed")
    {
      REQUIRE(instance);
    }

    // SECTION("has a non-empty subtitle")
    // {
    //   auto widget = instance->get_  builder->get_widget<Adwaita::WindowTitle>("title");
    //   REQUIRE_FALSE(widget->get_subtitle().empty());
    // }

    // SECTION("has its subtitle set according to the active language")
    // {
    //   auto widget = builder->get_widget<Adwaita::WindowTitle>("title");
    //   REQUIRE(widget->get_subtitle() == _(lang::no_active_turn_order));
    // }

    // SECTION("has a non-empty title")
    // {
    //   auto widget = builder->get_widget<Adwaita::WindowTitle>("title");
    //   REQUIRE_FALSE(widget->get_title().empty());
    // }

    // SECTION("has its title set according to the active language")
    // {
    //   auto widget = builder->get_widget<Adwaita::WindowTitle>("title");
    //   REQUIRE(widget->get_title() == _(lang::turns));
    // }

    // SECTION("has its add_participant button's tooltip set according to the active language")
    // {
    //   auto widget = builder->get_widget<Gtk::Button>("add_participant");
    //   REQUIRE(widget->get_tooltip_text() == _(lang::add_participant));
    // }

    // SECTION("as its open_main_menu button's tooltip set according to the active language")
    // {
    //   auto widget = builder->get_widget<Gtk::MenuButton>("open_main_menu");
    //   REQUIRE(widget->get_tooltip_text() == _(lang::main_menu));
    // }

    // instance->destroy();
    // delete instance;
  }

}  // namespace turns::ui::tests