diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2022-05-05 09:45:32 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-05-10 09:52:04 +1000 |
commit | 2f1a7ae905886fb1441d45b97c8e9952a1c3a878 (patch) | |
tree | 36d923f8a9003606c6b5e7c59065d856c08566a0 /test | |
parent | 4d3bbc84e026ad4f7513d54432c26ae49b2fdd4d (diff) | |
download | xf86-input-wacom-2f1a7ae905886fb1441d45b97c8e9952a1c3a878.tar.gz |
test: swap the axis checks for an iterator-based approach
This ensures we get a StopIteration exception if we don't have the
events we expect - previously we'd get a false positive on this test if
we had no motion events after the first one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_wacom.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/test_wacom.py b/test/test_wacom.py index b92901c..d3e315d 100644 --- a/test/test_wacom.py +++ b/test/test_wacom.py @@ -190,11 +190,13 @@ def test_axis_updates(mainloop, opts, axis): mainloop.run() logger.debug(f"We have {len(monitor.events)} events") - # ignore the initial proximity event since all axes change there - # by necessity - first = {name: getattr(monitor.events[1].axes, name) for name in map} + events = iter(monitor.events) + # Ignore the proximity event since all axes change there by necessity + _ = next(events) - for e in monitor.events[2:]: + first = {name: getattr(next(events).axes, name) for name in map} + + for e in events: current = {name: getattr(e.axes, name) for name in map} for name in map: if name == axis: |