summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-10-22 15:17:50 +1000
committerChase Douglas <chase.douglas@ubuntu.com>2010-11-05 10:42:17 -0400
commitc63a177cd2e31d6435542978c09b5e1dd0a648df (patch)
treeb75b18dcd97a4a4b87a2311d32266641ba420f37 /test
parentfe6f497b436292651bc561f70d5116055ac7108f (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')
-rw-r--r--test/input.c33
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);