summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-01-07 09:35:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-01-07 09:35:07 +1000
commit8456625d64bb0013a496f3b56ea3aa20cf7a6142 (patch)
tree1d2430303bbf11fae34f672149a71eda1a2dc510 /test
parentaa30a86583c3fc1a83c46e8c7583182d750edcde (diff)
parentce74e7562dcc800306ff92b6d3c5ee885cd4763d (diff)
Merge branch 'for-peter' of git://people.freedesktop.org/~daniels/xserver into for-keith
Diffstat (limited to 'test')
-rw-r--r--test/input.c29
-rw-r--r--test/xi2/protocol-eventconvert.c12
-rw-r--r--test/xi2/protocol-xiselectevents.c18
3 files changed, 31 insertions, 28 deletions
diff --git a/test/input.c b/test/input.c
index 39d0badf9..879e14f2f 100644
--- a/test/input.c
+++ b/test/input.c
@@ -256,7 +256,7 @@ static void dix_event_to_core(int type)
#undef test_event
}
-static void dix_event_to_core_conversion(void)
+static void dix_event_to_core_fail(int evtype, int expected_rc)
{
DeviceEvent ev;
xEvent core;
@@ -265,25 +265,18 @@ static void dix_event_to_core_conversion(void)
ev.header = 0xFF;
ev.length = sizeof(DeviceEvent);
- ev.type = 0;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadImplementation);
-
- ev.type = 1;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadImplementation);
-
- ev.type = ET_ProximityOut + 1;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadImplementation);
-
- ev.type = ET_ProximityIn;
+ ev.type = evtype;
rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadMatch);
+ g_assert(rc == expected_rc);
+}
- ev.type = ET_ProximityOut;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadMatch);
+static void dix_event_to_core_conversion(void)
+{
+ dix_event_to_core_fail(0, BadImplementation);
+ dix_event_to_core_fail(1, BadImplementation);
+ dix_event_to_core_fail(ET_ProximityOut + 1, BadImplementation);
+ dix_event_to_core_fail(ET_ProximityIn, BadMatch);
+ dix_event_to_core_fail(ET_ProximityOut, BadMatch);
dix_event_to_core(ET_KeyPress);
dix_event_to_core(ET_KeyRelease);
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 211cce6ad..0478c33fe 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -272,6 +272,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
int buttons, valuators;
int i;
unsigned char *ptr;
+ uint32_t flagmask = 0;
FP3232 *values;
if (swap) {
@@ -297,6 +298,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
swapl(&out->mods.latched_mods, n);
swapl(&out->mods.locked_mods, n);
swapl(&out->mods.effective_mods, n);
+ swapl(&out->flags, n);
}
g_assert(out->extension == 0); /* IReqCode defaults to 0 */
@@ -308,7 +310,15 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
g_assert(out->deviceid == in->deviceid);
g_assert(out->sourceid == in->sourceid);
- g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+ switch (in->type) {
+ case ET_KeyPress:
+ flagmask = XIKeyRepeat;
+ break;
+ default:
+ flagmask = 0;
+ break;
+ }
+ g_assert((out->flags & ~flagmask) == 0);
g_assert(out->root == in->root);
g_assert(out->event == None); /* set in FixUpEventFromWindow */
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index fe1c26df8..f951a14fe 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -131,7 +131,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
{
int i, j;
xXIEventMask *mask;
- int nmasks = (XI_LASTEVENT + 7)/8;
+ int nmasks = (XI2LASTEVENT + 7)/8;
unsigned char *bits;
mask = (xXIEventMask*)&req[1];
@@ -150,14 +150,14 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
request_XISelectEvent(req, Success);
/* Test 1:
- * mask may be larger than needed for XI_LASTEVENT.
+ * mask may be larger than needed for XI2LASTEVENT.
* Test setting each valid mask bit, while leaving unneeded bits 0.
* -> Success
*/
bits = (unsigned char*)&mask[1];
mask->mask_len = (nmasks + 3)/4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI_LASTEVENT; j++)
+ for (j = 0; j <= XI2LASTEVENT; j++)
{
SetBit(bits, j);
request_XISelectEvent(req, Success);
@@ -165,7 +165,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
}
/* Test 2:
- * mask may be larger than needed for XI_LASTEVENT.
+ * mask may be larger than needed for XI2LASTEVENT.
* Test setting all valid mask bits, while leaving unneeded bits 0.
* -> Success
*/
@@ -173,21 +173,21 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
mask->mask_len = (nmasks + 3)/4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI_LASTEVENT; j++)
+ for (j = 0; j <= XI2LASTEVENT; j++)
{
SetBit(bits, j);
request_XISelectEvent(req, Success);
}
/* Test 3:
- * mask is larger than needed for XI_LASTEVENT. If any unneeded bit
+ * mask is larger than needed for XI2LASTEVENT. If any unneeded bit
* is set -> BadValue
*/
bits = (unsigned char*)&mask[1];
mask->mask_len = (nmasks + 3)/4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = XI_LASTEVENT + 1; j < mask->mask_len * 4; j++)
+ for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++)
{
SetBit(bits, j);
request_XISelectEvent(req, BadValue);
@@ -200,7 +200,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
bits = (unsigned char*)&mask[1];
mask->mask_len = (nmasks + 3)/4;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI_LASTEVENT; j++)
+ for (j = 0; j <= XI2LASTEVENT; j++)
{
SetBit(bits, j);
request_XISelectEvent(req, Success);
@@ -228,7 +228,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
bits = (unsigned char*)&mask[1];
mask->mask_len = (nmasks + 3)/4;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI_LASTEVENT; j++)
+ for (j = 0; j <= XI2LASTEVENT; j++)
SetBit(bits, j);
ClearBit(bits, XI_HierarchyChanged);
for (j = 1; j < 6; j++)