From 661e98cf8bb61f29049d405aef9cdaace1449ac8 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 13 May 2025 14:19:42 +0200 Subject: libmm: add tests --- lib/src/turnsmm/participant.cpp | 66 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) (limited to 'lib/src/turnsmm/participant.cpp') diff --git a/lib/src/turnsmm/participant.cpp b/lib/src/turnsmm/participant.cpp index 0086ada..5cc3db6 100644 --- a/lib/src/turnsmm/participant.cpp +++ b/lib/src/turnsmm/participant.cpp @@ -2,12 +2,14 @@ #include "turns-disposition.h" #include "turns-participant.h" +#include "turnsmm/enums.hpp" #include "turnsmm/private/participant_p.hpp" #include #include #include #include +#include #include #include #include @@ -23,8 +25,6 @@ namespace Turns namespace { auto constinit _class = Participant_Class{}; - - auto constexpr type_name = "TurnsParticipant"; } // namespace auto Participant_Class::init() -> Glib::Class const & @@ -49,13 +49,13 @@ namespace Turns } Participant::Participant() - : Glib::ObjectBase{type_name} + : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init()}} { } - Participant::Participant(Glib::ustring const & name, float priority, int disposition) - : Glib::ObjectBase{type_name} + Participant::Participant(Glib::ustring const & name, float priority, Disposition disposition) + : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init(), "name", name.c_str(), "priority", priority, "disposition", disposition, nullptr}} { } @@ -86,9 +86,9 @@ namespace Turns return turns_participant_get_defeated(const_cast(unwrap(this))); } - auto Participant::get_disposition() const noexcept -> int + auto Participant::get_disposition() const noexcept -> Disposition { - return turns_participant_get_disposition(const_cast(unwrap(this))); + return static_cast(turns_participant_get_disposition(const_cast(unwrap(this)))); } auto Participant::get_name() const -> Glib::ustring @@ -111,7 +111,7 @@ namespace Turns return turns_participant_set_defeated(unwrap(this), value); } - auto Participant::set_disposition(int value) noexcept -> void + auto Participant::set_disposition(Disposition value) noexcept -> void { return turns_participant_set_disposition(unwrap(this), static_cast(value)); } @@ -126,6 +126,56 @@ namespace Turns return turns_participant_set_priority(unwrap(this), value); } + auto Participant::property_active() const noexcept -> Glib::PropertyProxy_ReadOnly + { + return {this, "active"}; + } + + auto Participant::property_active() noexcept -> Glib::PropertyProxy + { + return {this, "active"}; + } + + auto Participant::property_defeated() const noexcept -> Glib::PropertyProxy_ReadOnly + { + return {this, "defeated"}; + } + + auto Participant::property_defeated() noexcept -> Glib::PropertyProxy + { + return {this, "defeated"}; + } + + auto Participant::property_disposition() const noexcept -> Glib::PropertyProxy_ReadOnly + { + return {this, "disposition"}; + } + + auto Participant::property_disposition() noexcept -> Glib::PropertyProxy + { + return {this, "disposition"}; + } + + auto Participant::property_name() const noexcept -> Glib::PropertyProxy_ReadOnly + { + return {this, "name"}; + } + + auto Participant::property_name() noexcept -> Glib::PropertyProxy + { + return {this, "name"}; + } + + auto Participant::property_priority() const noexcept -> Glib::PropertyProxy_ReadOnly + { + return {this, "priority"}; + } + + auto Participant::property_priority() noexcept -> Glib::PropertyProxy + { + return {this, "priority"}; + } + Participant::Participant(BaseObjectType * gobj) : Glib::Object((GObject *)gobj) { -- cgit v1.2.3