[PATCH libinput 01/11] test: add two more touch..._extended functions

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 30 00:58:37 UTC 2017


So we can set pressure during touch sequences

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest.c | 22 ++++++++++++++++++++++
 test/litest.h |  8 ++++++++
 2 files changed, 30 insertions(+)

diff --git a/test/litest.c b/test/litest.c
index b3e7ba3..1bb18dd 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 e6d35a9..886337b 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -438,6 +438,14 @@ litest_touch_move_to(struct litest_device *d,
 		     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,
 			      double x1, double y1,
-- 
2.9.3



More information about the wayland-devel mailing list