[PATCH libinput] test: add two gesture tests for scrolling with a thumb in the btnarea
Hans de Goede
hdegoede at redhat.com
Thu Jan 28 22:31:00 PST 2016
Hi,
On 01/29/2016 02:21 AM, Peter Hutterer wrote:
> If a finger is resting in the software button area, it must not be counted
> towards the gesture. So a two-finger movement must be a scroll event, not a
> three-finger pinch.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> test/gestures.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/test/gestures.c b/test/gestures.c
> index 3f7ee83..c814911 100644
> --- a/test/gestures.c
> +++ b/test/gestures.c
> @@ -1153,6 +1153,63 @@ START_TEST(gestures_time_usec)
> }
> END_TEST
>
> +START_TEST(gestures_3fg_buttonarea_scroll)
> +{
> + struct litest_device *dev = litest_current_device();
> + struct libinput *li = dev->libinput;
> +
> + if (libevdev_get_num_slots(dev->evdev) < 3)
> + return;
> +
> + litest_enable_buttonareas(dev);
> + litest_enable_2fg_scroll(dev);
> + litest_drain_events(li);
> +
> + litest_touch_down(dev, 0, 40, 20);
> + litest_touch_down(dev, 1, 30, 20);
> + /* third finger in btnarea */
> + litest_touch_down(dev, 2, 50, 99);
> + libinput_dispatch(li);
> + litest_touch_move_two_touches(dev,
> + 40, 20,
> + 30, 20,
> + 0, 40,
> + 4, 2);
> +
> + litest_touch_up(dev, 0);
> + litest_touch_up(dev, 1);
> + libinput_dispatch(li);
> + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4);
> +}
> +END_TEST
> +
> +START_TEST(gestures_3fg_buttonarea_scroll_btntool)
> +{
> + struct litest_device *dev = litest_current_device();
> + struct libinput *li = dev->libinput;
> +
> + if (libevdev_get_num_slots(dev->evdev) > 2)
> + return;
> +
> + litest_enable_buttonareas(dev);
> + litest_enable_2fg_scroll(dev);
> + litest_drain_events(li);
> +
> + /* first finger in btnarea */
> + litest_touch_down(dev, 0, 20, 99);
> + litest_touch_down(dev, 1, 30, 20);
> + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
> + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
> + litest_event(dev, EV_SYN, SYN_REPORT, 0);
> + libinput_dispatch(li);
> + litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10, 1);
> +
> + litest_touch_up(dev, 1);
> + libinput_dispatch(li);
> + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4);
> +}
> +END_TEST
> +
> void
> litest_setup_tests(void)
> {
> @@ -1173,5 +1230,8 @@ litest_setup_tests(void)
> litest_add_ranged("gestures:pinch", gestures_pinch_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
> litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
>
> + litest_add("gestures:swipe", gestures_3fg_buttonarea_scroll, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
> + litest_add("gestures:swipe", gestures_3fg_buttonarea_scroll_btntool, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
> +
> litest_add("gesture:time", gestures_time_usec, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
> }
>
More information about the wayland-devel
mailing list