[PATCH libinput 5/8] test: Check that libinput doesn't send double touch down/up events
Jonas Ådahl
jadahl at gmail.com
Tue Mar 25 13:45:56 PDT 2014
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
test/touch.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/test/touch.c b/test/touch.c
index 61d8762..4a6af21 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -323,6 +323,47 @@ START_TEST(touch_many_slots)
}
END_TEST
+START_TEST(touch_double_touch_down_up)
+{
+ struct libinput *libinput;
+ struct litest_device *dev;
+ struct libinput_event *ev;
+ bool got_down = false;
+ bool got_up = false;
+
+ dev = litest_current_device();
+ libinput = dev->libinput;
+
+ litest_touch_down(dev, 0, 0, 0);
+ litest_touch_down(dev, 0, 0, 0);
+ litest_touch_up(dev, 0);
+ litest_touch_up(dev, 0);
+
+ libinput_dispatch(libinput);
+
+ while ((ev = libinput_get_event(libinput))) {
+ switch (libinput_event_get_type(ev)) {
+ case LIBINPUT_EVENT_TOUCH_DOWN:
+ ck_assert(!got_down);
+ got_down = true;
+ break;
+ case LIBINPUT_EVENT_TOUCH_UP:
+ ck_assert(got_down);
+ ck_assert(!got_up);
+ got_up = true;
+ break;
+ default:
+ break;
+ }
+
+ libinput_dispatch(libinput);
+ }
+
+ ck_assert(got_down);
+ ck_assert(got_up);
+}
+END_TEST
+
int
main(int argc, char **argv)
{
@@ -333,6 +374,8 @@ main(int argc, char **argv)
litest_add_no_device("touch:seat-slot-drop", touch_seat_slot_drop);
litest_add("touch:many-slots", touch_many_slots,
LITEST_TOUCH, LITEST_ANY);
+ litest_add("touch:double-touch-down-up", touch_double_touch_down_up,
+ LITEST_TOUCH, LITEST_ANY);
return litest_run(argc, argv);
}
--
1.8.3.2
More information about the wayland-devel
mailing list