[PATCH libinput 5/9] test: Check that libinput doesn't send double touch down/up events
Jonas Ådahl
jadahl at gmail.com
Wed Apr 9 12:02:12 PDT 2014
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
test/touch.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/test/touch.c b/test/touch.c
index ae881b0..6805340 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -340,6 +340,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)
{
@@ -348,6 +389,7 @@ main(int argc, char **argv)
litest_add_no_device("touch:seat-slot", touch_seat_slots);
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