mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-13 17:50:03 +01:00
test: fix expected delta from relative motion
We send two delta events. One may get eaten or softened by the accel code but our expectation should be that both may get through, so the length of the expected vector is √((2dx)² + (2dy)²). That is the maximum length we expect though for deltas ranged [-1, 1]. Deltas above the threshold would fail this test but we can fix that when needed. Pointer acceleration is subject to timing changes. When running tests in valgrind pointer accel timeouts and tracker resets may happen so we can't guarantee a specific acceleration length. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
03a1ef7540
commit
e4d50a73a1
1 changed files with 2 additions and 2 deletions
|
|
@ -63,7 +63,7 @@ test_relative_event(struct litest_device *dev, int dx, int dy)
|
|||
ptrev = libinput_event_get_pointer_event(event);
|
||||
ck_assert(ptrev != NULL);
|
||||
|
||||
expected_length = sqrt(dx*dx + dy*dy);
|
||||
expected_length = sqrt(4 * dx*dx + 4 * dy*dy);
|
||||
expected_dir = atan2(dx, dy);
|
||||
|
||||
ev_dx = libinput_event_pointer_get_dx(ptrev);
|
||||
|
|
@ -72,7 +72,7 @@ test_relative_event(struct litest_device *dev, int dx, int dy)
|
|||
actual_dir = atan2(ev_dx, ev_dy);
|
||||
|
||||
/* Check the length of the motion vector (tolerate 1.0 indifference). */
|
||||
ck_assert(fabs(expected_length - actual_length) < 1.0);
|
||||
ck_assert(fabs(expected_length) >= actual_length);
|
||||
|
||||
/* Check the direction of the motion vector (tolerate 2π/4 radians
|
||||
* indifference). */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue