Commit 6e264932 authored by Jonas Ådahl's avatar Jonas Ådahl

test/pointer: Don't rely on velocities in direction change test

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's avatarJonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 85f7bad7
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment