diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-08-04 11:00:37 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-08-04 12:57:02 +1000 |
commit | 114021a6c1fa2a4132c4628ea1bd1dfa55482b9f (patch) | |
tree | 84f56d4caf849a9b4a472a9284d8ec9a39d561bb | |
parent | 8a8c72983fbf334e1b321ae870c1d13fdeda5bc8 (diff) |
test: add dwt modifier/fkey test cases
dwt shouldn't trigger on those keys
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | test/touchpad.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test/touchpad.c b/test/touchpad.c index 57e4712..9f78ed7 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -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); |