diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-03-27 10:44:23 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-04-29 12:52:00 +1000 |
commit | 0aa152792d7054c7dcce588b1553ade2d9925cda (patch) | |
tree | 61e55e845b2bb01109fe113e70989d5c67354f91 | |
parent | 86a8fdf4d73ef766de286314b8f22f896900127f (diff) |
input/evdev: test for XI_TRACKBALL labelling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | recordings/mice/Logitech-USB-Trackball.desc | 42 | ||||
-rw-r--r-- | tests/input/evdev.cpp | 41 |
2 files changed, 83 insertions, 0 deletions
diff --git a/recordings/mice/Logitech-USB-Trackball.desc b/recordings/mice/Logitech-USB-Trackball.desc new file mode 100644 index 0000000..eeae44d --- /dev/null +++ b/recordings/mice/Logitech-USB-Trackball.desc @@ -0,0 +1,42 @@ +# standard USB mouse +# Input driver version is 1.0.1 +# Input device ID: bus 0x3 vendor 0x46d product 0xc408 version 0x110 +# Input device name: "Logitech USB Trackball" +# Supported events: +# Event type 0 (EV_SYN) +# Event type 1 (EV_KEY) +# Event code 272 (BTN_LEFT) +# Event code 273 (BTN_RIGHT) +# Event code 274 (BTN_MIDDLE) +# Event code 275 (BTN_SIDE) +# Event code 276 (BTN_EXTRA) +# Event type 2 (EV_REL) +# Event code 0 (REL_X) +# Event code 1 (REL_Y) +# Event type 4 (EV_MSC) +# Event code 4 (MSC_SCAN) +# +N: Logitech USB Trackball +I: 0003 046d c408 0110 +P: 00 00 00 00 00 00 00 00 +B: 00 17 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 1f 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 01 00 00 00 00 00 00 00 00 +B: 02 03 00 00 00 00 00 00 00 +B: 03 00 00 00 00 00 00 00 00 +B: 04 10 00 00 00 00 00 00 00 +B: 05 00 00 00 00 00 00 00 00 +B: 11 00 00 00 00 00 00 00 00 +B: 12 00 00 00 00 00 00 00 00 +B: 15 00 00 00 00 00 00 00 00 +B: 15 00 00 00 00 00 00 00 00 diff --git a/tests/input/evdev.cpp b/tests/input/evdev.cpp index 816274e..b9d242c 100644 --- a/tests/input/evdev.cpp +++ b/tests/input/evdev.cpp @@ -837,6 +837,47 @@ INSTANTIATE_TEST_CASE_P(, EvdevInvalidButtonMappingTest, ::testing::Values(" ", "a", "64", "1 2 ", "-1", "1 a", "1 55", "1 -2")); +class EvdevTrackballTest : public EvdevMouseTest { + virtual void SetUp() { + SetDevice("mice/Logitech-USB-Trackball.desc"); + XITServerInputTest::SetUp(); + } + + virtual void SetUpConfigAndLog() { + config.AddDefaultScreenWithDriver(); + config.AddInputSection("evdev", "Logitech USB Trackball", + "Option \"Floating\" \"on\"\n" + "Option \"GrabDevice\" \"on\"" + "Option \"TypeName\" \"TRACKBALL\"" + "Option \"Device\" \"" + dev->GetDeviceNode() + "\""); + config.WriteConfig(); + } +}; + +TEST_F(EvdevTrackballTest, TypeIsXI_TRACKBALL) +{ + XORG_TESTCASE("A trackball should be of type XI_TRACKBALL.\n" + "https://bugs.freedesktop.org/show_bug.cgi?id=55867"); + + ::Display *dpy = Display(); + + Atom trackball_prop = XInternAtom(dpy, XI_TRACKBALL, True); + ASSERT_NE(trackball_prop, (Atom)None); + + int ndevices; + XDeviceInfo *info = XListInputDevices(dpy, &ndevices); + + for (int i = 0; i < ndevices; i++) { + XDeviceInfo *di = &info[i]; + if (strcmp(di->name, "Logitech USB Trackball") == 0) { + ASSERT_EQ(di->type, trackball_prop); + return; + } + } + + FAIL() << "Failed to find device"; +} + class EvdevJoystickTest : public EvdevMouseTest { virtual void SetUp() { SetDevice("joysticks/Sony-PLAYSTATION(R)3-Controller.desc"); |