[pygobject] [gi-tests] use Gdk.test_simulate_button instead of emitting event ourselves



commit c2d5122b8e3cf51ec52418f90f1788895b842b6a
Author: John (J5) Palmieri <johnp redhat com>
Date:   Mon Feb 28 14:08:05 2011 -0500

    [gi-tests] use Gdk.test_simulate_button instead of emitting event ourselves
    
     * this function is available specifically so we can test events so use this
       instead of creating our own button press event

 tests/test_overrides.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 992ec57..e2333b1 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -364,10 +364,7 @@ class TestGdk(unittest.TestCase):
             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
@@ -378,7 +375,11 @@ class TestGdk(unittest.TestCase):
         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))
+        Gdk.test_simulate_button(b.get_window(),
+                                 2, 5,
+                                 0,
+                                 Gdk.ModifierType.CONTROL_MASK,
+                                 Gdk.EventType.BUTTON_PRESS)
 
     def test_cursor(self):
         self.assertEquals(Gdk.Cursor, overrides.Gdk.Cursor)



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