From 8483b08152104dc619d9e44f877d2687d866355e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 7 Aug 2009 16:11:37 +1000 Subject: test: add focus and enter conversion testing. Doesn't actually convert anything, but verify the expected behaviour. --- test/xi2/protocol-eventconvert.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index ce201587d..e9ca68b2e 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -150,6 +150,35 @@ static void test_XIRawEvent(RawDeviceEvent *in) } +static void test_convert_XIFocusEvent(void) +{ + xEvent *out; + DeviceEvent in; + int rc; + + in.header = ET_Internal; + in.type = ET_Enter; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == Success); + g_assert(out == NULL); + + in.header = ET_Internal; + in.type = ET_FocusIn; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == Success); + g_assert(out == NULL); + + in.header = ET_Internal; + in.type = ET_FocusOut; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == BadImplementation); + + in.header = ET_Internal; + in.type = ET_Leave; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == BadImplementation); +} + static void test_convert_XIRawEvent(void) { @@ -244,6 +273,7 @@ int main(int argc, char** argv) g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent); + g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent); return g_test_run(); } -- cgit v1.2.3