[PATCH 3/4] testbot: Make it possible to get the number of items in a Collection.

Francois Gouget fgouget at codeweavers.com
Mon Dec 18 16:53:55 CST 2017


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

For the next patch.

 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 d4418603..c3bc438c 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.
-- 
2.15.1




More information about the wine-devel mailing list