mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-07 14:40:15 +01:00
test: add dwt modifier/fkey test cases
dwt shouldn't trigger on those keys Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8a8c72983f
commit
114021a6c1
1 changed files with 82 additions and 0 deletions
|
|
@ -2955,6 +2955,86 @@ START_TEST(touchpad_dwt_type_short_timeout)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_modifier_no_dwt)
|
||||
{
|
||||
struct litest_device *touchpad = litest_current_device();
|
||||
struct litest_device *keyboard;
|
||||
struct libinput *li = touchpad->libinput;
|
||||
unsigned int modifiers[] = {
|
||||
KEY_LEFTCTRL,
|
||||
KEY_RIGHTCTRL,
|
||||
KEY_LEFTALT,
|
||||
KEY_RIGHTALT,
|
||||
KEY_LEFTSHIFT,
|
||||
KEY_RIGHTSHIFT,
|
||||
KEY_FN,
|
||||
KEY_CAPSLOCK,
|
||||
KEY_TAB,
|
||||
KEY_COMPOSE,
|
||||
KEY_RIGHTMETA,
|
||||
KEY_LEFTMETA,
|
||||
};
|
||||
unsigned int *key;
|
||||
|
||||
if (!has_disable_while_typing(touchpad))
|
||||
return;
|
||||
|
||||
keyboard = dwt_init_paired_keyboard(li, touchpad);
|
||||
litest_disable_tap(touchpad->libinput_device);
|
||||
litest_drain_events(li);
|
||||
|
||||
ARRAY_FOR_EACH(modifiers, key) {
|
||||
litest_keyboard_key(keyboard, *key, true);
|
||||
litest_keyboard_key(keyboard, *key, false);
|
||||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
|
||||
|
||||
litest_touch_down(touchpad, 0, 50, 50);
|
||||
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1);
|
||||
litest_touch_up(touchpad, 0);
|
||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
||||
}
|
||||
|
||||
litest_delete_device(keyboard);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_fkeys_no_dwt)
|
||||
{
|
||||
struct litest_device *touchpad = litest_current_device();
|
||||
struct litest_device *keyboard;
|
||||
struct libinput *li = touchpad->libinput;
|
||||
unsigned int key;
|
||||
|
||||
if (!has_disable_while_typing(touchpad))
|
||||
return;
|
||||
|
||||
keyboard = dwt_init_paired_keyboard(li, touchpad);
|
||||
litest_disable_tap(touchpad->libinput_device);
|
||||
litest_drain_events(li);
|
||||
|
||||
for (key = KEY_F1; key < KEY_CNT; key++) {
|
||||
if (!libinput_device_keyboard_has_key(keyboard->libinput_device,
|
||||
key))
|
||||
continue;
|
||||
|
||||
litest_keyboard_key(keyboard, key, true);
|
||||
litest_keyboard_key(keyboard, key, false);
|
||||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
|
||||
|
||||
litest_touch_down(touchpad, 0, 50, 50);
|
||||
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1);
|
||||
litest_touch_up(touchpad, 0);
|
||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
||||
}
|
||||
|
||||
litest_delete_device(keyboard);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_tap)
|
||||
{
|
||||
struct litest_device *touchpad = litest_current_device();
|
||||
|
|
@ -4227,6 +4307,8 @@ litest_setup_tests(void)
|
|||
litest_add("touchpad:dwt", touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_fkeys_no_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_tap_drag, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:dwt", touchpad_dwt_click, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue