testinggtk r443 - trunk/tests
- From: bjornl svn gnome org
- To: svn-commits-list gnome org
- Subject: testinggtk r443 - trunk/tests
- Date: Wed, 10 Sep 2008 14:04:25 +0000 (UTC)
Author: bjornl
Date: Wed Sep 10 14:04:25 2008
New Revision: 443
URL: http://svn.gnome.org/viewvc/testinggtk?rev=443&view=rev
Log:
Add test case for #550345
Modified:
trunk/tests/test_widget.py
Modified: trunk/tests/test_widget.py
==============================================================================
--- trunk/tests/test_widget.py (original)
+++ trunk/tests/test_widget.py Wed Sep 10 14:04:25 2008
@@ -167,6 +167,59 @@
widget.hide()
assert not widget.get_property('visible')
+def test_tooltip_overlapping_widgets():
+ '''
+ Ensure that the correct tooltip is shown when two widgets inside a
+ ``gtk.Layout`` overlaps each other.
+
+ :bug: #550345
+ '''
+ b1 = gtk.Button('1')
+ b1.set_size_request(100, 100)
+ b1.set_tooltip_text('button1')
+
+ b2 = gtk.Button('2')
+ b2.set_size_request(100, 100)
+ b2.set_tooltip_text('button2')
+
+ # Note that in this layout b2 overlaps b1.
+ layout = gtk.Layout()
+ layout.set_size_request(400, 400)
+ layout.put(b1, 0, 0)
+ layout.put(b2, 50, 0)
+ win = gtk.Window()
+ win.add(layout)
+ win.show_all()
+
+ # By setting the timeout to 0 the tooltip should show after one
+ # iteration of the mainloop.
+ settings = gtk.settings_get_default()
+ settings.set_property('gtk-tooltip-timeout', 0)
+
+ # Simulate a motion notify over the second button on a location
+ # where it overlaps the first button.
+ ev = gdk.Event(gdk.MOTION_NOTIFY)
+ ev.window = win.window
+ ev.x = ev.x_root = 80.0
+ ev.y = ev.y_root = 10.0
+ ev.is_hint = False
+
+ # GTK gets the motion notify event and shows the tooltip in
+ # response.
+ gtk.main_do_event(ev)
+ gtk.main_iteration()
+
+ # Find the tooltip window in the toplevel list.
+ tooltip_win = None
+ for w in gtk.window_list_toplevels():
+ if w.name == 'gtk-tooltip':
+ tooltip_win = w
+
+ # The tooltip label shown should be the second buttons.
+ tooltip_label = tooltip_win.get_child().get_child().get_children()[1]
+ assert tooltip_label.get_text() == 'button2'
+
+
@utils.pass_on_warnings
def test_realize_without_parent():
'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]