test: re-use code in litest_touch_move_to()
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 27 Aug 2018 03:26:04 +0000 (13:26 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 27 Aug 2018 07:21:01 +0000 (17:21 +1000)
We can use the _extended version here. And it turns out the behavior was
slightly different, with the _extended version doing one step too few.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/litest.c

index 5fa4bfbe3a216f8d99354df0356bb38efe175edb..3bcbde9a2227f0d175252cce4a8da41e17194feb 100644 (file)
@@ -1994,17 +1994,11 @@ litest_touch_move_to(struct litest_device *d,
                     double x_to, double y_to,
                     int steps, int sleep_ms)
 {
-       for (int i = 1; i < steps; i++) {
-               litest_touch_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);
-               }
-       }
-       litest_touch_move(d, slot, x_to, y_to);
+       litest_touch_move_to_extended(d, slot,
+                                     x_from, y_from,
+                                     x_to, y_to,
+                                     NULL,
+                                     steps, sleep_ms);
 }
 
 void
@@ -2015,7 +2009,7 @@ litest_touch_move_to_extended(struct litest_device *d,
                              struct axis_replacement *axes,
                              int steps, int sleep_ms)
 {
-       for (int i = 1; i < steps - 1; i++) {
+       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,