diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-29 15:55:30 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-29 15:55:30 +0200 |
| commit | 873bf396b904ce477a238f22d1891e1b03f24eff (patch) | |
| tree | 3b1906644e032a94ce7968851e98349e4acb9501 /ui/tests | |
| parent | e84e5e463ce9fc735e9a9d8e03da884d3babb71b (diff) | |
| download | turns-873bf396b904ce477a238f22d1891e1b03f24eff.tar.xz turns-873bf396b904ce477a238f22d1891e1b03f24eff.zip | |
ui: convert editor into a template_widget
Diffstat (limited to 'ui/tests')
| -rw-r--r-- | ui/tests/widgets/participant_editor.cpp (renamed from ui/tests/windows/participant_editor.cpp) | 29 | ||||
| -rw-r--r-- | ui/tests/windows/resources.cpp | 10 |
2 files changed, 12 insertions, 27 deletions
diff --git a/ui/tests/windows/participant_editor.cpp b/ui/tests/widgets/participant_editor.cpp index 02e387f..41ba5bd 100644 --- a/ui/tests/windows/participant_editor.cpp +++ b/ui/tests/widgets/participant_editor.cpp @@ -1,4 +1,4 @@ -#include "turns/ui/windows/participant_editor.hpp" +#include "turns/ui/widgets/participant_editor.hpp" #include "turns/core/disposition.hpp" #include "turns/core/participant.hpp" @@ -21,8 +21,9 @@ #include <gtk/gtk.h> #include <clocale> +#include <memory> -namespace turns::ui::windows::tests +namespace turns::ui::widgets::tests { TEST_CASE("A freshly constructed participant editor without a participant", "[windows]") @@ -30,8 +31,7 @@ namespace turns::ui::windows::tests 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/participant_editor.ui"); - auto instance = Gtk::Builder::get_widget_derived<participant_editor>(builder, "participant_editor"); + auto instance = std::make_shared<ParticipantEditor>(nullptr); auto window = Gtk::Window{}; SECTION("was successfully constructed") @@ -49,16 +49,14 @@ namespace turns::ui::windows::tests REQUIRE(instance->get_title() == _(lang::add_participant)); } - SECTION("has an empty name field") + SECTION("has an empty name") { - auto widget = builder->get_widget<Adwaita::EntryRow>("name"); - REQUIRE(widget->get_text().empty()); + REQUIRE(instance->get_name().empty()); } - SECTION("has a zero priority field") + SECTION("has a zero priority") { - auto widget = builder->get_widget<Adwaita::SpinRow>("priority"); - REQUIRE(widget->get_value() == 0); + REQUIRE(instance->get_priority() == 0); } SECTION("allows binding to the finished signal") @@ -73,8 +71,7 @@ namespace turns::ui::windows::tests setlocale(LC_ALL, locale); auto participant = core::participant::create("Qibi Babblebranch", 12, core::disposition::neutral); - auto builder = Gtk::Builder::create_from_resource("/windows/participant_editor.ui"); - auto instance = Gtk::Builder::get_widget_derived<participant_editor>(builder, "participant_editor", participant); + auto instance = std::make_shared<ParticipantEditor>(participant); auto window = Gtk::Window{}; SECTION("was successfully constructed") @@ -94,14 +91,12 @@ namespace turns::ui::windows::tests SECTION("has its name field set according to its participant") { - auto widget = builder->get_widget<Adwaita::EntryRow>("name"); - REQUIRE(widget->get_text() == participant->property_name().get_value()); + REQUIRE(instance->get_name() == participant->property_name().get_value()); } SECTION("has its priority field set according to its participant") { - auto widget = builder->get_widget<Adwaita::SpinRow>("priority"); - REQUIRE(widget->get_value() == participant->property_priority()); + REQUIRE(instance->get_priority() == participant->property_priority()); } SECTION("allows binding to the finished signal") @@ -110,4 +105,4 @@ namespace turns::ui::windows::tests } } -} // namespace turns::ui::windows::tests
\ No newline at end of file +} // namespace turns::ui::widgets::tests
\ No newline at end of file diff --git a/ui/tests/windows/resources.cpp b/ui/tests/windows/resources.cpp index b9ac42e..022f3c4 100644 --- a/ui/tests/windows/resources.cpp +++ b/ui/tests/windows/resources.cpp @@ -12,13 +12,3 @@ TEST_CASE("GResource for tracker") REQUIRE(builder); } } - -TEST_CASE("GResource for participant_editor") -{ - auto builder = Gtk::Builder::create_from_resource("/ch/arknet/Turns/windows/participant_editor.ui"); - - SECTION("can create Gtk.Builder for the participant_editor window UI definition") - { - REQUIRE(builder); - } -}
\ No newline at end of file |
