summaryrefslogtreecommitdiff
path: root/test/litest-device-wacom-intuos3-pad.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-09-21 09:25:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-09-21 15:06:17 +1000
commit2346801b0e296e936cb383738ee88b76dfdad46c (patch)
tree29c600649393ac48ef20f0aa05fdf5d23ac23e51 /test/litest-device-wacom-intuos3-pad.c
parent5516e9ea74fad1fce35b151f4053114727544760 (diff)
downloadlibinput-2346801b0e296e936cb383738ee88b76dfdad46c.tar.gz
test: switch to a TEST_DEVICE macro for all the litest test devices
The test device initialization code was a bit of duplicated boilerplate and required adding a reference to the devices to the 'devices' list in litest.c. Automate this with a new TEST_DEVICE macro that adds the devices to a custom section in the binary, then loops throught that section to get the device out. This reduces the boilerplate for each test device to just the TEST_MACRO and the LITEST_foo device enum entry. It also now automates the shortname of the device. The device's shortname was standardised in this approach as well, lowercase and dashes only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/litest-device-wacom-intuos3-pad.c')
-rw-r--r--test/litest-device-wacom-intuos3-pad.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/test/litest-device-wacom-intuos3-pad.c b/test/litest-device-wacom-intuos3-pad.c
index d971c1b1..5e3569fa 100644
--- a/test/litest-device-wacom-intuos3-pad.c
+++ b/test/litest-device-wacom-intuos3-pad.c
@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
-static void
-litest_wacom_intuos3_pad_setup(void)
-{
- struct litest_device *d = litest_create_device(LITEST_WACOM_INTUOS3_PAD);
- litest_set_current_device(d);
-}
-
static struct input_event down[] = {
{ .type = -1, .code = -1 },
};
@@ -101,11 +94,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"pad_end\"";
-struct litest_test_device litest_wacom_intuos3_pad_device = {
+TEST_DEVICE("wacom-intuos3-pad",
.type = LITEST_WACOM_INTUOS3_PAD,
.features = LITEST_TABLET_PAD | LITEST_STRIP,
- .shortname = "wacom-intuos3-pad",
- .setup = litest_wacom_intuos3_pad_setup,
.interface = &interface,
.name = "Wacom Intuos3 4x6 Pad",
@@ -113,4 +104,4 @@ struct litest_test_device litest_wacom_intuos3_pad_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
-};
+)