diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-05-16 11:12:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-05-16 11:12:43 +0200 |
| commit | 84fb875123201f28a3333285b6323037b08accb4 (patch) | |
| tree | d588328fbb4ffcfc803d4cde7f749566984ea28c /lib/tests | |
| parent | 06200268231281ce925c8eea83cfd30fa824af2b (diff) | |
| download | turns-84fb875123201f28a3333285b6323037b08accb4.tar.xz turns-84fb875123201f28a3333285b6323037b08accb4.zip | |
lib: implement ListModel interface for TurnOrder
Diffstat (limited to 'lib/tests')
| -rw-r--r-- | lib/tests/turns-turn-order.cpp | 19 | ||||
| -rw-r--r-- | lib/tests/turnsmm/turn-order.cpp | 18 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/tests/turns-turn-order.cpp b/lib/tests/turns-turn-order.cpp index f204847..e0ee431 100644 --- a/lib/tests/turns-turn-order.cpp +++ b/lib/tests/turns-turn-order.cpp @@ -1,7 +1,10 @@ #include "turns-turn-order.h" +#include "turns-participant.h" + #include <catch2/catch_test_macros.hpp> +#include <gio/gio.h> #include <glib-object.h> SCENARIO("Creating a turn order", "[lib][object][lifetime]") @@ -29,5 +32,21 @@ SCENARIO("Creating a turn order", "[lib][object][lifetime]") REQUIRE_FALSE(property_value); } + + THEN("it's item count is 0") + { + REQUIRE(g_list_model_get_n_items(G_LIST_MODEL(instance)) == 0); + } + + THEN("it's item type is Turns.Participant") + { + REQUIRE(g_list_model_get_item_type(G_LIST_MODEL(instance)) == turns_participant_get_type()); + } + + THEN("it's first item is NULL") + { + REQUIRE(g_list_model_get_item(G_LIST_MODEL(instance), 0) == nullptr); + REQUIRE(g_list_model_get_object(G_LIST_MODEL(instance), 0) == nullptr); + } } }
\ No newline at end of file diff --git a/lib/tests/turnsmm/turn-order.cpp b/lib/tests/turnsmm/turn-order.cpp index ad8306b..ed9d586 100644 --- a/lib/tests/turnsmm/turn-order.cpp +++ b/lib/tests/turnsmm/turn-order.cpp @@ -1,5 +1,7 @@ #include "turnsmm/turn-order.hpp" +#include "turnsmm/participant.hpp" + #include <catch2/catch_test_macros.hpp> #include <cstddef> @@ -21,5 +23,21 @@ SCENARIO("Creating a turn order", "[lib][object][lifetime]") REQUIRE_FALSE(instance.get_running()); REQUIRE_FALSE(instance.get_property<std::size_t>("running")); } + + THEN("it's item count is 0") + { + REQUIRE(instance.get_n_items() == 0); + } + + THEN("it's item type is Turns.Participant") + { + REQUIRE(instance.get_item_type() == Turns::Participant::get_type()); + } + + THEN("it's first item is NULL") + { + REQUIRE(instance.get_object(0) == nullptr); + REQUIRE(instance.get_typed_object<Turns::Participant>(0) == nullptr); + } } }
\ No newline at end of file |
