diff options
author | marha <marha@users.sourceforge.net> | 2011-12-12 12:23:04 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-12 12:23:04 +0100 |
commit | 5efb0a5e19b75137b7294b27f4e7878aeb8f0927 (patch) | |
tree | a8138a3cf2f3ed5beacd1ce9e44dda79b51f9ffd /xorg-server/test/input.c | |
parent | 5b178ff5a5f0b6e481cf9fd9749eb7ef9581c987 (diff) | |
download | vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.gz vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.bz2 vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.zip |
libxtrans libX11 libxcb xserver mesa git update 12 dec 2011
Diffstat (limited to 'xorg-server/test/input.c')
-rw-r--r-- | xorg-server/test/input.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c index 5b4c8c193..c44e5f613 100644 --- a/xorg-server/test/input.c +++ b/xorg-server/test/input.c @@ -1674,8 +1674,75 @@ mieq_test(void) { mieqFini(); } +/* Simple check that we're replaying events in-order */ +static void +process_input_proc(InternalEvent *ev, DeviceIntPtr device) +{ + static int last_evtype = -1; + + if (ev->any.header == 0xac) + last_evtype = -1; + + assert(ev->any.type == ++last_evtype); +} + +static void +dix_enqueue_events(void) { +#define NEVENTS 5 + DeviceIntRec dev; + InternalEvent ev[NEVENTS]; + SpriteInfoRec spriteInfo; + SpriteRec sprite; + QdEventPtr qe; + int i; + + memset(&dev, 0, sizeof(dev)); + dev.public.processInputProc = process_input_proc; + + memset(&spriteInfo, 0, sizeof(spriteInfo)); + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &spriteInfo; + spriteInfo.sprite = &sprite; + + InitEvents(); + assert(list_is_empty(&syncEvents.pending)); + + /* this way PlayReleasedEvents really runs through all events in the + * queue */ + inputInfo.devices = &dev; + + /* to reset process_input_proc */ + ev[0].any.header = 0xac; + + for (i = 0; i < NEVENTS; i++) + { + ev[i].any.length = sizeof(*ev); + ev[i].any.type = i; + EnqueueEvent(&ev[i], &dev); + assert(!list_is_empty(&syncEvents.pending)); + qe = list_last_entry(&syncEvents.pending, QdEventRec, next); + assert(memcmp(qe->event, &ev[i], ev[i].any.length) == 0); + qe = list_first_entry(&syncEvents.pending, QdEventRec, next); + assert(memcmp(qe->event, &ev[0], ev[i].any.length) == 0); + } + + /* calls process_input_proc */ + dev.deviceGrab.sync.frozen = 1; + PlayReleasedEvents(); + assert(!list_is_empty(&syncEvents.pending)); + + + dev.deviceGrab.sync.frozen = 0; + PlayReleasedEvents(); + assert(list_is_empty(&syncEvents.pending)); + + inputInfo.devices = NULL; +} + + int main(int argc, char** argv) { + dix_enqueue_events(); dix_double_fp_conversion(); dix_input_valuator_masks(); dix_input_attributes(); |