[PATCH libinput 1/8] test: make the mouse tool a litest feature bit

Peter Hutterer peter.hutterer at who-t.net
Wed Feb 7 01:44:59 UTC 2018


Aiptek tablets have the BTN_TOOL_MOUSE|LENS bits but don't actually have a
mouse, at least not in libinput (see future patches). Turns out we only have
one device that really has the tool anyway, so not running the tests for the
others seems sensible.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest-device-wacom-intuos5-pen.c |  2 +-
 test/litest.h                          |  1 +
 test/test-tablet.c                     | 63 +++++-----------------------------
 3 files changed, 11 insertions(+), 55 deletions(-)

diff --git a/test/litest-device-wacom-intuos5-pen.c b/test/litest-device-wacom-intuos5-pen.c
index 3d834322..3df2b14f 100644
--- a/test/litest-device-wacom-intuos5-pen.c
+++ b/test/litest-device-wacom-intuos5-pen.c
@@ -153,7 +153,7 @@ static const char udev_rule[] =
 
 TEST_DEVICE("wacom-intuos-tablet",
 	.type = LITEST_WACOM_INTUOS,
-	.features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT,
+	.features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT | LITEST_TOOL_MOUSE,
 	.interface = &interface,
 
 	.name = "Wacom Intuos5 touch M Pen",
diff --git a/test/litest.h b/test/litest.h
index faa469c0..c048e303 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -303,6 +303,7 @@ enum litest_device_feature {
 	LITEST_LEDS = 1 << 25,
 	LITEST_SWITCH = 1 << 26,
 	LITEST_IGNORED = 1 << 27,
+	LITEST_TOOL_MOUSE = 1 << 28,
 };
 
 /* this is a semi-mt device, so we keep track of the touches that the tests
diff --git a/test/test-tablet.c b/test/test-tablet.c
index b32aaad6..12ea3ec5 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -1127,11 +1127,6 @@ START_TEST(proximity_range_enter)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_push_event_frame(dev);
@@ -1167,11 +1162,6 @@ START_TEST(proximity_range_in_out)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_push_event_frame(dev);
@@ -1213,11 +1203,6 @@ START_TEST(proximity_range_button_click)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_push_event_frame(dev);
@@ -1247,11 +1232,6 @@ START_TEST(proximity_range_button_press)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_push_event_frame(dev);
 	litest_tablet_proximity_in(dev, 10, 10, axes);
 	litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
@@ -1295,11 +1275,6 @@ START_TEST(proximity_range_button_release)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_push_event_frame(dev);
 	litest_tablet_proximity_in(dev, 10, 10, axes);
 	litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
@@ -1655,11 +1630,6 @@ START_TEST(left_handed_mouse_rotation)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
 	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
 
@@ -2560,11 +2530,6 @@ START_TEST(mouse_tool)
 	struct libinput_event_tablet_tool *tev;
 	struct libinput_tablet_tool *tool;
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
@@ -2593,11 +2558,6 @@ START_TEST(mouse_buttons)
 	struct libinput_tablet_tool *tool;
 	int code;
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
@@ -2659,11 +2619,6 @@ START_TEST(mouse_rotation)
 		{ -1, -1 }
 	};
 
-	if (!libevdev_has_event_code(dev->evdev,
-				    EV_KEY,
-				    BTN_TOOL_MOUSE))
-		return;
-
 	litest_drain_events(li);
 
 	litest_push_event_frame(dev);
@@ -4556,11 +4511,11 @@ litest_setup_tests_tablet(void)
 	litest_add("tablet:proximity", proximity_out_button_up, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:proximity", proximity_has_axes, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:proximity", bad_distance_events, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-	litest_add("tablet:proximity", proximity_range_enter, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-	litest_add("tablet:proximity", proximity_range_in_out, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-	litest_add("tablet:proximity", proximity_range_button_click, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-	litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-	litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
+	litest_add("tablet:proximity", proximity_range_enter, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:proximity", proximity_range_in_out, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:proximity", proximity_range_button_click, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
 	litest_add("tablet:button", button_down_up, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:button", button_seat_count, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:tip", tip_down_up, LITEST_TABLET, LITEST_ANY);
@@ -4586,10 +4541,10 @@ litest_setup_tests_tablet(void)
 	litest_add_for_device("tablet:left_handed", left_handed_artpen_rotation, LITEST_WACOM_INTUOS);
 	litest_add_for_device("tablet:left_handed", no_left_handed, LITEST_WACOM_CINTIQ);
 	litest_add("tablet:pad", pad_buttons_ignored, LITEST_TABLET, LITEST_ANY);
-	litest_add("tablet:mouse", mouse_tool, LITEST_TABLET, LITEST_ANY);
-	litest_add("tablet:mouse", mouse_buttons, LITEST_TABLET, LITEST_ANY);
-	litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET, LITEST_ANY);
-	litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET, LITEST_WHEEL);
+	litest_add("tablet:mouse", mouse_tool, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:mouse", mouse_buttons, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
+	litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_WHEEL);
 	litest_add("tablet:airbrush", airbrush_tool, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:airbrush", airbrush_slider, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:artpen", artpen_tool, LITEST_TABLET, LITEST_ANY);
-- 
2.14.3



More information about the wayland-devel mailing list