testinggtk r321 - trunk/tests



Author: bjornl
Date: Sun Jun 29 23:16:53 2008
New Revision: 321
URL: http://svn.gnome.org/viewvc/testinggtk?rev=321&view=rev

Log:
Test grab-notify signal

Modified:
   trunk/tests/test_window.py

Modified: trunk/tests/test_window.py
==============================================================================
--- trunk/tests/test_window.py	(original)
+++ trunk/tests/test_window.py	Sun Jun 29 23:16:53 2008
@@ -80,3 +80,24 @@
     assert len(gtk.window_list_toplevels()) == 3
     for topwin, win in zip(gtk.window_list_toplevels(), windows):
         assert topwin == win
+
+def test_grab_notify_emitted_when_shadowed():
+    '''
+    Ensure that ``grab-notify`` is emitted on a widget when
+    ``grab_add`` is called on a widget that is not the ancestor of
+    that widget.
+    '''
+    data = []
+    def grab_notify_cb(widget, was_grabbed):
+        data.append((widget, was_grabbed))
+
+    # Two windows
+    win = gtk.Window()
+    win2 = gtk.Window()
+    win.connect('grab-notify', grab_notify_cb)
+
+    # Grab win2, win is now "shadowed" and grab-notify should be
+    # emitted on it.
+    win2.grab_add()
+
+    assert data[0] == (win, False)



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