diff options
Diffstat (limited to 'test/input.c')
-rw-r--r-- | test/input.c | 29 |
1 files changed, 11 insertions, 18 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); |