aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test/xi2/protocol-xiquerydevice.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/test/xi2/protocol-xiquerydevice.c')
-rw-r--r--xorg-server/test/xi2/protocol-xiquerydevice.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 47eb5b14c..63d725f28 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -127,7 +127,7 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
dev = devices.mouse;
assert(info->use == XISlavePointer);
assert(info->attachment == devices.vcp->id);
- assert(info->num_classes == 3); /* 2 axes + button */
+ assert(info->num_classes == 7); /* 4 axes + button + 2 scroll*/
break;
case 5: /* keyboard */
dev = devices.kbd;
@@ -183,11 +183,48 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
}
break;
}
- case 2: /* VCP and mouse have the same properties */
case 4:
{
assert(any->type == XIButtonClass ||
- any->type == XIValuatorClass);
+ any->type == XIValuatorClass ||
+ any->type == XIScrollClass);
+
+ if (any->type == XIScrollClass)
+ {
+ xXIScrollInfo *si = (xXIScrollInfo*)any;
+
+ if (client->swapped)
+ {
+ swaps(&si->number);
+ swaps(&si->scroll_type);
+ swapl(&si->increment.integral);
+ swapl(&si->increment.frac);
+ }
+ assert(si->length == 6);
+ assert(si->number == 2 || si->number == 3);
+ if (si->number == 2) {
+ assert(si->scroll_type == XIScrollTypeVertical);
+ assert(!si->flags);
+ }
+ if (si->number == 3) {
+ assert(si->scroll_type == XIScrollTypeHorizontal);
+ assert(si->flags & XIScrollFlagPreferred);
+ assert(!(si->flags & ~XIScrollFlagPreferred));
+ }
+
+ assert(si->increment.integral == si->number);
+ /* FIXME: frac testing with float/FP issues? */
+ assert(si->increment.frac > 0.3 * (1UL << 32));
+ assert(si->increment.frac < 0.6 * (1UL << 32));
+ }
+
+ }
+ /* fall through */
+ case 2: /* VCP and mouse have the same properties except for scroll */
+ {
+ if (info->deviceid == 2 ) /* VCP */
+ assert(any->type == XIButtonClass ||
+ any->type == XIValuatorClass);
if (any->type == XIButtonClass)
{
@@ -217,8 +254,10 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
}
assert(vi->length == 11);
- assert(vi->number == 0 ||
- vi->number == 1);
+ assert(vi->number >= 0 && vi->number < 4);
+ if (info->deviceid == 2) /* VCP */
+ assert(vi->number < 2);
+
assert(vi->mode == XIModeRelative);
/* device was set up as relative, so standard
* values here. */