From 05eb41b8cc52b99e10cd0b6e7198b6d06e89eb63 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 May 2019 13:59:27 +1000 Subject: [PATCH] test: fix a bunch of tests expecting BTN_TOOL_TRIPLETAP A device may have 1 or 2 slots without setting BTN_TOOL_TRIPLETAP, those devices will fail those tests. Signed-off-by: Peter Hutterer (cherry picked from commit 803a99ac05821f3dc43f6daf54eb33b57fda8b0b) --- test/test-gestures.c | 1 + test/test-touchpad-tap.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/test-gestures.c b/test/test-gestures.c index e1b7b2d4..73cb6d70 100644 --- a/test/test-gestures.c +++ b/test/test-gestures.c @@ -173,6 +173,7 @@ START_TEST(gestures_swipe_3fg_btntool) }; if (libevdev_get_num_slots(dev->evdev) > 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) return; diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c index c1fc613e..5e410ddd 100644 --- a/test/test-touchpad-tap.c +++ b/test/test-touchpad-tap.c @@ -936,8 +936,8 @@ 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) + if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) > 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; litest_enable_tap(dev->libinput_device); @@ -1676,7 +1676,8 @@ 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 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; /* libinput doesn't export when it uses pressure detection, so we @@ -1736,8 +1737,9 @@ 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; + if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) + return; /* libinput doesn't export when it uses pressure detection, so we * need to reconstruct this here. Specifically, semi-mt devices are @@ -1789,8 +1791,8 @@ START_TEST(touchpad_3fg_tap_btntool) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) + if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) > 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; litest_enable_tap(dev->libinput_device); @@ -1839,8 +1841,8 @@ START_TEST(touchpad_3fg_tap_btntool_inverted) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) + if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) > 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; litest_enable_tap(dev->libinput_device); @@ -1889,8 +1891,8 @@ START_TEST(touchpad_3fg_tap_btntool_pointerjump) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) + if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) > 2 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; litest_enable_tap(dev->libinput_device);