test: check that the pressure offset is reduced during motion events too

Ensure that if we do get pressure < offset that that offset is reduced
to the current pressure value.

The implementation for this is arguably buggy, reducing the pressure
means we get a tip up event since we now reach 0% of pressure. Arguably
we should enforce the tip staying down and releasing it later but since
this should typically never happen more than once per tool per context
and working around this is a lot of effort, we live with it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2023-06-13 15:22:26 +10:00
parent 24cf215f54
commit 6f10f01af2

View file

@ -3921,6 +3921,26 @@ START_TEST(tablet_pressure_offset_decrease)
* account it's closer to 5% into the remaining effective 89% range
*/
assert_pressure(li, LIBINPUT_EVENT_TABLET_TOOL_TIP, 0.05);
/* a reduced pressure value during motion events must reduce the offset
* - here back down to 5%.
* FIXME: this causes a tip up event which is a bug but working around
* this is more effort than it's worth for what should be quite a niche
* case.
*/
litest_axis_set_value(axes, ABS_PRESSURE, 5);
litest_tablet_motion(dev, 75, 75, axes);
libinput_dispatch(li);
assert_pressure(li, LIBINPUT_EVENT_TABLET_TOOL_TIP, 0.0);
litest_drain_events(li);
/* back to 10% should now give us 5% pressure because we reduced the
* offset */
litest_axis_set_value(axes, ABS_PRESSURE, 10);
litest_tablet_motion(dev, 75, 75, axes);
libinput_dispatch(li);
assert_pressure(li, LIBINPUT_EVENT_TABLET_TOOL_TIP, 0.05);
litest_drain_events(li);
}
END_TEST