summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-05-01 09:50:42 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-05-01 09:50:42 +0200
commit27f8edb8b311de1fee9d9707fc461519a380d140 (patch)
tree6752570c1774a2de0704decf8521bf1b5a83c270 /ui
parent8c00eef46ac5d917292cd3d64b700b3965a06f63 (diff)
downloadturns-27f8edb8b311de1fee9d9707fc461519a380d140.tar.xz
turns-27f8edb8b311de1fee9d9707fc461519a380d140.zip
ui: add more tests for ParticipantEditor
Diffstat (limited to 'ui')
-rw-r--r--ui/tests/participant_editor.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/ui/tests/participant_editor.cpp b/ui/tests/participant_editor.cpp
index 0d2ab13..b2398de 100644
--- a/ui/tests/participant_editor.cpp
+++ b/ui/tests/participant_editor.cpp
@@ -31,6 +31,7 @@ namespace turns::ui::tests
auto locale = GENERATE("en_US.UTF-8", "de_CH.UTF-8");
setlocale(LC_ALL, locale);
+ auto participant = core::Participant::create("Frederick Thumblewackle", 7.2, core::disposition::friendly);
auto instance = std::make_shared<ParticipantEditor>(nullptr);
auto window = Gtk::Window{};
@@ -59,6 +60,47 @@ namespace turns::ui::tests
REQUIRE(instance->get_priority() == 0);
}
+ SECTION("has neutral disposition")
+ {
+ REQUIRE(instance->get_disposition() == core::disposition::neutral);
+ }
+
+ SECTION("has a null participant")
+ {
+ REQUIRE_FALSE(instance->get_participant());
+ }
+
+ WHEN("setting a new participant")
+ {
+ instance->set_participant(participant);
+
+ THEN("getting the participant returns the new one")
+ {
+ REQUIRE(instance->get_participant() == participant);
+ }
+
+ THEN("changes to the name propagate to the participant")
+ {
+ CHECK(participant->get_name() != "REPLACED");
+ instance->set_name("REPLACED");
+ REQUIRE(participant->get_name() == "REPLACED");
+ }
+
+ THEN("changes to the priority propagate to the participant")
+ {
+ CHECK(participant->get_priority() != 0);
+ instance->set_priority(0);
+ REQUIRE(participant->get_priority() == 0);
+ }
+
+ THEN("changes to the disposition propagate to the participant")
+ {
+ CHECK(participant->get_disposition() != core::disposition::secret);
+ instance->set_disposition(core::disposition::secret);
+ REQUIRE(participant->get_disposition() == core::disposition::secret);
+ }
+ }
+
SECTION("allows binding to the finished signal")
{
REQUIRE((instance->signal_finished().connect([](auto, auto, auto) {})).connected());
@@ -105,4 +147,4 @@ namespace turns::ui::tests
}
}
-} // namespace turns::ui::widgets::tests \ No newline at end of file
+} // namespace turns::ui::tests \ No newline at end of file