testinggtk r291 - trunk/tests



Author: bjornl
Date: Sat Jun 28 11:35:11 2008
New Revision: 291
URL: http://svn.gnome.org/viewvc/testinggtk?rev=291&view=rev

Log:
Test grabbing on button press

Modified:
   trunk/tests/test_scalebutton.py

Modified: trunk/tests/test_scalebutton.py
==============================================================================
--- trunk/tests/test_scalebutton.py	(original)
+++ trunk/tests/test_scalebutton.py	Sat Jun 28 11:35:11 2008
@@ -34,3 +34,23 @@
         assert False
     except TypeError:
         assert True
+
+def test_button_press_triggers_grab():
+    '''
+    Ensure that ``gtk.ScaleButton`` performs a grab when it received a
+    button press event.
+    '''
+    from gtk import gdk
+    sb = gtk.ScaleButton(gtk.ICON_SIZE_INVALID, 0, 100, 2)
+
+    # Assign it a suitable gdk.Window
+    sb.window = gdk.Window(None,
+                           100, 100,
+                           gdk.WINDOW_TOPLEVEL,
+                           0,
+                           gdk.INPUT_OUTPUT,
+                           x = 120, y = 80)
+
+    ev = gdk.Event(gdk.BUTTON_PRESS)
+    sb.do_button_press_event(sb, ev)
+    assert gtk.grab_get_current()



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