[PATCH libinput 2/7] test: split 3-finger tap-and-drag test
Peter Hutterer
peter.hutterer at who-t.net
Tue Mar 3 20:18:32 PST 2015
Split out into a btntool test and a true three-finger test. For consistency,
check the number of slots on all those tests rather than having
litest-device-specific exclusions.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/touchpad.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 63 insertions(+), 4 deletions(-)
diff --git a/test/touchpad.c b/test/touchpad.c
index d1f1257..627d64a 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -231,6 +231,10 @@ 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);
@@ -268,6 +272,49 @@ START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool)
}
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();
@@ -618,6 +665,10 @@ START_TEST(touchpad_3fg_tap)
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);
@@ -653,6 +704,10 @@ START_TEST(touchpad_3fg_tap_btntool)
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);
@@ -688,6 +743,10 @@ START_TEST(touchpad_3fg_tap_btntool_inverted)
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);
@@ -3260,6 +3319,7 @@ int main(int argc, char **argv) {
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_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD, LITEST_CLICKPAD);
@@ -3270,10 +3330,9 @@ int main(int argc, char **argv) {
litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, 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_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
- /* apple is the only one with real 3-finger support */
- litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
- litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
- litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_APPLE_CLICKPAD, LITEST_ANY);
+ 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);
/* Real buttons don't interfere with tapping, so don't run those for
pads with buttons */
--
2.1.0
More information about the wayland-devel
mailing list