diff options
author | Daniel Stone <daniel@fooishbar.org> | 2010-12-28 16:06:29 +0000 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2011-01-06 17:10:25 +0000 |
commit | a083efe8715e8b29c9bd7f4e7bb429a94620bfc4 (patch) | |
tree | eb2b96f416da496e7ed355d068adb5d5b4a32686 /test/xi2 | |
parent | 2592effef5f171af3f01a2b5130d9747403140f6 (diff) |
Test: Input: Check flags on DeviceEvent
Add initial validation of acceptable flags for XI2 device events, and
make sure they're swapped.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'test/xi2')
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 12 |
1 files changed, 11 insertions, 1 deletions
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 */ |