[perl-Gtk2] Test that Gtk2::Dialog gets the custom "response" signal marshaller



commit c1a116df1004b8d8aaddb5470630e65f1f670105
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Nov 21 22:46:27 2010 +0100

    Test that Gtk2::Dialog gets the custom "response" signal marshaller
    
    Also test that this works for subclasses of Gtk2::Dialog.

 t/GtkDialog.t        |   13 ++++++++++++-
 t/GtkMessageDialog.t |   17 ++++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/t/GtkDialog.t b/t/GtkDialog.t
index aab02b0..72f54bf 100644
--- a/t/GtkDialog.t
+++ b/t/GtkDialog.t
@@ -9,7 +9,7 @@
 # 	- rm
 #########################
 
-use Gtk2::TestHelper tests => 28;
+use Gtk2::TestHelper tests => 29;
 
 ok( my $win = Gtk2::Window->new('toplevel') );
 
@@ -111,6 +111,17 @@ SKIP: {
 	is ($d3->get_widget_for_response('help'), $button);
 }
 
+# Make sure that our custom "response" marshaller is used.
+{
+	my $d = Gtk2::Dialog->new("Test Dialog", undef, [],
+				  'gtk-ok', 'ok');
+	$d->signal_connect(response => sub {
+		is ($_[1], 'ok');
+		Gtk2->main_quit;
+	});
+	run_main (sub { $d->response ('ok'); });
+}
+
 __END__
 
 Copyright (C) 2003-2005, 2010 by the gtk2-perl team (see the file AUTHORS for the
diff --git a/t/GtkMessageDialog.t b/t/GtkMessageDialog.t
index 77f8da4..87fa559 100644
--- a/t/GtkMessageDialog.t
+++ b/t/GtkMessageDialog.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 6;
+use Gtk2::TestHelper tests => 7;
 
 # $Id$
 
@@ -25,6 +25,21 @@ $dialog = Gtk2::MessageDialog -> new(undef,
                                      undef);
 isa_ok($dialog, "Gtk2::MessageDialog");
 
+# Make we sure we get the custom 'response' signal marshaller.
+{
+  my $dialog = Gtk2::MessageDialog -> new(undef,
+                                          "destroy-with-parent",
+                                          "warning",
+                                          "ok-cancel",
+                                          undef);
+  $dialog->signal_connect(response => sub {
+    is ($_[1], 'ok');
+    Gtk2->main_quit;
+  });
+  $dialog->show;
+  run_main (sub { $dialog->response ('ok'); });
+}
+
 SKIP: {
   skip("new_with_markup and set_markup are new in 2.4", 2)
     unless Gtk2->CHECK_VERSION (2, 4, 0);



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