mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 01:10:25 +01:00
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:
parent
4fe85b736a
commit
c9d2d5e3de
1 changed files with 16 additions and 5 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue