test: fix off-by-ones in two ranges, prevent the same in remaining ranged tests

touchpad_move_after_touch contains support for up to 5 fingers but was only run
with 2..4 fingers.
touchpad_multitap and several others using the same parameter definition were
long ago tested with 3..7 taps. In 8f92b091 this was reduced to 3..4 for CI
performance, while the commit message indicates 3..5 were intended.

The common theme is that the upper bound of `struct range` is interpreted
as exclusive, while some uses assumed it would be inclusive.
There are relatively recent helper functions range_init_inclusive and
range_init_exclusive (since 817dc423) to avoid this trap. Use them on the
remaining two ranged tests.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1142>
This commit is contained in:
satrmb 2025-02-16 17:05:39 +01:00
parent 6f9a54c573
commit a71f560f3e
2 changed files with 5 additions and 5 deletions

View file

@ -1747,8 +1747,8 @@ END_TEST
TEST_COLLECTION(device)
{
struct range abs_range = { 0, ABS_MISC };
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
struct range abs_range = range_init_exclusive(0, ABS_MISC);
struct range abs_mt_range = range_init_exclusive(ABS_MT_SLOT + 1, ABS_CNT);
litest_add(device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD|LITEST_TABLET);
litest_add(device_sendevents_config_invalid, LITEST_ANY, LITEST_TABLET);

View file

@ -5701,7 +5701,7 @@ TEST_COLLECTION(touchpad_tap)
litest_add_parametrized(touchpad_doubletap, LITEST_TOUCHPAD, LITEST_ANY, params);
}
litest_with_parameters(params, "fingers", 'i', 3, 1, 2, 3,
"taps", 'i', 2, 3, 4) {
"taps", 'i', 3, 3, 4, 5) {
litest_add_parametrized(touchpad_multitap, LITEST_TOUCHPAD, LITEST_ANY, params);
litest_add_parametrized(touchpad_multitap_timeout, LITEST_TOUCHPAD, LITEST_ANY, params);
}
@ -5739,7 +5739,7 @@ TEST_COLLECTION(touchpad_tap)
litest_add_parametrized(touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, params);
}
litest_with_parameters(params, "fingers", 'i', 3, 2, 3, 4) {
litest_with_parameters(params, "fingers", 'i', 4, 2, 3, 4, 5) {
litest_add_parametrized(touchpad_move_after_touch, LITEST_TOUCHPAD, LITEST_ANY, params);
}
@ -5772,7 +5772,7 @@ TEST_COLLECTION(touchpad_tap_drag)
litest_add(touchpad_drag_lock_default_unavailable, LITEST_ANY, LITEST_TOUCHPAD);
litest_with_parameters(params, "fingers", 'i', 3, 1, 2, 3,
"taps", 'i', 2, 3, 4) {
"taps", 'i', 3, 3, 4, 5) {
litest_add_parametrized(touchpad_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, params);
litest_add_parametrized(touchpad_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, params);