[PATCH libinput 4/7] touchpad: Add a test for 2fg tap-n-drag release on a 3th finger down

Hans de Goede hdegoede at redhat.com
Sun Sep 28 04:22:20 PDT 2014


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 test/touchpad.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/test/touchpad.c b/test/touchpad.c
index fba1d58..f9031dd 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -239,6 +239,54 @@ START_TEST(touchpad_2fg_tap_n_drag)
 }
 END_TEST
 
+START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool)
+{
+	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);
+	litest_touch_down(dev, 0, 50, 50);
+	litest_touch_down(dev, 1, 60, 50);
+	litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40);
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li, BTN_LEFT,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+
+	while (libinput_next_event_type(li) == LIBINPUT_EVENT_POINTER_MOTION) {
+		event = libinput_get_event(li);
+		libinput_event_destroy(event);
+		libinput_dispatch(li);
+	}
+	litest_assert_empty_queue(li);
+
+	/* 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)
 {
 	struct litest_device *dev = litest_current_device();
@@ -1974,6 +2022,7 @@ int main(int argc, char **argv) {
 	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag, 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, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
 	litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
 	litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD, LITEST_CLICKPAD);
-- 
2.1.0



More information about the wayland-devel mailing list