test: allow the first event to be a short one during scroll tests

The hysteresis cuts the first pointer motion by the hysteresis margin. On some
touchpads this causes the tests to fail when the motion history length is
reduced (future patch). Allow the first event to be smaller than the expected
minimum.

This doesn't trigger in current tests because the hysteresis is per-event and
by the time we get past the minimum 4 events to move the pointer, we're
already flying unaffected by the hysteresis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2016-11-21 14:10:10 +10:00
parent 4fe85b736a
commit c9d2d5e3de

View file

@ -2806,6 +2806,7 @@ litest_assert_scroll(struct libinput *li,
struct libinput_event *event, *next_event;
struct libinput_event_pointer *ptrev;
int value;
int nevents = 0;
event = libinput_get_event(li);
next_event = libinput_get_event(li);
@ -2813,16 +2814,26 @@ litest_assert_scroll(struct libinput *li,
while (event) {
ptrev = litest_is_axis_event(event, axis, 0);
nevents++;
if (next_event) {
int min = minimum_movement;
value = libinput_event_pointer_get_axis_value(ptrev,
axis);
/* Due to how the hysteresis works on touchpad
* events, the first event is reduced by the
* hysteresis margin that can cause the first event
* go under the minimum we expect for all other
* events */
if (nevents == 1)
min = minimum_movement/2;
/* Normal scroll event, check dir */
if (minimum_movement > 0) {
litest_assert_int_ge(value, minimum_movement);
} else {
litest_assert_int_le(value, minimum_movement);
}
if (minimum_movement > 0)
litest_assert_int_ge(value, min);
else
litest_assert_int_le(value, min);
} else {
/* Last scroll event, must be 0 */
ck_assert_double_eq(