mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-21 23:50:45 +01:00
test: loosen up litest to allow major/minor handling
The max values on ABS_MT_TOUCH_MAJOR/MINOR aren't hard limits, they basically represent the size of a finger with (afaict) a suggestion that anything greater than the max may be a palm. Disable the 0-100% range checks for those axes so we can send custom events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4af403ab5e
commit
f13abd202a
2 changed files with 26 additions and 6 deletions
|
|
@ -2184,7 +2184,11 @@ litest_scale_axis(const struct litest_device *d,
|
|||
const struct input_absinfo *abs;
|
||||
|
||||
litest_assert_double_ge(val, 0.0);
|
||||
litest_assert_double_le(val, 100.0);
|
||||
/* major/minor must be able to beyond 100% for large fingers */
|
||||
if (axis != ABS_MT_TOUCH_MAJOR &&
|
||||
axis != ABS_MT_TOUCH_MINOR) {
|
||||
litest_assert_double_le(val, 100.0);
|
||||
}
|
||||
|
||||
abs = libevdev_get_abs_info(d->evdev, axis);
|
||||
litest_assert_notnull(abs);
|
||||
|
|
@ -2205,8 +2209,12 @@ int
|
|||
litest_scale(const struct litest_device *d, unsigned int axis, double val)
|
||||
{
|
||||
int min, max;
|
||||
|
||||
litest_assert_double_ge(val, 0.0);
|
||||
litest_assert_double_le(val, 100.0);
|
||||
/* major/minor must be able to beyond 100% for large fingers */
|
||||
if (axis != ABS_MT_TOUCH_MAJOR &&
|
||||
axis != ABS_MT_TOUCH_MINOR)
|
||||
litest_assert_double_le(val, 100.0);
|
||||
|
||||
if (axis <= ABS_Y) {
|
||||
min = d->interface->min[axis];
|
||||
|
|
|
|||
|
|
@ -303,12 +303,12 @@ struct axis_replacement {
|
|||
double value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as litest_axis_set_value but allows for ranges outside 0..100%
|
||||
*/
|
||||
static inline void
|
||||
litest_axis_set_value(struct axis_replacement *axes, int code, double value)
|
||||
litest_axis_set_value_unchecked(struct axis_replacement *axes, int code, double value)
|
||||
{
|
||||
litest_assert_double_ge(value, 0.0);
|
||||
litest_assert_double_le(value, 100.0);
|
||||
|
||||
while (axes->evcode != -1) {
|
||||
if (axes->evcode == code) {
|
||||
axes->value = value;
|
||||
|
|
@ -320,6 +320,18 @@ litest_axis_set_value(struct axis_replacement *axes, int code, double value)
|
|||
litest_abort_msg("Missing axis code %d\n", code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a value in percent and sets the given axis to that code.
|
||||
*/
|
||||
static inline void
|
||||
litest_axis_set_value(struct axis_replacement *axes, int code, double value)
|
||||
{
|
||||
litest_assert_double_ge(value, 0.0);
|
||||
litest_assert_double_le(value, 100.0);
|
||||
|
||||
litest_axis_set_value_unchecked(axes, code, value);
|
||||
}
|
||||
|
||||
/* A loop range, resolves to:
|
||||
for (i = lower; i < upper; i++)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue