summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-07-22 13:54:43 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-07-22 13:54:43 +1000
commitf695fc7a1bcd8e4f2662e8b376e6efe21e9dbe1c (patch)
treed982ad93984fea2c27369bff95350e554814724a
parent96e6f9fc52ed280b78029a409fc6a8abf363f838 (diff)
server/input: add test for XI 1.x valuator 1 data
Server had a bug that didn't fill in that data correctly for missing valuators between first and num_valuators. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tests/server/input.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/server/input.cpp b/tests/server/input.cpp
index 0acd402..5ed96b5 100644
--- a/tests/server/input.cpp
+++ b/tests/server/input.cpp
@@ -71,6 +71,73 @@ public:
}
};
+class TabletMotionTest : public PointerMotionTest
+{
+ virtual void SetUp() {
+ SetDevice("tablets/Wacom-Intuos4-6x9.desc");
+ XITServerInputTest::SetUp();
+ }
+
+ virtual void SetUpConfigAndLog() {
+ config.AddDefaultScreenWithDriver();
+ /* need the wacom driver for this */
+ config.AddInputSection("wacom", "--device--",
+ "Option \"CorePointer\" \"on\"\n"
+ "Option \"GrabDevice\" \"on\"\n"
+ "Option \"Type\" \"stylus\"\n"
+ "Option \"Device\" \"" + dev->GetDeviceNode() + "\"");
+ /* add default keyboard device to avoid server adding our device again */
+ config.AddInputSection("kbd", "kbd-device",
+ "Option \"CoreKeyboard\" \"on\"\n");
+ config.WriteConfig();
+ }
+};
+
+TEST_F(TabletMotionTest, MissingValuator1InEvent)
+{
+ XORG_TESTCASE("Create tablet device\n"
+ "Register for XI 1.x motion events\n"
+ "Move tablet's x and pressure axis, leave y umodified\n"
+ "Ensure that valuator 1 is set correctly in XI event\n");
+
+ ::Display *dpy = Display();
+
+ int deviceid;
+ ASSERT_EQ(FindInputDeviceByName(dpy, "--device--", &deviceid), 1);
+
+ dev->PlayOne(EV_ABS, ABS_X, 1000);
+ dev->PlayOne(EV_ABS, ABS_Y, 1000);
+ dev->PlayOne(EV_ABS, ABS_PRESSURE, 56);
+ dev->PlayOne(EV_ABS, ABS_DISTANCE, 0);
+ dev->PlayOne(EV_KEY, BTN_TOOL_PEN, 1, true);
+
+ XDevice *xdev = XOpenDevice(dpy, deviceid);
+ ASSERT_TRUE(xdev);
+
+ XSetDeviceMode(dpy, xdev, Relative);
+
+ int motion_type;
+ XEventClass evclass;
+ DeviceMotionNotify(xdev, motion_type, evclass);
+ XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), &evclass, 1);
+
+ dev->PlayOne(EV_ABS, ABS_X, 5000);
+ dev->PlayOne(EV_ABS, ABS_Y, 1000);
+ dev->PlayOne(EV_ABS, ABS_PRESSURE, 200);
+ dev->PlayOne(EV_ABS, ABS_DISTANCE, 0);
+ dev->PlayOne(EV_KEY, BTN_TOOL_PEN, 1, true);
+
+ ASSERT_EVENT(XEvent, motion, dpy, motion_type);
+ XDeviceMotionEvent *m = reinterpret_cast<XDeviceMotionEvent*>(motion);
+ ASSERT_EQ(m->first_axis, 0);
+ ASSERT_EQ(m->axes_count, 6);
+ ASSERT_GT(m->axis_data[0], 1000);
+ ASSERT_EQ(m->axis_data[1], 1000);
+ ASSERT_GT(m->axis_data[2], 56);
+
+ XCloseDevice(dpy, xdev);
+}
+
#ifdef HAVE_XI22
enum scoll_direction {
VSCROLL_UP = 4,