summaryrefslogtreecommitdiff
path: root/test/input.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-04-12 10:17:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-04-18 13:04:19 +1000
commit419a27b5219a739f2fbd50cc96a1b54c469e4a88 (patch)
tree34eafb211d89f17862f3aacfb1f4daa7509efdec /test/input.c
parent7762de65e153790ee9f63903964d168a6680d815 (diff)
Xi: fix valuator alignment in DeepCopyDeviceClasses (#36119)
commit 678f5396c91b3d0c7572ed579b0a4fb62b2b4655 only fixed the initialization, not the copy. After a slave device change, the valuator were out of alignment again. X.Org Bug 36119 <http://bugs.freedesktop.org/show_bug.cgi?id=36119> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'test/input.c')
-rw-r--r--test/input.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/input.c b/test/input.c
index c13b4f213..89cce3f33 100644
--- a/test/input.c
+++ b/test/input.c
@@ -1209,6 +1209,28 @@ static void include_bit_test_macros(void)
}
}
+/**
+ * Ensure that val->axisVal and val->axes are aligned on doubles.
+ */
+static void dix_valuator_alloc(void)
+{
+ ValuatorClassPtr v = NULL;
+ int num_axes = 0;
+
+ while (num_axes < 5)
+ {
+ v = AllocValuatorClass(v, num_axes);
+
+ g_assert(v);
+ g_assert(v->numAxes == num_axes);
+ g_assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0);
+ g_assert(((void*)v->axes - (void*)v) % sizeof(double) == 0);
+ num_axes ++;
+ }
+
+ free(v);
+}
+
int main(int argc, char** argv)
{
g_test_init(&argc, &argv,NULL);
@@ -1226,7 +1248,7 @@ int main(int argc, char** argv)
g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros);
g_test_add_func("/include/bit_test_macros", include_bit_test_macros);
g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers);
-
+ g_test_add_func("/dix/input/valuator-alloc", dix_valuator_alloc);
return g_test_run();
}