diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-14 12:15:29 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-16 11:18:47 +1000 |
commit | 92c6c0c1d2d6a8882ed97b0e7f2952978ee5ce82 (patch) | |
tree | 2cc4b223a237ec2a9da7db4c705b02ba57950f41 | |
parent | 731b1db2fcc82c0a8afd28d7f28363c1db0a20ce (diff) |
tests: update for touch support
Touch event mask must be set for all three event types.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | test/xi2/protocol-xipassivegrabdevice.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xiselectevents.c | 38 |
2 files changed, 31 insertions, 9 deletions
diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c index 89ffc3d29..b405556be 100644 --- a/test/xi2/protocol-xipassivegrabdevice.c +++ b/test/xi2/protocol-xipassivegrabdevice.c @@ -180,7 +180,7 @@ static void test_XIPassiveGrabDevice(void) request->deviceid = XIAllMasterDevices; printf("Testing invalid grab types\n"); - for (i = XIGrabtypeFocusIn + 1; i < 0xFF; i++) + for (i = XIGrabtypeTouchBegin + 1; i < 0xFF; i++) { request->grab_type = i; request_XIPassiveGrabDevice(&client_request, request, BadValue, request->grab_type); diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c index 4eaf839fa..0390858b1 100644 --- a/test/xi2/protocol-xiselectevents.c +++ b/test/xi2/protocol-xiselectevents.c @@ -125,6 +125,28 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error) assert(rc == error); } +static void _set_bit(unsigned char *bits, int bit) +{ + SetBit(bits, bit); + if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership) + { + SetBit(bits, XI_TouchBegin); + SetBit(bits, XI_TouchUpdate); + SetBit(bits, XI_TouchEnd); + } +} + +static void _clear_bit(unsigned char *bits, int bit) +{ + ClearBit(bits, bit); + if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership) + { + ClearBit(bits, XI_TouchBegin); + ClearBit(bits, XI_TouchUpdate); + ClearBit(bits, XI_TouchEnd); + } +} + static void request_XISelectEvents_masks(xXISelectEventsReq *req) { int i, j; @@ -157,9 +179,9 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) memset(bits, 0, mask->mask_len * 4); for (j = 0; j <= XI2LASTEVENT; j++) { - SetBit(bits, j); + _set_bit(bits, j); request_XISelectEvent(req, Success); - ClearBit(bits, j); + _clear_bit(bits, j); } /* Test 2: @@ -173,7 +195,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) for (j = 0; j <= XI2LASTEVENT; j++) { - SetBit(bits, j); + _set_bit(bits, j); request_XISelectEvent(req, Success); } @@ -187,9 +209,9 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++) { - SetBit(bits, j); + _set_bit(bits, j); request_XISelectEvent(req, BadValue); - ClearBit(bits, j); + _clear_bit(bits, j); } /* Test 4: @@ -200,7 +222,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) memset(bits, 0, mask->mask_len * 4); for (j = 0; j <= XI2LASTEVENT; j++) { - SetBit(bits, j); + _set_bit(bits, j); request_XISelectEvent(req, Success); } @@ -227,8 +249,8 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) mask->mask_len = (nmasks + 3)/4; memset(bits, 0, mask->mask_len * 4); for (j = 0; j <= XI2LASTEVENT; j++) - SetBit(bits, j); - ClearBit(bits, XI_HierarchyChanged); + _set_bit(bits, j); + _clear_bit(bits, XI_HierarchyChanged); for (j = 1; j < 6; j++) { mask->deviceid = j; |