[PATCH libinput 3/5] test: add pointer acceleration defaults test
Peter Hutterer
peter.hutterer at who-t.net
Mon Feb 2 17:07:04 PST 2015
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/pointer.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/test/pointer.c b/test/pointer.c
index 45e0d57..9a91231 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -732,6 +732,44 @@ START_TEST(pointer_scroll_button)
}
END_TEST
+START_TEST(pointer_accel_defaults)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput_device *device = dev->libinput_device;
+ enum libinput_config_status status;
+ double speed;
+
+ ck_assert(libinput_device_config_accel_is_available(device));
+ ck_assert(libinput_device_config_accel_get_default_speed(device) == 0.0);
+ ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
+
+ for (speed = -2.0; speed < -1.0; speed += 0.2) {
+ status = libinput_device_config_accel_set_speed(device,
+ speed);
+ ck_assert_int_eq(status,
+ LIBINPUT_CONFIG_STATUS_INVALID);
+ ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
+ }
+
+ for (speed = -1.0; speed <= 1.0; speed += 0.2) {
+ status = libinput_device_config_accel_set_speed(device,
+ speed);
+ ck_assert_int_eq(status,
+ LIBINPUT_CONFIG_STATUS_SUCCESS);
+ ck_assert(libinput_device_config_accel_get_speed(device) == speed);
+ }
+
+ for (speed = 1.2; speed <= -2.0; speed += 0.2) {
+ status = libinput_device_config_accel_set_speed(device,
+ speed);
+ ck_assert_int_eq(status,
+ LIBINPUT_CONFIG_STATUS_INVALID);
+ ck_assert(libinput_device_config_accel_get_speed(device) == 1.0);
+ }
+
+}
+END_TEST
+
int main (int argc, char **argv) {
litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_ANY);
@@ -754,5 +792,7 @@ int main (int argc, char **argv) {
litest_add("pointer:left-handed", pointer_left_handed_during_click, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
litest_add("pointer:left-handed", pointer_left_handed_during_click_multiple_buttons, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
+ litest_add("pointer:accel", pointer_accel_defaults, LITEST_RELATIVE, LITEST_ANY);
+
return litest_run(argc, argv);
}
--
2.1.0
More information about the wayland-devel
mailing list