[perl-Gtk3] Add overrides for Gtk3::Widget::find_style_property and list_style_properties



commit fcd4942c1f2d05893cf9ca75078ee79d1ca28c80
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Oct 25 17:40:29 2016 +0200

    Add overrides for Gtk3::Widget::find_style_property and list_style_properties

 lib/Gtk3.pm   |   16 ++++++++++++++++
 t/overrides.t |   21 ++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index f52ba2a..d408c60 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1883,6 +1883,22 @@ sub Gtk3::Widget::render_icon {
     $_GTK_ICON_SIZE_NICK_TO_ID->($size), $detail);
 }
 
+=item * C<Gtk3::Widget::find_style_property> and
+C<Gtk3::Widget::list_style_properties> to the corresponding functions in
+C<Gtk3::WidgetClass>.
+
+=cut
+
+sub Gtk3::Widget::find_style_property {
+  return Gtk3::WidgetClass::find_style_property (@_);
+}
+
+sub Gtk3::Widget::list_style_properties {
+  my $ref = Gtk3::WidgetClass::list_style_properties (@_);
+  return if not defined $ref;
+  return wantarray ? @$ref : $ref->[$#$ref];
+}
+
 =item * A Perl reimplementation of C<Gtk3::Widget::style_get> is provided.
 
 =cut
diff --git a/t/overrides.t b/t/overrides.t
index 808d3d8..0d136c2 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -7,7 +7,7 @@ use warnings;
 use utf8;
 use Encode;
 
-plan tests => 216;
+plan tests => 224;
 
 note('Gtk3::CHECK_VERSION and check_version');
 {
@@ -579,6 +579,25 @@ SKIP: {
                                       focus-line-width
                                       focus-padding/);
   is (@values, 4);
+
+  { my @pspecs = $widget->list_style_properties;
+    cmp_ok (scalar(@pspecs), '>', 0);
+    isa_ok ($pspecs[0], 'Glib::ParamSpec');
+  }
+  { my @pspecs = Gtk3::Label->list_style_properties;
+    cmp_ok (scalar(@pspecs), '>', 0);
+    isa_ok ($pspecs[0], 'Glib::ParamSpec');
+  }
+
+  is ($widget->find_style_property('no-such-style-property-of-this-name'),
+      undef,
+      "find_style_property() no such name, on object");
+  is (Gtk3::Label->find_style_property('no-such-style-property-of-this-name'),
+      undef,
+      "find_style_property() no such name, on class");
+
+  isa_ok ($widget->find_style_property('interior-focus'), 'Glib::ParamSpec');
+  isa_ok (Gtk3::Label->find_style_property('interior-focus'), 'Glib::ParamSpec');
 }
 
 SKIP: {


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