[PATCH libinput 4/9] test: Test handling of many touch points

Jonas Ådahl jadahl at gmail.com
Wed Apr 9 23:26:47 PDT 2014


On Thu, Apr 10, 2014 at 03:51:23PM +1000, Peter Hutterer wrote:
> On Wed, Apr 09, 2014 at 09:02:11PM +0200, Jonas Ådahl wrote:
> > libinput currently handles 16 per device touch points. Test that we
> > behave as expected when a device has an even higher number of active
> > touch points.
> > 
> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> > ---
> >  test/touch.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 49 insertions(+)
> > 
> > diff --git a/test/touch.c b/test/touch.c
> > index e1a8146..ae881b0 100644
> > --- a/test/touch.c
> > +++ b/test/touch.c
> > @@ -292,6 +292,54 @@ START_TEST(touch_seat_slot_drop)
> >  }
> >  END_TEST
> >  
> > +START_TEST(touch_many_slots)
> > +{
> > +	struct libinput *libinput;
> > +	struct litest_device *dev;
> > +	struct libinput_event *ev;
> > +	int slot;
> > +	const int num_tps = 100;
> > +	int slot_count = 0;
> > +	enum libinput_event_type type;
> > +
> > +	dev = litest_current_device();
> > +	libinput = dev->libinput;
> > +
> > +	for (slot = 0; slot < num_tps; ++slot)
> > +		litest_touch_down(dev, slot, 0, 0);
> > +	for (slot = 0; slot < num_tps; ++slot)
> > +		litest_touch_up(dev, slot);
> > +
> > +	libinput_dispatch(libinput);
> > +	while ((ev = libinput_get_event(libinput))) {
> > +		type = libinput_event_get_type(ev);
> > +
> > +		if (type == LIBINPUT_EVENT_TOUCH_DOWN)
> > +			slot_count++;
> > +		else if (type == LIBINPUT_EVENT_TOUCH_UP)
> > +			break;
> > +
> > +		libinput_dispatch(libinput);
> > +	}
> > +
> > +	ck_assert_notnull(ev);
> > +	ck_assert_int_gt(slot_count, 0);
> 
> maybe ck_assert_int_eq(slot_count, libevdev_num_slots(dev->evdev)) ?

Fixed locally (and the superfluous {} below).

> 
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net> either way
> 
> 
> > +
> > +	libinput_dispatch(libinput);
> > +	do {
> > +		type = libinput_event_get_type(ev);
> > +		ck_assert_int_ne(type, LIBINPUT_EVENT_TOUCH_DOWN);
> > +		if (type == LIBINPUT_EVENT_TOUCH_UP) {
> > +			slot_count--;
> > +		}
> 
> superfluous {}
> 
> Cheers,
>    Peter
> 
> > +
> > +		libinput_dispatch(libinput);
> > +	} while ((ev = libinput_get_event(libinput)));
> > +
> > +	ck_assert_int_eq(slot_count, 0);
> > +}
> > +END_TEST
> > +
> >  int
> >  main(int argc, char **argv)
> >  {
> > @@ -299,6 +347,7 @@ main(int argc, char **argv)
> >  	litest_add_no_device("touch:abs-transform", touch_abs_transform);
> >  	litest_add_no_device("touch:seat-slot", touch_seat_slots);
> >  	litest_add_no_device("touch:seat-slot-drop", touch_seat_slot_drop);
> > +	litest_add("touch:many-slots", touch_many_slots, 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