diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-03 14:36:55 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-03 14:36:55 +1000 |
commit | 06a95f7d08b4d163f75e429ec5aa79dad294d91e (patch) | |
tree | 726589a695da0b2909552efe02c8c62ec78ac9b1 | |
parent | 332daf937e78b8c97ef593df889af9b654a280b1 (diff) |
server/barriers: unviewable windows still receive barrier events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/server/barriers-notify.cpp | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp index a75e7eb..f16e7f2 100644 --- a/tests/server/barriers-notify.cpp +++ b/tests/server/barriers-notify.cpp @@ -227,7 +227,64 @@ TEST_F(BarrierNotify, DestroyWindow) EXPECT_EQ(y, 30); ASSERT_FALSE(xorg::testing::XServer::WaitForEventOfType(Display(), - GenericEvent, xi2_opcode, XI_BarrierHit, 500)); + GenericEvent, + xi2_opcode, + XI_BarrierHit, + 500)); XFixesDestroyPointerBarrier(dpy, barrier); } + +TEST_F(BarrierNotify, UnmapWindow) +{ + 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"); + + ::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); + + PointerBarrier barrier = XFixesCreatePointerBarrier(dpy, win, 20, 20, 20, 40, 0, 0, NULL); + XSync(dpy, False); + + XIEventMask mask; + mask.deviceid = XIAllMasterDevices; + mask.mask_len = XIMaskLen(XI_LASTEVENT); + mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + XISetMask(mask.mask, XI_BarrierHit); + XISelectEvents(dpy, win, &mask, 1); + free(mask.mask); + XSync(dpy, False); + + 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); + ASSERT_EQ(barrier, event.ev->barrier); + 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); + XUnmapWindow(dpy, win); + XSync(dpy, True); + + dev->PlayOne(EV_REL, REL_X, -40, True); + + double x, y; + QueryPointerPosition(dpy, &x, &y); + EXPECT_EQ(x, 20); + EXPECT_EQ(y, 30); + + ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(Display(), + GenericEvent, + xi2_opcode, + XI_BarrierHit, + 500)); + XFixesDestroyPointerBarrier(dpy, barrier); +} |