[PATCH libinput] test: add test for no scroll events before the scroll button timeout

Hans de Goede hdegoede at redhat.com
Wed Apr 13 08:57:59 UTC 2016


Hi,

On 12-04-16 20:50, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Looks good to me:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> ---
>   src/evdev.c    |  2 ++
>   test/pointer.c | 31 +++++++++++++++++++++++++++++++
>   2 files changed, 33 insertions(+)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index f0311c6..a237ce6 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -280,6 +280,8 @@ evdev_post_trackpoint_scroll(struct evdev_device *device,
>   		evdev_post_scroll(device, time,
>   				  LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
>   				  &unaccel);
> +	/* if the button is down but scroll is not active, we're within the
> +	   timeout where swallow motion events but don't post scroll buttons */
>
>   	return true;
>   }
> diff --git a/test/pointer.c b/test/pointer.c
> index a34740a..8c7ad46 100644
> --- a/test/pointer.c
> +++ b/test/pointer.c
> @@ -893,6 +893,36 @@ START_TEST(pointer_scroll_button)
>   }
>   END_TEST
>
> +START_TEST(pointer_scroll_button_no_event_before_timeout)
> +{
> +	struct litest_device *device = litest_current_device();
> +	struct libinput *li = device->libinput;
> +	int i;
> +
> +	disable_button_scrolling(device);
> +
> +	libinput_device_config_scroll_set_method(device->libinput_device,
> +					LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
> +	libinput_device_config_scroll_set_button(device->libinput_device,
> +						 BTN_LEFT);
> +	litest_drain_events(li);
> +
> +	litest_button_click(device, BTN_LEFT, true);
> +	litest_assert_empty_queue(li);
> +
> +	for (i = 0; i < 10; i++) {
> +		litest_event(device, EV_REL, REL_Y, 1);
> +		litest_event(device, EV_SYN, SYN_REPORT, 0);
> +	}
> +	litest_assert_empty_queue(li);
> +
> +	litest_timeout_buttonscroll();
> +	libinput_dispatch(li);
> +	litest_button_click(device, BTN_LEFT, false);
> +	litest_assert_empty_queue(li);
> +}
> +END_TEST
> +
>   START_TEST(pointer_scroll_nowheel_defaults)
>   {
>   	struct litest_device *dev = litest_current_device();
> @@ -1600,6 +1630,7 @@ litest_setup_tests(void)
>   	litest_add_no_device("pointer:button", pointer_seat_button_count);
>   	litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_TABLET);
>   	litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
> +	litest_add("pointer:scroll", pointer_scroll_button_no_event_before_timeout, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
>   	litest_add("pointer:scroll", pointer_scroll_nowheel_defaults, LITEST_RELATIVE|LITEST_BUTTON, LITEST_WHEEL);
>   	litest_add("pointer:scroll", pointer_scroll_natural_defaults, LITEST_WHEEL, LITEST_TABLET);
>   	litest_add("pointer:scroll", pointer_scroll_natural_enable_config, LITEST_WHEEL, LITEST_TABLET);
>


More information about the wayland-devel mailing list