[PATCH libinput 3/5] test: adjust the movement size for edge scroll timeout testing

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 20 22:28:38 PDT 2015


The goal of this test is to make sure that the deltas are less than 5, which
is the scroll trigger for movement-based edge scrolling. The litest suite
takes percentages of the device, so use a scale factor to change how far we
move on the tablet. The wacom tablet is 141mm, the movement must be smaller to
provide small-enough deltas.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/touchpad.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/touchpad.c b/test/touchpad.c
index aef8e1e..8a8203c 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -2698,6 +2698,18 @@ START_TEST(touchpad_edge_scroll_timeout)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_pointer *ptrev;
+	double width = 0, height = 0;
+	int y_movement = 30; /* in percent of height */
+
+	/* account for different touchpad heights, let's move 100% on a 15mm
+	   high touchpad, less on anything else. This number is picked at
+	   random, we just want deltas less than 5.
+	   */
+	if (libinput_device_get_size(dev->libinput_device,
+				     &width,
+				     &height) != -1) {
+		y_movement = 100 * 15/height;
+	}
 
 	litest_drain_events(li);
 	enable_edge_scroll(dev);
@@ -2707,7 +2719,7 @@ START_TEST(touchpad_edge_scroll_timeout)
 	litest_timeout_edgescroll();
 	libinput_dispatch(li);
 
-	litest_touch_move_to(dev, 0, 99, 20, 99, 80, 60, 10);
+	litest_touch_move_to(dev, 0, 99, 20, 99, 20 + y_movement, 60, 10);
 	litest_touch_up(dev, 0);
 	libinput_dispatch(li);
 
-- 
2.3.5



More information about the wayland-devel mailing list