[PATCH libinput 3/3] test: add tests for natural scrolling
Peter Hutterer
peter.hutterer at who-t.net
Thu Sep 18 16:01:32 PDT 2014
2-finger scrolling only, we don't have anything else yet
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/touchpad.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/test/touchpad.c b/test/touchpad.c
index 7ff3d14..2c2504f 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -1409,6 +1409,52 @@ START_TEST(touchpad_2fg_scroll)
}
END_TEST
+START_TEST(touchpad_scroll_natural_defaults)
+{
+ struct litest_device *dev = litest_current_device();
+
+ ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1);
+ ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
+ ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0);
+}
+END_TEST
+
+START_TEST(touchpad_scroll_natural_enable_config)
+{
+ struct litest_device *dev = litest_current_device();
+ enum libinput_config_status status;
+
+ status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
+ ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1);
+
+ status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0);
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
+ ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
+}
+END_TEST
+
+START_TEST(touchpad_scroll_natural)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+
+ litest_drain_events(li);
+
+ libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
+
+ test_2fg_scroll(dev, 0.1, 40, 0);
+ check_2fg_scroll(dev, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10);
+ test_2fg_scroll(dev, 0.1, -40, 0);
+ check_2fg_scroll(dev, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10);
+ test_2fg_scroll(dev, 40, 0.1, 0);
+ check_2fg_scroll(dev, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10);
+ test_2fg_scroll(dev, -40, 0.1, 0);
+ check_2fg_scroll(dev, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10);
+
+}
+END_TEST
+
START_TEST(touchpad_tap_is_available)
{
struct litest_device *dev = litest_current_device();
@@ -1681,6 +1727,9 @@ int main(int argc, char **argv) {
litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_ignore, LITEST_TOPBUTTONPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+ litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("touchpad:scroll", touchpad_scroll_natural, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD);
--
1.9.3
More information about the wayland-devel
mailing list