summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-09-01 15:46:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-03 08:39:26 +1000
commit6fe235d3635aaf995dfa198c60ded1a43fe9dd45 (patch)
treecaaafe0e132a5f087a7e392e5a53a78c1a0fedb8 /test
parent7ab1b50c545ae1a62384bedee60168e227bb2a94 (diff)
test: fix request length calculation, add length tests for XISelectEvents
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/xi2/protocol-xiselectevents.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index 825eeb628..ac38c53c9 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -95,7 +95,14 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error)
ClientRec client;
xXIEventMask *mask, *next;
- req->length = (sz_xXISelectEventsReq/4) + req->num_masks;
+ req->length = (sz_xXISelectEventsReq/4);
+ mask = (xXIEventMask*)&req[1];
+ for (i = 0; i < req->num_masks; i++)
+ {
+ req->length += sizeof(xXIEventMask)/4 + mask->mask_len;
+ mask = (xXIEventMask*)((char*)&mask[1] + mask->mask_len * 4);
+ }
+
client = init_client(req->length, req);
rc = ProcXISelectEvents(&client);
@@ -280,16 +287,24 @@ static void test_XISelectEvents(void)
req->num_masks = 0xFFFF;
request_XISelectEvent(req, BadLength);
- /* testing various device ids */
req->win = ROOT_WINDOW_ID;
req->num_masks = 1;
+ g_test_message("Triggering bogus mask length error");
+ mask = (xXIEventMask*)&req[1];
+ mask->deviceid = 0;
+ mask->mask_len = 0xFFFF;
+ request_XISelectEvent(req, BadLength);
+
+ /* testing various device ids */
g_test_message("Testing existing device ids.");
for (i = 0; i < 6; i++)
{
mask = (xXIEventMask*)&req[1];
mask->deviceid = i;
mask->mask_len = 1;
+ req->win = ROOT_WINDOW_ID;
+ req->num_masks = 1;
request_XISelectEvent(req, Success);
}