[PATCH libinput 07/14] test: run pinch gesture tests for 2-slot touchpads

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 7 20:11:11 PST 2016


Some of the 2-slot touchpads don't do gestures though (e.g. semi-mt) so skip
those.

And change the movement granularity for the pinch and spread tests so we stay
under one degree angle for lower-resolution touchpads too.

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

diff --git a/test/gestures.c b/test/gestures.c
index 71c8fd3..eb2ad81 100644
--- a/test/gestures.c
+++ b/test/gestures.c
@@ -179,7 +179,9 @@ START_TEST(gestures_pinch)
 		{ -30, 30 },
 	};
 
-	if (libevdev_get_num_slots(dev->evdev) < 3)
+	if (libevdev_get_num_slots(dev->evdev) < 2 ||
+	    !libinput_device_has_capability(dev->libinput_device,
+					    LIBINPUT_DEVICE_CAP_GESTURE))
 		return;
 
 	dir_x = cardinals[cardinal][0];
@@ -194,13 +196,13 @@ START_TEST(gestures_pinch)
 	for (i = 0; i < 8; i++) {
 		litest_push_event_frame(dev);
 		if (dir_x > 0.0)
-			dir_x -= 3;
+			dir_x -= 2;
 		else if (dir_x < 0.0)
-			dir_x += 3;
+			dir_x += 2;
 		if (dir_y > 0.0)
-			dir_y -= 3;
+			dir_y -= 2;
 		else if (dir_y < 0.0)
-			dir_y += 3;
+			dir_y += 2;
 		litest_touch_move(dev,
 				  0,
 				  50 + dir_x,
@@ -268,17 +270,19 @@ START_TEST(gestures_spread)
 	double scale, oldscale;
 	double angle;
 	int cardinals[8][2] = {
-		{ 0, 1 },
-		{ 1, 1 },
-		{ 1, 0 },
-		{ 1, -1 },
-		{ 0, -1 },
-		{ -1, -1 },
-		{ -1, 0 },
-		{ -1, 1 },
+		{ 0, 30 },
+		{ 30, 30 },
+		{ 30, 0 },
+		{ 30, -30 },
+		{ 0, -30 },
+		{ -30, -30 },
+		{ -30, 0 },
+		{ -30, 30 },
 	};
 
-	if (libevdev_get_num_slots(dev->evdev) < 3)
+	if (libevdev_get_num_slots(dev->evdev) < 2 ||
+	    !libinput_device_has_capability(dev->libinput_device,
+					    LIBINPUT_DEVICE_CAP_GESTURE))
 		return;
 
 	dir_x = cardinals[cardinal][0];
-- 
2.5.0



More information about the wayland-devel mailing list