[pygobject/tests-event-strip-boolean] tests: add a test for stripping return values from event methods. Fixes #85
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/tests-event-strip-boolean] tests: add a test for stripping return values from event methods. Fixes #85
- Date: Sat, 19 Jan 2019 16:45:40 +0000 (UTC)
commit ac3582563a7ac385e256f6a6328209d6d6ffdd95
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sat Jan 19 17:39:05 2019 +0100
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.
tests/test_overrides_gdk.py | 10 ++++++++++
1 file changed, 10 insertions(+)
---
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
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]