[PATCH libinput] test: move tapping tests into a separate binary

Peter Hutterer peter.hutterer at who-t.net
Fri Jun 19 00:08:15 PDT 2015


The previous set hit _some_ sort of limit, but no idea what or why. When
adding one more test, the touchpad test case would reliably fail with a udev
timeout in litest_wait_for_udev(). This only happened in the valgrind case,
the normal run succeeded. Reproduced on three different installations (2 vms
on two different hosts).

Move the tapping tests into a separate binary, this unwedges whatever was
unhappy and sunshine, lollipops and rainbows are distributed generously.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/Makefile.am    |    5 +
 test/touchpad-tap.c | 1726 +++++++++++++++++++++++++++++++++++++++++++++++++++
 test/touchpad.c     | 1687 -------------------------------------------------
 3 files changed, 1731 insertions(+), 1687 deletions(-)
 create mode 100644 test/touchpad-tap.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 2dfd5c1..d4838ca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -48,6 +48,7 @@ endif
 
 run_tests = \
 	test-touchpad \
+	test-touchpad-tap \
 	test-device \
 	test-pointer \
 	test-touch \
@@ -95,6 +96,10 @@ test_touchpad_SOURCES = touchpad.c
 test_touchpad_LDADD = $(TEST_LIBS)
 test_touchpad_LDFLAGS = -no-install
 
+test_touchpad_tap_SOURCES = touchpad-tap.c
+test_touchpad_tap_LDADD = $(TEST_LIBS)
+test_touchpad_tap_LDFLAGS = -no-install
+
 test_trackpoint_SOURCES = trackpoint.c
 test_trackpoint_LDADD = $(TEST_LIBS)
 test_trackpoint_LDFLAGS = -no-install
diff --git a/test/touchpad-tap.c b/test/touchpad-tap.c
new file mode 100644
index 0000000..79381e6
--- /dev/null
+++ b/test/touchpad-tap.c
@@ -0,0 +1,1726 @@
+/*
+ * Copyright © 2014-2015 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <check.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libinput.h>
+#include <unistd.h>
+
+#include "libinput-util.h"
+#include "litest.h"
+
+START_TEST(touchpad_1fg_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	libinput_dispatch(li);
+	event = libinput_get_event(li);
+	ck_assert(event == NULL);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_doubletap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime, curtime;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	libinput_dispatch(li);
+
+	litest_timeout_tap();
+
+	libinput_dispatch(li);
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	oldtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_RELEASED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_le(oldtime, curtime);
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_lt(oldtime, curtime);
+	oldtime = curtime;
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_RELEASED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_le(oldtime, curtime);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	litest_timeout_tap();
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+	litest_timeout_tap();
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_move)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	libinput_dispatch(li);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_gt(curtime, oldtime);
+
+	litest_assert_only_typed_events(li,
+					LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_2fg)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i,
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	libinput_dispatch(li);
+	litest_touch_down(dev, 0, 50, 50);
+	msleep(10);
+	litest_touch_down(dev, 1, 70, 50);
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_gt(curtime, oldtime);
+
+	litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10, 4);
+
+	litest_assert_only_typed_events(li,
+					LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+	litest_timeout_tap();
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(li);
+	litest_button_click(dev, BTN_LEFT, true);
+	litest_button_click(dev, BTN_LEFT, false);
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_touch_up(dev, 0);
+	litest_timeout_tap();
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_timeout)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	libinput_dispatch(li);
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(li);
+
+	litest_timeout_tap();
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_gt(curtime, oldtime);
+
+	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
+
+	litest_assert_only_typed_events(li,
+					LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	libinput_dispatch(li);
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(li);
+
+	litest_timeout_tap();
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_gt(curtime, oldtime);
+
+	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
+
+	litest_assert_only_typed_events(li,
+					LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 70, 50);
+	litest_touch_up(dev, 0);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_multitap_n_drag_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_pointer *ptrev;
+	uint32_t oldtime = 0,
+		 curtime;
+	int range = _i, /* looped test */
+	    ntaps;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_up(dev, 0);
+		libinput_dispatch(li);
+		msleep(10);
+	}
+
+	libinput_dispatch(li);
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(li);
+
+	litest_timeout_tap();
+	libinput_dispatch(li);
+
+	for (ntaps = 0; ntaps <= range; ntaps++) {
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_PRESSED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_gt(curtime, oldtime);
+
+		event = libinput_get_event(li);
+		ptrev = litest_is_button_event(event,
+					       BTN_LEFT,
+					       LIBINPUT_BUTTON_STATE_RELEASED);
+		curtime = libinput_event_pointer_get_time(ptrev);
+		libinput_event_destroy(event);
+		ck_assert_int_ge(curtime, oldtime);
+		oldtime = curtime;
+	}
+
+	event = libinput_get_event(li);
+	ptrev = litest_is_button_event(event,
+				       BTN_LEFT,
+				       LIBINPUT_BUTTON_STATE_PRESSED);
+	curtime = libinput_event_pointer_get_time(ptrev);
+	libinput_event_destroy(event);
+	ck_assert_int_gt(curtime, oldtime);
+
+	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
+
+	litest_assert_only_typed_events(li,
+					LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 70, 50);
+	litest_button_click(dev, BTN_LEFT, true);
+	litest_button_click(dev, BTN_LEFT, false);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	/* the physical click */
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_n_drag)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	libinput_dispatch(li);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	/* lift finger, set down again, should continue dragging */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+	litest_touch_up(dev, 0);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_timeout_tap();
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_n_drag_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	libinput_dispatch(li);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	/* lift finger, set down again, should continue dragging */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_n_drag_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	libinput_dispatch(li);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	/* lift finger, set down again, should continue dragging */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_button_click(dev, BTN_LEFT, true);
+	litest_button_click(dev, BTN_LEFT, false);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	/* the physical click */
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li,
+				   BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_n_drag_timeout)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(li);
+	litest_timeout_tap();
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_assert_empty_queue(li);
+	litest_touch_up(dev, 0);
+
+	litest_timeout_tapndrag();
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_n_drag)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_down(dev, 1, 80, 70);
+	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_touch_up(dev, 0);
+	litest_touch_up(dev, 1);
+
+	/* This will wait for the DRAGGING_WAIT timeout */
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) > 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_down(dev, 1, 80, 90);
+	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	/* Putting down a third finger should end the drag */
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	/* Releasing the fingers should not cause any events */
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_n_drag_3fg)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 30, 70);
+	litest_touch_down(dev, 1, 80, 90);
+	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	/* Putting down a third finger should end the drag */
+	litest_touch_down(dev, 2, 50, 50);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	/* Releasing the fingers should not cause any events */
+	litest_touch_up(dev, 2);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 70);
+	litest_touch_up(dev, 0);
+	litest_touch_up(dev, 1);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_inverted)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 70);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_quickrelease)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 70);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* Finger down, finger up -> tap button press
+	 * Physical button click -> no button press/release
+	 * Tap timeout -> tap button release */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	libinput_dispatch(li);
+	litest_timeout_tap();
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* two fingers down, left button click, fingers up
+	   -> one left button, one right button event pair */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_2fg_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* two fingers down, button click, fingers up
+	   -> only one button left event pair */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_click_apple)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* two fingers down, button click, fingers up
+	   -> only one button right event pair
+	   (apple have clickfinger enabled by default) */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_RIGHT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_no_2fg_tap_after_move)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+	litest_drain_events(dev->libinput);
+
+	/* one finger down, move past threshold,
+	   second finger down, first finger up
+	   -> no event
+	 */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0);
+	litest_drain_events(dev->libinput);
+
+	litest_touch_down(dev, 1, 70, 50);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_no_2fg_tap_after_timeout)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+	litest_drain_events(dev->libinput);
+
+	/* one finger down, wait past tap timeout,
+	   second finger down, first finger up
+	   -> no event
+	 */
+	litest_touch_down(dev, 0, 50, 50);
+	libinput_dispatch(dev->libinput);
+	litest_timeout_tap();
+	libinput_dispatch(dev->libinput);
+	litest_drain_events(dev->libinput);
+
+	litest_touch_down(dev, 1, 70, 50);
+	litest_touch_up(dev, 0);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_no_first_fg_tap_after_move)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* one finger down, second finger down,
+	   second finger moves beyond threshold,
+	   first finger up
+	   -> no event
+	 */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	libinput_dispatch(dev->libinput);
+	litest_touch_move_to(dev, 1, 70, 50, 90, 90, 10, 0);
+	libinput_dispatch(dev->libinput);
+	litest_touch_up(dev, 0);
+	litest_touch_up(dev, 1);
+	libinput_dispatch(dev->libinput);
+
+	while ((event = libinput_get_event(li))) {
+		ck_assert_int_ne(libinput_event_get_type(event),
+				 LIBINPUT_EVENT_POINTER_BUTTON);
+		libinput_event_destroy(event);
+	}
+}
+END_TEST
+
+START_TEST(touchpad_1fg_double_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* one finger down, up, down, button click, finger up
+	   -> two button left event pairs */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_tap_n_drag_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* one finger down, up, down, move, button click, finger up
+	   -> two button left event pairs, motion allowed */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_up(dev, 0);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 50, 10, 0);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	int i;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	for (i = 0; i < 3; i++) {
+		litest_drain_events(li);
+
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_down(dev, 1, 70, 50);
+		litest_touch_down(dev, 2, 80, 50);
+
+		litest_touch_up(dev, (i + 2) % 3);
+		litest_touch_up(dev, (i + 1) % 3);
+		litest_touch_up(dev, (i + 0) % 3);
+
+		libinput_dispatch(li);
+
+		litest_assert_button_event(li, BTN_MIDDLE,
+					   LIBINPUT_BUTTON_STATE_PRESSED);
+		litest_timeout_tap();
+		litest_assert_button_event(li, BTN_MIDDLE,
+					   LIBINPUT_BUTTON_STATE_RELEASED);
+
+		libinput_dispatch(li);
+		event = libinput_get_event(li);
+		ck_assert(event == NULL);
+	}
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap_quickrelease)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_touch_down(dev, 2, 80, 50);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	libinput_dispatch(li);
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap_btntool)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) > 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device, 1);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 1);
+	litest_touch_up(dev, 0);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	libinput_dispatch(li);
+	event = libinput_get_event(li);
+	ck_assert(event == NULL);
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap_btntool_inverted)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) > 2)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device, 1);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 0);
+	litest_touch_up(dev, 1);
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_timeout_tap();
+	litest_assert_button_event(li, BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	libinput_dispatch(li);
+	event = libinput_get_event(li);
+	ck_assert(event == NULL);
+}
+END_TEST
+
+START_TEST(touchpad_4fg_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	int i;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 3)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	for (i = 0; i < 4; i++) {
+		litest_drain_events(li);
+
+		litest_touch_down(dev, 0, 50, 50);
+		litest_touch_down(dev, 1, 70, 50);
+		litest_touch_down(dev, 2, 80, 50);
+		litest_touch_down(dev, 3, 90, 50);
+
+		litest_touch_up(dev, (i + 3) % 4);
+		litest_touch_up(dev, (i + 2) % 4);
+		litest_touch_up(dev, (i + 1) % 4);
+		litest_touch_up(dev, (i + 0) % 4);
+
+		libinput_dispatch(li);
+		litest_assert_empty_queue(li);
+		litest_timeout_tap();
+		litest_assert_empty_queue(li);
+		event = libinput_get_event(li);
+		ck_assert(event == NULL);
+	}
+}
+END_TEST
+
+START_TEST(touchpad_4fg_tap_quickrelease)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 3)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 70, 50);
+	litest_touch_down(dev, 2, 80, 50);
+	litest_touch_down(dev, 3, 90, 50);
+
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 3);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+	libinput_dispatch(li);
+	litest_assert_empty_queue(li);
+	litest_timeout_tap();
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_5fg_tap)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	int i;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 4)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	for (i = 0; i < 5; i++) {
+		litest_drain_events(li);
+
+		litest_touch_down(dev, 0, 20, 50);
+		litest_touch_down(dev, 1, 30, 50);
+		litest_touch_down(dev, 2, 40, 50);
+		litest_touch_down(dev, 3, 50, 50);
+		litest_touch_down(dev, 4, 60, 50);
+
+		litest_touch_up(dev, (i + 4) % 5);
+		litest_touch_up(dev, (i + 3) % 5);
+		litest_touch_up(dev, (i + 2) % 5);
+		litest_touch_up(dev, (i + 1) % 5);
+		litest_touch_up(dev, (i + 0) % 5);
+
+		libinput_dispatch(li);
+		litest_assert_empty_queue(li);
+		litest_timeout_tap();
+		litest_assert_empty_queue(li);
+		event = libinput_get_event(li);
+		ck_assert(event == NULL);
+	}
+}
+END_TEST
+
+START_TEST(touchpad_5fg_tap_quickrelease)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (libevdev_get_abs_maximum(dev->evdev,
+				     ABS_MT_SLOT) <= 4)
+		return;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 20, 50);
+	litest_touch_down(dev, 1, 30, 50);
+	litest_touch_down(dev, 2, 40, 50);
+	litest_touch_down(dev, 3, 70, 50);
+	litest_touch_down(dev, 4, 90, 50);
+
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 3);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_ABS, ABS_MT_SLOT, 4);
+	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+	litest_event(dev, EV_KEY, BTN_TOOL_QUINTTAP, 0);
+	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+	libinput_dispatch(li);
+	litest_assert_empty_queue(li);
+	litest_timeout_tap();
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_1fg_tap_click)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	libinput_device_config_tap_set_enabled(dev->libinput_device,
+					       LIBINPUT_CONFIG_TAP_ENABLED);
+
+	litest_drain_events(dev->libinput);
+
+	/* finger down, button click, finger up
+	   -> only one button left event pair */
+	litest_touch_down(dev, 0, 50, 50);
+	litest_event(dev, EV_KEY, BTN_LEFT, 1);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_event(dev, EV_KEY, BTN_LEFT, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	litest_touch_up(dev, 0);
+	libinput_dispatch(li);
+	litest_timeout_tap();
+
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
+
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_tap_is_available)
+{
+	struct litest_device *dev = litest_current_device();
+
+	ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1);
+}
+END_TEST
+
+START_TEST(touchpad_tap_is_not_available)
+{
+	struct litest_device *dev = litest_current_device();
+
+	ck_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0);
+	ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
+			 LIBINPUT_CONFIG_TAP_DISABLED);
+	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
+								LIBINPUT_CONFIG_TAP_ENABLED),
+			 LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
+	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
+								LIBINPUT_CONFIG_TAP_DISABLED),
+			 LIBINPUT_CONFIG_STATUS_SUCCESS);
+}
+END_TEST
+
+START_TEST(touchpad_tap_default_disabled)
+{
+	struct litest_device *dev = litest_current_device();
+
+	/* this test is only run on specific devices */
+
+	ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
+			 LIBINPUT_CONFIG_TAP_DISABLED);
+}
+END_TEST
+
+START_TEST(touchpad_tap_default_enabled)
+{
+	struct litest_device *dev = litest_current_device();
+
+	/* this test is only run on specific devices */
+
+	ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
+			 LIBINPUT_CONFIG_TAP_ENABLED);
+}
+END_TEST
+
+START_TEST(touchpad_tap_invalid)
+{
+	struct litest_device *dev = litest_current_device();
+
+	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2),
+			 LIBINPUT_CONFIG_STATUS_INVALID);
+	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1),
+			 LIBINPUT_CONFIG_STATUS_INVALID);
+}
+END_TEST
+
+void
+litest_setup_tests(void)
+{
+	struct range multitap_range = {3, 8};
+
+	litest_add("touchpad:tap", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
+	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
+	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
+	litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
+
+	litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+	litest_add("touchpad:tap", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+	litest_add("touchpad:tap", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
+
+	/* Real buttons don't interfere with tapping, so don't run those for
+	   pads with buttons */
+	litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
+	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
+	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY);
+
+	litest_add("touchpad:tap", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON);
+	litest_add("touchpad:tap", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:tap", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD);
+
+	litest_add("touchpad:tap", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY);
+	litest_add("touchpad:tap", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
+
+}
diff --git a/test/touchpad.c b/test/touchpad.c
index d968d55..7e9317f 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -96,1553 +96,6 @@ START_TEST(touchpad_2fg_no_motion)
 }
 END_TEST
 
-START_TEST(touchpad_1fg_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	libinput_dispatch(li);
-	event = libinput_get_event(li);
-	ck_assert(event == NULL);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_doubletap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime, curtime;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	libinput_dispatch(li);
-
-	litest_timeout_tap();
-
-	libinput_dispatch(li);
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	oldtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_RELEASED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_le(oldtime, curtime);
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_lt(oldtime, curtime);
-	oldtime = curtime;
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_RELEASED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_le(oldtime, curtime);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	litest_timeout_tap();
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-	litest_timeout_tap();
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_move)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	libinput_dispatch(li);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_gt(curtime, oldtime);
-
-	litest_assert_only_typed_events(li,
-					LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_2fg)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i,
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	libinput_dispatch(li);
-	litest_touch_down(dev, 0, 50, 50);
-	msleep(10);
-	litest_touch_down(dev, 1, 70, 50);
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_gt(curtime, oldtime);
-
-	litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10, 4);
-
-	litest_assert_only_typed_events(li,
-					LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-	litest_timeout_tap();
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(li);
-	litest_button_click(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_touch_up(dev, 0);
-	litest_timeout_tap();
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_timeout)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	libinput_dispatch(li);
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(li);
-
-	litest_timeout_tap();
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_gt(curtime, oldtime);
-
-	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
-
-	litest_assert_only_typed_events(li,
-					LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	libinput_dispatch(li);
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(li);
-
-	litest_timeout_tap();
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_gt(curtime, oldtime);
-
-	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
-
-	litest_assert_only_typed_events(li,
-					LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 70, 50);
-	litest_touch_up(dev, 0);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_multitap_n_drag_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	struct libinput_event_pointer *ptrev;
-	uint32_t oldtime = 0,
-		 curtime;
-	int range = _i, /* looped test */
-	    ntaps;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_up(dev, 0);
-		libinput_dispatch(li);
-		msleep(10);
-	}
-
-	libinput_dispatch(li);
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(li);
-
-	litest_timeout_tap();
-	libinput_dispatch(li);
-
-	for (ntaps = 0; ntaps <= range; ntaps++) {
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_PRESSED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_gt(curtime, oldtime);
-
-		event = libinput_get_event(li);
-		ptrev = litest_is_button_event(event,
-					       BTN_LEFT,
-					       LIBINPUT_BUTTON_STATE_RELEASED);
-		curtime = libinput_event_pointer_get_time(ptrev);
-		libinput_event_destroy(event);
-		ck_assert_int_ge(curtime, oldtime);
-		oldtime = curtime;
-	}
-
-	event = libinput_get_event(li);
-	ptrev = litest_is_button_event(event,
-				       BTN_LEFT,
-				       LIBINPUT_BUTTON_STATE_PRESSED);
-	curtime = libinput_event_pointer_get_time(ptrev);
-	libinput_event_destroy(event);
-	ck_assert_int_gt(curtime, oldtime);
-
-	litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4);
-
-	litest_assert_only_typed_events(li,
-					LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 70, 50);
-	litest_button_click(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	/* the physical click */
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_n_drag)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	libinput_dispatch(li);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	/* lift finger, set down again, should continue dragging */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-	litest_touch_up(dev, 0);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_timeout_tap();
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_n_drag_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	libinput_dispatch(li);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	/* lift finger, set down again, should continue dragging */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_n_drag_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	libinput_dispatch(li);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	/* lift finger, set down again, should continue dragging */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_button_click(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	/* the physical click */
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li,
-				   BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_n_drag_timeout)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(li);
-	litest_timeout_tap();
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_assert_empty_queue(li);
-	litest_touch_up(dev, 0);
-
-	litest_timeout_tapndrag();
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_n_drag)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_down(dev, 1, 80, 70);
-	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_touch_up(dev, 0);
-	litest_touch_up(dev, 1);
-
-	/* This will wait for the DRAGGING_WAIT timeout */
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) > 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_down(dev, 1, 80, 90);
-	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	/* Putting down a third finger should end the drag */
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	/* Releasing the fingers should not cause any events */
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_n_drag_3fg)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 30, 70);
-	litest_touch_down(dev, 1, 80, 90);
-	litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40);
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	/* Putting down a third finger should end the drag */
-	litest_touch_down(dev, 2, 50, 50);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	/* Releasing the fingers should not cause any events */
-	litest_touch_up(dev, 2);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 70);
-	litest_touch_up(dev, 0);
-	litest_touch_up(dev, 1);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_inverted)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 70);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_quickrelease)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 70);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* Finger down, finger up -> tap button press
-	 * Physical button click -> no button press/release
-	 * Tap timeout -> tap button release */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	libinput_dispatch(li);
-	litest_timeout_tap();
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* two fingers down, left button click, fingers up
-	   -> one left button, one right button event pair */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(clickpad_2fg_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* two fingers down, button click, fingers up
-	   -> only one button left event pair */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_2fg_tap_click_apple)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* two fingers down, button click, fingers up
-	   -> only one button right event pair
-	   (apple have clickfinger enabled by default) */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_RIGHT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_no_2fg_tap_after_move)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-	litest_drain_events(dev->libinput);
-
-	/* one finger down, move past threshold,
-	   second finger down, first finger up
-	   -> no event
-	 */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0);
-	litest_drain_events(dev->libinput);
-
-	litest_touch_down(dev, 1, 70, 50);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_no_2fg_tap_after_timeout)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-	litest_drain_events(dev->libinput);
-
-	/* one finger down, wait past tap timeout,
-	   second finger down, first finger up
-	   -> no event
-	 */
-	litest_touch_down(dev, 0, 50, 50);
-	libinput_dispatch(dev->libinput);
-	litest_timeout_tap();
-	libinput_dispatch(dev->libinput);
-	litest_drain_events(dev->libinput);
-
-	litest_touch_down(dev, 1, 70, 50);
-	litest_touch_up(dev, 0);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_no_first_fg_tap_after_move)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* one finger down, second finger down,
-	   second finger moves beyond threshold,
-	   first finger up
-	   -> no event
-	 */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	libinput_dispatch(dev->libinput);
-	litest_touch_move_to(dev, 1, 70, 50, 90, 90, 10, 0);
-	libinput_dispatch(dev->libinput);
-	litest_touch_up(dev, 0);
-	litest_touch_up(dev, 1);
-	libinput_dispatch(dev->libinput);
-
-	while ((event = libinput_get_event(li))) {
-		ck_assert_int_ne(libinput_event_get_type(event),
-				 LIBINPUT_EVENT_POINTER_BUTTON);
-		libinput_event_destroy(event);
-	}
-}
-END_TEST
-
-START_TEST(touchpad_1fg_double_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* one finger down, up, down, button click, finger up
-	   -> two button left event pairs */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_1fg_tap_n_drag_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* one finger down, up, down, move, button click, finger up
-	   -> two button left event pairs, motion allowed */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_up(dev, 0);
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_move_to(dev, 0, 50, 50, 80, 50, 10, 0);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
-
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_3fg_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	int i;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	for (i = 0; i < 3; i++) {
-		litest_drain_events(li);
-
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_down(dev, 1, 70, 50);
-		litest_touch_down(dev, 2, 80, 50);
-
-		litest_touch_up(dev, (i + 2) % 3);
-		litest_touch_up(dev, (i + 1) % 3);
-		litest_touch_up(dev, (i + 0) % 3);
-
-		libinput_dispatch(li);
-
-		litest_assert_button_event(li, BTN_MIDDLE,
-					   LIBINPUT_BUTTON_STATE_PRESSED);
-		litest_timeout_tap();
-		litest_assert_button_event(li, BTN_MIDDLE,
-					   LIBINPUT_BUTTON_STATE_RELEASED);
-
-		libinput_dispatch(li);
-		event = libinput_get_event(li);
-		ck_assert(event == NULL);
-	}
-}
-END_TEST
-
-START_TEST(touchpad_3fg_tap_quickrelease)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_touch_down(dev, 2, 80, 50);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	libinput_dispatch(li);
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_3fg_tap_btntool)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) > 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device, 1);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 1);
-	litest_touch_up(dev, 0);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	libinput_dispatch(li);
-	event = libinput_get_event(li);
-	ck_assert(event == NULL);
-}
-END_TEST
-
-START_TEST(touchpad_3fg_tap_btntool_inverted)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) > 2)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device, 1);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 0);
-	litest_touch_up(dev, 1);
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_timeout_tap();
-	litest_assert_button_event(li, BTN_MIDDLE,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	libinput_dispatch(li);
-	event = libinput_get_event(li);
-	ck_assert(event == NULL);
-}
-END_TEST
-
-START_TEST(touchpad_4fg_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	int i;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 3)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	for (i = 0; i < 4; i++) {
-		litest_drain_events(li);
-
-		litest_touch_down(dev, 0, 50, 50);
-		litest_touch_down(dev, 1, 70, 50);
-		litest_touch_down(dev, 2, 80, 50);
-		litest_touch_down(dev, 3, 90, 50);
-
-		litest_touch_up(dev, (i + 3) % 4);
-		litest_touch_up(dev, (i + 2) % 4);
-		litest_touch_up(dev, (i + 1) % 4);
-		litest_touch_up(dev, (i + 0) % 4);
-
-		libinput_dispatch(li);
-		litest_assert_empty_queue(li);
-		litest_timeout_tap();
-		litest_assert_empty_queue(li);
-		event = libinput_get_event(li);
-		ck_assert(event == NULL);
-	}
-}
-END_TEST
-
-START_TEST(touchpad_4fg_tap_quickrelease)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 3)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 50, 50);
-	litest_touch_down(dev, 1, 70, 50);
-	litest_touch_down(dev, 2, 80, 50);
-	litest_touch_down(dev, 3, 90, 50);
-
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 3);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-
-	libinput_dispatch(li);
-	litest_assert_empty_queue(li);
-	litest_timeout_tap();
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
-START_TEST(touchpad_5fg_tap)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-	struct libinput_event *event;
-	int i;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 4)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	for (i = 0; i < 5; i++) {
-		litest_drain_events(li);
-
-		litest_touch_down(dev, 0, 20, 50);
-		litest_touch_down(dev, 1, 30, 50);
-		litest_touch_down(dev, 2, 40, 50);
-		litest_touch_down(dev, 3, 50, 50);
-		litest_touch_down(dev, 4, 60, 50);
-
-		litest_touch_up(dev, (i + 4) % 5);
-		litest_touch_up(dev, (i + 3) % 5);
-		litest_touch_up(dev, (i + 2) % 5);
-		litest_touch_up(dev, (i + 1) % 5);
-		litest_touch_up(dev, (i + 0) % 5);
-
-		libinput_dispatch(li);
-		litest_assert_empty_queue(li);
-		litest_timeout_tap();
-		litest_assert_empty_queue(li);
-		event = libinput_get_event(li);
-		ck_assert(event == NULL);
-	}
-}
-END_TEST
-
-START_TEST(touchpad_5fg_tap_quickrelease)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	if (libevdev_get_abs_maximum(dev->evdev,
-				     ABS_MT_SLOT) <= 4)
-		return;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(li);
-
-	litest_touch_down(dev, 0, 20, 50);
-	litest_touch_down(dev, 1, 30, 50);
-	litest_touch_down(dev, 2, 40, 50);
-	litest_touch_down(dev, 3, 70, 50);
-	litest_touch_down(dev, 4, 90, 50);
-
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 1);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 2);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 3);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_ABS, ABS_MT_SLOT, 4);
-	litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
-	litest_event(dev, EV_KEY, BTN_TOOL_QUINTTAP, 0);
-	litest_event(dev, EV_KEY, BTN_TOUCH, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-
-	libinput_dispatch(li);
-	litest_assert_empty_queue(li);
-	litest_timeout_tap();
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
 START_TEST(touchpad_click_defaults_clickfinger)
 {
 	struct litest_device *dev = litest_current_device();
@@ -2064,38 +517,6 @@ START_TEST(touchpad_btn_left)
 }
 END_TEST
 
-START_TEST(clickpad_1fg_tap_click)
-{
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
-
-	libinput_device_config_tap_set_enabled(dev->libinput_device,
-					       LIBINPUT_CONFIG_TAP_ENABLED);
-
-	litest_drain_events(dev->libinput);
-
-	/* finger down, button click, finger up
-	   -> only one button left event pair */
-	litest_touch_down(dev, 0, 50, 50);
-	litest_event(dev, EV_KEY, BTN_LEFT, 1);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_event(dev, EV_KEY, BTN_LEFT, 0);
-	litest_event(dev, EV_SYN, SYN_REPORT, 0);
-	litest_touch_up(dev, 0);
-	libinput_dispatch(li);
-	litest_timeout_tap();
-
-	libinput_dispatch(li);
-
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_PRESSED);
-	litest_assert_button_event(li, BTN_LEFT,
-				   LIBINPUT_BUTTON_STATE_RELEASED);
-
-	litest_assert_empty_queue(li);
-}
-END_TEST
-
 START_TEST(clickpad_btn_left)
 {
 	struct litest_device *dev = litest_current_device();
@@ -3228,63 +1649,6 @@ START_TEST(touchpad_edge_scroll_no_2fg)
 }
 END_TEST
 
-START_TEST(touchpad_tap_is_available)
-{
-	struct litest_device *dev = litest_current_device();
-
-	ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1);
-}
-END_TEST
-
-START_TEST(touchpad_tap_is_not_available)
-{
-	struct litest_device *dev = litest_current_device();
-
-	ck_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0);
-	ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
-			 LIBINPUT_CONFIG_TAP_DISABLED);
-	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
-								LIBINPUT_CONFIG_TAP_ENABLED),
-			 LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
-	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
-								LIBINPUT_CONFIG_TAP_DISABLED),
-			 LIBINPUT_CONFIG_STATUS_SUCCESS);
-}
-END_TEST
-
-START_TEST(touchpad_tap_default_disabled)
-{
-	struct litest_device *dev = litest_current_device();
-
-	/* this test is only run on specific devices */
-
-	ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
-			 LIBINPUT_CONFIG_TAP_DISABLED);
-}
-END_TEST
-
-START_TEST(touchpad_tap_default_enabled)
-{
-	struct litest_device *dev = litest_current_device();
-
-	/* this test is only run on specific devices */
-
-	ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
-			 LIBINPUT_CONFIG_TAP_ENABLED);
-}
-END_TEST
-
-START_TEST(touchpad_tap_invalid)
-{
-	struct litest_device *dev = litest_current_device();
-
-	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2),
-			 LIBINPUT_CONFIG_STATUS_INVALID);
-	ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1),
-			 LIBINPUT_CONFIG_STATUS_INVALID);
-}
-END_TEST
-
 static int
 touchpad_has_palm_detect_size(struct litest_device *dev)
 {
@@ -5116,62 +3480,11 @@ END_TEST
 void
 litest_setup_tests(void)
 {
-	struct range multitap_range = {3, 8};
 	struct range axis_range = {ABS_X, ABS_Y + 1};
 
 	litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY);
 	litest_add("touchpad:motion", touchpad_2fg_no_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
 
-	litest_add("touchpad:tap", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
-	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
-	litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
-	litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
-
-	litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
-	litest_add("touchpad:tap", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-	litest_add("touchpad:tap", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-
-	/* Real buttons don't interfere with tapping, so don't run those for
-	   pads with buttons */
-	litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
-	litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
-	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY);
-
-	litest_add("touchpad:tap", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON);
-	litest_add("touchpad:tap", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:tap", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD);
-
-	litest_add("touchpad:tap", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY);
-	litest_add("touchpad:tap", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
-
 	litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
 	litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
 	litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
-- 
2.4.3



More information about the wayland-devel mailing list