aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
committermarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
commit0e950715b62dcf30ffbf69831bf932fd348537e5 (patch)
tree83fdafc455e9906f029e2e1ad926fb35c98e7be9 /xorg-server/test
parent506537495e6d808f219361a5b270510c752e7a2e (diff)
parent3f553aaceddc9b09363c73d9bea40eaea8164fc4 (diff)
downloadvcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.gz
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.bz2
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.zip
Merge remote-tracking branch 'origin/released'
* origin/released: pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013 Conflicts: fontconfig/src/fcatomic.c pixman/pixman/pixman-mmx.c pixman/pixman/pixman-sse2.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/xfixes/cursor.c
Diffstat (limited to 'xorg-server/test')
-rw-r--r--xorg-server/test/fixes.c26
-rw-r--r--xorg-server/test/input.c2
-rw-r--r--xorg-server/test/xi2/protocol-eventconvert.c218
-rw-r--r--xorg-server/test/xi2/protocol-xiquerydevice.c2
-rw-r--r--xorg-server/test/xi2/protocol-xiselectevents.c12
5 files changed, 251 insertions, 9 deletions
diff --git a/xorg-server/test/fixes.c b/xorg-server/test/fixes.c
index 7807c73ce..4ac6750e4 100644
--- a/xorg-server/test/fixes.c
+++ b/xorg-server/test/fixes.c
@@ -265,6 +265,32 @@ fixes_pointer_barriers_test(void)
x2 = x + 100;
assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+ /* ray vert barrier */
+ barrier.x1 = x;
+ barrier.x2 = x;
+ barrier.y1 = -1;
+ barrier.y2 = y + 100;
+
+ /* ray barrier simple case */
+ y1 = y;
+ y2 = y;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+ /* endpoint outside y range; should be blocked */
+ y1 = y - 1000;
+ y2 = y - 1000;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+ /* endpoint outside y range */
+ y1 = y + 150;
+ y2 = y + 150;
+ x1 = x + 50;
+ x2 = x - 50;
+ assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
}
static void
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 191c81789..be988a4a3 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -406,7 +406,7 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
assert(kbp->same_screen == FALSE);
while (--count > 0) {
- deviceValuator *v = (deviceValuator *) & xi[count];
+ deviceValuator *v = (deviceValuator *) &xi[count];
assert(v->type == DeviceValuator);
assert(v->num_valuators <= 6);
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index bb3177cc1..aea380ed5 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -694,7 +694,7 @@ test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
assert(k->num_keycodes == in->keys.max_keycode -
in->keys.min_keycode + 1);
- kc = (uint32_t *) & k[1];
+ kc = (uint32_t *) &k[1];
for (j = 0; j < k->num_keycodes; j++) {
if (swap) {
swapl(&kc[j]);
@@ -984,6 +984,221 @@ test_convert_XITouchOwnershipEvent(void)
}
}
+static void
+test_XIBarrierEvent(BarrierEvent *in)
+{
+ xXIBarrierEvent *out, *swapped;
+ int count;
+ int rc;
+ int eventlen;
+ FP3232 value;
+
+ rc = EventToXI((InternalEvent*)in, (xEvent**)&out, &count);
+ assert(rc == BadMatch);
+
+ rc = EventToCore((InternalEvent*)in, (xEvent**)&out, &count);
+ assert(rc == BadMatch);
+
+ rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+
+ assert(out->type == GenericEvent);
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->evtype == GetXI2Type(in->type));
+ assert(out->time == in->time);
+ assert(out->deviceid == in->deviceid);
+ assert(out->sourceid == in->sourceid);
+ assert(out->barrier == in->barrierid);
+ assert(out->flags == in->flags);
+ assert(out->event == in->window);
+ assert(out->root == in->root);
+ assert(out->dtime == in->dt);
+ assert(out->eventid == in->event_id);
+ assert(out->root_x == double_to_fp1616(in->root_x));
+ assert(out->root_y == double_to_fp1616(in->root_y));
+
+ value = double_to_fp3232(in->dx);
+ assert(out->dx.integral == value.integral);
+ assert(out->dx.frac == value.frac);
+ value = double_to_fp3232(in->dy);
+ assert(out->dy.integral == value.integral);
+ assert(out->dy.frac == value.frac);
+
+ eventlen = sizeof(xEvent) + out->length * 4;
+ swapped = calloc(1, eventlen);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
+
+ swaps(&swapped->sequenceNumber);
+ swapl(&swapped->length);
+ swaps(&swapped->evtype);
+ swaps(&swapped->deviceid);
+ swapl(&swapped->time);
+ swapl(&swapped->eventid);
+ swapl(&swapped->root);
+ swapl(&swapped->event);
+ swapl(&swapped->barrier);
+ swapl(&swapped->dtime);
+ swaps(&swapped->sourceid);
+ swapl(&swapped->root_x);
+ swapl(&swapped->root_y);
+ swapl(&swapped->dx.integral);
+ swapl(&swapped->dx.frac);
+ swapl(&swapped->dy.integral);
+ swapl(&swapped->dy.frac);
+
+ assert(memcmp(swapped, out, eventlen) == 0);
+
+ free(swapped);
+ free(out);
+}
+
+static void
+test_convert_XIBarrierEvent(void)
+{
+ BarrierEvent in;
+
+ memset(&in, 0, sizeof(in));
+ in.header = ET_Internal;
+ in.type = ET_BarrierHit;
+ in.length = sizeof(in);
+ in.time = 0;
+ in.deviceid = 1;
+ in.sourceid = 2;
+
+ test_XIBarrierEvent(&in);
+
+ in.deviceid = 1;
+ while(in.deviceid & 0xFFFF) {
+ test_XIBarrierEvent(&in);
+ in.deviceid <<= 1;
+ }
+ in.deviceid = 0;
+
+ in.sourceid = 1;
+ while(in.sourceid & 0xFFFF) {
+ test_XIBarrierEvent(&in);
+ in.sourceid <<= 1;
+ }
+ in.sourceid = 0;
+
+ in.flags = 1;
+ while(in.flags) {
+ test_XIBarrierEvent(&in);
+ in.flags <<= 1;
+ }
+
+ in.barrierid = 1;
+ while(in.barrierid) {
+ test_XIBarrierEvent(&in);
+ in.barrierid <<= 1;
+ }
+
+ in.dt = 1;
+ while(in.dt) {
+ test_XIBarrierEvent(&in);
+ in.dt <<= 1;
+ }
+
+ in.event_id = 1;
+ while(in.event_id) {
+ test_XIBarrierEvent(&in);
+ in.event_id <<= 1;
+ }
+
+ in.window = 1;
+ while(in.window) {
+ test_XIBarrierEvent(&in);
+ in.window <<= 1;
+ }
+
+ in.root = 1;
+ while(in.root) {
+ test_XIBarrierEvent(&in);
+ in.root <<= 1;
+ }
+
+ /* pseudo-random 16 bit numbers */
+ in.root_x = 1;
+ test_XIBarrierEvent(&in);
+ in.root_x = 1.3;
+ test_XIBarrierEvent(&in);
+ in.root_x = 264.908;
+ test_XIBarrierEvent(&in);
+ in.root_x = 35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_x = -1;
+ test_XIBarrierEvent(&in);
+ in.root_x = -1.3;
+ test_XIBarrierEvent(&in);
+ in.root_x = -264.908;
+ test_XIBarrierEvent(&in);
+ in.root_x = -35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_y = 1;
+ test_XIBarrierEvent(&in);
+ in.root_y = 1.3;
+ test_XIBarrierEvent(&in);
+ in.root_y = 264.908;
+ test_XIBarrierEvent(&in);
+ in.root_y = 35638.292;
+ test_XIBarrierEvent(&in);
+
+ in.root_y = -1;
+ test_XIBarrierEvent(&in);
+ in.root_y = -1.3;
+ test_XIBarrierEvent(&in);
+ in.root_y = -264.908;
+ test_XIBarrierEvent(&in);
+ in.root_y = -35638.292;
+ test_XIBarrierEvent(&in);
+
+ /* equally pseudo-random 32 bit numbers */
+ in.dx = 1;
+ test_XIBarrierEvent(&in);
+ in.dx = 1.3;
+ test_XIBarrierEvent(&in);
+ in.dx = 264.908;
+ test_XIBarrierEvent(&in);
+ in.dx = 35638.292;
+ test_XIBarrierEvent(&in);
+ in.dx = 2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dx = -1;
+ test_XIBarrierEvent(&in);
+ in.dx = -1.3;
+ test_XIBarrierEvent(&in);
+ in.dx = -264.908;
+ test_XIBarrierEvent(&in);
+ in.dx = -35638.292;
+ test_XIBarrierEvent(&in);
+ in.dx = -2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dy = 1;
+ test_XIBarrierEvent(&in);
+ in.dy = 1.3;
+ test_XIBarrierEvent(&in);
+ in.dy = 264.908;
+ test_XIBarrierEvent(&in);
+ in.dy = 35638.292;
+ test_XIBarrierEvent(&in);
+ in.dy = 2947813871.2342;
+ test_XIBarrierEvent(&in);
+
+ in.dy = -1;
+ test_XIBarrierEvent(&in);
+ in.dy = -1.3;
+ test_XIBarrierEvent(&in);
+ in.dy = -264.908;
+ test_XIBarrierEvent(&in);
+ in.dy = -35638.292;
+ test_XIBarrierEvent(&in);
+ in.dy = -2947813871.2342;
+ test_XIBarrierEvent(&in);
+}
+
int
main(int argc, char **argv)
{
@@ -992,6 +1207,7 @@ main(int argc, char **argv)
test_convert_XIDeviceEvent();
test_convert_XIDeviceChangedEvent();
test_convert_XITouchOwnershipEvent();
+ test_convert_XIBarrierEvent();
return 0;
}
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 9d13bbb6f..c066daa35 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -171,7 +171,7 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure)
(xkb->max_key_code - xkb->min_key_code + 1));
assert(any->length == (2 + ki->num_keycodes));
- kc = (uint32_t *) & ki[1];
+ kc = (uint32_t *) &ki[1];
for (k = 0; k < ki->num_keycodes; k++, kc++) {
if (client->swapped)
swapl(kc);
diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c
index 8f6b947d4..183746f98 100644
--- a/xorg-server/test/xi2/protocol-xiselectevents.c
+++ b/xorg-server/test/xi2/protocol-xiselectevents.c
@@ -98,7 +98,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
xXIEventMask *mask, *next;
req->length = (sz_xXISelectEventsReq / 4);
- mask = (xXIEventMask *) & req[1];
+ 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);
@@ -111,7 +111,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
client.swapped = TRUE;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
for (i = 0; i < req->num_masks; i++) {
next = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
swaps(&mask->deviceid);
@@ -156,7 +156,7 @@ request_XISelectEvents_masks(xXISelectEventsReq * req)
int nmasks = (XI2LASTEVENT + 7) / 8;
unsigned char *bits;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
req->win = ROOT_WINDOW_ID;
/* if a clients submits more than 100 masks, consider it insane and untested */
@@ -312,7 +312,7 @@ test_XISelectEvents(void)
req->num_masks = 1;
printf("Triggering bogus mask length error\n");
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = 0;
mask->mask_len = 0xFFFF;
request_XISelectEvent(req, BadLength);
@@ -320,7 +320,7 @@ test_XISelectEvents(void)
/* testing various device ids */
printf("Testing existing device ids.\n");
for (i = 0; i < 6; i++) {
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = i;
mask->mask_len = 1;
req->win = ROOT_WINDOW_ID;
@@ -332,7 +332,7 @@ test_XISelectEvents(void)
for (i = 6; i <= 0xFFFF; i++) {
req->win = ROOT_WINDOW_ID;
req->num_masks = 1;
- mask = (xXIEventMask *) & req[1];
+ mask = (xXIEventMask *) &req[1];
mask->deviceid = i;
mask->mask_len = 1;
request_XISelectEvent(req, BadDevice);