summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-12-11 16:16:18 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-12-11 16:16:18 +1000
commit63291f573a699479044200c35c3bb89c27667d48 (patch)
tree630070c2722eaca20532ff516b36d71aa985ab1e
parentd56558d48926825d5b477716d9824458f8ae15dd (diff)
server/barriers: check deviceid/sourceid
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tests/server/barriers-notify.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp
index 7aaf252..8ad485a 100644
--- a/tests/server/barriers-notify.cpp
+++ b/tests/server/barriers-notify.cpp
@@ -304,6 +304,9 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
+ int deviceid;
+
+ ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &deviceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -329,6 +332,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -353,6 +358,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -370,6 +377,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -387,6 +396,9 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
+ int deviceid;
+
+ ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &deviceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -413,6 +425,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -429,6 +443,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -445,6 +461,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -461,6 +479,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -479,6 +499,9 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient)
XSynchronize(dpy, True);
XSynchronize(dpy2, True);
Window root = DefaultRootWindow(dpy);
+ int deviceid;
+
+ ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &deviceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -506,6 +529,8 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -532,6 +557,9 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
+ int deviceid;
+
+ ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &deviceid)) << "Failed to find device.";
XIGrabModifiers mods = { (int)XIAnyModifier, 0 };
@@ -561,6 +589,8 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
@@ -596,6 +626,8 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
@@ -616,6 +648,8 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
ASSERT_EQ(hit.ev->barrier, barrier);
ASSERT_EQ(hit.ev->root_x, 20);
ASSERT_EQ(hit.ev->root_y, 30);
+ ASSERT_EQ(hit.ev->deviceid, VIRTUAL_CORE_POINTER_ID);
+ ASSERT_EQ(hit.ev->sourceid, deviceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);