summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-04-27 14:12:11 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-04-28 15:11:30 +1000
commite461f21c5232baba105c0aaf17987e319143ba9d (patch)
tree1e97666e142ae62859ffe65be483e9bce037b5fd /test
parent8a626394c9d304358039aadd2086ef7025132157 (diff)
touchpad: fix the button timestamps for double/tripletap
Both events had the same timestamp but we have the timestamp from the original event - use it. https://bugs.freedesktop.org/show_bug.cgi?id=100796 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/test-touchpad-tap.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index cc0d86f..2739f85 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -916,6 +916,9 @@ START_TEST(touchpad_2fg_tap)
struct libinput *li = dev->libinput;
enum libinput_config_tap_button_map map = _i; /* ranged test */
unsigned int button = 0;
+ struct libinput_event *ev;
+ struct libinput_event_pointer *ptrev;
+ uint64_t ptime, rtime;
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
@@ -940,11 +943,20 @@ START_TEST(touchpad_2fg_tap)
libinput_dispatch(li);
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_PRESSED);
- litest_timeout_tap();
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_PRESSED);
+ ptime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
+ rtime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+
+ ck_assert_int_lt(ptime, rtime);
litest_assert_empty_queue(li);
}
@@ -956,6 +968,9 @@ START_TEST(touchpad_2fg_tap_inverted)
struct libinput *li = dev->libinput;
enum libinput_config_tap_button_map map = _i; /* ranged test */
unsigned int button = 0;
+ struct libinput_event *ev;
+ struct libinput_event_pointer *ptrev;
+ uint64_t ptime, rtime;
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
@@ -980,11 +995,20 @@ START_TEST(touchpad_2fg_tap_inverted)
libinput_dispatch(li);
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_PRESSED);
- litest_timeout_tap();
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_PRESSED);
+ ptime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
+ rtime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+
+ ck_assert_int_lt(ptime, rtime);
litest_assert_empty_queue(li);
}
@@ -1379,6 +1403,10 @@ START_TEST(touchpad_3fg_tap)
}
for (i = 0; i < 3; i++) {
+ uint64_t ptime, rtime;
+ struct libinput_event *ev;
+ struct libinput_event_pointer *ptrev;
+
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@@ -1391,13 +1419,21 @@ START_TEST(touchpad_3fg_tap)
libinput_dispatch(li);
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_PRESSED);
- litest_timeout_tap();
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_PRESSED);
+ ptime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+ ev = libinput_get_event(li);
+ ptrev = litest_is_button_event(ev,
+ button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
+ rtime = libinput_event_pointer_get_time_usec(ptrev);
+ libinput_event_destroy(ev);
+
+ ck_assert_int_lt(ptime, rtime);
- litest_assert_empty_queue(li);
}
}
END_TEST