[pygobject/pygobject-2-28] [gi-tests] tests for EventButton override.
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-2-28] [gi-tests] tests for EventButton override.
- Date: Mon, 28 Feb 2011 18:45:21 +0000 (UTC)
commit baa9865e6ff8b4eee4b16235b8dcc5dc48d2634d
Author: Laszlo Pandy <lpandy src gnome org>
Date: Thu Feb 24 19:30:32 2011 +0100
[gi-tests] tests for EventButton override.
* John (J5) Palmieri - fixed up original patch so that we actually
emit the event instead of just creating a Gdk.ButtonEvent object
https://bugzilla.gnome.org/show_bug.cgi?id=642554
tests/test_overrides.py | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 2fc5512..992ec57 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -359,6 +359,27 @@ class TestGdk(unittest.TestCase):
event.type = Gdk.EventType.SCROLL
self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar'))
+ def test_event_structures(self):
+ def button_press_cb(button, event):
+ self.assertTrue(isinstance(event, Gdk.EventButton))
+ self.assertTrue(event.type == Gdk.EventType.BUTTON_PRESS)
+ self.assertEquals(event.send_event, 0)
+ event.state = Gdk.ModifierType.CONTROL_MASK
+ self.assertEquals(event.get_state(), Gdk.ModifierType.CONTROL_MASK)
+
+ event.x_root, event.y_root = 2, 5
+ self.assertEquals(event.get_root_coords(), (2, 5))
+
+ event.time = 12345
+ self.assertEquals(event.get_time(), 12345)
+
+ w = Gtk.Window()
+ b = Gtk.Button()
+ b.connect('button-press-event', button_press_cb)
+ w.add(b)
+ w.show_all()
+ b.emit('button-press-event', Gdk.Event.new(Gdk.EventType.BUTTON_PRESS))
+
def test_cursor(self):
self.assertEquals(Gdk.Cursor, overrides.Gdk.Cursor)
c = Gdk.Cursor(Gdk.CursorType.WATCH)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]