summaryrefslogtreecommitdiff
path: root/app/tests/windows/main.cpp
blob: d2ad60ed31a46aabb65d7cbdc4d32cf0b63312cb (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
#include "turns/app/windows/main.hpp"

#include <catch2/catch_test_macros.hpp>

#include <string>

#include <adwaita.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 builder = Gtk::Builder::create_from_resource("/turns/windows/main_window.ui");
    auto instance = Gtk::Builder::get_widget_derived<main>(builder, "main_window");

    SECTION("construction via builder succeeds")
    {
      REQUIRE(instance);
    }

    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);
    }
  }

}  // namespace turns::app::windows::tests