diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-06 15:08:15 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-06 15:08:39 +1000 |
commit | 42513c12b906567381a89e8b26b7006434585bdb (patch) | |
tree | cec36cc9c6e4379b32fc3c6fd4335d2fc7bf35ea | |
parent | bb4db83a92fca706f12cda13d057cef9e3efb97c (diff) |
server/barrier: check for barrier event details
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/server/barriers-notify.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp index 7b82a3e..970e9d3 100644 --- a/tests/server/barriers-notify.cpp +++ b/tests/server/barriers-notify.cpp @@ -408,24 +408,60 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabNonGrabWindow) XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, win, CurrentTime, None, GrabModeAsync, GrabModeAsync, True, &no_mask); 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); + ASSERT_TRUE(hit.ev); + ASSERT_EQ(hit.ev->window, root); + ASSERT_EQ(hit.ev->root, root); + ASSERT_EQ(hit.ev->barrier, barrier); + ASSERT_EQ(hit.ev->root_x, 20); + ASSERT_EQ(hit.ev->root_y, 30); + } /* 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); 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); + ASSERT_TRUE(hit.ev); + ASSERT_EQ(hit.ev->window, root); + ASSERT_EQ(hit.ev->root, root); + ASSERT_EQ(hit.ev->barrier, barrier); + ASSERT_EQ(hit.ev->root_x, 20); + ASSERT_EQ(hit.ev->root_y, 30); + } /* 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); 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); + ASSERT_TRUE(hit.ev); + ASSERT_EQ(hit.ev->window, root); + ASSERT_EQ(hit.ev->root, root); + ASSERT_EQ(hit.ev->barrier, barrier); + ASSERT_EQ(hit.ev->root_x, 20); + ASSERT_EQ(hit.ev->root_y, 30); + } /* 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); 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); + ASSERT_TRUE(hit.ev); + ASSERT_EQ(hit.ev->window, root); + ASSERT_EQ(hit.ev->root, root); + ASSERT_EQ(hit.ev->barrier, barrier); + ASSERT_EQ(hit.ev->root_x, 20); + ASSERT_EQ(hit.ev->root_y, 30); + } XFixesDestroyPointerBarrier(dpy, barrier); } @@ -461,6 +497,15 @@ TEST_F(BarrierNotify, EventsDuringActiveGrabOtherClient) XISelectEvents(dpy, root, &event_mask, 1); 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); + ASSERT_TRUE(hit.ev); + ASSERT_EQ(hit.ev->window, root); + ASSERT_EQ(hit.ev->root, root); + ASSERT_EQ(hit.ev->barrier, barrier); + ASSERT_EQ(hit.ev->root_x, 20); + ASSERT_EQ(hit.ev->root_y, 30); + } XFixesDestroyPointerBarrier(dpy, barrier); } |