[perl-Gtk3] Add overrides for Gtk3::Container::find_child_property and list_child_properties



commit fd800403253fb9122943fa6712eb268b856458d7
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Oct 25 17:48:01 2016 +0200

    Add overrides for Gtk3::Container::find_child_property and list_child_properties

 lib/Gtk3.pm         |   20 ++++++++++++++++++--
 t/zz-GtkContainer.t |   22 +++-------------------
 2 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index d408c60..7471c05 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -980,6 +980,22 @@ sub Gtk3::Container::child_set {
   }
 }
 
+=item * C<Gtk3::Container::find_child_property> and
+C<Gtk3::Container::list_child_properties> are forwarded to the corresponding
+functions in C<Gtk3::ContainerClass>.
+
+=cut
+
+sub Gtk3::Container::find_child_property {
+  return Gtk3::ContainerClass::find_child_property (@_);
+}
+
+sub Gtk3::Container::list_child_properties {
+  my $ref = Gtk3::ContainerClass::list_child_properties (@_);
+  return if not defined $ref;
+  return wantarray ? @$ref : $ref->[$#$ref];
+}
+
 =item * C<Gtk3::Container::get_focus_chain> returns a list of widgets, or an
 empty list.
 
@@ -1884,8 +1900,8 @@ sub Gtk3::Widget::render_icon {
 }
 
 =item * C<Gtk3::Widget::find_style_property> and
-C<Gtk3::Widget::list_style_properties> to the corresponding functions in
-C<Gtk3::WidgetClass>.
+C<Gtk3::Widget::list_style_properties> are forwarded to the corresponding
+functions in C<Gtk3::WidgetClass>.
 
 =cut
 
diff --git a/t/zz-GtkContainer.t b/t/zz-GtkContainer.t
index c132f96..ff9f82c 100644
--- a/t/zz-GtkContainer.t
+++ b/t/zz-GtkContainer.t
@@ -7,7 +7,7 @@ BEGIN { require './t/inc/setup.pl' }
 use strict;
 use warnings;
 
-plan tests => 31;
+plan tests => 42;
 
 # we'll create some containers (windows and boxes are containers) and
 # mess around with some of the methods to make sure they do things.
@@ -128,8 +128,6 @@ $vbox->remove ($label);
 #------------------------------------------------------------------------------
 # find_child_property()
 
-=for FIXME3
-
 is (Gtk3::Container->find_child_property('Gtk3-Perl-test-no-such-property'),
     undef,
     'find_child_property() no such child property');
@@ -139,11 +137,6 @@ is (eval { Gtk3::Container::find_child_property('Not::A::Container::Class',
     undef,
     'find_child_property() Not::A::Container::Class croaks');
 
-is (eval { Gtk3::Container::find_child_property('Gtk3::Widget',
-                                               'propname'); 1 },
-    undef,
-    'find_child_property() Gtk3::Widget croaks');
-
 {
   my $pspec = Gtk3::Box->find_child_property('expand');
   isa_ok ($pspec, 'Glib::Param::Boolean',
@@ -161,13 +154,9 @@ is (eval { Gtk3::Container::find_child_property('Gtk3::Widget',
          'find_child_property() object method "expand" is a boolean');
 }
 
-=cut
-
 #------------------------------------------------------------------------------
 # list_child_properties()
 
-=for FIXME3
-
 # as of Gtk 2.20 the base Gtk3::Container class doesn't have any child
 # properties, but don't assume that, so don't ask anything of @pspecs, just
 # that list_child_properties() returns
@@ -178,11 +167,6 @@ is (eval { Gtk3::Container::list_child_properties('Not::A::Container::Class');
     undef,
     'list_child_properties() Not::A::Container::Class croaks');
 
-is (eval { Gtk3::Container::list_child_properties('Gtk3::Widget');
-          1 },
-    undef,
-    'list_child_properties() Gtk3::Widget croaks');
-
 {
   my @pspecs = Gtk3::Box->list_child_properties;
   cmp_ok (scalar(@pspecs), '>=', 2,
@@ -204,10 +188,10 @@ is (eval { Gtk3::Container::list_child_properties('Gtk3::Widget');
   my @pspecs = $hbox->list_child_properties;
   cmp_ok (scalar(@pspecs), '>=', 2,
          'list_child_properties() object method at least "expand" and "pack"');
+  isa_ok ($pspecs[0], 'Glib::ParamSpec');
+  isa_ok ($pspecs[1], 'Glib::ParamSpec');
 }
 
-=cut
-
 __END__
 
 Copyright (C) 2003-2012 by the gtk2-perl team (see the file AUTHORS for the


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]