Re: Patch for Gtk3



Dear all,

I have written a test to insert in the test file zz-GtkDialog.t
regarding the passing of userdata to the "response callback function" of
a Gtk3::Dialog. Enclosed you find the output of the diff - u command. It
would be great, if the passing of userdata to the callback function,
which is connected to the response signal of a Gtk3::Dialog, will work
in the next version of Gtk3...

Thanks and best wishes,
Max

Output of the diff command:
diff -u ./zz-GtkDialog.t ./zz-GtkDialog_PATCH.t
--- ./zz-GtkDialog.t    2016-06-08 14:44:39.839525025 +0200
+++ ./zz-GtkDialog_PATCH.t      2016-06-08 14:47:27.659517834 +0200
@@ -7,7 +7,7 @@
 use strict;
 use warnings;
 
-plan tests => 15;
+plan tests => 16;
 
 my $win = Gtk3::Window->new ('toplevel');
 
@@ -50,6 +50,23 @@
 $d3->signal_connect (response => sub { is ($_[1], 44); 1; });
 $btn3->clicked;
 
+# Test whether the userdatas are passed to the callback functions
+{
+my $d = Gtk3::Dialog->new();
+$d->set_transient_for($win);
+my $b = $d->add_button('Ok','ok');
+# pass userdata to the callback function
+$d->signal_connect('response'=> sub {
+       my ($widget,$response_id,$userdata) = @_;
+       ok($userdata eq 'DATA', 'Test whether userdata is passed to the
callback function');
+       Gtk3::EVENT_STOP;       
+},'DATA');
+Glib::Idle->add( sub {
+      $b->clicked;
+      Glib::SOURCE_REMOVE;
+    });
+}
+
 # make sure that known response types are converted to strings for the
reponse
 # signal of Gtk3::Dialog and its ancestors
 SKIP: {



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