summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-12-12 12:58:40 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-12-13 15:12:44 +1000
commitbb113bd1d3b825136ee903ed398fb7131b1e2c71 (patch)
tree3e6c07094417f91a781b0a0eea00b6b930456bd9
parent1e7b6af41052e633211f9f7366de80fd23828b8d (diff)
test/barriers: update all tests to work on multiple device combinations
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tests/server/barriers-notify.cpp367
1 files changed, 232 insertions, 135 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp
index 85fdba9..db8973e 100644
--- a/tests/server/barriers-notify.cpp
+++ b/tests/server/barriers-notify.cpp
@@ -17,8 +17,55 @@
using namespace xorg::testing::evemu;
-class BarrierNotify : public BarrierDevices {
+enum BarrierDeviceTestCombinations {
+ NO_DEVICE_SPECIFICS, /**< test with no barrier device ID specified */
+ VCP_ONLY, /**< test for VCP, only one MD */
+ TARGET_VCP, /**< test for VCP with two MDs present */
+ TARGET_POINTER2, /**< test for second pointer with two MDs present */
+};
+
+static std::string enum_to_string(enum BarrierDeviceTestCombinations b) {
+ switch(b) {
+ case NO_DEVICE_SPECIFICS: return "NO_DEVICE_SPECIFICS";
+ case VCP_ONLY: return "VCP_ONLY";
+ case TARGET_VCP: return "TARGET_VCP";
+ case TARGET_POINTER2: return "TARGET_POINTER2";
+ }
+
+ ADD_FAILURE() << "Bug. we shouldn't get here.";
+ return "";
+}
+
+class BarrierNotify : public BarrierDevices,
+ public ::testing::WithParamInterface<enum BarrierDeviceTestCombinations> {
public:
+ std::auto_ptr<Device>* target_dev;
+ int ndevices;
+ int deviceid;
+ int sourceid;
+ int *all_deviceids;
+
+ virtual void SetUp(){
+ SetUpDevices();
+ XITServerInputTest::SetUp();
+
+ switch(GetParam()) {
+ case NO_DEVICE_SPECIFICS:
+ case VCP_ONLY:
+ break;
+
+ /* Set up 2 MDs */
+ case TARGET_VCP:
+ case TARGET_POINTER2:
+ ConfigureDevices();
+ break;
+ default:
+ FAIL();
+ break;
+ }
+
+ SetDeviceValues(GetParam());
+ }
virtual void SelectBarrierEvents(::Display *dpy, Window win) {
XIEventMask mask;
@@ -31,6 +78,38 @@ public:
delete[] mask.mask;
XSync(dpy, False);
}
+
+ virtual void SetDeviceValues(enum BarrierDeviceTestCombinations combination)
+ {
+ static int vcpid = VIRTUAL_CORE_POINTER_ID;
+ const char *source_dev;
+ switch(combination) {
+ case NO_DEVICE_SPECIFICS:
+ target_dev = &dev1;
+ deviceid = vcpid;
+ ndevices = 0;
+ all_deviceids = &vcpid;
+ source_dev = "--device1--";
+ break;
+ case TARGET_VCP:
+ case VCP_ONLY:
+ ndevices = 1;
+ deviceid = vcpid;
+ all_deviceids = &vcpid;
+ target_dev = &dev1;
+ source_dev = "--device1--";
+ break;
+ case TARGET_POINTER2:
+ ndevices = 1;
+ deviceid = master_id_2;
+ all_deviceids = &master_id_2;
+ target_dev = &dev2;
+ source_dev = "--device2--";
+ break;
+ }
+
+ ASSERT_TRUE(FindInputDeviceByName(Display(), source_dev, &sourceid)) << "Failed to find device.";
+ }
};
#define ASSERT_PTR_POS(x, y) \
@@ -38,25 +117,26 @@ public:
ASSERT_EQ(x, root_x); \
ASSERT_EQ(y, root_y);
-TEST_F(BarrierNotify, ReceivesNotifyEvents)
+TEST_P(BarrierNotify, ReceivesNotifyEvents)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
+
XORG_TESTCASE("Ensure that we receive BarrierNotify events\n"
"when barriers are hit.\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
PointerBarrier barrier;
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
-
- barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
- XSync(dpy, False);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
+ barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, root);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* Ensure we have a BarrierHit on our hands. */
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -64,31 +144,34 @@ TEST_F(BarrierNotify, ReceivesNotifyEvents)
ASSERT_EQ(barrier, event.ev->barrier);
ASSERT_EQ(20, event.ev->root_x);
ASSERT_EQ(-40, event.ev->dx);
+ ASSERT_EQ(event.ev->deviceid, deviceid);
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, CorrectEventIDs)
+TEST_P(BarrierNotify, CorrectEventIDs)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
+
XORG_TESTCASE("Ensure that barrier event IDs have correct and "
"sequential values, and that multiple chained hits "
"have the same event ID\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
PointerBarrier barrier;
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, root);
- XSync(dpy, False);
/* Ensure we have a bunch of BarrierHits on our hands. */
for (int i = 0; i < 10; i++) {
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* Ensure we have a BarrierHit on our hands. */
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -103,25 +186,26 @@ TEST_F(BarrierNotify, CorrectEventIDs)
/* Move outside the hitbox, and ensure that we
* get a BarrierLeave */
- dev1->PlayOne(EV_REL, REL_X, 20, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, 20, True);
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierLeave);
ASSERT_EQ(barrier, event.ev->barrier);
ASSERT_EQ(1U, event.ev->eventid);
for (int i = 0; i < 10; i++) {
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
+ ASSERT_TRUE(event.ev);
ASSERT_EQ(barrier, event.ev->barrier);
ASSERT_EQ(2U, event.ev->eventid);
}
/* Ensure that we're still inside the hit box. Event ID
* should stay the same on such a minor change. */
- dev1->PlayOne(EV_REL, REL_X, 1, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, 1, True);
for (int i = 0; i < 10; i++) {
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
ASSERT_EQ(barrier, event.ev->barrier);
@@ -131,12 +215,15 @@ TEST_F(BarrierNotify, CorrectEventIDs)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, BarrierReleases)
+
+TEST_P(BarrierNotify, BarrierReleases)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Ensure that releasing barriers works without "
"erroring out and allows pointer movement over "
"the barrier, and that we properly get a "
"XI_BarrierHit with the correct flags.\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
@@ -144,12 +231,12 @@ TEST_F(BarrierNotify, BarrierReleases)
SelectBarrierEvents(dpy, root);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
{
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
ASSERT_TRUE(event.ev);
@@ -158,10 +245,10 @@ TEST_F(BarrierNotify, BarrierReleases)
ASSERT_FALSE((event.ev->flags & XIBarrierPointerReleased));
}
- XIBarrierReleasePointer(dpy, VIRTUAL_CORE_POINTER_ID, barrier, 1);
+ XIBarrierReleasePointer(dpy, deviceid, barrier, 1);
XSync(dpy, False);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* We should have a new event because we exited the hit box */
{
@@ -175,27 +262,29 @@ TEST_F(BarrierNotify, BarrierReleases)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, DestroyWindow)
+TEST_P(BarrierNotify, DestroyWindow)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Create a window.\n"
"Set up a barrier using this window as drawable.\n"
"Select for barrier events.\n"
"Ensure events are received\n"
"Destroy the window.\n"
"Ensure events are not received anymore.\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, win);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* Ensure we have a BarrierHit on our hands. */
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -204,14 +293,14 @@ TEST_F(BarrierNotify, DestroyWindow)
ASSERT_EQ(20, event.ev->root_x);
ASSERT_EQ(-40, event.ev->dx);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XDestroyWindow(dpy, win);
XSync(dpy, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
double x, y;
- QueryPointerPosition(dpy, &x, &y);
+ QueryPointerPosition(dpy, &x, &y, deviceid);
EXPECT_EQ(x, 20);
EXPECT_EQ(y, 30);
@@ -224,27 +313,29 @@ TEST_F(BarrierNotify, DestroyWindow)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, UnmapWindow)
+TEST_P(BarrierNotify, UnmapWindow)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Create a window.\n"
"Set up a barrier using this window as drawable.\n"
"Select for barrier events.\n"
"Ensure events are received\n"
"Unmap the window.\n"
"Ensure events are still received.\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, win);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* Ensure we have a BarrierHit on our hands. */
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -253,14 +344,14 @@ TEST_F(BarrierNotify, UnmapWindow)
ASSERT_EQ(20, event.ev->root_x);
ASSERT_EQ(-40, event.ev->dx);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XUnmapWindow(dpy, win);
XSync(dpy, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
double x, y;
- QueryPointerPosition(dpy, &x, &y);
+ QueryPointerPosition(dpy, &x, &y, deviceid);
EXPECT_EQ(x, 20);
EXPECT_EQ(y, 30);
@@ -272,12 +363,14 @@ TEST_F(BarrierNotify, UnmapWindow)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, EventsDuringActiveGrab)
+TEST_P(BarrierNotify, EventsDuringActiveGrab)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up a pointer barrier.\n"
"Actively grab the pointer.\n"
"Move pointer against barrier.\n"
"Expect events\n");
+ SCOPED_TRACE(enum_to_string(combination));
/* variations
TODO: - core, xi2 (xi1 not needed)
- barrier event masks set in grab mask
@@ -292,11 +385,6 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
- int sourceid;
-
- int deviceid;
-
- ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &sourceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -305,14 +393,14 @@ TEST_F(BarrierNotify, EventsDuringActiveGrab)
unsigned char no_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask no_mask = { XIAllMasterDevices, sizeof (no_mask_bits), no_mask_bits };
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
/* if OE is true and mask is not set, but set on window → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIGrabDevice(dpy, deviceid, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -322,23 +410,23 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
/* if OE is false and mask is not set, but set on window → no event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &no_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIGrabDevice(dpy, deviceid, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &no_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_FALSE(xorg::testing::XServer::WaitForEvent(dpy, 500));
/* if OE is true and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &no_mask, 1);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &event_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIGrabDevice(dpy, deviceid, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &event_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -348,16 +436,16 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
/* if OE is false and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &no_mask, 1);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &event_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIGrabDevice(dpy, deviceid, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &event_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -367,28 +455,27 @@ 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_EQ(hit.ev->deviceid, deviceid);
+ ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
+TEST_P(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up a pointer barrier on the root window.\n"
"Create a window\n"
"Actively grab the pointer on the window.\n"
"Move pointer against barrier.\n"
"Expect events\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
- int sourceid;
-
- ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &sourceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -397,15 +484,15 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
unsigned char no_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask no_mask = { XIAllMasterDevices, sizeof (no_mask_bits), no_mask_bits };
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
/* expect event regardless on owner_events setting */
/* if OE is true and mask is not set, but set on window → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIGrabDevice(dpy, deviceid, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -415,15 +502,15 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
/* if OE is false and mask is not set, but set on window → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &no_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
+ XIGrabDevice(dpy, deviceid, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &no_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -433,15 +520,15 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
/* if OE is true and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &event_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
+ XIGrabDevice(dpy, deviceid, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &event_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -451,15 +538,15 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
/* if OE is false and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
- XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &event_mask);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
+ XIGrabDevice(dpy, deviceid, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, False, &event_mask);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -469,7 +556,7 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -477,21 +564,20 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient)
+TEST_P(BarrierNotify, EventsDuringActiveGrabOtherClient)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up a pointer barrier.\n"
"Have another client actively grab the pointer.\n"
"Move pointer against barrier.\n"
"Expect events\n");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
::Display *dpy2 = XOpenDisplay(server.GetDisplayString().c_str());
XSynchronize(dpy, True);
XSynchronize(dpy2, True);
Window root = DefaultRootWindow(dpy);
- int sourceid;
-
- ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &sourceid)) << "Failed to find device.";
unsigned char event_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask event_mask = { XIAllMasterDevices, sizeof (event_mask_bits), event_mask_bits };
@@ -500,16 +586,16 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient)
unsigned char no_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask no_mask = { XIAllMasterDevices, sizeof (no_mask_bits), no_mask_bits };
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
/* second client grabs device */
- XIGrabDevice(dpy2, VIRTUAL_CORE_POINTER_ID, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
+ XIGrabDevice(dpy2, deviceid, root, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask);
/* We still expect events */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -519,7 +605,7 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
@@ -527,12 +613,14 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient)
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, EventsDuringPassiveGrab)
+TEST_P(BarrierNotify, EventsDuringPassiveGrab)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up a pointer barrier.\n"
"Trigger a passive pointer grab\n"
"Move pointer against barrier.\n"
"Expect events\n");
+ SCOPED_TRACE(enum_to_string(combination));
/* variations
TODO: - core, xi2 (xi1 not needed)
- barrier event masks set in grab mask
@@ -547,9 +635,6 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
- int sourceid;
-
- ASSERT_TRUE(FindInputDeviceByName(dpy, "--device--", &sourceid)) << "Failed to find device.";
XIGrabModifiers mods = { (int)XIAnyModifier, 0 };
@@ -560,16 +645,16 @@ TEST_F(BarrierNotify, EventsDuringPassiveGrab)
unsigned char no_mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask no_mask = { XIAllMasterDevices, sizeof (no_mask_bits), no_mask_bits };
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, root, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
/* if OE is true and mask is not set, but set on window → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- XIGrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, None, GrabModeAsync, GrabModeAsync, True, &no_mask, 1, &mods);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 1, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 0, True);
+ XIGrabButton(dpy, deviceid, 1, root, None, GrabModeAsync, GrabModeAsync, True, &no_mask, 1, &mods);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 1, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 0, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -579,34 +664,34 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
- XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
+ XIUngrabButton(dpy, deviceid, 1, root, 1, &mods);
/* if OE is false and mask is not set, but set on window → no event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &event_mask, 1);
- XIGrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, None, GrabModeAsync, GrabModeAsync, False, &no_mask, 1, &mods);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 1, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 0, True);
+ XIGrabButton(dpy, deviceid, 1, root, None, GrabModeAsync, GrabModeAsync, False, &no_mask, 1, &mods);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 1, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 0, True);
{
XITEvent<XIDeviceEvent> press(dpy, GenericEvent, xi2_opcode, XI_ButtonPress);
ASSERT_TRUE(press.ev);
}
ASSERT_FALSE(xorg::testing::XServer::WaitForEvent(dpy, 500));
- XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
+ XIUngrabButton(dpy, deviceid, 1, root, 1, &mods);
/* if OE is true and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &no_mask, 1);
- XIGrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, None, GrabModeAsync, GrabModeAsync, True, &event_mask, 1, &mods);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 1, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 0, True);
+ XIGrabButton(dpy, deviceid, 1, root, None, GrabModeAsync, GrabModeAsync, True, &event_mask, 1, &mods);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 1, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 0, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -616,19 +701,19 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
- XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
+ XIUngrabButton(dpy, deviceid, 1, root, 1, &mods);
/* if OE is false and mask is set → event */
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XISelectEvents(dpy, root, &no_mask, 1);
- XIGrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, None, GrabModeAsync, GrabModeAsync, False, &event_mask, 1, &mods);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 1, True);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
- dev1->PlayOne(EV_KEY, BTN_LEFT, 0, True);
+ XIGrabButton(dpy, deviceid, 1, root, None, GrabModeAsync, GrabModeAsync, False, &event_mask, 1, &mods);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 1, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_KEY, BTN_LEFT, 0, True);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, GenericEvent, xi2_opcode, XI_BarrierHit, 500));
{
XITEvent<XIBarrierEvent> hit(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
@@ -638,21 +723,23 @@ 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->deviceid, deviceid);
ASSERT_EQ(hit.ev->sourceid, sourceid);
ASSERT_TRUE((hit.ev->flags & XIBarrierDeviceIsGrabbed));
}
- XIUngrabButton(dpy, VIRTUAL_CORE_POINTER_ID, 1, root, 1, &mods);
+ XIUngrabButton(dpy, deviceid, 1, root, 1, &mods);
XFixesDestroyPointerBarrier(dpy, barrier);
}
-TEST_F(BarrierNotify, BarrierRandREventsVertical)
+TEST_P(BarrierNotify, BarrierRandREventsVertical)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up pointer barrier close to a screen.\n"
"Move the pointer against the barrier that the barrier blocks movement\n"
"Same movement must be restriced by the RandR dimensions"
"Ensure Barrier event root x/y are fully constrained");
+ SCOPED_TRACE(enum_to_string(combination));
#if 0
+-------------+
| |
@@ -679,12 +766,12 @@ TEST_F(BarrierNotify, BarrierRandREventsVertical)
int w = DisplayWidth(dpy, DefaultScreen(dpy));
int h = DisplayHeight(dpy, DefaultScreen(dpy));
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, w - 40 , h - 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, w - 40 , h - 30);
- barrier = XFixesCreatePointerBarrier(dpy, root, w - 20, 0, w - 20, 4000, 0, 0, NULL);
+ barrier = XFixesCreatePointerBarrier(dpy, root, w - 20, 0, w - 20, 4000, 0, ndevices, all_deviceids);
- dev1->PlayOne(EV_REL, REL_X, 40, false);
- dev1->PlayOne(EV_REL, REL_Y, 100, true);
+ (*target_dev)->PlayOne(EV_REL, REL_X, 40, false);
+ (*target_dev)->PlayOne(EV_REL, REL_Y, 100, true);
XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
ASSERT_EQ(barrier, event.ev->barrier);
@@ -693,25 +780,27 @@ TEST_F(BarrierNotify, BarrierRandREventsVertical)
ASSERT_LT(event.ev->root_y, h);
}
-TEST_F(BarrierNotify, ReceivesLeaveOnDestroyWhenInsideHitbox)
+TEST_P(BarrierNotify, ReceivesLeaveOnDestroyWhenInsideHitbox)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up pointer barrier.\n"
"Move the pointer into the barrier hitbox.\n"
"Destroy the barrier.\n"
"Ensure that we receive an event.");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, win);
- dev1->PlayOne(EV_REL, REL_X, -40, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -40, True);
/* Ensure we have a BarrierHit on our hands. */
{
@@ -729,29 +818,37 @@ TEST_F(BarrierNotify, ReceivesLeaveOnDestroyWhenInsideHitbox)
}
}
-TEST_F(BarrierNotify, DoesntReceiveLeaveOnDestroyWhenOutsideHitbox)
+TEST_P(BarrierNotify, DoesntReceiveLeaveOnDestroyWhenOutsideHitbox)
{
+ enum BarrierDeviceTestCombinations combination = GetParam();
XORG_TESTCASE("Set up pointer barrier.\n"
"Move the pointer a bit, but don't make it touch the barrier.\n"
"Destroy the barrier.\n"
"Ensure that we didn't receive an event.");
+ SCOPED_TRACE(enum_to_string(combination));
::Display *dpy = Display();
Window root = DefaultRootWindow(dpy);
Window win = CreateWindow(dpy, root);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
- PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL);
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, ndevices, all_deviceids);
XSync(dpy, False);
SelectBarrierEvents(dpy, win);
/* Move the pointer, but don't hit the barrier. */
- dev1->PlayOne(EV_REL, REL_X, -5, True);
+ (*target_dev)->PlayOne(EV_REL, REL_X, -5, True);
- XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30);
+ XIWarpPointer(dpy, deviceid, None, root, 0, 0, 0, 0, 30, 30);
XFixesDestroyPointerBarrier(dpy, barrier);
ASSERT_FALSE(xorg::testing::XServer::WaitForEvent(dpy, 500));
}
+
+INSTANTIATE_TEST_CASE_P(, BarrierNotify, ::testing::Values(NO_DEVICE_SPECIFICS,
+ VCP_ONLY,
+ TARGET_VCP,
+ TARGET_POINTER2));
+
#endif