GitLab will be down for maintenance this Sunday 13th June, from approx 7-11am UTC. This is for a PostgreSQL migration. See the tracker issue for more informations.

Commit a0976f77 authored by Povilas Kanapickas's avatar Povilas Kanapickas
Browse files

Test case when emulated touch is replayed after a explicit grab

This covers
parent 54ab1574
Pipeline #267197 passed with stages
in 1 minute and 37 seconds
......@@ -1232,6 +1232,74 @@ TEST_F(TouchGrabTest, GrabMultipleTouchpoints)
EXPECT_EVENT(XIDeviceEvent, tend2, dpy, GenericEvent, xi2_opcode, XI_TouchEnd);
TEST_F(TouchGrabTest, DISABLED_DeviceUngrabDropsEmulatedEvents)
XORG_TESTCASE("Client A actively asynchronously grabs touch events on the device.\n"
"Client B selects for pointer events.\n"
"A touch begins and ends.\n"
"Client A deactivates the active grab.\n"
::Display *dpy = Display();
XSynchronize(dpy, True);
::Display *dpy2 = NewClient();
/* Client A grabs the device */
XIEventMask mask;
mask.deviceid = VIRTUAL_CORE_POINTER_ID;
mask.mask_len = XIMaskLen(XI_TouchOwnership);
mask.mask = new unsigned char[mask.mask_len]();
XISetMask(mask.mask, XI_TouchBegin);
XISetMask(mask.mask, XI_TouchUpdate);
XISetMask(mask.mask, XI_TouchEnd);
XISetMask(mask.mask, XI_TouchOwnership);
DefaultRootWindow(dpy), CurrentTime, None,
GrabModeAsync, GrabModeAsync,
False, &mask));
delete[] mask.mask;
XSync(dpy, False);
/* Client B selects for events on window */
Window win = CreateWindow(dpy2, DefaultRootWindow(dpy2));
mask.deviceid = XIAllMasterDevices;
mask.mask_len = XIMaskLen(XI_TouchEnd);
mask.mask = new unsigned char[mask.mask_len]();
XISetMask(mask.mask, XI_ButtonPress);
XISetMask(mask.mask, XI_Motion);
XISetMask(mask.mask, XI_ButtonRelease);
ASSERT_EQ(Success, XISelectEvents(dpy2, win, &mask, 1));
delete[] mask.mask;
XSync(dpy2, False);
/* Touch begins */
TouchDev().TouchBegin(200, 200, 0);
TouchDev().TouchEnd(200, 200, 0);
/* Expect emulated motion and button press events on A */
ASSERT_EVENT(XIDeviceEvent, A_begin, dpy, GenericEvent, xi2_opcode, XI_TouchBegin);
ASSERT_EVENT(XIDeviceEvent, A_owner, dpy, GenericEvent, xi2_opcode, XI_TouchOwnership);
ASSERT_EVENT(XIDeviceEvent, A_end, dpy, GenericEvent, xi2_opcode, XI_TouchEnd);
/* No other events should come */
/* Client A ungrabs */
XIUngrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, CurrentTime);
XSync(dpy, False);
class TouchGrabTestOnLegacyClient : public TouchGrabTest {
void SetUp() override {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment