perl-Gtk2 r2074 - in trunk: . t



Author: tsch
Date: Sun Oct 26 10:20:48 2008
New Revision: 2074
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2074&view=rev

Log:
For most callback tests, make sure we handle the case gracefully where they are
not called at all.


Modified:
   trunk/ChangeLog
   trunk/t/GtkTreeView.t

Modified: trunk/t/GtkTreeView.t
==============================================================================
--- trunk/t/GtkTreeView.t	(original)
+++ trunk/t/GtkTreeView.t	Sun Oct 26 10:20:48 2008
@@ -320,6 +320,11 @@
 	is($view -> row_expanded($path), 1);
 });
 
+SKIP: {
+	skip 'map_expanded_rows callback was not called', 3
+		unless $call_count++;
+}
+
 $view -> collapse_all();
 ok(!$view -> row_expanded($path));
 
@@ -351,6 +356,11 @@
 	$entry -> set_text ('test');
 	run_main sub { $view -> signal_emit('start_interactive_search') };
 
+	SKIP: {
+		skip 'set_search_equal_func callback was not called', 5
+			unless $been_here++;
+	}
+
 	$view -> set_search_equal_func(undef);
 }
 
@@ -363,7 +373,10 @@
 
 	$window -> show_all();
 
+	my $been_here = 0;
 	$view -> set_search_position_func(sub {
+		return if $been_here++;
+
 		my ($callback_view, $widget, $data) = @_;
 
 		is($callback_view, $view);
@@ -372,6 +385,11 @@
 	});
 	run_main sub { $view -> signal_emit('start_interactive_search') };
 
+	SKIP: {
+		skip 'set_search_position_func callback was not called', 3
+			unless $been_here++;
+	}
+
 	$view -> set_search_position_func(undef);
 }
 
@@ -416,6 +434,19 @@
 		my $path = $model->get_path ($iter);
 		return 1 == ($path->get_indices)[0];
 	}, {thing=>'foo'});
+
+	# trigger the callback
+	$view->insert_column_with_attributes
+		(0, "", Gtk2::CellRendererText->new, text => 0);
+	run_main;
+	$view->remove_column ($view->get_column (0));
+
+	SKIP: {
+		skip 'set_row_separator_func callback was not called', 3
+			unless $i_know_this_place++;
+	}
+
+	# FIXME: $view->set_row_separator_func (undef);
 }
 
 SKIP: {
@@ -489,7 +520,7 @@
 
 	my $times_tooltip_queried = 0;
 
-	$window->signal_connect (query_tooltip => sub {
+	my $sid = $window->signal_connect (query_tooltip => sub {
 		my ($window, $x, $y, $keyboard_mode, $tip) = @_;
 
 		return TRUE if $times_tooltip_queried++;
@@ -508,8 +539,6 @@
 		$view->set_tooltip_column (1);
 		is ($view->get_tooltip_column, 1);
 
-		Glib::Idle->add (sub { Gtk2->main_quit; });
-
 		return TRUE;
 	});
 
@@ -521,7 +550,14 @@
 	Gtk2->main_do_event ($event);
 	Gtk2->main_do_event ($event);
 
-	Gtk2->main;
+	run_main;
+
+	SKIP: {
+		skip 'query_tooltip was not called', 6
+			unless $times_tooltip_queried++;
+	}
+
+	$window->signal_handler_disconnect ($sid);
 }
 
 ###############################################################################



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