summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-04 11:40:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-04 11:41:02 +1000
commitd979f443946011158b6a183582728a6899c33b85 (patch)
tree5f2fd76ce5a1765fdadb6d21ab7118d452ec116e /test
parentd8471bc7a19cd248fa3e0845496c86cd9251c013 (diff)
test: check from INT_MIN to INT_MAX for core type conversion
ErrorF is link-wrapped to reduce the run-time of the test. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/input.c56
2 files changed, 31 insertions, 26 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index dbad93bb1..57a31c242 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -10,6 +10,7 @@ TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLIB_LIBS)
xkb_LDADD=$(TEST_LDADD)
input_LDADD=$(TEST_LDADD)
+input_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,ErrorF
libxservertest_la_LIBADD = \
$(XSERVER_LIBS) \
diff --git a/test/input.c b/test/input.c
index b80e1f57f..dcce71918 100644
--- a/test/input.c
+++ b/test/input.c
@@ -40,6 +40,10 @@
#include <glib.h>
+void __wrap_ErrorF(const char *f, ...)
+{
+}
+
/**
* Init a device with axes.
* Verify values set on the device.
@@ -254,36 +258,36 @@ static void dix_event_to_core_conversion(void)
{
DeviceEvent ev;
xEvent core;
- int rc;
+ int rc, i;
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;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadMatch);
-
- ev.type = ET_ProximityOut;
- rc = EventToCore((InternalEvent*)&ev, &core);
- g_assert(rc == BadMatch);
-
- dix_event_to_core(ET_KeyPress);
- dix_event_to_core(ET_KeyRelease);
- dix_event_to_core(ET_ButtonPress);
- dix_event_to_core(ET_ButtonRelease);
- dix_event_to_core(ET_Motion);
+ for (i = INT_MIN; i < INT_MAX; i++)
+ {
+ switch(i)
+ {
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_Motion:
+ dix_event_to_core(i);
+ break;
+ case ET_Raw:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ ev.type = i;
+ rc = EventToCore((InternalEvent*)&ev, &core);
+ g_assert(rc == BadMatch);
+ break;
+ default:
+ ev.type = i;
+ rc = EventToCore((InternalEvent*)&ev, &core);
+ g_assert(rc == BadImplementation);
+ break;
+ }
+ }
}
static void xi2_struct_sizes(void)