Francois Gouget : testbot: Make it possible to get the number of items in a Collection.
Module: tools Branch: master Commit: ef0dc7115bc27fb25ec76a1941d4ee472d362d91 URL: http://source.winehq.org/git/tools.git/?a=commit;h=ef0dc7115bc27fb25ec76a194... Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Mon Dec 18 23:53:55 2017 +0100 testbot: Make it possible to get the number of items in a Collection. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- testbot/lib/ObjectModel/Collection.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm index d441860..c3bc438 100644 --- a/testbot/lib/ObjectModel/Collection.pm +++ b/testbot/lib/ObjectModel/Collection.pm @@ -373,6 +373,28 @@ sub GetItems($) =pod =over 12 +=item C<GetItemsCount()> + +Returns how many Items are present in the Collection. + +=back +=cut + +sub GetItemsCount($) +{ + my ($self) = @_; + + if (! $self->{Loaded}) + { + $self->Load(); + } + + return scalar(keys %{$self->{Items}}); +} + +=pod +=over 12 + =item C<IsEmpty()> Returns true if the Collection contains no Item.
participants (1)
-
Alexandre Julliard