2015-07-23 11:29:32 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2014 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 <errno.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <libinput.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
#include "libinput-util.h"
|
|
|
|
|
#include "litest.h"
|
|
|
|
|
|
2019-01-31 11:55:55 +10:00
|
|
|
START_TEST(touchpad_button)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_LEFT))
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2019-01-31 11:55:55 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_button_click(dev, BTN_LEFT, true);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2019-01-31 11:55:55 +10:00
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_button_click(dev, BTN_LEFT, false);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2019-01-31 11:55:55 +10:00
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(touchpad_click_defaults_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
uint32_t methods, method;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
|
|
|
|
/* call this test for apple touchpads */
|
|
|
|
|
|
|
|
|
|
methods = libinput_device_config_click_get_methods(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
|
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
method = libinput_device_config_click_get_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2015-07-23 11:29:32 +10:00
|
|
|
method = libinput_device_config_click_get_default_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2015-07-23 11:29:32 +10:00
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_NONE);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2024-04-09 18:46:42 -03:00
|
|
|
START_TEST(touchpad_click_default_clickfinger_map)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
enum libinput_config_clickfinger_button_map map;
|
|
|
|
|
|
|
|
|
|
map = libinput_device_config_click_get_clickfinger_button_map(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
|
2024-04-09 18:46:42 -03:00
|
|
|
map = libinput_device_config_click_get_default_clickfinger_button_map(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
|
2024-04-09 18:46:42 -03:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_click_set_clickfinger_map)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
enum libinput_config_clickfinger_button_map map;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
|
|
|
|
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
|
|
|
|
status = libinput_device_config_click_set_clickfinger_button_map(device, map);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2024-04-09 18:46:42 -03:00
|
|
|
map = libinput_device_config_click_get_clickfinger_button_map(
|
|
|
|
|
dev->libinput_device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
|
2024-04-09 18:46:42 -03:00
|
|
|
|
|
|
|
|
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
|
|
|
|
status = libinput_device_config_click_set_clickfinger_button_map(device, map);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2024-04-09 18:46:42 -03:00
|
|
|
map = libinput_device_config_click_get_clickfinger_button_map(
|
|
|
|
|
dev->libinput_device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR);
|
2024-04-09 18:46:42 -03:00
|
|
|
|
|
|
|
|
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM - 1;
|
|
|
|
|
status = libinput_device_config_click_set_clickfinger_button_map(device, map);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
2024-04-09 18:46:42 -03:00
|
|
|
|
|
|
|
|
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR + 1;
|
|
|
|
|
status = libinput_device_config_click_set_clickfinger_button_map(device, map);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
2024-04-09 18:46:42 -03:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(touchpad_click_defaults_btnarea)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
uint32_t methods, method;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
|
|
|
|
/* call this test for non-apple clickpads */
|
|
|
|
|
|
|
|
|
|
methods = libinput_device_config_click_get_methods(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
|
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
method = libinput_device_config_click_get_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2015-07-23 11:29:32 +10:00
|
|
|
method = libinput_device_config_click_get_default_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2015-07-23 11:29:32 +10:00
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_NONE);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_click_defaults_none)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
uint32_t methods, method;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
2017-01-10 09:22:16 +10:00
|
|
|
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE &&
|
|
|
|
|
libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2017-01-10 09:22:16 +10:00
|
|
|
|
2017-02-06 11:03:43 +10:00
|
|
|
/* call this test for non-clickpads and non-touchpads */
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
methods = libinput_device_config_click_get_methods(device);
|
2024-10-11 13:55:56 +10:00
|
|
|
litest_assert_int_eq(methods, 0U);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
method = libinput_device_config_click_get_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE);
|
2015-07-23 11:29:32 +10:00
|
|
|
method = libinput_device_config_click_get_default_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
2015-07-23 11:29:32 +10:00
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_1fg_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_1fg_clickfinger_no_touch)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2023-04-11 02:00:52 +00:00
|
|
|
if (dev->which == LITEST_SYNAPTICS_PHANTOMCLICKS) {
|
|
|
|
|
/* The XPS 15 9500 touchpad has the ModelTouchpadPhantomClicks
|
|
|
|
|
* quirk enabled and doesn't generate events without touches. */
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2023-04-11 02:00:52 +00:00
|
|
|
}
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2023-04-11 02:00:52 +00:00
|
|
|
START_TEST(touchpad_1fg_clickfinger_no_touch_phantomclicks)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_clickfinger(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2023-04-11 02:00:52 +00:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(touchpad_2fg_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int button = 0;
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
|
|
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
litest_abort_msg("Invalid map range %d", map);
|
|
|
|
|
}
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 70, 70);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_3fg_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int button = 0;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 3)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
|
|
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
litest_abort_msg("Invalid map range %d", map);
|
|
|
|
|
}
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 70);
|
|
|
|
|
litest_touch_down(dev, 2, 70, 70);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_3fg_clickfinger_btntool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int button = 0;
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) >= 3 ||
|
2015-07-23 11:29:32 +10:00
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP))
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
|
|
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
litest_abort_msg("Invalid map range %d", map);
|
|
|
|
|
}
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 70);
|
|
|
|
|
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);
|
|
|
|
|
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_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_4fg_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 4)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 70);
|
|
|
|
|
litest_touch_down(dev, 2, 70, 70);
|
|
|
|
|
litest_touch_down(dev, 3, 80, 70);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
litest_touch_up(dev, 3);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_4fg_clickfinger_btntool_2slots)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) >= 3 ||
|
2015-07-23 11:29:32 +10:00
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP))
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 70);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 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);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_4fg_clickfinger_btntool_3slots)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) != 3 ||
|
2015-07-23 11:29:32 +10:00
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP))
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 70);
|
|
|
|
|
litest_touch_down(dev, 2, 70, 70);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 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);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_2fg_clickfinger_distance)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
double w, h;
|
|
|
|
|
bool small_touchpad = false;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int expected_button = 0;
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
if (libinput_device_get_size(dev->libinput_device, &w, &h) == 0 && h < 50.0)
|
|
|
|
|
small_touchpad = true;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 10, 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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 5);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 95);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
/* if the touchpad is small enough, we expect all fingers to count
|
|
|
|
|
* for clickfinger */
|
|
|
|
|
if (small_touchpad)
|
2024-04-09 18:46:42 -03:00
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
expected_button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
expected_button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-07-23 11:29:32 +10:00
|
|
|
else
|
|
|
|
|
expected_button = BTN_LEFT;
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, expected_button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, expected_button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 16:06:48 +10:00
|
|
|
START_TEST(touchpad_3fg_clickfinger_distance)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int button = 0;
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 3)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 16:06:48 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
|
|
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
litest_abort_msg("Invalid map range %d", map);
|
|
|
|
|
}
|
2015-07-23 16:06:48 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2019-06-18 20:52:42 +10:00
|
|
|
litest_touch_down(dev, 0, 90, 20);
|
2015-07-23 16:06:48 +10:00
|
|
|
litest_touch_down(dev, 1, 10, 15);
|
|
|
|
|
litest_touch_down(dev, 2, 10, 15);
|
2019-06-18 20:48:22 +10:00
|
|
|
|
2015-07-23 16:06:48 +10:00
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_3fg_clickfinger_distance_btntool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2024-04-09 18:46:42 -03:00
|
|
|
unsigned int button = 0;
|
2025-02-13 22:10:02 +01:00
|
|
|
enum libinput_config_clickfinger_button_map map =
|
|
|
|
|
litest_test_param_get_i32(test_env->params, "map");
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) > 2)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 16:06:48 +10:00
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_set_clickfinger_map(dev, map);
|
|
|
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
litest_abort_msg("Invalid map range %d", map);
|
|
|
|
|
}
|
2015-07-23 16:06:48 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2019-06-18 20:52:42 +10:00
|
|
|
litest_touch_down(dev, 0, 90, 15);
|
2015-07-23 16:06:48 +10:00
|
|
|
litest_touch_down(dev, 1, 10, 15);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 16:06:48 +10:00
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 16:06:48 +10:00
|
|
|
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_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(touchpad_2fg_clickfinger_bottom)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
/* this test is run for the T440s touchpad only, makes getting the
|
|
|
|
|
* mm correct easier */
|
|
|
|
|
|
|
|
|
|
libinput_device_config_click_set_method(
|
|
|
|
|
dev->libinput_device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* one above, one below the magic line, vert spread ca 27mm */
|
|
|
|
|
litest_touch_down(dev, 0, 40, 60);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 100);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
/* both below the magic line */
|
|
|
|
|
litest_touch_down(dev, 0, 40, 100);
|
|
|
|
|
litest_touch_down(dev, 1, 60, 95);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
/* one above, one below the magic line, vert spread 17mm */
|
|
|
|
|
litest_touch_down(dev, 0, 50, 75);
|
|
|
|
|
litest_touch_down(dev, 1, 55, 100);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_to_area_method)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_buttonareas(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* use bottom right corner to catch accidental softbutton right */
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_to_area_method_while_down)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_buttonareas(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* use bottom right corner to catch accidental softbutton right */
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_area_to_clickfinger_method)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* use bottom right corner to catch accidental softbutton right */
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_buttonareas(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_area_to_clickfinger_method_while_down)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* use bottom right corner to catch accidental softbutton right */
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_buttonareas(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 95, 95);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-24 09:19:08 +10:00
|
|
|
START_TEST(touchpad_clickfinger_3fg_tool_position)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-24 09:19:08 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-07-23 16:06:48 +10:00
|
|
|
/* one in thumb area, one in normal area + TRIPLETAP. spread is wide
|
2017-12-19 14:54:53 +10:00
|
|
|
* but any non-palm 3fg touch+click counts as middle */
|
|
|
|
|
litest_touch_down(dev, 0, 20, 99);
|
2015-07-24 09:19:08 +10:00
|
|
|
litest_touch_down(dev, 1, 90, 15);
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-24 09:19:08 +10:00
|
|
|
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-24 09:19:08 +10:00
|
|
|
|
2019-06-21 13:19:22 +10:00
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
2015-07-24 09:19:08 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_4fg_tool_position)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-24 09:19:08 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 5, 99);
|
|
|
|
|
litest_touch_down(dev, 1, 90, 15);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-24 09:19:08 +10:00
|
|
|
|
|
|
|
|
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);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-24 09:19:08 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-01-10 09:22:16 +10:00
|
|
|
START_TEST(touchpad_clickfinger_appletouch_config)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
uint32_t methods, method;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
|
|
|
|
methods = libinput_device_config_click_get_methods(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS));
|
|
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2017-01-10 09:22:16 +10:00
|
|
|
|
|
|
|
|
method = libinput_device_config_click_get_method(device);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2017-01-10 09:22:16 +10:00
|
|
|
|
|
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
2017-01-10 09:22:16 +10:00
|
|
|
status = libinput_device_config_click_set_method(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_CLICK_METHOD_NONE);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2017-01-10 09:22:16 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_appletouch_1fg)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_clickfinger(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-01-10 09:22:16 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_appletouch_2fg)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_clickfinger(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-01-10 09:22:16 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(touchpad_clickfinger_appletouch_3fg)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_clickfinger(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 50);
|
|
|
|
|
litest_touch_down(dev, 2, 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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-01-10 09:22:16 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-08-14 08:29:07 -05:00
|
|
|
START_TEST(touchpad_clickfinger_click_drag)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2025-02-06 20:14:57 +01:00
|
|
|
int nfingers = litest_test_param_get_i32(test_env->params, "fingers");
|
2019-08-14 08:29:07 -05:00
|
|
|
unsigned int button;
|
2020-01-09 11:13:18 +10:00
|
|
|
int nslots = litest_slot_count(dev);
|
2019-08-14 08:29:07 -05:00
|
|
|
|
|
|
|
|
litest_enable_clickfinger(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 50);
|
|
|
|
|
button = BTN_LEFT;
|
|
|
|
|
|
|
|
|
|
if (nfingers > 1) {
|
|
|
|
|
if (nslots > 1) {
|
|
|
|
|
litest_touch_down(dev, 1, 50, 50);
|
|
|
|
|
} else {
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
|
|
|
|
|
}
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nfingers > 2) {
|
|
|
|
|
if (nslots > 2) {
|
|
|
|
|
litest_touch_down(dev, 2, 60, 50);
|
|
|
|
|
} else {
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
|
|
|
|
|
}
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_button_click(dev, BTN_LEFT, true);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2019-08-14 08:29:07 -05:00
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 3:
|
|
|
|
|
if (nslots >= nfingers)
|
|
|
|
|
litest_touch_move(dev, 2, 60, 50 + i);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2019-08-14 08:29:07 -05:00
|
|
|
case 2:
|
|
|
|
|
if (nslots >= nfingers)
|
|
|
|
|
litest_touch_move(dev, 1, 50, 50 + i);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2019-08-14 08:29:07 -05:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_move(dev, 0, 40, 50 + i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2019-08-14 08:29:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
|
|
|
|
|
litest_button_click(dev, BTN_LEFT, false);
|
|
|
|
|
litest_assert_button_event(li, button, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
if (nfingers > 3) {
|
|
|
|
|
if (nslots > 3) {
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
} else {
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nfingers > 2) {
|
|
|
|
|
if (nslots > 2) {
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
} else {
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2019-08-14 08:29:07 -05:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(touchpad_btn_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_btn_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_buttonareas(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* A clickpad always needs a finger down to tell where the
|
|
|
|
|
click happens */
|
|
|
|
|
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);
|
|
|
|
|
|
2024-09-18 14:57:51 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_click_n_drag)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
2024-09-18 14:57:51 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
/* now put a second finger down */
|
|
|
|
|
litest_touch_down(dev, 1, 70, 70);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 1, 70, 70, 80, 50, 5);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_finger_pin)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libevdev *evdev = dev->evdev;
|
|
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
double w, h;
|
|
|
|
|
double dist;
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_notnull(abs);
|
2015-07-23 11:29:32 +10:00
|
|
|
if (abs->resolution == 0)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0)
|
2024-10-12 10:31:42 +10:00
|
|
|
return LITEST_NOT_APPLICABLE;
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
dist = 100.0 / max(w, h);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* make sure the movement generates pointer events when
|
|
|
|
|
not pinned */
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
2021-05-31 17:58:39 +02:00
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 54, 54, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 54, 54, 46, 46, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 46, 46, 50, 50, 10);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
|
2017-11-20 10:49:08 +10:00
|
|
|
litest_button_click(dev, BTN_LEFT, true);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2017-11-20 10:49:08 +10:00
|
|
|
litest_button_click(dev, BTN_LEFT, false);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
|
|
|
|
|
|
|
|
|
|
/* still pinned after release */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10);
|
|
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* move to unpin */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_softbutton_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 10, 90);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-04-04 10:06:36 +10:00
|
|
|
START_TEST(clickpad_softbutton_middle)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 90);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, 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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-04-04 10:06:36 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(clickpad_softbutton_right)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 90);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, 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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_softbutton_left_tap_n_drag)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* Tap in left button area, then finger down, button click
|
|
|
|
|
-> expect left button press/release and left button press
|
|
|
|
|
Release button, finger up
|
|
|
|
|
-> expect right button release
|
|
|
|
|
*/
|
|
|
|
|
litest_touch_down(dev, 0, 20, 90);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_down(dev, 0, 20, 90);
|
|
|
|
|
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_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_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
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(clickpad_softbutton_right_tap_n_drag)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* Tap in right button area, then finger down, button click
|
|
|
|
|
-> expect left button press/release and right button press
|
|
|
|
|
Release button, finger up
|
|
|
|
|
-> expect right button release
|
|
|
|
|
*/
|
|
|
|
|
litest_touch_down(dev, 0, 90, 90);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_down(dev, 0, 90, 90);
|
|
|
|
|
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_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_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_softbutton_left_1st_fg_move)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
double x = 0, y = 0;
|
|
|
|
|
int nevents = 0;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* One finger down in the left button area, button press
|
|
|
|
|
-> expect a button event
|
|
|
|
|
Move finger up out of the area, wait for timeout
|
|
|
|
|
Move finger around diagonally down left
|
|
|
|
|
-> expect motion events down left
|
|
|
|
|
Release finger
|
|
|
|
|
-> expect a button event */
|
|
|
|
|
|
|
|
|
|
/* finger down, press in left button */
|
|
|
|
|
litest_touch_down(dev, 0, 20, 90);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* move out of the area, then wait for softbutton timer */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 20, 90, 50, 50, 20);
|
2025-04-01 09:23:10 +10:00
|
|
|
litest_timeout_softbuttons(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* move down left, expect motion */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 20, 90, 20);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_notnull(event);
|
2015-07-23 11:29:32 +10:00
|
|
|
while (event) {
|
|
|
|
|
struct libinput_event_pointer *p;
|
|
|
|
|
|
2024-09-18 14:44:38 +10:00
|
|
|
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION);
|
2015-07-23 11:29:32 +10:00
|
|
|
p = libinput_event_get_pointer_event(event);
|
|
|
|
|
|
|
|
|
|
/* we moved up/right, now down/left so the pointer accel
|
|
|
|
|
code may lag behind with the dx/dy vectors. Hence, add up
|
|
|
|
|
the x/y movements and expect that on average we moved
|
|
|
|
|
left and down */
|
|
|
|
|
x += libinput_event_pointer_get_dx(p);
|
|
|
|
|
y += libinput_event_pointer_get_dy(p);
|
|
|
|
|
nevents++;
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(x / nevents < 0);
|
|
|
|
|
litest_assert(y / nevents > 0);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
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(clickpad_softbutton_left_2nd_fg_move)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* One finger down in the left button area, button press
|
|
|
|
|
-> expect a button event
|
|
|
|
|
Put a second finger down in the area, move it right, release
|
|
|
|
|
-> expect motion events right
|
|
|
|
|
Put a second finger down in the area, move it down, release
|
|
|
|
|
-> expect motion events down
|
|
|
|
|
Release second finger, release first finger
|
|
|
|
|
-> expect a button event */
|
|
|
|
|
litest_touch_down(dev, 0, 20, 90);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 1, 20, 20);
|
2024-03-15 15:06:09 +10:00
|
|
|
litest_touch_move_to(dev, 1, 20, 20, 80, 20, 25);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_notnull(event);
|
2015-07-23 11:29:32 +10:00
|
|
|
while (event) {
|
|
|
|
|
struct libinput_event_pointer *p;
|
|
|
|
|
double x, y;
|
|
|
|
|
|
2024-09-18 14:44:38 +10:00
|
|
|
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION);
|
2015-07-23 11:29:32 +10:00
|
|
|
p = libinput_event_get_pointer_event(event);
|
|
|
|
|
|
|
|
|
|
x = libinput_event_pointer_get_dx(p);
|
|
|
|
|
y = libinput_event_pointer_get_dy(p);
|
|
|
|
|
|
|
|
|
|
/* Ignore events only containing an unaccelerated motion
|
|
|
|
|
* vector. */
|
|
|
|
|
if (x != 0 || y != 0) {
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(x > 0);
|
|
|
|
|
litest_assert(y == 0);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
}
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
/* second finger down */
|
|
|
|
|
litest_touch_down(dev, 1, 20, 20);
|
2023-04-11 02:00:52 +00:00
|
|
|
litest_touch_move_to(dev, 1, 20, 20, 20, 80, 15);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_notnull(event);
|
2015-07-23 11:29:32 +10:00
|
|
|
while (event) {
|
|
|
|
|
struct libinput_event_pointer *p;
|
|
|
|
|
double x, y;
|
|
|
|
|
|
2024-09-18 14:44:38 +10:00
|
|
|
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION);
|
2015-07-23 11:29:32 +10:00
|
|
|
p = libinput_event_get_pointer_event(event);
|
|
|
|
|
|
|
|
|
|
x = libinput_event_pointer_get_dx(p);
|
|
|
|
|
y = libinput_event_pointer_get_dy(p);
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(x == 0);
|
|
|
|
|
litest_assert(y > 0);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
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(clickpad_softbutton_left_to_right)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* One finger down in left software button area,
|
|
|
|
|
move to right button area immediately, click
|
|
|
|
|
-> expect right button event
|
|
|
|
|
*/
|
|
|
|
|
|
2018-08-28 10:06:41 +10:00
|
|
|
litest_touch_down(dev, 0, 30, 90);
|
2024-03-15 15:06:09 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 90, 90, 90, 25);
|
2018-08-07 14:49:27 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_softbutton_right_to_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* One finger down in right software button area,
|
|
|
|
|
move to left button area immediately, click
|
|
|
|
|
-> expect left button event
|
|
|
|
|
*/
|
|
|
|
|
|
2018-08-28 10:06:41 +10:00
|
|
|
litest_touch_down(dev, 0, 80, 90);
|
2024-03-15 15:06:09 +10:00
|
|
|
litest_touch_move_to(dev, 0, 80, 90, 30, 90, 25);
|
2018-08-07 14:49:27 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
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_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-03-01 11:26:06 +10:00
|
|
|
START_TEST(clickpad_softbutton_hover_into_buttons)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_hover_start(dev, 0, 50, 50);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2024-03-15 15:06:09 +10:00
|
|
|
litest_hover_move_to(dev, 0, 50, 50, 90, 90, 20);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-03-01 11:26:06 +10:00
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 90, 90, 91, 91, 1);
|
2017-03-01 11:26:06 +10:00
|
|
|
|
2017-11-20 10:49:08 +10:00
|
|
|
litest_button_click(dev, BTN_LEFT, true);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-03-01 11:26:06 +10:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2017-11-20 10:49:08 +10:00
|
|
|
litest_button_click(dev, BTN_LEFT, false);
|
2017-03-01 11:26:06 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-23 11:29:32 +10:00
|
|
|
START_TEST(clickpad_topsoftbuttons_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 10, 5);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
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(clickpad_topsoftbuttons_right)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 5);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_topsoftbuttons_middle)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 5);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-06-27 11:30:51 +10:00
|
|
|
START_TEST(clickpad_topsoftbuttons_move_out_leftclick_before_timeout)
|
2015-07-23 11:29:32 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2017-06-27 11:30:51 +10:00
|
|
|
/* Finger down in top right button area, wait past enter timeout
|
2015-07-23 11:29:32 +10:00
|
|
|
Move into main area, wait past leave timeout
|
|
|
|
|
Click
|
2017-06-27 11:30:51 +10:00
|
|
|
-> expect left click
|
2015-07-23 11:29:32 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2017-06-27 11:30:51 +10:00
|
|
|
litest_touch_down(dev, 0, 80, 5);
|
2025-04-01 09:23:10 +10:00
|
|
|
litest_timeout_softbuttons(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2017-06-27 11:30:51 +10:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_topsoftbuttons_move_out_leftclick)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
/* Finger down in top right button area, wait past enter timeout
|
|
|
|
|
Move into main area, wait past leave timeout
|
|
|
|
|
Click
|
|
|
|
|
-> expect left click
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 80, 5);
|
2025-04-01 09:23:10 +10:00
|
|
|
litest_timeout_softbuttons(li);
|
2017-06-27 11:30:51 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20);
|
2025-04-01 09:23:10 +10:00
|
|
|
litest_timeout_softbuttons(li);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2017-06-27 11:30:51 +10:00
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_topsoftbuttons_clickfinger)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 5);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 5);
|
|
|
|
|
litest_touch_down(dev, 1, 80, 5);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_topsoftbuttons_clickfinger_dev_disabled)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct litest_device *trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
|
|
|
|
|
|
|
|
|
|
libinput_device_config_send_events_set_mode(
|
|
|
|
|
dev->libinput_device,
|
|
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
2015-07-30 14:48:12 +10:00
|
|
|
litest_enable_clickfinger(dev);
|
2015-07-23 11:29:32 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 5);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 90, 5);
|
|
|
|
|
litest_touch_down(dev, 1, 10, 5);
|
|
|
|
|
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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2025-04-07 15:12:51 +10:00
|
|
|
litest_device_destroy(trackpoint);
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-06-30 15:49:40 +10:00
|
|
|
START_TEST(clickpad_middleemulation_config_delayed)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
int enabled;
|
|
|
|
|
|
|
|
|
|
enabled = libinput_device_config_middle_emulation_get_enabled(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!enabled);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
/* actual config is delayed, but status is immediate */
|
|
|
|
|
status = libinput_device_config_middle_emulation_set_enabled(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
enabled = libinput_device_config_middle_emulation_get_enabled(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(enabled);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
status = libinput_device_config_middle_emulation_set_enabled(
|
|
|
|
|
device,
|
|
|
|
|
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2016-06-30 15:49:40 +10:00
|
|
|
enabled = libinput_device_config_middle_emulation_get_enabled(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!enabled);
|
2016-06-30 15:49:40 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_middleemulation_click)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_middleemu(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 95);
|
|
|
|
|
litest_touch_down(dev, 1, 80, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, 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);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_middleemulation_click_middle_left)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_middleemu(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 49, 95);
|
|
|
|
|
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_PRESSED);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_middleemulation_click_middle_right)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_middleemu(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 51, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, 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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_middleemulation_click_enable_while_down)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 49, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
|
|
|
|
litest_enable_middleemu(dev);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 49, 95);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(clickpad_middleemulation_click_disable_while_down)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_middleemu(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 95);
|
|
|
|
|
litest_touch_down(dev, 1, 70, 95);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
|
|
|
|
litest_disable_middleemu(dev);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 49, 95);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-06-30 15:49:40 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-04-14 15:18:13 +10:00
|
|
|
START_TEST(touchpad_non_clickpad_detection)
|
|
|
|
|
{
|
|
|
|
|
struct libinput_device *device;
|
|
|
|
|
struct libevdev_uinput *uinput;
|
|
|
|
|
static struct input_absinfo absinfo[] = {
|
|
|
|
|
{ ABS_X, 1472, 5472, 0, 0, 75 },
|
|
|
|
|
{ ABS_Y, 1408, 4448, 0, 0, 129 },
|
|
|
|
|
{ ABS_PRESSURE, 0, 255, 0, 0, 0 },
|
|
|
|
|
{ ABS_TOOL_WIDTH, 0, 15, 0, 0, 0 },
|
|
|
|
|
{ ABS_MT_SLOT, 0, 1, 0, 0, 0 },
|
|
|
|
|
{ ABS_MT_POSITION_X, 1472, 5472, 0, 0, 75 },
|
|
|
|
|
{ ABS_MT_POSITION_Y, 1408, 4448, 0, 0, 129 },
|
|
|
|
|
{ ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
|
|
|
|
|
{ ABS_MT_PRESSURE, 0, 255, 0, 0, 0 },
|
|
|
|
|
{ .value = -1 }
|
|
|
|
|
};
|
|
|
|
|
uint32_t methods;
|
|
|
|
|
|
|
|
|
|
/* Create a touchpad with only a left button but missing
|
|
|
|
|
* INPUT_PROP_BUTTONPAD. We should treat this as clickpad.
|
|
|
|
|
*/
|
2025-07-01 09:23:01 +10:00
|
|
|
/* clang-format off */
|
2021-04-14 15:18:13 +10:00
|
|
|
uinput = litest_create_uinput_abs_device("litest NonClickpad",
|
|
|
|
|
NULL,
|
|
|
|
|
absinfo,
|
|
|
|
|
EV_KEY, BTN_LEFT,
|
|
|
|
|
EV_KEY, BTN_TOOL_FINGER,
|
|
|
|
|
EV_KEY, BTN_TOUCH,
|
|
|
|
|
-1);
|
2025-07-01 09:23:01 +10:00
|
|
|
/* clang-format on */
|
2021-04-14 15:18:13 +10:00
|
|
|
|
2025-04-07 13:15:28 +10:00
|
|
|
_litest_context_destroy_ struct libinput *li = litest_create_context();
|
2021-04-14 15:18:13 +10:00
|
|
|
device = libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput));
|
|
|
|
|
|
|
|
|
|
methods = libinput_device_config_click_get_methods(device);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
|
|
|
|
litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
2021-04-14 15:18:13 +10:00
|
|
|
|
|
|
|
|
libinput_path_remove_device(device);
|
|
|
|
|
libevdev_uinput_destroy(uinput);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-03-21 12:54:10 +10:00
|
|
|
TEST_COLLECTION(touchpad_buttons)
|
2015-07-23 11:29:32 +10:00
|
|
|
{
|
2025-07-01 11:30:59 +10:00
|
|
|
/* clang-format off */
|
2021-02-05 14:51:02 +10:00
|
|
|
litest_add(touchpad_button, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
|
|
|
|
|
|
|
|
|
litest_add(touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
|
2025-01-08 11:59:14 +10:00
|
|
|
|
2025-02-13 22:10:02 +01:00
|
|
|
litest_with_parameters(params, "map", 'I', 2, litest_named_i32(LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM, "LRM"),
|
|
|
|
|
litest_named_i32(LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR, "LMR")) {
|
2025-01-08 11:59:14 +10:00
|
|
|
litest_add_parametrized(touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
litest_add_parametrized(touchpad_3fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
litest_add_parametrized(touchpad_3fg_clickfinger_btntool, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
litest_add_parametrized(touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
litest_add_parametrized(touchpad_3fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
litest_add_parametrized(touchpad_3fg_clickfinger_distance_btntool, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_add_for_device(touchpad_2fg_clickfinger_bottom, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
2021-02-05 14:51:02 +10:00
|
|
|
litest_add(touchpad_4fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_4fg_clickfinger_btntool_2slots, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_4fg_clickfinger_btntool_3slots, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_clickfinger_to_area_method, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_clickfinger_to_area_method_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_area_to_clickfinger_method, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_area_to_clickfinger_method_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
2015-07-24 09:19:08 +10:00
|
|
|
/* run those two for the T440 one only so we don't have to worry
|
|
|
|
|
* about small touchpads messing with thumb detection expectations */
|
2021-02-05 14:51:02 +10:00
|
|
|
litest_add_for_device(touchpad_clickfinger_3fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
|
|
|
|
litest_add_for_device(touchpad_clickfinger_4fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
|
|
|
|
|
|
|
|
|
litest_add_for_device(touchpad_clickfinger_appletouch_config, LITEST_APPLETOUCH);
|
|
|
|
|
litest_add_for_device(touchpad_clickfinger_appletouch_1fg, LITEST_APPLETOUCH);
|
|
|
|
|
litest_add_for_device(touchpad_clickfinger_appletouch_2fg, LITEST_APPLETOUCH);
|
|
|
|
|
litest_add_for_device(touchpad_clickfinger_appletouch_3fg, LITEST_APPLETOUCH);
|
|
|
|
|
|
2023-04-11 02:00:52 +00:00
|
|
|
litest_add_for_device(touchpad_1fg_clickfinger_no_touch_phantomclicks, LITEST_SYNAPTICS_PHANTOMCLICKS);
|
|
|
|
|
|
2025-02-06 20:14:57 +01:00
|
|
|
litest_with_parameters(params, "fingers", 'i', 3, 1, 2, 3) {
|
|
|
|
|
litest_add_parametrized(touchpad_clickfinger_click_drag, LITEST_CLICKPAD, LITEST_ANY, params);
|
|
|
|
|
}
|
2021-02-05 14:51:02 +10:00
|
|
|
|
|
|
|
|
litest_add(touchpad_click_defaults_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY);
|
2024-04-09 18:46:42 -03:00
|
|
|
litest_add(touchpad_click_default_clickfinger_map, LITEST_APPLE_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(touchpad_click_set_clickfinger_map, LITEST_APPLE_CLICKPAD, LITEST_ANY);
|
2021-02-05 14:51:02 +10:00
|
|
|
litest_add(touchpad_click_defaults_btnarea, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(touchpad_click_defaults_none, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
|
|
|
|
litest_add(touchpad_click_defaults_none, LITEST_ANY, LITEST_TOUCHPAD);
|
|
|
|
|
|
|
|
|
|
litest_add(touchpad_btn_left, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_btn_left, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_click_n_drag, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add(clickpad_finger_pin, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
|
|
|
|
|
litest_add(clickpad_softbutton_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_middle, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_left_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_right_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_left_1st_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_left_2nd_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_left_to_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_right_to_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
litest_add(clickpad_softbutton_hover_into_buttons, LITEST_CLICKPAD|LITEST_HOVER, LITEST_APPLE_CLICKPAD);
|
|
|
|
|
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_left, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_right, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_middle, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_move_out_leftclick, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_move_out_leftclick_before_timeout, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_clickfinger, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_topsoftbuttons_clickfinger_dev_disabled, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
|
|
|
|
|
|
|
|
|
litest_add(clickpad_middleemulation_config_delayed, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_middleemulation_click, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_middleemulation_click_middle_left, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_middleemulation_click_middle_right, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_middleemulation_click_enable_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
|
|
|
|
litest_add(clickpad_middleemulation_click_disable_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
2021-04-14 15:18:13 +10:00
|
|
|
|
|
|
|
|
litest_add_no_device(touchpad_non_clickpad_detection);
|
2025-07-01 11:30:59 +10:00
|
|
|
/* clang-format on */
|
2015-07-23 11:29:32 +10:00
|
|
|
}
|