[perl-Gtk3] Skip tests that involve tree model ctors if they won't work



commit 079275df1612dfbe2ed837d28870fa1024d03d41
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Dec 9 11:31:11 2011 +0100

    Skip tests that involve tree model ctors if they won't work
    
    With gobject-introspection < 1.29.17, the tree model constructors were
    not presented correctly.

 t/inc/setup.pl |    5 +++++
 t/overrides.t  |   35 ++++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/t/inc/setup.pl b/t/inc/setup.pl
index 5134079..aac3750 100644
--- a/t/inc/setup.pl
+++ b/t/inc/setup.pl
@@ -5,4 +5,9 @@ if (!Gtk3::init_check ()) {
   plan skip_all => 'Gtk3::init_check failed';
 }
 
+sub check_gi_version {
+  my ($x, $y, $z) = @_;
+  return !system ('pkg-config', "--atleast-version=$x.$y.$z", 'gobject-introspection-1.0');
+}
+
 1;
diff --git a/t/overrides.t b/t/overrides.t
index d49941d..42c32b4 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -34,7 +34,10 @@ plan tests => 46;
 }
 
 # Gtk3::ListStore::new, set and get
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 5
+    unless check_gi_version(1, 29, 17);
+
   my $model = Gtk3::ListStore->new ([qw/Glib::String Glib::Int/]);
   my $iter = $model->append;
   $model->set ($iter, [0, 1], ['Foo', 23]);
@@ -52,7 +55,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeStore::new, set and get
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 5
+    unless check_gi_version(1, 29, 17);
+
   my $model = Gtk3::TreeStore->new ([qw/Glib::String Glib::Int/]);
   my $iter = $model->append (undef);
   $model->set ($iter, [0, 1], ['Foo', 23]);
@@ -82,7 +88,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeModel::get_iter, get_iter_first, get_iter_from_string
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 6
+    unless check_gi_version(1, 29, 17);
+
   my $model = Gtk3::ListStore->new ('Glib::String');
   my $path = Gtk3::TreePath->new_from_string ('0');
   is ($model->get_iter ($path), undef);
@@ -95,7 +104,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeModel::iter_children, iter_nth_child, iter_parent
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 6
+    unless check_gi_version(1, 29, 17);
+
   my $model = Gtk3::TreeStore->new ([qw/Glib::String/]);
   my $parent_iter = $model->append (undef);
   is ($model->iter_children ($parent_iter), undef);
@@ -108,7 +120,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeModelFilter
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 3
+    unless check_gi_version(1, 29, 17);
+
   my $child_model = Gtk3::TreeStore->new ([qw/Glib::String/]);
   my $child_iter = $child_model->append (undef);
   $child_model->set ($child_iter, 0 => 'Bla');
@@ -120,7 +135,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeModelSort
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 3
+    unless check_gi_version(1, 29, 17);
+
   my $child_model = Gtk3::TreeStore->new ([qw/Glib::String/]);
   my $child_iter = $child_model->append (undef);
   $child_model->set ($child_iter, 0 => 'Bla');
@@ -132,7 +150,10 @@ plan tests => 46;
 }
 
 # Gtk3::TreeSelection::get_selected
-{
+SKIP: {
+  skip 'tree model ctors not properly supported', 2
+    unless check_gi_version(1, 29, 17);
+
   my $model = Gtk3::ListStore->new ('Glib::String');
   my $view = Gtk3::TreeView->new ($model);
   my $selection = $view->get_selection;



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