diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-22 15:17:50 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-25 10:37:52 +1000 |
commit | 4613ce3f78a32f2a6f422e719150d55b035c758e (patch) | |
tree | 31c72bf7533a9abc7d0ce845fb9ab47339d67ca2 /test/input.c | |
parent | 58554f1c6429535e7ab432c920aabca71a77edb8 (diff) |
test: valuator_mode tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'test/input.c')
-rw-r--r-- | test/input.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/input.c b/test/input.c index daadbea31..2aa76de6c 100644 --- a/test/input.c +++ b/test/input.c @@ -978,6 +978,38 @@ static void dix_input_valuator_masks(void) free(mask); } +static void dix_valuator_mode(void) +{ + DeviceIntRec dev; + const int num_axes = MAX_VALUATORS; + int i; + Atom atoms[MAX_VALUATORS] = { 0 }; + + memset(&dev, 0, sizeof(DeviceIntRec)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ + + g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE); + g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute)); + + for (i = 0; i < num_axes; i++) + { + g_assert(valuator_get_mode(&dev, i) == Absolute); + valuator_set_mode(&dev, i, Relative); + g_assert(dev.valuator->axes[i].mode == Relative); + g_assert(valuator_get_mode(&dev, i) == Relative); + } + + valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Absolute); + for (i = 0; i < num_axes; i++) + g_assert(valuator_get_mode(&dev, i) == Absolute); + + valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Relative); + for (i = 0; i < num_axes; i++) + g_assert(valuator_get_mode(&dev, i) == Relative); +} + + + int main(int argc, char** argv) { g_test_init(&argc, &argv,NULL); @@ -990,6 +1022,7 @@ int main(int argc, char** argv) g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values); g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes); g_test_add_func("/dix/input/grab_matching", dix_grab_matching); + g_test_add_func("/dix/input/valuator_mode", dix_valuator_mode); g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros); g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers); |