From 7c8cecdb022b7c29890c84f3bab89149348d3309 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 11 Jan 2017 14:48:11 +1000 Subject: [PATCH] test: add two more touch..._extended functions So we can set pressure during touch sequences Signed-off-by: Peter Hutterer --- test/litest.c | 22 ++++++++++++++++++++++ test/litest.h | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/test/litest.c b/test/litest.c index b3e7ba3d..1bb18dde 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1643,6 +1643,28 @@ litest_touch_move_to(struct litest_device *d, litest_touch_move(d, slot, x_to, y_to); } +void +litest_touch_move_to_extended(struct litest_device *d, + unsigned int slot, + double x_from, double y_from, + double x_to, double y_to, + struct axis_replacement *axes, + int steps, int sleep_ms) +{ + for (int i = 1; i < steps - 1; i++) { + litest_touch_move_extended(d, slot, + x_from + (x_to - x_from)/steps * i, + y_from + (y_to - y_from)/steps * i, + axes); + if (sleep_ms) { + libinput_dispatch(d->libinput); + msleep(sleep_ms); + libinput_dispatch(d->libinput); + } + } + litest_touch_move_extended(d, slot, x_to, y_to, axes); +} + static int auto_assign_tablet_value(struct litest_device *d, const struct input_event *ev, diff --git a/test/litest.h b/test/litest.h index e6d35a90..886337ba 100644 --- a/test/litest.h +++ b/test/litest.h @@ -437,6 +437,14 @@ litest_touch_move_to(struct litest_device *d, double x_to, double y_to, int steps, int sleep_ms); +void +litest_touch_move_to_extended(struct litest_device *d, + unsigned int slot, + double x_from, double y_from, + double x_to, double y_to, + struct axis_replacement *axes, + int steps, int sleep_ms); + void litest_touch_move_two_touches(struct litest_device *d, double x0, double y0,