Commit ac358256 authored by Christoph Reiter's avatar Christoph Reiter 🐍

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.
parent 81418f49
......@@ -125,6 +125,16 @@ class TestGdk(unittest.TestCase):
event.type = Gdk.EventType.SCROLL
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment