mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 19:20:05 +01:00
test: switch touchpad button tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
This commit is contained in:
parent
6ee8e8d9b6
commit
11dec0bd9b
1 changed files with 48 additions and 15 deletions
|
|
@ -254,13 +254,27 @@ START_TEST(touchpad_1fg_clickfinger_no_touch_phantomclicks)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
static enum libinput_config_clickfinger_button_map
|
||||
map_param_lookup(const char *arg)
|
||||
{
|
||||
if (streq(arg, "LMR"))
|
||||
return LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
||||
if (streq(arg, "LRM"))
|
||||
return LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
||||
|
||||
litest_abort_msg("Invalid map parameter: %s", arg);
|
||||
}
|
||||
|
||||
START_TEST(touchpad_2fg_clickfinger)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
unsigned int button = 0;
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
litest_enable_clickfinger(dev);
|
||||
litest_set_clickfinger_map(dev, map);
|
||||
|
||||
|
|
@ -299,9 +313,12 @@ START_TEST(touchpad_3fg_clickfinger)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
unsigned int button = 0;
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
if (litest_slot_count(dev) < 3)
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
|
|
@ -347,9 +364,12 @@ START_TEST(touchpad_3fg_clickfinger_btntool)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
unsigned int button = 0;
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
if (litest_slot_count(dev) >= 3 ||
|
||||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
|
@ -502,7 +522,10 @@ START_TEST(touchpad_2fg_clickfinger_distance)
|
|||
double w, h;
|
||||
bool small_touchpad = false;
|
||||
unsigned int expected_button = 0;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
if (libinput_device_get_size(dev->libinput_device, &w, &h) == 0 &&
|
||||
h < 50.0)
|
||||
|
|
@ -567,9 +590,12 @@ START_TEST(touchpad_3fg_clickfinger_distance)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
unsigned int button = 0;
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
if (litest_slot_count(dev) < 3)
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
|
|
@ -614,9 +640,12 @@ START_TEST(touchpad_3fg_clickfinger_distance_btntool)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_clickfinger_button_map map = _i; /* ranged test */
|
||||
unsigned int button = 0;
|
||||
|
||||
const char *mapstr;
|
||||
litest_test_param_fetch(test_env->params, "map", &mapstr);
|
||||
enum libinput_config_clickfinger_button_map map = map_param_lookup(mapstr);
|
||||
|
||||
if (litest_slot_count(dev) > 2)
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
|
|
@ -2242,23 +2271,27 @@ END_TEST
|
|||
TEST_COLLECTION(touchpad_buttons)
|
||||
{
|
||||
struct range finger_count = {1, 4};
|
||||
struct range clickfinger_map_range = { LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM,
|
||||
LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR + 1 };
|
||||
|
||||
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);
|
||||
litest_add_ranged(touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
litest_add_ranged(touchpad_3fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
litest_add_ranged(touchpad_3fg_clickfinger_btntool, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
|
||||
{
|
||||
struct litest_parameters *params = litest_parameters_new("map", 's', 2, "LRM", "LMR");
|
||||
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_parameters_unref(params);
|
||||
}
|
||||
|
||||
litest_add_for_device(touchpad_2fg_clickfinger_bottom, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
||||
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_ranged(touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
litest_add_ranged(touchpad_3fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
litest_add_ranged(touchpad_3fg_clickfinger_distance_btntool, LITEST_CLICKPAD, LITEST_ANY, &clickfinger_map_range);
|
||||
litest_add_for_device(touchpad_2fg_clickfinger_bottom, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue