From: Peter Hutterer Date: Thu, 18 Sep 2014 06:14:35 +0000 (+1000) Subject: test: add tests for natural scrolling X-Git-Tag: 0.7.0~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f73c28bf70d7c3941a758296f89334463e3f1d4f;p=platform%2Fupstream%2Flibinput.git test: add tests for natural scrolling 2-finger scrolling only, we don't have anything else yet Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- diff --git a/test/touchpad.c b/test/touchpad.c index 522cee65..717cb692 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -1368,6 +1368,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); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10); + test_2fg_scroll(dev, 0.1, -40, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10); + test_2fg_scroll(dev, 40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); + test_2fg_scroll(dev, -40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10); + +} +END_TEST + START_TEST(touchpad_tap_is_available) { struct litest_device *dev = litest_current_device(); @@ -1640,6 +1686,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);