mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
test: fix the pressure offset tests
Unsuprisingly, a normalized [0,1] value will always be between 0 and 1, so bhis gave us a false positive. Check for the real values instead. Those values aren't 100% correct because of a bug in the offset handling which will be fixed in a follow-up commit. The difference is near enough that it doesn't matter here anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
031fbc84bd
commit
ad13116f4e
1 changed files with 7 additions and 10 deletions
|
|
@ -3611,9 +3611,7 @@ START_TEST(tablet_pressure_offset)
|
|||
|
||||
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
||||
|
||||
/* can't use the double_eq here, the pressure value is too tiny */
|
||||
ck_assert(pressure > 0.0);
|
||||
ck_assert(pressure < 1.0);
|
||||
ck_assert_double_lt(pressure, 0.015);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
END_TEST
|
||||
|
|
@ -3642,7 +3640,7 @@ START_TEST(tablet_pressure_offset_decrease)
|
|||
litest_tablet_proximity_out(dev);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* a reduced pressure value must reduce the offset */
|
||||
/* a higher pressure value leaves it as-is */
|
||||
litest_tablet_proximity_in(dev, 5, 100, axes);
|
||||
libinput_dispatch(li);
|
||||
event = libinput_get_event(li);
|
||||
|
|
@ -3668,9 +3666,9 @@ START_TEST(tablet_pressure_offset_decrease)
|
|||
|
||||
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
||||
|
||||
/* can't use the double_eq here, the pressure value is too tiny */
|
||||
ck_assert(pressure > 0.0);
|
||||
ck_assert(pressure < 1.0);
|
||||
/* offset is 10, value is 15, so that's a around 5% of the
|
||||
* remaining range */
|
||||
ck_assert_double_eq_tol(pressure, 0.05, 0.01);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
END_TEST
|
||||
|
|
@ -3715,9 +3713,8 @@ START_TEST(tablet_pressure_offset_increase)
|
|||
tev = litest_is_tablet_event(event,
|
||||
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
||||
/* can't use the double_eq here, the pressure value is too tiny */
|
||||
ck_assert(pressure > 0.0);
|
||||
ck_assert(pressure < 1.0);
|
||||
/* Pressure should be around 10% */
|
||||
ck_assert_double_eq_tol(pressure, 0.10, 0.01);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue