[perl-Gtk3] Fix test failures on older versions of gtk+



commit 60faf4435c7b5b5cec3673b7f14f2d2acc6561f9
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Feb 8 12:52:45 2013 +0100

    Fix test failures on older versions of gtk+

 NEWS                    |    1 +
 t/overrides.t           |   31 +++++++++-------
 t/zz-GdkEvent.t         |   88 ++++++++++++++++++++++++++++++----------------
 t/zz-GtkRadioMenuItem.t |    7 +++-
 t/zz-GtkTextBuffer.t    |    5 ++-
 5 files changed, 84 insertions(+), 48 deletions(-)
---
diff --git a/NEWS b/NEWS
index 59d5d06..4f9aaf1 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@
 * Add Gtk3::EVENT_PROPAGATE and Gtk3::EVENT_STOP.
 * In Gtk3::TreeModel::get, if no columns are specified, use all columns.
 * Test that no double-frees occur for custom Gtk3::Widget subclasses.
+* Fix test failures on older versions of gtk+.
 
 Overview of changes in Gtk3 0.008 [2012-08-26]
 ==============================================
diff --git a/t/overrides.t b/t/overrides.t
index 8c1d5bf..54d6cdb 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -83,7 +83,10 @@ plan tests => 139;
 }
 
 # Gtk3::CssProvider
-{
+SKIP: {
+  skip 'Gtk3::CssProvider; incorrect annotations', 2
+    unless Gtk3::CHECK_VERSION (3, 2, 0);
+
   my $css = "GtkButton {font: Cantarelll 10}";
   my $expect = qr/Cantarelll/;
   my $p = Gtk3::CssProvider->new;
@@ -124,7 +127,7 @@ plan tests => 139;
 
 # GtkEditable.insert-text signal
 SKIP: {
-  skip 'Need generic signal marshaller', 5
+  skip 'GtkEditable.insert-text signal; need generic signal marshaller', 5
     unless check_gi_version (1, 33, 10);
 
   my $entry = Gtk3::Entry->new;
@@ -175,7 +178,7 @@ SKIP: {
 
 # Gtk3::ListStore::new, set and get, insert_with_values
 SKIP: {
-  skip 'tree model ctors not properly supported', 10
+  skip 'Gtk3::ListStore; tree model ctors not properly supported', 10
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::ListStore->new ([qw/Glib::String Glib::Int/]);
@@ -211,7 +214,7 @@ SKIP: {
 
 # Gtk3::Menu::popup and popup_for_device
 SKIP: {
-  skip 'incorrect annotations for menu position callbacks', 2
+  skip 'Gtk3::Menu; incorrect annotations', 2
     unless Gtk3::CHECK_VERSION (3, 2, 0);
 
   {
@@ -271,7 +274,7 @@ SKIP: {
 
 # Gtk3::TreeStore::new, set and get, insert_with_values
 SKIP: {
-  skip 'tree model ctors not properly supported', 10
+  skip 'Gtk3::TreeStore; tree model ctors not properly supported', 10
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::TreeStore->new ([qw/Glib::String Glib::Int/]);
@@ -319,7 +322,7 @@ SKIP: {
 
 # Gtk3::TreeModel::get_iter, get_iter_first, get_iter_from_string
 SKIP: {
-  skip 'tree model ctors not properly supported', 6
+  skip 'Gtk3::TreeModel; tree model ctors not properly supported', 6
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::ListStore->new ('Glib::String');
@@ -335,7 +338,7 @@ SKIP: {
 
 # Gtk3::TreeModel::iter_children, iter_nth_child, iter_parent
 SKIP: {
-  skip 'tree model ctors not properly supported', 6
+  skip 'Gtk3::TreeModel; tree model ctors not properly supported', 6
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::TreeStore->new ([qw/Glib::String/]);
@@ -351,7 +354,7 @@ SKIP: {
 
 # Gtk3::TreeModelFilter
 SKIP: {
-  skip 'tree model ctors not properly supported', 3
+  skip 'Gtk3::TreeFilter; tree model ctors not properly supported', 3
     unless check_gi_version(1, 29, 17);
 
   my $child_model = Gtk3::TreeStore->new ([qw/Glib::String/]);
@@ -366,7 +369,7 @@ SKIP: {
 
 # Gtk3::TreeModelSort
 SKIP: {
-  skip 'tree model ctors not properly supported', 3
+  skip 'Gtk3::TreeModelSort; tree model ctors not properly supported', 3
     unless check_gi_version(1, 29, 17);
 
   my $child_model = Gtk3::TreeStore->new ([qw/Glib::String/]);
@@ -381,7 +384,7 @@ SKIP: {
 
 # Gtk3::TreeSelection::get_selected
 SKIP: {
-  skip 'tree model ctors not properly supported', 3
+  skip 'Gtk3::TreeSelection; tree model ctors not properly supported', 3
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::ListStore->new ('Glib::String');
@@ -399,7 +402,7 @@ SKIP: {
 # Gtk3::TreeView::insert_column_with_attributes, get_dest_row_at_pos,
 # get_path_at_pos, get_tooltip_context, get_visible_range
 SKIP: {
-  skip 'tree model ctors not properly supported', 5
+  skip 'Gtk3::TreeView; tree model ctors not properly supported', 5
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::ListStore->new ('Glib::String');
@@ -434,7 +437,7 @@ SKIP: {
 
 # Gtk3::TreeViewColumn::new_with_attributes, set_attributes, cell_get_position
 SKIP: {
-  skip 'tree model ctors not properly supported', 2
+  skip 'Gtk3::TreeViewColumn; tree model ctors not properly supported', 2
     unless check_gi_version(1, 29, 17);
 
   my $model = Gtk3::ListStore->new ('Glib::String');
@@ -520,7 +523,7 @@ __EOD__
 # Gtk3::Gdk::Window::new
 SKIP: {
   # https://bugzilla.gnome.org/show_bug.cgi?id=670369
-  skip 'window attr type annotation missing', 3
+  skip 'Gtk3::Gdk::Window::new; window attr type annotation missing', 3
     unless Gtk3::CHECK_VERSION (3, 6, 0);
 
   my $window = Gtk3::Gdk::Window->new (undef, {
@@ -552,7 +555,7 @@ SKIP: {
 # Gtk3::Gdk::Pixbuf::save, save_to_buffer, save_to_callback
 SKIP: {
   # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=670372
-  skip 'save & save_to_buffer annotations missing', 7;
+  skip 'Gtk3::Gdk::Pixbuf; save & save_to_buffer annotations missing', 7;
 
   my ($width, $height) = (45, 89);
   my $data = pack "C*", map { int rand 255 } 0..(3*$width*$height);
diff --git a/t/zz-GdkEvent.t b/t/zz-GdkEvent.t
index 951947b..320d321 100644
--- a/t/zz-GdkEvent.t
+++ b/t/zz-GdkEvent.t
@@ -7,7 +7,7 @@ BEGIN { require './t/inc/setup.pl' }
 use strict;
 use warnings;
 
-plan tests => 144;
+plan tests => 142;
 
 sub fields_ok {
   my ($event, %fields_values) = @_;
@@ -34,7 +34,6 @@ is ($event->type, 'enter-notify');
 my $window = Gtk3::Gdk::Window->new (undef, {
 			width => 20,
 			height => 20,
-			wclass => 'input-output',
 			window_type => 'toplevel'
 		});
 field_ok ($event, window => $window);
@@ -111,7 +110,12 @@ is ($event->get_axis ("x"), 13);
 $event = Gtk3::Gdk::Event->new ('motion-notify');
 $event->device ($device);
 $event->window ($window);
-$event->request_motions;
+
+SKIP: {
+  skip 'request_motions; missing annotations', 0
+    unless Gtk3::CHECK_VERSION(3, 2, 0);
+  $event->request_motions;
+}
 
 # Button #######################################################################
 
@@ -132,7 +136,7 @@ field_ok ($event, device => $device);
 field_ok ($event, device => undef);
 
 SKIP: {
-  skip 'new 3.2 stuff', 2
+  skip 'get_button&get_click_count; new in 3.2', 2
     unless Gtk3::CHECK_VERSION(3, 2, 0);
 
   is ($event->get_button, 2);
@@ -149,8 +153,6 @@ fields_ok ($event, time => 42,
                    y => 14,
                    x_root => 15,
                    y_root => 16,
-                   delta_x => 17,
-                   delta_y => 18,
                    state => [qw/shift-mask control-mask/],
                    direction => 'down');
 
@@ -158,13 +160,17 @@ field_ok ($event, device => $device);
 field_ok ($event, device => undef);
 
 SKIP: {
-  skip 'new 3.2 stuff', 2
-    unless Gtk3::CHECK_VERSION(3, 2, 0);
+  skip 'new 3.4 stuff', 2
+    unless Gtk3::CHECK_VERSION(3, 4, 0);
+
+  $event->delta_x (17);
+  $event->delta_y (18);
+
   is ($event->get_scroll_direction, 'down');
 
   #  <https://bugzilla.gnome.org/show_bug.cgi?id=677774>
-  skip 'missing annotations', 1
-    unless Gtk3::CHECK_VERSION(3, 5, 6);
+  skip 'direction&get_scroll_deltas; missing annotations', 1
+    unless Gtk3::CHECK_VERSION(3, 6, 0);
   $event->direction ('smooth');
   is_deeply ([$event->get_scroll_deltas], [17, 18]);
 }
@@ -182,7 +188,7 @@ fields_ok ($event, time => 42,
                    is_modifier => Glib::TRUE);
 
 SKIP: {
-  skip 'new 3.2 stuff', 2
+  skip 'keycode&keyval; new in 3.2', 2
     unless Gtk3::CHECK_VERSION(3, 2, 0);
 
   is ($event->get_keycode, 10);
@@ -231,17 +237,22 @@ isa_ok ($event = Gtk3::Gdk::Event->new ('property-notify'),
 
 fields_ok ($event, time => 42);
 
-my $atom = Gtk3::Gdk::Atom::intern ('foo', Glib::FALSE);
-$event->atom ($atom);
-isa_ok ($event->atom, 'Gtk3::Gdk::Atom', '$property_event->atom');
-is ($event->atom->name, $atom->name, '$property_event->atom');
-$event->atom (undef);
-is ($event->atom, undef);
+SKIP: {
+  skip 'atom stuff; missing annotations', 3
+    unless Gtk3::CHECK_VERSION(3, 2, 0);
+
+  my $atom = Gtk3::Gdk::Atom::intern ('foo', Glib::FALSE);
+  $event->atom ($atom);
+  isa_ok ($event->atom, 'Gtk3::Gdk::Atom', '$property_event->atom');
+  is ($event->atom->name, $atom->name, '$property_event->atom');
+  $event->atom (undef);
+  is ($event->atom, undef);
+}
 
 SKIP: {
   # <https://bugzilla.gnome.org/show_bug.cgi?id=677775>
-  skip 'missing annotations', 1
-    unless Gtk3::CHECK_VERSION (3, 5, 6);
+  skip 'state accessor; missing annotations', 1
+    unless Gtk3::CHECK_VERSION (3, 6, 0);
   field_ok ($event, state => 'new-value');
 }
 
@@ -292,12 +303,18 @@ isa_ok ($event = Gtk3::Gdk::Event->new ('selection-clear'),
 
 fields_ok ($event, time => 42);
 
-$event->property ($atom);
-is ($event->property->name, $atom->name);
-$event->selection ($atom);
-is ($event->selection->name, $atom->name);
-$event->target ($atom);
-is ($event->target->name, $atom->name);
+SKIP: {
+  skip 'atom stuff; missing annotations', 3
+    unless Gtk3::CHECK_VERSION(3, 2, 0);
+
+  my $atom = Gtk3::Gdk::Atom::intern ('foo', Glib::FALSE);
+  $event->property ($atom);
+  is ($event->property->name, $atom->name);
+  $event->selection ($atom);
+  is ($event->selection->name, $atom->name);
+  $event->target ($atom);
+  is ($event->target->name, $atom->name);
+}
 
 field_ok ($event, requestor => $window);
 field_ok ($event, requestor => undef);
@@ -314,8 +331,14 @@ fields_ok ($event, reason => 'destroy',
 field_ok ($event, owner => $window);
 field_ok ($event, owner => undef);
 
-$event->selection ($atom);
-is ($event->selection->name, $atom->name);
+SKIP: {
+  skip 'atom stuff; missing annotations', 1
+    unless Gtk3::CHECK_VERSION(3, 2, 0);
+
+  my $atom = Gtk3::Gdk::Atom::intern ('foo', Glib::FALSE);
+  $event->selection ($atom);
+  is ($event->selection->name, $atom->name);
+}
 
 # GrabBroken ##################################################################
 
@@ -331,7 +354,7 @@ field_ok ($event, grab_window => undef);
 # Touch #######################################################################
 
 SKIP: {
-  skip 'new 3.4 stuff', 2
+  skip 'touch stuff; new in 3.4', 10
     unless Gtk3::CHECK_VERSION(3, 4, 0);
 
   isa_ok ($event = Gtk3::Gdk::Event->new ("touch-begin"),
@@ -353,12 +376,15 @@ SKIP: {
 
 # Misc. #######################################################################
 
-{
+SKIP: {
+  skip 'misc. stuff; missing annotations', 4
+    unless Gtk3::CHECK_VERSION(3, 2, 0);
+
   my $event = Gtk3::Gdk::Event->new ('button-press');
 
   $event->put;
   ok (Gtk3::Gdk::events_pending);
-  isa_ok (Gtk3::Gdk::Event::get, 'Gtk3::Gdk::EventButton');
+  isa_ok (Gtk3::Gdk::Event::get (), 'Gtk3::Gdk::EventButton');
 
   my $i_know_you = 0;
   Gtk3::Gdk::Event::handler_set (sub {
@@ -399,7 +425,7 @@ SKIP: {
   skip 'new 3.4 stuff', 1
     unless Gtk3::CHECK_VERSION (3, 4, 0);
   my $event = Gtk3::Gdk::Event->new ('button-press');
-  $event->button (Gtk3::Gdk::BUTTON_SECONDARY);
+  $event->button (Gtk3::Gdk::BUTTON_SECONDARY ());
   $event->window ($window);
   ok ($event->triggers_context_menu);
 }
diff --git a/t/zz-GtkRadioMenuItem.t b/t/zz-GtkRadioMenuItem.t
index 588679f..834b8c3 100644
--- a/t/zz-GtkRadioMenuItem.t
+++ b/t/zz-GtkRadioMenuItem.t
@@ -10,7 +10,7 @@ use warnings;
 plan tests => 11;
 
 SKIP: {
-  skip 'the list-based API is broken currently', 9
+  skip 'list-based API; it is broken currently', 9
     unless 0; # FIXME: <https://bugzilla.gnome.org/show_bug.cgi?id=679563>
 
   my $item_one = Gtk3::RadioMenuItem -> new();
@@ -43,7 +43,10 @@ SKIP: {
              $item_five, $item_six, $item_seven]);
 }
 
-{
+SKIP: {
+  skip 'item-based API; missing annotations', 2
+    unless Gtk3::CHECK_VERSION (3, 6, 0);
+
   # FIXME: The item-based API is not bootstrap-able on its own yet, see
   # <https://bugzilla.gnome.org/show_bug.cgi?id=679563>.
   # my $item_one = Gtk3::RadioMenuItem -> new_from_widget(undef);
diff --git a/t/zz-GtkTextBuffer.t b/t/zz-GtkTextBuffer.t
index 78d46f0..d400521 100644
--- a/t/zz-GtkTextBuffer.t
+++ b/t/zz-GtkTextBuffer.t
@@ -117,7 +117,10 @@ $buffer -> remove_tag($tag_one, $bounds->());
 $buffer -> remove_tag_by_name("bulb", $bounds->());
 $buffer -> remove_all_tags($bounds->());
 
-{
+SKIP: {
+  skip 'clipboard stuff; missing annotations', 0
+    unless Gtk3::CHECK_VERSION (3, 2, 0);
+
   my $clipboard = Gtk3::Clipboard::get(Gtk3::Gdk::Atom::intern('clipboard', Glib::FALSE));
 
   $buffer -> paste_clipboard($clipboard, $buffer -> get_end_iter(), TRUE);


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