Commit 3fea53c3 authored by Peter Hutterer's avatar Peter Hutterer

test: restore the non-debounced litest_button_click()

8cf6893f removed it to make search/replace easier, restore it for the tests
where we don't want debouncing to automatically be handled.

Still left in place are the various top software button cases. Because of the
button re-routing through the fallback interface we need those to be
debounced.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 0e0dfe9b
......@@ -2018,12 +2018,10 @@ litest_hover_move_two_touches(struct litest_device *d,
}
void
litest_button_click_debounced(struct litest_device *d,
struct libinput *li,
unsigned int button,
bool is_press)
litest_button_click(struct litest_device *d,
unsigned int button,
bool is_press)
{
struct input_event *ev;
struct input_event click[] = {
{ .type = EV_KEY, .code = button, .value = is_press ? 1 : 0 },
......@@ -2032,6 +2030,16 @@ litest_button_click_debounced(struct litest_device *d,
ARRAY_FOR_EACH(click, ev)
litest_event(d, ev->type, ev->code, ev->value);
}
void
litest_button_click_debounced(struct litest_device *d,
struct libinput *li,
unsigned int button,
bool is_press)
{
litest_button_click(d, button, is_press);
libinput_dispatch(li);
litest_timeout_debounce();
libinput_dispatch(li);
......
......@@ -602,6 +602,11 @@ litest_button_click_debounced(struct litest_device *d,
unsigned int button,
bool is_press);
void
litest_button_click(struct litest_device *d,
unsigned int button,
bool is_press);
void
litest_button_scroll(struct litest_device *d,
unsigned int button,
......
......@@ -416,8 +416,8 @@ START_TEST(event_conversion_tablet)
litest_tablet_proximity_in(dev, 50, 50, axes);
litest_tablet_motion(dev, 60, 50, axes);
litest_button_click_debounced(dev, li, BTN_STYLUS, true);
litest_button_click_debounced(dev, li, BTN_STYLUS, false);
litest_button_click(dev, BTN_STYLUS, true);
litest_button_click(dev, BTN_STYLUS, false);
libinput_dispatch(li);
......@@ -458,7 +458,7 @@ START_TEST(event_conversion_tablet_pad)
struct libinput_event *event;
int events = 0;
litest_button_click_debounced(dev, li, BTN_0, true);
litest_button_click(dev, BTN_0, true);
litest_pad_ring_start(dev, 10);
litest_pad_ring_end(dev);
......
......@@ -68,8 +68,8 @@ START_TEST(pad_time)
if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
continue;
litest_button_click_debounced(dev, li, code, 1);
litest_button_click_debounced(dev, li, code, 0);
litest_button_click(dev, code, 1);
litest_button_click(dev, code, 0);
libinput_dispatch(li);
switch (code) {
......@@ -98,8 +98,8 @@ START_TEST(pad_time)
litest_drain_events(li);
msleep(10);
litest_button_click_debounced(dev, li, code, 1);
litest_button_click_debounced(dev, li, code, 0);
litest_button_click(dev, code, 1);
litest_button_click(dev, code, 0);
libinput_dispatch(li);
ev = libinput_get_event(li);
......@@ -156,8 +156,8 @@ START_TEST(pad_button)
if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
continue;
litest_button_click_debounced(dev, li, code, 1);
litest_button_click_debounced(dev, li, code, 0);
litest_button_click(dev, code, 1);
litest_button_click(dev, code, 0);
libinput_dispatch(li);
switch (code) {
......@@ -207,8 +207,8 @@ START_TEST(pad_button_mode_groups)
if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
continue;
litest_button_click_debounced(dev, li, code, 1);
litest_button_click_debounced(dev, li, code, 0);
litest_button_click(dev, code, 1);
litest_button_click(dev, code, 0);
libinput_dispatch(li);
switch (code) {
......
......@@ -1041,7 +1041,7 @@ START_TEST(clickpad_finger_pin)
litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
litest_drain_events(li);
litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1);
......@@ -1050,7 +1050,7 @@ START_TEST(clickpad_finger_pin)
litest_assert_empty_queue(li);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, false);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
/* still pinned after release */
......@@ -1490,7 +1490,7 @@ START_TEST(clickpad_softbutton_hover_into_buttons)
litest_touch_move_to(dev, 0, 90, 90, 91, 91, 1, 0);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
libinput_dispatch(li);
litest_assert_button_event(li,
......@@ -1498,7 +1498,7 @@ START_TEST(clickpad_softbutton_hover_into_buttons)
LIBINPUT_BUTTON_STATE_PRESSED);
litest_assert_empty_queue(li);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, false);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......
......@@ -332,8 +332,8 @@ START_TEST(touchpad_1fg_multitap_n_drag_click)
litest_touch_down(dev, 0, 50, 50);
libinput_dispatch(li);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, false);
libinput_dispatch(li);
for (ntaps = 0; ntaps <= range; ntaps++) {
......@@ -627,8 +627,8 @@ START_TEST(touchpad_1fg_multitap_n_drag_tap_click)
litest_touch_up(dev, 0);
litest_touch_down(dev, 0, 70, 50);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, false);
libinput_dispatch(li);
litest_assert_button_event(li,
......@@ -799,8 +799,8 @@ START_TEST(touchpad_1fg_tap_n_drag_draglock_tap_click)
litest_touch_up(dev, 0);
litest_touch_down(dev, 0, 50, 50);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, false);
libinput_dispatch(li);
litest_assert_button_event(li, BTN_LEFT,
......
......@@ -842,7 +842,7 @@ START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll)
litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -865,7 +865,7 @@ START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll)
litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0);
litest_assert_empty_queue(li);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, false);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
......@@ -892,7 +892,7 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -916,7 +916,7 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_assert_empty_queue(li);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, false);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
......@@ -1717,8 +1717,8 @@ START_TEST(touchpad_left_handed)
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_assert_button_event(li,
BTN_RIGHT,
......@@ -1727,8 +1727,8 @@ START_TEST(touchpad_left_handed)
BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED);
litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
litest_button_click(dev, BTN_RIGHT, 1);
litest_button_click(dev, BTN_RIGHT, 0);
litest_assert_button_event(li,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_PRESSED);
......@@ -1739,8 +1739,8 @@ START_TEST(touchpad_left_handed)
if (libevdev_has_event_code(dev->evdev,
EV_KEY,
BTN_MIDDLE)) {
litest_button_click_debounced(dev, li, BTN_MIDDLE, 1);
litest_button_click_debounced(dev, li, BTN_MIDDLE, 0);
litest_button_click(dev, BTN_MIDDLE, 1);
litest_button_click(dev, BTN_MIDDLE, 0);
litest_assert_button_event(li,
BTN_MIDDLE,
LIBINPUT_BUTTON_STATE_PRESSED);
......@@ -1779,8 +1779,8 @@ START_TEST(touchpad_left_handed_clickpad)
litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......@@ -1792,8 +1792,8 @@ START_TEST(touchpad_left_handed_clickpad)
litest_drain_events(li);
litest_touch_down(dev, 0, 90, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......@@ -1805,8 +1805,8 @@ START_TEST(touchpad_left_handed_clickpad)
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......@@ -1833,8 +1833,8 @@ START_TEST(touchpad_left_handed_clickfinger)
litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
/* Clickfinger is unaffected by left-handed setting */
......@@ -1848,8 +1848,8 @@ START_TEST(touchpad_left_handed_clickfinger)
litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90);
litest_touch_down(dev, 1, 30, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
......@@ -1943,13 +1943,13 @@ START_TEST(touchpad_left_handed_delayed)
return;
litest_drain_events(li);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 1);
libinput_dispatch(li);
status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 0);
litest_assert_button_event(li,
BTN_LEFT,
......@@ -1959,18 +1959,18 @@ START_TEST(touchpad_left_handed_delayed)
LIBINPUT_BUTTON_STATE_RELEASED);
/* left-handed takes effect now */
litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
litest_button_click(dev, BTN_RIGHT, 1);
libinput_dispatch(li);
litest_timeout_middlebutton();
libinput_dispatch(li);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 1);
libinput_dispatch(li);
status = libinput_device_config_left_handed_set(d, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_RIGHT, 0);
litest_button_click(dev, BTN_LEFT, 0);
litest_assert_button_event(li,
BTN_LEFT,
......@@ -1999,13 +1999,13 @@ START_TEST(touchpad_left_handed_clickpad_delayed)
litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 1);
libinput_dispatch(li);
status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......@@ -2018,13 +2018,13 @@ START_TEST(touchpad_left_handed_clickpad_delayed)
/* left-handed takes effect now */
litest_drain_events(li);
litest_touch_down(dev, 0, 90, 90);
litest_button_click_debounced(dev, li, BTN_LEFT, 1);
litest_button_click(dev, BTN_LEFT, 1);
libinput_dispatch(li);
status = libinput_device_config_left_handed_set(d, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click_debounced(dev, li, BTN_LEFT, 0);
litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0);
litest_assert_button_event(li,
......@@ -2683,7 +2683,7 @@ START_TEST(touchpad_trackpoint_mb_scroll)
LITEST_TRACKPOINT);
litest_drain_events(li);
litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */
litest_button_click(touchpad, BTN_2, true); /* middle */
libinput_dispatch(li);
litest_timeout_buttonscroll();
libinput_dispatch(li);
......@@ -2695,7 +2695,7 @@ START_TEST(touchpad_trackpoint_mb_scroll)
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
litest_event(trackpoint, EV_REL, REL_Y, -2);
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
litest_button_click_debounced(touchpad, li, BTN_2, false);
litest_button_click(touchpad, BTN_2, false);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
......@@ -2874,16 +2874,16 @@ START_TEST(touchpad_trackpoint_no_trackpoint)
struct libinput *li = touchpad->libinput;
litest_drain_events(li);
litest_button_click_debounced(touchpad, li, BTN_0, true); /* left */
litest_button_click_debounced(touchpad, li, BTN_0, false);
litest_button_click(touchpad, BTN_0, true); /* left */
litest_button_click(touchpad, BTN_0, false);
litest_assert_empty_queue(li);
litest_button_click_debounced(touchpad, li, BTN_1, true); /* right */
litest_button_click_debounced(touchpad, li, BTN_1, false);
litest_button_click(touchpad, BTN_1, true); /* right */
litest_button_click(touchpad, BTN_1, false);
litest_assert_empty_queue(li);
litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */
litest_button_click_debounced(touchpad, li, BTN_2, false);
litest_button_click(touchpad, BTN_2, true); /* middle */
litest_button_click(touchpad, BTN_2, false);
litest_assert_empty_queue(li);
}
END_TEST
......@@ -3679,8 +3679,8 @@ START_TEST(touchpad_dwt_click)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
litest_touch_down(touchpad, 0, 50, 50);
litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
litest_button_click(touchpad, BTN_LEFT, true);
litest_button_click(touchpad, BTN_LEFT, false);
libinput_dispatch(li);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
......@@ -4492,7 +4492,7 @@ START_TEST(touchpad_thumb_clickfinger)
litest_touch_down(dev, 0, 50, 99);
litest_touch_down(dev, 1, 60, 99);
litest_touch_move_extended(dev, 0, 55, 99, axes);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -4503,7 +4503,7 @@ START_TEST(touchpad_thumb_clickfinger)
litest_assert_empty_queue(li);
litest_button_click_debounced(dev, li, BTN_LEFT, false);
litest_button_click(dev, BTN_LEFT, false);
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
......@@ -4512,7 +4512,7 @@ START_TEST(touchpad_thumb_clickfinger)
litest_touch_down(dev, 0, 50, 99);
litest_touch_down(dev, 1, 60, 99);
litest_touch_move_extended(dev, 1, 65, 99, axes);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
......@@ -4547,7 +4547,7 @@ START_TEST(touchpad_thumb_btnarea)
litest_touch_down(dev, 0, 90, 99);
litest_touch_move_extended(dev, 0, 95, 99, axes);
litest_button_click_debounced(dev, li, BTN_LEFT, true);
litest_button_click(dev, BTN_LEFT, true);
/* button areas work as usual with a thumb */
......
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