summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-12-13 14:41:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-12-13 15:13:27 +1000
commitd07da9369e5f3226e5b8ee961adf87afd0cb7344 (patch)
treeed02a2c8fa3c2fe9057822c539b39a399511e25d
parent9358dd3d53ace574904434a8e432faf4b56a5d1b (diff)
server/barrier: add test for leave notifies on MD destroybarriers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tests/server/barriers-notify.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp
index 714d112..9158b9b 100644
--- a/tests/server/barriers-notify.cpp
+++ b/tests/server/barriers-notify.cpp
@@ -226,6 +226,7 @@ TEST_P(BarrierNotify, ReceivesNotifyEvents)
ASSERT_EQ(event.ev->sourceid, sourceid);
XFixesDestroyPointerBarrier(dpy, barrier);
+
}
TEST_P(BarrierNotify, CorrectEventIDs)
@@ -983,4 +984,55 @@ INSTANTIATE_TEST_CASE_P(, BarrierNotify, ::testing::Values(NO_DEVICE_SPECIFICS,
LATE_SECOND_MD_VCP,
LATE_SECOND_MD_POINTER2));
+class BarrierMPXTest : public BarrierDevices {};
+
+TEST_F(BarrierMPXTest, BarrierLeaveOnMDDestroyWhenInsideHitbox)
+{
+ XORG_TESTCASE("Set up pointer barrier.\n"
+ "Create two MDs\n"
+ "Move the pointer into the barrier hitbox.\n"
+ "Remove the MD.\n"
+ "Ensure that we receive an event.");
+
+ ::Display *dpy = Display();
+ XSynchronize(dpy, True);
+ Window root = DefaultRootWindow(dpy);
+ Window win = CreateWindow(dpy, root);
+
+ XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL);
+
+ SelectBarrierEvents(dpy, win);
+
+ XIWarpPointer(dpy, master_id_2, None, root, 0, 0, 0, 0, 30, 30);
+
+ dev2->PlayOne(EV_REL, REL_X, -40, True);
+
+ /* Ensure we have a BarrierHit on our hands. */
+ {
+ XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierHit);
+ }
+
+ XIAnyHierarchyChangeInfo change;
+ change.remove = (XIRemoveMasterInfo) {
+ .type = XIRemoveMaster,
+ .deviceid = master_id_2,
+ .return_mode = XIAttachToMaster,
+ .return_pointer = VIRTUAL_CORE_POINTER_ID,
+ .return_keyboard = VIRTUAL_CORE_POINTER_ID + 1, /* VCK */
+ };
+
+ ASSERT_EQ(XIChangeHierarchy(dpy, &change, 1), Success) << "Couldn't remove new master device.";
+
+ {
+ XITEvent<XIBarrierEvent> event(dpy, GenericEvent, xi2_opcode, XI_BarrierLeave);
+ ASSERT_TRUE(event.ev);
+ ASSERT_EQ(0, event.ev->dx);
+ ASSERT_EQ(0, event.ev->dy);
+ ASSERT_TRUE(event.ev->flags & XIBarrierPointerReleased);
+ ASSERT_EQ(event.ev->deviceid, master_id_2);
+ ASSERT_EQ(event.ev->sourceid, 0);
+ }
+
+ ASSERT_TRUE(NoEventPending(dpy));
+}
#endif