mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 22:50:05 +01:00
test: move the helper functions to the litest.h file
To avoid duplication Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
a12a39fb82
commit
2dd1b3ead0
4 changed files with 176 additions and 200 deletions
|
|
@ -472,6 +472,99 @@ litest_disable_tap(struct libinput_device *device)
|
|||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
litest_has_2fg_scroll(struct litest_device *dev)
|
||||
{
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
return !!(libinput_device_config_scroll_get_methods(device) &
|
||||
LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_enable_2fg_scroll(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_scroll_set_method(device,
|
||||
LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_enable_edge_scroll(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_scroll_set_method(device,
|
||||
LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_enable_clickfinger(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_enable_buttonareas(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline int
|
||||
litest_is_synaptics_semi_mt(struct litest_device *dev)
|
||||
{
|
||||
struct libevdev *evdev = dev->evdev;
|
||||
|
||||
return libevdev_has_property(evdev, INPUT_PROP_SEMI_MT) &&
|
||||
libevdev_get_id_vendor(evdev) == 0x2 &&
|
||||
libevdev_get_id_product(evdev) == 0x7;
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_enable_drag_lock(struct libinput_device *device)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
status = libinput_device_config_tap_set_drag_lock_enabled(device,
|
||||
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
|
||||
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_disable_drag_lock(struct libinput_device *device)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
status = libinput_device_config_tap_set_drag_lock_enabled(device,
|
||||
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
|
||||
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
#define CK_DOUBLE_EQ_EPSILON 1E-3
|
||||
#define ck_assert_double_eq(X,Y) \
|
||||
do { \
|
||||
|
|
|
|||
|
|
@ -32,30 +32,6 @@
|
|||
#include "libinput-util.h"
|
||||
#include "litest.h"
|
||||
|
||||
static void
|
||||
enable_clickfinger(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_buttonareas(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
START_TEST(touchpad_click_defaults_clickfinger)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -141,7 +117,7 @@ START_TEST(touchpad_1fg_clickfinger)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -166,7 +142,7 @@ START_TEST(touchpad_1fg_clickfinger_no_touch)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -189,7 +165,7 @@ START_TEST(touchpad_2fg_clickfinger)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -219,7 +195,7 @@ START_TEST(touchpad_3fg_clickfinger)
|
|||
if (libevdev_get_num_slots(dev->evdev) < 3)
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -254,7 +230,7 @@ START_TEST(touchpad_3fg_clickfinger_btntool)
|
|||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP))
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -293,7 +269,7 @@ START_TEST(touchpad_4fg_clickfinger)
|
|||
if (libevdev_get_num_slots(dev->evdev) < 4)
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -338,7 +314,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_2slots)
|
|||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP))
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -384,7 +360,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_3slots)
|
|||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP))
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -435,7 +411,7 @@ START_TEST(touchpad_2fg_clickfinger_distance)
|
|||
h < 50.0)
|
||||
small_touchpad = true;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -490,7 +466,7 @@ START_TEST(touchpad_3fg_clickfinger_distance)
|
|||
if (libevdev_get_num_slots(dev->evdev) < 3)
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -524,7 +500,7 @@ START_TEST(touchpad_3fg_clickfinger_distance_btntool)
|
|||
if (libevdev_get_num_slots(dev->evdev) > 2)
|
||||
return;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -628,7 +604,7 @@ START_TEST(touchpad_clickfinger_to_area_method)
|
|||
|
||||
litest_drain_events(li);
|
||||
|
||||
enable_buttonareas(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 95);
|
||||
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||
|
|
@ -643,7 +619,7 @@ START_TEST(touchpad_clickfinger_to_area_method)
|
|||
litest_assert_button_event(li, BTN_RIGHT,
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -671,7 +647,7 @@ START_TEST(touchpad_clickfinger_to_area_method_while_down)
|
|||
|
||||
litest_drain_events(li);
|
||||
|
||||
enable_buttonareas(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 95);
|
||||
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||
|
|
@ -680,7 +656,7 @@ START_TEST(touchpad_clickfinger_to_area_method_while_down)
|
|||
litest_assert_button_event(li, BTN_RIGHT,
|
||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
|
|
@ -714,7 +690,7 @@ START_TEST(touchpad_area_to_clickfinger_method)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -732,7 +708,7 @@ START_TEST(touchpad_area_to_clickfinger_method)
|
|||
litest_assert_button_event(li, BTN_LEFT,
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
|
||||
enable_buttonareas(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 95);
|
||||
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||
|
|
@ -755,7 +731,7 @@ START_TEST(touchpad_area_to_clickfinger_method_while_down)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -766,7 +742,7 @@ START_TEST(touchpad_area_to_clickfinger_method_while_down)
|
|||
litest_assert_button_event(li, BTN_LEFT,
|
||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||
|
||||
enable_buttonareas(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
|
|
@ -797,7 +773,7 @@ START_TEST(touchpad_clickfinger_3fg_tool_position)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* one in thumb area, one in normal area + TRIPLETAP. spread is wide
|
||||
|
|
@ -827,7 +803,7 @@ START_TEST(touchpad_clickfinger_4fg_tool_position)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 99);
|
||||
|
|
@ -878,7 +854,7 @@ START_TEST(clickpad_btn_left)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_buttonareas(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -1487,7 +1463,7 @@ START_TEST(clickpad_topsoftbuttons_clickfinger)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -1534,7 +1510,7 @@ START_TEST(clickpad_topsoftbuttons_clickfinger_dev_disabled)
|
|||
|
||||
libinput_device_config_send_events_set_mode(dev->libinput_device,
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 90, 5);
|
||||
|
|
|
|||
|
|
@ -32,30 +32,6 @@
|
|||
#include "libinput-util.h"
|
||||
#include "litest.h"
|
||||
|
||||
static inline void
|
||||
enable_drag_lock(struct libinput_device *device)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
status = libinput_device_config_tap_set_drag_lock_enabled(device,
|
||||
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
|
||||
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline void
|
||||
disable_drag_lock(struct libinput_device *device)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
status = libinput_device_config_tap_set_drag_lock_enabled(device,
|
||||
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
|
||||
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
START_TEST(touchpad_1fg_tap)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -467,7 +443,7 @@ START_TEST(touchpad_1fg_multitap_n_drag_tap)
|
|||
ntaps;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -540,7 +516,7 @@ START_TEST(touchpad_1fg_multitap_n_drag_tap_click)
|
|||
ntaps;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -621,7 +597,7 @@ START_TEST(touchpad_1fg_tap_n_drag)
|
|||
struct libinput_event_pointer *ptrev __attribute__((unused));
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
disable_drag_lock(dev->libinput_device);
|
||||
litest_disable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -663,7 +639,7 @@ START_TEST(touchpad_1fg_tap_n_drag_draglock)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -704,7 +680,7 @@ START_TEST(touchpad_1fg_tap_n_drag_draglock_tap)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -746,7 +722,7 @@ START_TEST(touchpad_1fg_tap_n_drag_draglock_tap_click)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -791,7 +767,7 @@ START_TEST(touchpad_1fg_tap_n_drag_draglock_timeout)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_drag_lock(dev->libinput_device);
|
||||
litest_enable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -822,7 +798,7 @@ START_TEST(touchpad_2fg_tap_n_drag)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
disable_drag_lock(dev->libinput_device);
|
||||
litest_disable_drag_lock(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
|
|||
171
test/touchpad.c
171
test/touchpad.c
|
|
@ -32,75 +32,6 @@
|
|||
#include "libinput-util.h"
|
||||
#include "litest.h"
|
||||
|
||||
static bool
|
||||
has_2fg_scroll(struct litest_device *dev)
|
||||
{
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
return !!(libinput_device_config_scroll_get_methods(device) &
|
||||
LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_2fg_scroll(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_scroll_set_method(device,
|
||||
LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_edge_scroll(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_scroll_set_method(device,
|
||||
LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_clickfinger(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_buttonareas(struct litest_device *dev)
|
||||
{
|
||||
enum libinput_config_status status, expected;
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
status = libinput_device_config_click_set_method(device,
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
litest_assert_int_eq(status, expected);
|
||||
}
|
||||
|
||||
static inline int
|
||||
is_synaptics_semi_mt(struct litest_device *dev)
|
||||
{
|
||||
struct libevdev *evdev = dev->evdev;
|
||||
|
||||
return libevdev_has_property(evdev, INPUT_PROP_SEMI_MT) &&
|
||||
libevdev_get_id_vendor(evdev) == 0x2 &&
|
||||
libevdev_get_id_product(evdev) == 0x7;
|
||||
}
|
||||
|
||||
START_TEST(touchpad_1fg_motion)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -192,10 +123,10 @@ START_TEST(touchpad_2fg_scroll)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
test_2fg_scroll(dev, 0.1, 40, 0);
|
||||
|
|
@ -222,7 +153,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
|
|||
const struct input_absinfo *y;
|
||||
double y_move;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
/* We want to move > 5 mm. */
|
||||
|
|
@ -234,7 +165,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
|
|||
y_move = 20.0;
|
||||
}
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 49, 50);
|
||||
|
|
@ -279,10 +210,10 @@ START_TEST(touchpad_2fg_scroll_source)
|
|||
struct libinput_event *event;
|
||||
struct libinput_event_pointer *ptrev;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
test_2fg_scroll(dev, 0, 30, 0);
|
||||
|
|
@ -304,10 +235,10 @@ START_TEST(touchpad_2fg_scroll_semi_mt)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 20, 20);
|
||||
|
|
@ -328,10 +259,10 @@ START_TEST(touchpad_2fg_scroll_return_to_motion)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* start with motion */
|
||||
|
|
@ -399,10 +330,10 @@ START_TEST(touchpad_scroll_natural_2fg)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!has_2fg_scroll(dev))
|
||||
if (!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
|
||||
|
|
@ -425,7 +356,7 @@ START_TEST(touchpad_edge_scroll)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 99, 20);
|
||||
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0);
|
||||
|
|
@ -472,13 +403,13 @@ START_TEST(touchpad_scroll_defaults)
|
|||
method = libinput_device_config_scroll_get_methods(device);
|
||||
ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||
if (libevdev_get_num_slots(evdev) > 1 &&
|
||||
!is_synaptics_semi_mt(dev))
|
||||
!litest_is_synaptics_semi_mt(dev))
|
||||
ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
else
|
||||
ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0);
|
||||
|
||||
if (libevdev_get_num_slots(evdev) > 1 &&
|
||||
!is_synaptics_semi_mt(dev))
|
||||
!litest_is_synaptics_semi_mt(dev))
|
||||
expected = LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
else
|
||||
expected = LIBINPUT_CONFIG_SCROLL_EDGE;
|
||||
|
|
@ -495,7 +426,7 @@ START_TEST(touchpad_scroll_defaults)
|
|||
LIBINPUT_CONFIG_SCROLL_2FG);
|
||||
|
||||
if (libevdev_get_num_slots(evdev) > 1 &&
|
||||
!is_synaptics_semi_mt(dev))
|
||||
!litest_is_synaptics_semi_mt(dev))
|
||||
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||
else
|
||||
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
||||
|
|
@ -522,7 +453,7 @@ START_TEST(touchpad_edge_scroll_timeout)
|
|||
}
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 99, 20);
|
||||
libinput_dispatch(li);
|
||||
|
|
@ -568,7 +499,7 @@ START_TEST(touchpad_edge_scroll_no_motion)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 99, 10);
|
||||
litest_touch_move_to(dev, 0, 99, 10, 99, 70, 10, 0);
|
||||
|
|
@ -590,7 +521,7 @@ START_TEST(touchpad_edge_scroll_no_edge_after_motion)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
/* moving into the edge zone must not trigger scroll events */
|
||||
litest_touch_down(dev, 0, 20, 20);
|
||||
|
|
@ -612,7 +543,7 @@ START_TEST(touchpad_edge_scroll_source)
|
|||
struct libinput_event_pointer *ptrev;
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 99, 20);
|
||||
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0);
|
||||
|
|
@ -637,7 +568,7 @@ START_TEST(touchpad_edge_scroll_no_2fg)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_drain_events(li);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_touch_down(dev, 0, 49, 50);
|
||||
litest_touch_down(dev, 1, 51, 50);
|
||||
|
|
@ -656,8 +587,8 @@ START_TEST(touchpad_edge_scroll_into_buttonareas)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_buttonareas(dev);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 99, 40);
|
||||
|
|
@ -682,8 +613,8 @@ START_TEST(touchpad_edge_scroll_within_buttonareas)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_buttonareas(dev);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 20, 99);
|
||||
|
|
@ -710,8 +641,8 @@ START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll)
|
|||
struct libinput_event_pointer *ptrev;
|
||||
double val;
|
||||
|
||||
enable_buttonareas(dev);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_buttonareas(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 20, 95);
|
||||
|
|
@ -757,8 +688,8 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
|
|||
struct libinput_event_pointer *ptrev;
|
||||
double val;
|
||||
|
||||
enable_clickfinger(dev);
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 20, 95);
|
||||
|
|
@ -802,7 +733,7 @@ START_TEST(touchpad_edge_scroll_into_area)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* move into area, move vertically, move back to edge */
|
||||
|
|
@ -846,10 +777,10 @@ START_TEST(touchpad_palm_detect_at_edge)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev) ||
|
||||
!has_2fg_scroll(dev))
|
||||
!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
|
|
@ -875,7 +806,7 @@ START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling)
|
|||
if (!touchpad_has_palm_detect_size(dev))
|
||||
return;
|
||||
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
|
|
@ -893,10 +824,10 @@ START_TEST(touchpad_palm_detect_at_bottom_corners)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev) ||
|
||||
!has_2fg_scroll(dev))
|
||||
!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
|
|
@ -922,10 +853,10 @@ START_TEST(touchpad_palm_detect_at_top_corners)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev) ||
|
||||
!has_2fg_scroll(dev))
|
||||
!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
|
|
@ -951,10 +882,10 @@ START_TEST(touchpad_palm_detect_palm_stays_palm)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev) ||
|
||||
!has_2fg_scroll(dev))
|
||||
!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
|
|
@ -973,10 +904,10 @@ START_TEST(touchpad_palm_detect_palm_becomes_pointer)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev) ||
|
||||
!has_2fg_scroll(dev))
|
||||
!litest_has_2fg_scroll(dev))
|
||||
return;
|
||||
|
||||
enable_2fg_scroll(dev);
|
||||
litest_enable_2fg_scroll(dev);
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
|
|
@ -2571,7 +2502,7 @@ START_TEST(touchpad_dwt_edge_scroll)
|
|||
if (!has_disable_while_typing(touchpad))
|
||||
return;
|
||||
|
||||
enable_edge_scroll(touchpad);
|
||||
litest_enable_edge_scroll(touchpad);
|
||||
|
||||
keyboard = litest_add_device(li, LITEST_KEYBOARD);
|
||||
litest_drain_events(li);
|
||||
|
|
@ -2618,7 +2549,7 @@ START_TEST(touchpad_dwt_edge_scroll_interrupt)
|
|||
if (!has_disable_while_typing(touchpad))
|
||||
return;
|
||||
|
||||
enable_edge_scroll(touchpad);
|
||||
litest_enable_edge_scroll(touchpad);
|
||||
|
||||
keyboard = litest_add_device(li, LITEST_KEYBOARD);
|
||||
litest_drain_events(li);
|
||||
|
|
@ -2977,7 +2908,7 @@ START_TEST(touchpad_thumb_update_no_motion)
|
|||
};
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
if (!has_thumb_detect(dev))
|
||||
return;
|
||||
|
|
@ -3003,7 +2934,7 @@ START_TEST(touchpad_thumb_moving)
|
|||
};
|
||||
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
if (!has_thumb_detect(dev))
|
||||
return;
|
||||
|
|
@ -3127,7 +3058,7 @@ START_TEST(touchpad_thumb_edgescroll)
|
|||
if (!has_thumb_detect(dev))
|
||||
return;
|
||||
|
||||
enable_edge_scroll(dev);
|
||||
litest_enable_edge_scroll(dev);
|
||||
litest_disable_tap(dev->libinput_device);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
|
@ -3159,7 +3090,7 @@ START_TEST(touchpad_thumb_tap_begin)
|
|||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* touch down is a thumb */
|
||||
|
|
@ -3192,7 +3123,7 @@ START_TEST(touchpad_thumb_tap_touch)
|
|||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* event after touch down is thumb */
|
||||
|
|
@ -3225,7 +3156,7 @@ START_TEST(touchpad_thumb_tap_hold)
|
|||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* event in state HOLD is thumb */
|
||||
|
|
@ -3259,7 +3190,7 @@ START_TEST(touchpad_thumb_tap_hold_2ndfg)
|
|||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* event in state HOLD is thumb */
|
||||
|
|
@ -3368,7 +3299,7 @@ START_TEST(touchpad_tool_tripletap_touch_count)
|
|||
* https://bugs.freedesktop.org/show_bug.cgi?id=91352
|
||||
*/
|
||||
litest_drain_events(li);
|
||||
enable_clickfinger(dev);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
/* touch 1 down */
|
||||
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue