summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-01-19 17:39:05 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2019-01-19 17:44:49 +0100
commitac3582563a7ac385e256f6a6328209d6d6ffdd95 (patch)
tree448b12a5177fbe6bc33993b53f28cc9554a7b1c6 /tests
parent81418f49b66c413797fe26c05536d346ac25cf18 (diff)
downloadpygobject-ac3582563a7ac385e256f6a6328209d6d6ffdd95.tar.gz
tests: add a test for stripping return values from event methods. Fixes #85
As pointed out in #85 we don't use strip_boolean_result() for the main Gdk.Event struct while we do for the member structs. But at this point int time I'm afraid that changing it will break existing code, so just add some tests to document the difference and make sure it doesn't change.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_overrides_gdk.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_overrides_gdk.py b/tests/test_overrides_gdk.py
index 88fc4654..0ea9187c 100644
--- a/tests/test_overrides_gdk.py
+++ b/tests/test_overrides_gdk.py
@@ -126,6 +126,16 @@ class TestGdk(unittest.TestCase):
self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar'))
@unittest.skipIf(GDK4, "not in gdk4")
+ def test_event_strip_boolean(self):
+ ev = Gdk.EventButton()
+ ev.type = Gdk.EventType.BUTTON_PRESS
+ assert ev.get_coords() == (0.0, 0.0)
+
+ # https://gitlab.gnome.org/GNOME/pygobject/issues/85
+ ev = Gdk.Event.new(Gdk.EventType.BUTTON_PRESS)
+ assert ev.get_coords() == (True, 0.0, 0.0)
+
+ @unittest.skipIf(GDK4, "not in gdk4")
def test_event_touch(self):
event = Gdk.Event.new(Gdk.EventType.TOUCH_BEGIN)
self.assertEqual(event.type, Gdk.EventType.TOUCH_BEGIN)