From 4cdb810bc8cc5106feb04b65403fa186c1f58507 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 21 Apr 2015 14:55:49 +1000 Subject: [PATCH] test: adjust the movement size for edge scroll timeout testing 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 Reviewed-by: Hans de Goede --- test/touchpad.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/touchpad.c b/test/touchpad.c index 2d25a177..88ae2b16 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);