[PATCH libinput 3/6] test: add a bunch of test for click behavior on touchpads

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 11 17:03:38 PDT 2014


On Wed, Jun 11, 2014 at 10:48:07AM +0200, Hans de Goede wrote:
> Hi,
> 
> On 06/11/2014 02:11 AM, Peter Hutterer wrote:
> > Mainly testing the behaviour when clicking during a tap or tap-n-drag. Adds a
> > new "feature" to the litest system, Apple clickpads don't have software
> > buttons by default.
> > 

[...]
> > +START_TEST(touchpad_1fg_tap_n_drag_click)
> > +{
> > +	struct litest_device *dev = litest_current_device();
> > +	struct libinput *li = dev->libinput;
> > +	struct libinput_event *event;
> > +
> > +	litest_drain_events(dev->libinput);
> > +
> > +	/* one finger down, up, down, move, button click, finger up
> > +	   -> two button left event pairs, motion allowed */
> > +	litest_touch_down(dev, 0, 50, 50);
> > +	litest_touch_up(dev, 0);
> > +	litest_touch_down(dev, 0, 50, 50);
> > +	litest_touch_move_to(dev, 1, 50, 50, 80, 50, 5);
> > +
> > +	assert_button_event(li, BTN_LEFT,
> > +			    LIBINPUT_BUTTON_STATE_PRESSED);
> > +
> > +	libinput_dispatch(li);
> > +	while (libinput_next_event_type(li) == LIBINPUT_EVENT_POINTER_MOTION) {
> > +		event = libinput_get_event(li);
> > +		libinput_event_destroy(event);
> > +		libinput_dispatch(li);
> > +	}
> 
> This test for a click + drag using double tapping, right, in that
> case I would like to see an assert checking that there is at least
> one LIBINPUT_EVENT_POINTER_MOTION event followed by the while consuming
> any more LIBINPUT_EVENT_POINTER_MOTION events

good call, and it exposed a copy/paste error: litest_move_to in the patch
I sent out was for slot 1 so had no effect. Fixed, and the check for a
motion event is in now.

> 
> > +
> > +	litest_event(dev, EV_KEY, BTN_LEFT, 1);
> > +	litest_event(dev, EV_SYN, SYN_REPORT, 0);
> > +
> > +	assert_button_event(li, BTN_LEFT,
> > +			    LIBINPUT_BUTTON_STATE_RELEASED);
> > +	assert_button_event(li, BTN_LEFT,
> > +			    LIBINPUT_BUTTON_STATE_PRESSED);
> > +
> > +	litest_event(dev, EV_KEY, BTN_LEFT, 0);
> > +	litest_event(dev, EV_SYN, SYN_REPORT, 0);
> > +	litest_touch_up(dev, 0);
> > +
> > +	libinput_dispatch(li);
> > +
> > +	assert_button_event(li, BTN_LEFT,
> > +			    LIBINPUT_BUTTON_STATE_RELEASED);
> > +
> > +	libinput_dispatch(li);
> > +
> > +	while (libinput_next_event_type(li) == LIBINPUT_EVENT_POINTER_MOTION) {
> > +		event = libinput_get_event(li);
> > +		libinput_event_destroy(event);
> > +		libinput_dispatch(li);
> > +	}
> 
> Is this really necessary, why would there be motion events after
> the button up ?

dropped, thanks

Cheers,
   Peter

> 
> > +
> > +	litest_assert_empty_queue(li);
> > +}
> > +END_TEST
> > +
> >  START_TEST(touchpad_1fg_clickfinger)
> >  {
> >  	struct litest_device *dev = litest_create_device(LITEST_BCM5974);
> > @@ -352,6 +525,13 @@ int main(int argc, char **argv) {
> >  	litest_add("touchpad:tap", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY);
> >  	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY);
> >  	litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
> > +	litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD, LITEST_ANY);
> > +	litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
> > +	litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY);
> > +	/* Real buttons don't interfere with tapping, so don't run those for
> > +	   pads with buttons */
> > +	litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
> > +	litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
> >  
> >  	litest_add_no_device("touchpad:clickfinger", touchpad_1fg_clickfinger);
> >  	litest_add_no_device("touchpad:clickfinger", touchpad_2fg_clickfinger);
> > 
> 
> Regards,
> 
> Hans


More information about the wayland-devel mailing list