[PATCH libinput 1/5] test: replace litest_button_click with a debounced version

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 14 04:12:57 UTC 2017


This is via a simple search & replace. Later auditing is needed to switch
clicks that should not be debounced (e.g. touchpads) back to a non-debounced
version.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest.c                |  20 +++++--
 test/litest.h                |   7 +--
 test/test-device.c           |  12 ++---
 test/test-misc.c             |   6 +--
 test/test-pad.c              |  16 +++---
 test/test-pointer.c          | 122 +++++++++++++++++++++++--------------------
 test/test-touchpad-buttons.c |   8 +--
 test/test-touchpad-tap.c     |  12 ++---
 test/test-touchpad.c         | 116 ++++++++++++++++++++--------------------
 test/test-trackpoint.c       |  16 +++---
 10 files changed, 177 insertions(+), 158 deletions(-)

diff --git a/test/litest.c b/test/litest.c
index 0784228b..9819bed9 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -2018,7 +2018,10 @@ litest_hover_move_two_touches(struct litest_device *d,
 }
 
 void
-litest_button_click(struct litest_device *d, unsigned int button, bool is_press)
+litest_button_click_debounced(struct litest_device *d,
+			      struct libinput *li,
+			      unsigned int button,
+			      bool is_press)
 {
 
 	struct input_event *ev;
@@ -2029,7 +2032,9 @@ litest_button_click(struct litest_device *d, unsigned int button, bool is_press)
 
 	ARRAY_FOR_EACH(click, ev)
 		litest_event(d, ev->type, ev->code, ev->value);
+	libinput_dispatch(li);
 	litest_timeout_debounce();
+	libinput_dispatch(li);
 }
 
 void
@@ -2039,7 +2044,7 @@ litest_button_scroll(struct litest_device *dev,
 {
 	struct libinput *li = dev->libinput;
 
-	litest_button_click(dev, button, 1);
+	litest_button_click_debounced(dev, li, button, 1);
 
 	libinput_dispatch(li);
 	litest_timeout_buttonscroll();
@@ -2049,7 +2054,7 @@ litest_button_scroll(struct litest_device *dev,
 	litest_event(dev, EV_REL, REL_Y, dy);
 	litest_event(dev, EV_SYN, SYN_REPORT, 0);
 
-	litest_button_click(dev, button, 0);
+	litest_button_click_debounced(dev, li, button, 0);
 
 	libinput_dispatch(li);
 }
@@ -2057,7 +2062,14 @@ litest_button_scroll(struct litest_device *dev,
 void
 litest_keyboard_key(struct litest_device *d, unsigned int key, bool is_press)
 {
-	litest_button_click(d, key, is_press);
+	struct input_event *ev;
+	struct input_event click[] = {
+		{ .type = EV_KEY, .code = key, .value = is_press ? 1 : 0 },
+		{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+	};
+
+	ARRAY_FOR_EACH(click, ev)
+		litest_event(d, ev->type, ev->code, ev->value);
 }
 
 void
diff --git a/test/litest.h b/test/litest.h
index 400b15ec..5d1f97f5 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -597,9 +597,10 @@ litest_hover_move_two_touches(struct litest_device *d,
 			      int steps, int sleep_ms);
 
 void
-litest_button_click(struct litest_device *d,
-		    unsigned int button,
-		    bool is_press);
+litest_button_click_debounced(struct litest_device *d,
+			      struct libinput *li,
+			      unsigned int button,
+			      bool is_press);
 
 void
 litest_button_scroll(struct litest_device *d,
diff --git a/test/test-device.c b/test/test-device.c
index c4dfdd47..7c39131f 100644
--- a/test/test-device.c
+++ b/test/test-device.c
@@ -463,7 +463,7 @@ START_TEST(device_disable_release_buttons)
 
 	device = dev->libinput_device;
 
-	litest_button_click(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
 	litest_drain_events(li);
 
 	status = libinput_device_config_send_events_set_mode(device,
@@ -497,7 +497,7 @@ START_TEST(device_disable_release_keys)
 
 	device = dev->libinput_device;
 
-	litest_button_click(dev, KEY_A, true);
+	litest_button_click_debounced(dev, li, KEY_A, true);
 	litest_drain_events(li);
 
 	status = libinput_device_config_send_events_set_mode(device,
@@ -616,7 +616,7 @@ START_TEST(device_disable_release_softbutton)
 	litest_drain_events(li);
 
 	litest_touch_down(dev, 0, 90, 90);
-	litest_button_click(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
 
 	/* make sure softbutton works */
 	litest_assert_button_event(li,
@@ -633,7 +633,7 @@ START_TEST(device_disable_release_softbutton)
 
 	litest_assert_empty_queue(li);
 
-	litest_button_click(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, false);
 	litest_touch_up(dev, 0);
 
 	litest_assert_empty_queue(li);
@@ -669,8 +669,8 @@ START_TEST(device_disable_topsoftbutton)
 	litest_drain_events(li);
 
 	litest_touch_down(dev, 0, 90, 10);
-	litest_button_click(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, BTN_LEFT, false);
 	litest_touch_up(dev, 0);
 
 	litest_wait_for_event(li);
diff --git a/test/test-misc.c b/test/test-misc.c
index 32081c03..5a4f6ad6 100644
--- a/test/test-misc.c
+++ b/test/test-misc.c
@@ -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(dev, BTN_STYLUS, true);
-	litest_button_click(dev, BTN_STYLUS, false);
+	litest_button_click_debounced(dev, li, BTN_STYLUS, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_0, true);
+	litest_button_click_debounced(dev, li, BTN_0, true);
 	litest_pad_ring_start(dev, 10);
 	litest_pad_ring_end(dev);
 
diff --git a/test/test-pad.c b/test/test-pad.c
index 5e4a66f5..b0c583d7 100644
--- a/test/test-pad.c
+++ b/test/test-pad.c
@@ -68,8 +68,8 @@ START_TEST(pad_time)
 		if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
 			continue;
 
-		litest_button_click(dev, code, 1);
-		litest_button_click(dev, code, 0);
+		litest_button_click_debounced(dev, li, code, 1);
+		litest_button_click_debounced(dev, li, code, 0);
 		libinput_dispatch(li);
 
 		switch (code) {
@@ -98,8 +98,8 @@ START_TEST(pad_time)
 	litest_drain_events(li);
 	msleep(10);
 
-	litest_button_click(dev, code, 1);
-	litest_button_click(dev, code, 0);
+	litest_button_click_debounced(dev, li, code, 1);
+	litest_button_click_debounced(dev, li, 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(dev, code, 1);
-		litest_button_click(dev, code, 0);
+		litest_button_click_debounced(dev, li, code, 1);
+		litest_button_click_debounced(dev, li, 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(dev, code, 1);
-		litest_button_click(dev, code, 0);
+		litest_button_click_debounced(dev, li, code, 1);
+		litest_button_click_debounced(dev, li, code, 0);
 		libinput_dispatch(li);
 
 		switch (code) {
diff --git a/test/test-pointer.c b/test/test-pointer.c
index 3ce80840..136aa48c 100644
--- a/test/test-pointer.c
+++ b/test/test-pointer.c
@@ -348,7 +348,7 @@ test_button_event(struct litest_device *dev, unsigned int button, int state)
 {
 	struct libinput *li = dev->libinput;
 
-	litest_button_click(dev, button, state);
+	litest_button_click_debounced(dev, li, button, state);
 	litest_event(dev, EV_SYN, SYN_REPORT, 0);
 
 	litest_assert_button_event(li, button,
@@ -500,7 +500,7 @@ START_TEST(pointer_recover_from_lost_button_count)
 
 	litest_drain_events(dev->libinput);
 
-	litest_button_click(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
 
 	litest_assert_button_event(li,
 				   BTN_LEFT,
@@ -508,15 +508,15 @@ START_TEST(pointer_recover_from_lost_button_count)
 
 	/* Grab for the release to make libinput lose count */
 	libevdev_grab(evdev, LIBEVDEV_GRAB);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 	libevdev_grab(evdev, LIBEVDEV_UNGRAB);
 
 	litest_assert_empty_queue(li);
 
-	litest_button_click(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
 	litest_assert_empty_queue(li);
 
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 	litest_assert_button_event(li,
 				   BTN_LEFT,
 				   LIBINPUT_BUTTON_STATE_RELEASED);
@@ -802,7 +802,10 @@ START_TEST(pointer_seat_button_count)
 	}
 
 	for (i = 0; i < num_devices; ++i)
-		litest_button_click(devices[i], BTN_LEFT, true);
+		litest_button_click_debounced(devices[i],
+					      libinput,
+					      BTN_LEFT,
+					      true);
 
 	libinput_dispatch(libinput);
 	while ((ev = libinput_get_event(libinput))) {
@@ -832,7 +835,10 @@ START_TEST(pointer_seat_button_count)
 	ck_assert_int_eq(seat_button_count, num_devices);
 
 	for (i = 0; i < num_devices; ++i)
-		litest_button_click(devices[i], BTN_LEFT, false);
+		litest_button_click_debounced(devices[i],
+					      libinput,
+					      BTN_LEFT,
+					      false);
 
 	libinput_dispatch(libinput);
 	while ((ev = libinput_get_event(libinput))) {
@@ -921,8 +927,8 @@ START_TEST(pointer_left_handed)
 	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
 
 	litest_drain_events(li);
-	litest_button_click(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 
 	litest_assert_button_event(li,
 				   BTN_RIGHT,
@@ -931,8 +937,8 @@ START_TEST(pointer_left_handed)
 				   BTN_RIGHT,
 				   LIBINPUT_BUTTON_STATE_RELEASED);
 
-	litest_button_click(dev, BTN_RIGHT, 1);
-	litest_button_click(dev, BTN_RIGHT, 0);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
 	litest_assert_button_event(li,
 				   BTN_LEFT,
 				   LIBINPUT_BUTTON_STATE_PRESSED);
@@ -941,8 +947,8 @@ START_TEST(pointer_left_handed)
 				   LIBINPUT_BUTTON_STATE_RELEASED);
 
 	if (libinput_device_pointer_has_button(d, BTN_MIDDLE)) {
-		litest_button_click(dev, BTN_MIDDLE, 1);
-		litest_button_click(dev, BTN_MIDDLE, 0);
+		litest_button_click_debounced(dev, li, BTN_MIDDLE, 1);
+		litest_button_click_debounced(dev, li, BTN_MIDDLE, 0);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
@@ -961,14 +967,14 @@ START_TEST(pointer_left_handed_during_click)
 	enum libinput_config_status status;
 
 	litest_drain_events(li);
-	litest_button_click(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
 	libinput_dispatch(li);
 
 	/* Change while button is down, expect correct release event */
 	status = libinput_device_config_left_handed_set(d, 1);
 	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
 
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 
 	litest_assert_button_event(li,
 				   BTN_LEFT,
@@ -992,16 +998,16 @@ START_TEST(pointer_left_handed_during_click_multiple_buttons)
 	litest_disable_middleemu(dev);
 
 	litest_drain_events(li);
-	litest_button_click(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
 	libinput_dispatch(li);
 
 	status = libinput_device_config_left_handed_set(d, 1);
 	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
 
 	/* No left-handed until all buttons were down */
-	litest_button_click(dev, BTN_RIGHT, 1);
-	litest_button_click(dev, BTN_RIGHT, 0);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 
 	litest_assert_button_event(li,
 				   BTN_LEFT,
@@ -1102,7 +1108,7 @@ START_TEST(pointer_scroll_button_no_event_before_timeout)
 						 BTN_LEFT);
 	litest_drain_events(li);
 
-	litest_button_click(device, BTN_LEFT, true);
+	litest_button_click_debounced(device, li, BTN_LEFT, true);
 	litest_assert_empty_queue(li);
 
 	for (i = 0; i < 10; i++) {
@@ -1113,7 +1119,7 @@ START_TEST(pointer_scroll_button_no_event_before_timeout)
 
 	litest_timeout_buttonscroll();
 	libinput_dispatch(li);
-	litest_button_click(device, BTN_LEFT, false);
+	litest_button_click_debounced(device, li, BTN_LEFT, false);
 
 	litest_assert_button_event(li, BTN_LEFT,
 				   LIBINPUT_BUTTON_STATE_PRESSED);
@@ -1146,8 +1152,8 @@ START_TEST(pointer_scroll_button_middle_emulation)
 
 	litest_drain_events(li);
 
-	litest_button_click(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_RIGHT, 1);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
 	libinput_dispatch(li);
 	litest_timeout_buttonscroll();
 	libinput_dispatch(li);
@@ -1159,8 +1165,8 @@ START_TEST(pointer_scroll_button_middle_emulation)
 
 	libinput_dispatch(li);
 
-	litest_button_click(dev, BTN_LEFT, 0);
-	litest_button_click(dev, BTN_RIGHT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
 	libinput_dispatch(li);
 
 	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -1);
@@ -1525,16 +1531,16 @@ START_TEST(middlebutton)
 	litest_drain_events(li);
 
 	for (i = 0; i < ARRAY_LENGTH(btn); i++) {
-		litest_button_click(device, btn[i][0], true);
-		litest_button_click(device, btn[i][1], true);
+		litest_button_click_debounced(device, li, btn[i][0], true);
+		litest_button_click_debounced(device, li, btn[i][1], true);
 
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 		litest_assert_empty_queue(li);
 
-		litest_button_click(device, btn[i][2], false);
-		litest_button_click(device, btn[i][3], false);
+		litest_button_click_debounced(device, li, btn[i][2], false);
+		litest_button_click_debounced(device, li, btn[i][3], false);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
@@ -1568,33 +1574,33 @@ START_TEST(middlebutton_nostart_while_down)
 	if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
 		return;
 
-	litest_button_click(device, BTN_MIDDLE, true);
+	litest_button_click_debounced(device, li, BTN_MIDDLE, true);
 	litest_drain_events(li);
 
 	for (i = 0; i < ARRAY_LENGTH(btn); i++) {
-		litest_button_click(device, btn[i][0], true);
+		litest_button_click_debounced(device, li, btn[i][0], true);
 		litest_assert_button_event(li,
 					   btn[i][0],
 					   LIBINPUT_BUTTON_STATE_PRESSED);
-		litest_button_click(device, btn[i][1], true);
+		litest_button_click_debounced(device, li, btn[i][1], true);
 		litest_assert_button_event(li,
 					   btn[i][1],
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 
 		litest_assert_empty_queue(li);
 
-		litest_button_click(device, btn[i][2], false);
+		litest_button_click_debounced(device, li, btn[i][2], false);
 		litest_assert_button_event(li,
 					   btn[i][2],
 					   LIBINPUT_BUTTON_STATE_RELEASED);
-		litest_button_click(device, btn[i][3], false);
+		litest_button_click_debounced(device, li, btn[i][3], false);
 		litest_assert_button_event(li,
 					   btn[i][3],
 					   LIBINPUT_BUTTON_STATE_RELEASED);
 		litest_assert_empty_queue(li);
 	}
 
-	litest_button_click(device, BTN_MIDDLE, false);
+	litest_button_click_debounced(device, li, BTN_MIDDLE, false);
 	litest_drain_events(li);
 }
 END_TEST
@@ -1616,7 +1622,7 @@ START_TEST(middlebutton_timeout)
 
 	for (button = BTN_LEFT; button <= BTN_RIGHT; button++) {
 		litest_drain_events(li);
-		litest_button_click(device, button, true);
+		litest_button_click_debounced(device, li, button, true);
 		litest_assert_empty_queue(li);
 		litest_timeout_middlebutton();
 
@@ -1624,7 +1630,7 @@ START_TEST(middlebutton_timeout)
 					   button,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 
-		litest_button_click(device, button, false);
+		litest_button_click_debounced(device, li, button, false);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
@@ -1657,22 +1663,22 @@ START_TEST(middlebutton_doubleclick)
 	litest_drain_events(li);
 
 	for (i = 0; i < ARRAY_LENGTH(btn); i++) {
-		litest_button_click(device, btn[i][0], true);
-		litest_button_click(device, btn[i][1], true);
+		litest_button_click_debounced(device, li, btn[i][0], true);
+		litest_button_click_debounced(device, li, btn[i][1], true);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 		litest_assert_empty_queue(li);
 
-		litest_button_click(device, btn[i][2], false);
-		litest_button_click(device, btn[i][2], true);
+		litest_button_click_debounced(device, li, btn[i][2], false);
+		litest_button_click_debounced(device, li, btn[i][2], true);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
-		litest_button_click(device, btn[i][3], false);
+		litest_button_click_debounced(device, li, btn[i][3], false);
 
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
@@ -1705,8 +1711,8 @@ START_TEST(middlebutton_middleclick)
 	for (button = BTN_LEFT; button <= BTN_RIGHT; button++) {
 		/* release button before middle */
 		litest_drain_events(li);
-		litest_button_click(device, button, true);
-		litest_button_click(device, BTN_MIDDLE, true);
+		litest_button_click_debounced(device, li, button, true);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, true);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
@@ -1714,19 +1720,19 @@ START_TEST(middlebutton_middleclick)
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 		litest_assert_empty_queue(li);
-		litest_button_click(device, button, false);
+		litest_button_click_debounced(device, li, button, false);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
-		litest_button_click(device, BTN_MIDDLE, false);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, false);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
 		litest_assert_empty_queue(li);
 
 		/* release middle before button */
-		litest_button_click(device, button, true);
-		litest_button_click(device, BTN_MIDDLE, true);
+		litest_button_click_debounced(device, li, button, true);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, true);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
@@ -1734,11 +1740,11 @@ START_TEST(middlebutton_middleclick)
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 		litest_assert_empty_queue(li);
-		litest_button_click(device, BTN_MIDDLE, false);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, false);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
-		litest_button_click(device, button, false);
+		litest_button_click_debounced(device, li, button, false);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
@@ -1770,14 +1776,14 @@ START_TEST(middlebutton_middleclick_during)
 
 	/* trigger emulation, then real middle */
 	for (button = BTN_LEFT; button <= BTN_RIGHT; button++) {
-		litest_button_click(device, BTN_LEFT, true);
-		litest_button_click(device, BTN_RIGHT, true);
+		litest_button_click_debounced(device, li, BTN_LEFT, true);
+		litest_button_click_debounced(device, li, BTN_RIGHT, true);
 
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 
-		litest_button_click(device, BTN_MIDDLE, true);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, true);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
@@ -1788,23 +1794,23 @@ START_TEST(middlebutton_middleclick_during)
 		litest_assert_empty_queue(li);
 
 		/* middle still down, release left/right */
-		litest_button_click(device, button, false);
+		litest_button_click_debounced(device, li, button, false);
 		litest_assert_empty_queue(li);
-		litest_button_click(device, button, true);
+		litest_button_click_debounced(device, li, button, true);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_PRESSED);
 		litest_assert_empty_queue(li);
 
 		/* release both */
-		litest_button_click(device, BTN_LEFT, false);
-		litest_button_click(device, BTN_RIGHT, false);
+		litest_button_click_debounced(device, li, BTN_LEFT, false);
+		litest_button_click_debounced(device, li, BTN_RIGHT, false);
 		litest_assert_button_event(li,
 					   button,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
 		litest_assert_empty_queue(li);
 
-		litest_button_click(device, BTN_MIDDLE, false);
+		litest_button_click_debounced(device, li, BTN_MIDDLE, false);
 		litest_assert_button_event(li,
 					   BTN_MIDDLE,
 					   LIBINPUT_BUTTON_STATE_RELEASED);
diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c
index 9f38e833..d7da7f1b 100644
--- a/test/test-touchpad-buttons.c
+++ b/test/test-touchpad-buttons.c
@@ -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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, false);
 	litest_touch_up(dev, 0);
 
 	litest_assert_button_event(li,
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index 6fc3c4f6..cd2f3e63 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -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(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
-	litest_button_click(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, BTN_LEFT, false);
 	libinput_dispatch(li);
 
 	litest_assert_button_event(li, BTN_LEFT,
diff --git a/test/test-touchpad.c b/test/test-touchpad.c
index 895de1f6..638d0b85 100644
--- a/test/test-touchpad.c
+++ b/test/test-touchpad.c
@@ -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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_RIGHT, 1);
-	litest_button_click(dev, BTN_RIGHT, 0);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_MIDDLE, 1);
-		litest_button_click(dev, BTN_MIDDLE, 0);
+		litest_button_click_debounced(dev, li, BTN_MIDDLE, 1);
+		litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_RIGHT, 1);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
 	libinput_dispatch(li);
 	litest_timeout_middlebutton();
 	libinput_dispatch(li);
-	litest_button_click(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_RIGHT, 0);
-	litest_button_click(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_RIGHT, 0);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 1);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, 0);
+	litest_button_click_debounced(dev, li, BTN_LEFT, 0);
 	litest_touch_up(dev, 0);
 
 	litest_assert_button_event(li,
@@ -2657,12 +2657,12 @@ START_TEST(touchpad_trackpoint_buttons)
 	litest_drain_events(li);
 
 	ARRAY_FOR_EACH(buttons, b) {
-		litest_button_click(touchpad, b->device_value, true);
+		litest_button_click_debounced(touchpad, li, b->device_value, true);
 		assert_btnevent_from_device(trackpoint,
 					    b->real_value,
 					    LIBINPUT_BUTTON_STATE_PRESSED);
 
-		litest_button_click(touchpad, b->device_value, false);
+		litest_button_click_debounced(touchpad, li, b->device_value, false);
 
 		assert_btnevent_from_device(trackpoint,
 					    b->real_value,
@@ -2683,7 +2683,7 @@ START_TEST(touchpad_trackpoint_mb_scroll)
 				       LITEST_TRACKPOINT);
 
 	litest_drain_events(li);
-	litest_button_click(touchpad, BTN_2, true); /* middle */
+	litest_button_click_debounced(touchpad, li, 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(touchpad, BTN_2, false);
+	litest_button_click_debounced(touchpad, li, BTN_2, false);
 
 	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
 
@@ -2718,8 +2718,8 @@ START_TEST(touchpad_trackpoint_mb_click)
 	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
 
 	litest_drain_events(li);
-	litest_button_click(touchpad, BTN_2, true); /* middle */
-	litest_button_click(touchpad, BTN_2, false);
+	litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */
+	litest_button_click_debounced(touchpad, li, BTN_2, false);
 
 	assert_btnevent_from_device(trackpoint,
 				    BTN_MIDDLE,
@@ -2743,11 +2743,11 @@ START_TEST(touchpad_trackpoint_buttons_softbuttons)
 	litest_drain_events(li);
 
 	litest_touch_down(touchpad, 0, 95, 90);
-	litest_button_click(touchpad, BTN_LEFT, true);
-	litest_button_click(touchpad, BTN_1, true);
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, BTN_1, true);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
 	litest_touch_up(touchpad, 0);
-	litest_button_click(touchpad, BTN_1, false);
+	litest_button_click_debounced(touchpad, li, BTN_1, false);
 
 	assert_btnevent_from_device(touchpad,
 				    BTN_RIGHT,
@@ -2763,10 +2763,10 @@ START_TEST(touchpad_trackpoint_buttons_softbuttons)
 				    LIBINPUT_BUTTON_STATE_RELEASED);
 
 	litest_touch_down(touchpad, 0, 95, 90);
-	litest_button_click(touchpad, BTN_LEFT, true);
-	litest_button_click(touchpad, BTN_1, true);
-	litest_button_click(touchpad, BTN_1, false);
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, BTN_1, true);
+	litest_button_click_debounced(touchpad, li, BTN_1, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
 	litest_touch_up(touchpad, 0);
 
 	assert_btnevent_from_device(touchpad,
@@ -2818,7 +2818,7 @@ START_TEST(touchpad_trackpoint_buttons_2fg_scroll)
 		libinput_event_destroy(e);
 	}
 
-	litest_button_click(touchpad, BTN_1, true);
+	litest_button_click_debounced(touchpad, li, BTN_1, true);
 	assert_btnevent_from_device(trackpoint,
 				    BTN_RIGHT,
 				    LIBINPUT_BUTTON_STATE_PRESSED);
@@ -2838,7 +2838,7 @@ START_TEST(touchpad_trackpoint_buttons_2fg_scroll)
 		libinput_event_destroy(e);
 	}
 
-	litest_button_click(touchpad, BTN_1, false);
+	litest_button_click_debounced(touchpad, li, BTN_1, false);
 	assert_btnevent_from_device(trackpoint,
 				    BTN_RIGHT,
 				    LIBINPUT_BUTTON_STATE_RELEASED);
@@ -2874,16 +2874,16 @@ START_TEST(touchpad_trackpoint_no_trackpoint)
 	struct libinput *li = touchpad->libinput;
 
 	litest_drain_events(li);
-	litest_button_click(touchpad, BTN_0, true); /* left */
-	litest_button_click(touchpad, BTN_0, false);
+	litest_button_click_debounced(touchpad, li, BTN_0, true); /* left */
+	litest_button_click_debounced(touchpad, li, BTN_0, false);
 	litest_assert_empty_queue(li);
 
-	litest_button_click(touchpad, BTN_1, true); /* right */
-	litest_button_click(touchpad, BTN_1, false);
+	litest_button_click_debounced(touchpad, li, BTN_1, true); /* right */
+	litest_button_click_debounced(touchpad, li, BTN_1, false);
 	litest_assert_empty_queue(li);
 
-	litest_button_click(touchpad, BTN_2, true); /* middle */
-	litest_button_click(touchpad, BTN_2, false);
+	litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */
+	litest_button_click_debounced(touchpad, li, 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(touchpad, BTN_LEFT, true);
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, 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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, false);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, 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(dev, BTN_LEFT, true);
+	litest_button_click_debounced(dev, li, BTN_LEFT, true);
 
 	/* button areas work as usual with a thumb */
 
diff --git a/test/test-trackpoint.c b/test/test-trackpoint.c
index adbd46e8..46a66893 100644
--- a/test/test-trackpoint.c
+++ b/test/test-trackpoint.c
@@ -43,9 +43,9 @@ START_TEST(trackpoint_middlebutton)
 	litest_drain_events(li);
 
 	/* A quick middle button click should get reported normally */
-	litest_button_click(dev, BTN_MIDDLE, 1);
+	litest_button_click_debounced(dev, li, BTN_MIDDLE, 1);
 	msleep(2);
-	litest_button_click(dev, BTN_MIDDLE, 0);
+	litest_button_click_debounced(dev, li, BTN_MIDDLE, 0);
 
 	litest_wait_for_event(li);
 
@@ -173,7 +173,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
 
 	litest_touch_down(touchpad, 0, 5, 5);
 	libinput_dispatch(li);
-	litest_button_click(touchpad, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
 	libinput_dispatch(li);
 
 	event = libinput_get_event(li);
@@ -184,7 +184,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
 	ck_assert(device == trackpoint->libinput_device);
 	libinput_event_destroy(event);
 
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
 	libinput_dispatch(li);
 	event = libinput_get_event(li);
 	litest_is_button_event(event,
@@ -216,7 +216,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
 
 	litest_touch_down(touchpad, 0, 5, 5);
 	libinput_dispatch(li);
-	litest_button_click(touchpad, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
 	libinput_dispatch(li);
 
 	event = libinput_get_event(li);
@@ -225,7 +225,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
 	ck_assert(device == trackpoint->libinput_device);
 	libinput_event_destroy(event);
 
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
 	libinput_dispatch(li);
 	event = libinput_get_event(li);
 	litest_is_button_event(event,
@@ -260,7 +260,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
 
 	litest_touch_down(touchpad, 0, 5, 5);
 	libinput_dispatch(li);
-	litest_button_click(touchpad, BTN_LEFT, true);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, true);
 	libinput_dispatch(li);
 
 	event = libinput_get_event(li);
@@ -271,7 +271,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
 	ck_assert(device == trackpoint->libinput_device);
 	libinput_event_destroy(event);
 
-	litest_button_click(touchpad, BTN_LEFT, false);
+	litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
 	libinput_dispatch(li);
 	event = libinput_get_event(li);
 	litest_is_button_event(event,
-- 
2.13.6



More information about the wayland-devel mailing list