summaryrefslogtreecommitdiff
path: root/test/test-touchpad-tap.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-02-28 14:24:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-03-01 12:21:21 +1000
commit990da54aa69b6e4aeba77573427615163105cb41 (patch)
tree3e81c1a1000c42d668924a6111c92a6b43873a99 /test/test-touchpad-tap.c
parentd25aa301b1545fe345c920cb3bdb6e31ec3b65f7 (diff)
downloadlibinput-990da54aa69b6e4aeba77573427615163105cb41.tar.gz
test: don't run the MT pressure test on devices without MT pressure
This test worked because on devices that don't use pressure the touches were reset when BTN_TOUCH when to 0, triggering the 'ignore fake fingers when no real fingers are down' behavior. But this is a different code path than the pressure handling, so let's separate those tests. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/test-touchpad-tap.c')
-rw-r--r--test/test-touchpad-tap.c63
1 files changed, 60 insertions, 3 deletions
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index a57677c2..948be965 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1591,13 +1591,19 @@ START_TEST(touchpad_3fg_tap_quickrelease)
}
END_TEST
-START_TEST(touchpad_3fg_tap_hover_btntool)
+START_TEST(touchpad_3fg_tap_pressure_btntool)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
- if (libevdev_get_abs_maximum(dev->evdev,
- ABS_MT_SLOT) >= 2)
+ if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2)
+ return;
+
+ /* libinput doesn't export when it uses pressure detection, so we
+ * need to reconstruct this here. Specifically, semi-mt devices are
+ * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it.
+ */
+ if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE))
return;
litest_enable_tap(dev->libinput_device);
@@ -1617,6 +1623,56 @@ START_TEST(touchpad_3fg_tap_hover_btntool)
* third touch */
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 3);
litest_event(dev, EV_ABS, ABS_PRESSURE, 3);
+ litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+ litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
+ litest_event(dev, EV_SYN, SYN_REPORT, 0);
+ libinput_dispatch(li);
+
+ litest_push_event_frame(dev);
+ litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+ litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+ litest_pop_event_frame(dev);
+ litest_assert_empty_queue(li);
+
+ litest_touch_up(dev, 0);
+ litest_touch_up(dev, 1);
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap_hover_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 doesn't export when it uses pressure detection, so we
+ * need to reconstruct this here. Specifically, semi-mt devices are
+ * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it.
+ */
+ if (libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE))
+ return;
+
+ if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT) &&
+ libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
+ return;
+
+ litest_enable_tap(dev->libinput_device);
+ litest_enable_edge_scroll(dev);
+
+ litest_drain_events(li);
+
+ litest_touch_down(dev, 0, 50, 50);
+ litest_touch_down(dev, 1, 70, 50);
+ libinput_dispatch(li);
+
+ litest_touch_move_to(dev, 0, 50, 50, 50, 70, 10, 0);
+ litest_touch_move_to(dev, 1, 70, 50, 50, 70, 10, 0);
+ litest_drain_events(li);
+
+ /* drop below the pressure threshold in the same frame as starting a
+ * third touch */
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
@@ -3317,6 +3373,7 @@ litest_setup_tests_touchpad_tap(void)
litest_add("tap-3fg:3fg", touchpad_3fg_tap_tap_again, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("tap-3fg:3fg", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("tap-3fg:3fg", touchpad_3fg_tap_hover_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+ litest_add("tap-3fg:3fg", touchpad_3fg_tap_pressure_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add_for_device("tap-3fg:3fg", touchpad_3fg_tap_btntool_pointerjump, LITEST_SYNAPTICS_TOPBUTTONPAD);
litest_add("tap-4fg:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
litest_add("tap-4fg:4fg", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);