[testinggtk] test binding keybinding signal to non-gtk class.



commit 48f1597121685d715b69562849268670da0bc39c
Author: Björn Lindqvist <bjourne gmail com>
Date:   Sat Jun 6 22:19:24 2009 +0200

    test binding keybinding signal to non-gtk class.
---
 tests/test_bindingset.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/tests/test_bindingset.py b/tests/test_bindingset.py
index 1fd0a50..27f2d7f 100644
--- a/tests/test_bindingset.py
+++ b/tests/test_bindingset.py
@@ -3,6 +3,7 @@ Tests for the ``gtk.BindingSet`` class and associated functions.
 '''
 import gobject
 import gtk
+from tests import utils
 
 def test_bool_arg_binding():
     '''
@@ -26,3 +27,23 @@ def test_bool_arg_binding():
     gtk.binding_entry_add_signal(Test, gtk.keysyms.k, 0, 'sig', bool, False)
     gtk.bindings_activate(test, gtk.keysyms.k, 0)
     assert not test.val
+
+ utils pass_on_warnings
+def test_keybinding_signal_on_gobject():
+    '''
+    Attempt to bind a keybinding to a signal in a non-gtk class.
+
+    Test should fail with a warning message because only gtk classes
+    can have keybindings.
+    '''
+    class Test47(gobject.GObject):
+        pass
+    gobject.type_register(Test47)
+
+    # Add a signal to the class
+    gobject.signal_new('asignal',
+                       Test47,
+                       gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION,
+                       gobject.TYPE_NONE,
+                       (gobject.TYPE_INT,))
+    gtk.binding_entry_add_signal(Test47, gtk.keysyms.x, 0, 'asignal', int, 5)



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