[perl-Gtk3] Add a few more overrides



commit c471de9aa6232e7341a6066b9f78fee586769863
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Wed Oct 12 19:39:45 2011 +0200

    Add a few more overrides

 lib/Gtk3.pm   |    9 +++++++++
 t/overrides.t |   30 ++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 6d7d982..cb71606 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -12,6 +12,8 @@ my $_GTK_BASENAME = 'Gtk';
 my $_GTK_VERSION = '3.0';
 my $_GTK_PACKAGE = 'Gtk3';
 my @_GTK_FLATTEN_ARRAY_REF_RETURN_FOR = qw/
+  Gtk3::CellLayout::get_cells
+  Gtk3::TreePath::get_indices
   Gtk3::Window::list_toplevels
 /;
 my @_GTK_HANDLE_SENTINEL_BOOLEAN_FOR = qw/
@@ -190,6 +192,13 @@ sub Gtk3::TreeViewColumn::new_with_attributes {
   return $object;
 }
 
+sub Gtk3::Window::new {
+  my ($class, $type) = @_;
+  $type = 'toplevel' unless defined $type;
+  return Glib::Object::Introspection->invoke (
+    $_GTK_BASENAME, 'Window', 'new', $class, $type);
+}
+
 1;
 
 __END__
diff --git a/t/overrides.t b/t/overrides.t
index 6c331a5..202266a 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -5,14 +5,17 @@ BEGIN { require './t/inc/setup.pl' };
 use strict;
 use warnings;
 
-plan tests => 11;
+plan tests => 14;
 
-# Gtk3::Window::list_toplevels
+# Gtk3::CellLayout::get_cells
 {
-  my $window1 = Gtk3::Window->new ('toplevel');
-  my $window2 = Gtk3::Window->new ('toplevel');
-  is_deeply ([Gtk3::Window::list_toplevels ()], [$window1, $window2]);
-  is (scalar Gtk3::Window::list_toplevels (), $window2);
+  my $cell = Gtk3::TreeViewColumn->new;
+  is_deeply([$cell->get_cells], []);
+  my $one = Gtk3::CellRendererText->new;
+  my $two = Gtk3::CellRendererText->new;
+  $cell->pack_start($one, 0);
+  $cell->pack_start($two, 1);
+  is_deeply([$cell->get_cells], [$one, $two]);
 }
 
 # Gtk3::ListStore->new, set and get
@@ -41,6 +44,13 @@ plan tests => 11;
   isa_ok ($model->get_iter_first, 'Gtk3::TreeIter');
 }
 
+# Gtk3::TreePath->get_indices
+{
+  # my $path = Gtk3::TreePath->new_from_indices ([1, 2, 3]); # FIXME
+  my $path = Gtk3::TreePath->new_from_string ('1:2:3');
+  is_deeply ([$path->get_indices], [1, 2, 3]);
+}
+
 # Gtk3::TreeSelection->get_selected
 {
   my $model = Gtk3::ListStore->new ('Glib::String');
@@ -52,3 +62,11 @@ plan tests => 11;
   is ($sel_model, $model);
   isa_ok ($sel_iter, 'Gtk3::TreeIter');
 }
+
+# Gtk3::Window::new and list_toplevels
+{
+  my $window1 = Gtk3::Window->new ('toplevel');
+  my $window2 = Gtk3::Window->new;
+  is_deeply ([Gtk3::Window::list_toplevels ()], [$window1, $window2]);
+  is (scalar Gtk3::Window::list_toplevels (), $window2);
+}



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