[PATCH libinput 5/8] test: Check that libinput doesn't send double touch down/up events
Peter Hutterer
peter.hutterer at who-t.net
Wed Mar 26 02:41:54 PDT 2014
On Tue, Mar 25, 2014 at 09:45:56PM +0100, Jonas Ådahl wrote:
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
> test/touch.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/test/touch.c b/test/touch.c
> index 61d8762..4a6af21 100644
> --- a/test/touch.c
> +++ b/test/touch.c
> @@ -323,6 +323,47 @@ START_TEST(touch_many_slots)
> }
> END_TEST
>
> +START_TEST(touch_double_touch_down_up)
> +{
> + struct libinput *libinput;
> + struct litest_device *dev;
> + struct libinput_event *ev;
> + bool got_down = false;
> + bool got_up = false;
> +
> + dev = litest_current_device();
> + libinput = dev->libinput;
> +
> + litest_touch_down(dev, 0, 0, 0);
> + litest_touch_down(dev, 0, 0, 0);
with this the kernel will filter the coordinates. This only works because
the tracking_id is automatically picked in touch_down. IMO it might be worth
changing the coordinates here too. It has no real effect but it'll look more
like two touchpoints and the evdev events will be more obvious to read too.
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
for the patches where I didn't complain about something :)
Cheers,
Peter
> + litest_touch_up(dev, 0);
> + litest_touch_up(dev, 0);
> +
> + libinput_dispatch(libinput);
> +
> + while ((ev = libinput_get_event(libinput))) {
> + switch (libinput_event_get_type(ev)) {
> + case LIBINPUT_EVENT_TOUCH_DOWN:
> + ck_assert(!got_down);
> + got_down = true;
> + break;
> + case LIBINPUT_EVENT_TOUCH_UP:
> + ck_assert(got_down);
> + ck_assert(!got_up);
> + got_up = true;
> + break;
> + default:
> + break;
> + }
> +
> + libinput_dispatch(libinput);
> + }
> +
> + ck_assert(got_down);
> + ck_assert(got_up);
> +}
> +END_TEST
> +
> int
> main(int argc, char **argv)
> {
> @@ -333,6 +374,8 @@ main(int argc, char **argv)
> litest_add_no_device("touch:seat-slot-drop", touch_seat_slot_drop);
> litest_add("touch:many-slots", touch_many_slots,
> LITEST_TOUCH, LITEST_ANY);
> + litest_add("touch:double-touch-down-up", touch_double_touch_down_up,
> + LITEST_TOUCH, LITEST_ANY);
>
> return litest_run(argc, argv);
> }
> --
> 1.8.3.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list