Commit 20a9c38d authored by Peter Hutterer's avatar Peter Hutterer

test: force 10ms intervals for touch moves, unless specified otherwise

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent bdc7ef8b
......@@ -2009,16 +2009,17 @@ litest_touch_move_to_extended(struct litest_device *d,
struct axis_replacement *axes,
int steps, int sleep_ms)
{
if (sleep_ms == 0)
sleep_ms = 10;
for (int i = 1; i < steps; i++) {
litest_touch_move_extended(d, slot,
x_from + (x_to - x_from)/steps * i,
y_from + (y_to - y_from)/steps * i,
axes);
if (sleep_ms) {
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
litest_touch_move_extended(d, slot, x_to, y_to, axes);
}
......@@ -2106,6 +2107,9 @@ litest_touch_move_two_touches(struct litest_device *d,
double dx, double dy,
int steps, int sleep_ms)
{
if (sleep_ms == 0)
sleep_ms = 10;
for (int i = 1; i < steps; i++) {
litest_push_event_frame(d);
litest_touch_move(d, 0, x0 + dx / steps * i,
......@@ -2113,10 +2117,8 @@ litest_touch_move_two_touches(struct litest_device *d,
litest_touch_move(d, 1, x1 + dx / steps * i,
y1 + dy / steps * i);
litest_pop_event_frame(d);
if (sleep_ms) {
libinput_dispatch(d->libinput);
msleep(sleep_ms);
}
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
litest_push_event_frame(d);
......@@ -2133,6 +2135,9 @@ litest_touch_move_three_touches(struct litest_device *d,
double dx, double dy,
int steps, int sleep_ms)
{
if (sleep_ms == 0)
sleep_ms = 10;
for (int i = 0; i < steps - 1; i++) {
litest_touch_move(d, 0, x0 + dx / steps * i,
y0 + dy / steps * i);
......@@ -2140,11 +2145,10 @@ litest_touch_move_three_touches(struct litest_device *d,
y1 + dy / steps * i);
litest_touch_move(d, 2, x2 + dx / steps * i,
y2 + dy / steps * i);
if (sleep_ms) {
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
litest_touch_move(d, 0, x0 + dx, y0 + dy);
litest_touch_move(d, 1, x1 + dx, y1 + dy);
......@@ -2218,15 +2222,16 @@ litest_hover_move_to(struct litest_device *d,
double x_to, double y_to,
int steps, int sleep_ms)
{
if (sleep_ms == 0)
sleep_ms = 10;
for (int i = 0; i < steps - 1; i++) {
litest_hover_move(d, slot,
x_from + (x_to - x_from)/steps * i,
y_from + (y_to - y_from)/steps * i);
if (sleep_ms) {
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
litest_hover_move(d, slot, x_to, y_to);
}
......@@ -2238,6 +2243,9 @@ litest_hover_move_two_touches(struct litest_device *d,
double dx, double dy,
int steps, int sleep_ms)
{
if (sleep_ms == 0)
sleep_ms = 10;
for (int i = 0; i < steps - 1; i++) {
litest_push_event_frame(d);
litest_hover_move(d, 0, x0 + dx / steps * i,
......@@ -2245,11 +2253,9 @@ litest_hover_move_two_touches(struct litest_device *d,
litest_hover_move(d, 1, x1 + dx / steps * i,
y1 + dy / steps * i);
litest_pop_event_frame(d);
if (sleep_ms) {
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
libinput_dispatch(d->libinput);
msleep(sleep_ms);
libinput_dispatch(d->libinput);
}
litest_push_event_frame(d);
litest_hover_move(d, 0, x0 + dx, y0 + dy);
......
......@@ -90,7 +90,7 @@ START_TEST(gestures_swipe_3fg)
50, 40,
60, 40,
dir_x, dir_y,
10, 2);
10, 0);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -197,7 +197,7 @@ START_TEST(gestures_swipe_3fg_btntool)
40, 40,
50, 40,
dir_x, dir_y,
10, 2);
10, 0);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -431,7 +431,7 @@ START_TEST(gestures_swipe_4fg_btntool)
40, 40,
50, 40,
dir_x, dir_y,
10, 2);
10, 0);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -986,7 +986,7 @@ START_TEST(gestures_time_usec)
50, 40,
60, 40,
0, 30,
10, 2);
30, 0);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -1021,7 +1021,7 @@ START_TEST(gestures_3fg_buttonarea_scroll)
40, 20,
30, 20,
0, 40,
10, 2);
10, 0);
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
......@@ -1049,7 +1049,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool)
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10, 1);
litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10, 0);
litest_touch_up(dev, 1);
libinput_dispatch(li);
......
......@@ -260,7 +260,7 @@ START_TEST(switch_disable_touchpad)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -269,7 +269,7 @@ START_TEST(switch_disable_touchpad)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -292,13 +292,13 @@ START_TEST(switch_disable_touchpad_during_touch)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1);
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -400,7 +400,7 @@ START_TEST(switch_disable_touchpad_already_open)
/* default: switch is off - motion events */
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -409,7 +409,7 @@ START_TEST(switch_disable_touchpad_already_open)
litest_assert_empty_queue(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -438,7 +438,7 @@ START_TEST(switch_dont_resume_disabled_touchpad)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -447,7 +447,7 @@ START_TEST(switch_dont_resume_disabled_touchpad)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -473,7 +473,7 @@ START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -482,7 +482,7 @@ START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -491,7 +491,7 @@ START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -567,7 +567,7 @@ START_TEST(lid_open_on_key_touchpad_enabled)
litest_timeout_dwt_long();
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 70, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 70, 10, 0);
litest_touch_up(touchpad, 0);
libinput_dispatch(li);
......@@ -847,7 +847,7 @@ START_TEST(tablet_mode_disable_touchpad_on_init)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -857,7 +857,7 @@ START_TEST(tablet_mode_disable_touchpad_on_init)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......
......@@ -4231,7 +4231,7 @@ START_TEST(touchpad_dwt_disabled)
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, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -4264,7 +4264,7 @@ START_TEST(touchpad_dwt_disable_during_touch)
litest_keyboard_key(keyboard, KEY_A, false);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_empty_queue(li);
litest_timeout_dwt_long();
......@@ -4273,7 +4273,7 @@ START_TEST(touchpad_dwt_disable_during_touch)
disable_dwt(touchpad);
/* touch already down -> keeps being ignored */
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1);
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -4306,7 +4306,7 @@ START_TEST(touchpad_dwt_disable_before_touch)
/* touch down during timeout -> still discarded */
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_empty_queue(li);
litest_delete_device(keyboard);
......@@ -4340,7 +4340,7 @@ START_TEST(touchpad_dwt_disable_during_key_release)
litest_touch_down(touchpad, 0, 50, 50);
libinput_dispatch(li);
litest_timeout_dwt_long();
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_delete_device(keyboard);
......@@ -4372,7 +4372,7 @@ START_TEST(touchpad_dwt_disable_during_key_hold)
litest_touch_down(touchpad, 0, 50, 50);
libinput_dispatch(li);
litest_timeout_dwt_long();
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_delete_device(keyboard);
......@@ -4399,13 +4399,13 @@ START_TEST(touchpad_dwt_enable_during_touch)
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, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
enable_dwt(touchpad);
/* touch already down -> still sends events */
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1);
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -4436,7 +4436,7 @@ START_TEST(touchpad_dwt_enable_before_touch)
libinput_dispatch(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_delete_device(keyboard);
......@@ -4473,7 +4473,7 @@ START_TEST(touchpad_dwt_enable_during_tap)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -4510,12 +4510,12 @@ START_TEST(touchpad_dwt_remove_kbd_while_active)
litest_delete_device(keyboard);
litest_drain_events(li);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -4538,7 +4538,7 @@ START_TEST(touchpad_dwt_apple)
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, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
libinput_dispatch(li);
litest_assert_empty_queue(li);
......@@ -4564,7 +4564,7 @@ START_TEST(touchpad_dwt_acer_hawaii)
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, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
......@@ -4576,7 +4576,7 @@ START_TEST(touchpad_dwt_acer_hawaii)
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, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
libinput_dispatch(li);
litest_assert_empty_queue(li);
......@@ -4604,7 +4604,7 @@ START_TEST(touchpad_dwt_multiple_keyboards)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -4615,7 +4615,7 @@ START_TEST(touchpad_dwt_multiple_keyboards)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -4646,7 +4646,7 @@ START_TEST(touchpad_dwt_multiple_keyboards_bothkeys)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -4681,7 +4681,7 @@ START_TEST(touchpad_dwt_multiple_keyboards_bothkeys_modifier)
* ctrl+B across two devices is *not* a dwt modifier combo
*/
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......@@ -4724,7 +4724,7 @@ START_TEST(touchpad_dwt_multiple_keyboards_remove)
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 0);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment