testinggtk r401 - trunk/tests



Author: bjornl
Date: Mon Sep  1 05:45:24 2008
New Revision: 401
URL: http://svn.gnome.org/viewvc/testinggtk?rev=401&view=rev

Log:
Tests for the gtk.BindingSet class and associated functions.

Added:
   trunk/tests/test_bindingset.py

Added: trunk/tests/test_bindingset.py
==============================================================================
--- (empty file)
+++ trunk/tests/test_bindingset.py	Mon Sep  1 05:45:24 2008
@@ -0,0 +1,28 @@
+'''
+Tests for the ``gtk.BindingSet`` class and associated functions.
+'''
+import gobject
+import gtk
+
+def test_bool_arg_binding():
+    '''
+    Ensure that a keybinding signal with a boolean argument is
+    emitted.
+    '''
+    class Test(gtk.Button):
+        __gsignals__ = {
+            'sig' : (gobject.SIGNAL_ACTION |
+                     gobject.SIGNAL_RUN_LAST, None, (bool,))
+            }
+        def __init__(self):
+            super(gtk.Button, self).__init__()
+        def do_sig(self, val):
+            self.val = val
+    
+    test = Test()
+    gtk.binding_entry_add_signal(Test, gtk.keysyms.r, 0, 'sig', bool, True)
+    gtk.bindings_activate(test, gtk.keysyms.r, 0)
+    assert test.val
+    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



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