[PATCH libinput 3/5] test/pointer: Don't rely on velocities in direction change test

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 27 23:42:28 PDT 2015


On Tue, Jul 28, 2015 at 12:47:04PM +0800, Jonas Ådahl wrote:
> We currently rely on an extra millisecond being added by the filter
> code to get a velocity that are small enough to not hit the max
> acceleration limit. If this arbitrary millisecond is changed (for
> example by changing the internal time measurment to microseconds and
> adding just a microsecond instead), the velocity may change so that the
> maximum or minimum acceleration is always hit.
> 
> Adding a delay to the test won't work either since it would not only rely
> on ending up within the acceleration limits but there would also be an
> non-deterministic actual delay causing the velocity of the movement
> after the direction change to be potentially larger than the movement
> in the original direction due to the actual time delta in libinput will
> not always be 1ms.
> 
> To fix the test to not rely on any artificial delays in the filter code
> nor any non-deterministic delays in the test, lets just test that the
> direction change of the hardware events resulted in a direction change
> of the libinput motion events.
> 
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter
> ---
>  test/pointer.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/test/pointer.c b/test/pointer.c
> index 1de5dc9..10b9fdc 100644
> --- a/test/pointer.c
> +++ b/test/pointer.c
> @@ -998,7 +998,6 @@ START_TEST(pointer_accel_direction_change)
>  	struct libinput_event_pointer *pev;
>  	int i;
>  	double delta;
> -	double max_accel;
>  
>  	litest_drain_events(li);
>  
> @@ -1019,7 +1018,6 @@ START_TEST(pointer_accel_direction_change)
>  
>  		delta = libinput_event_pointer_get_dx(pev);
>  		ck_assert_double_le(delta, 0.0);
> -		max_accel = delta;
>  		libinput_event_destroy(event);
>  		event = libinput_get_event(li);
>  	} while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE);
> @@ -1027,7 +1025,6 @@ START_TEST(pointer_accel_direction_change)
>  	pev = libinput_event_get_pointer_event(event);
>  	delta = libinput_event_pointer_get_dx(pev);
>  	ck_assert_double_gt(delta, 0.0);
> -	ck_assert_double_lt(delta, -max_accel);
>  	libinput_event_destroy(event);
>  }
>  END_TEST
> -- 
> 2.1.0
> 
> _______________________________________________
> 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