From a71f560f3ee69d8c4c543d812f5f9debb34a22ec Mon Sep 17 00:00:00 2001 From: satrmb <10471-satrmb@gitlab.freedesktop.org> Date: Sun, 16 Feb 2025 17:05:39 +0100 Subject: [PATCH] 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: --- test/test-device.c | 4 ++-- test/test-touchpad-tap.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test-device.c b/test/test-device.c index 9d041c0d..7441e9de 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -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); diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c index a3975055..cc75eb4e 100644 --- a/test/test-touchpad-tap.c +++ b/test/test-touchpad-tap.c @@ -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);