mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
test: switch the abs ranged tests over to real ranged tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
b97ad3c174
commit
ca10fc2be7
1 changed files with 13 additions and 44 deletions
|
|
@ -831,50 +831,22 @@ assert_device_ignored(struct libinput *li, struct input_absinfo *absinfo)
|
|||
libevdev_uinput_destroy(uinput);
|
||||
}
|
||||
|
||||
START_TEST(abs_device_no_range_lo)
|
||||
START_TEST(abs_device_no_range)
|
||||
{
|
||||
struct libinput *li;
|
||||
int code;
|
||||
int code = _i; /* looped test */
|
||||
/* set x/y so libinput doesn't just reject for missing axes */
|
||||
struct input_absinfo absinfo[] = {
|
||||
{ ABS_X, 0, 10, 0, 0, 0 },
|
||||
{ ABS_Y, 0, 10, 0, 0, 0 },
|
||||
{ -1, 0, 0, 0, 0, 0 },
|
||||
{ code, 0, 0, 0, 0, 0 },
|
||||
{ -1, -1, -1, -1, -1, -1 }
|
||||
};
|
||||
|
||||
li = litest_create_context();
|
||||
litest_disable_log_handler(li);
|
||||
|
||||
for (code = 0; code < ABS_MISC/2; code++) {
|
||||
absinfo[2].value = code;
|
||||
assert_device_ignored(li, absinfo);
|
||||
}
|
||||
|
||||
litest_restore_log_handler(li);
|
||||
libinput_unref(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(abs_device_no_range_hi)
|
||||
{
|
||||
struct libinput *li;
|
||||
int code;
|
||||
/* set x/y so libinput doesn't just reject for missing axes */
|
||||
struct input_absinfo absinfo[] = {
|
||||
{ ABS_X, 0, 10, 0, 0, 0 },
|
||||
{ ABS_Y, 0, 10, 0, 0, 0 },
|
||||
{ -1, 0, 0, 0, 0, 0 },
|
||||
{ -1, -1, -1, -1, -1, -1 }
|
||||
};
|
||||
|
||||
li = litest_create_context();
|
||||
litest_disable_log_handler(li);
|
||||
|
||||
for (code = ABS_MISC/2; code < ABS_MISC; code++) {
|
||||
absinfo[2].value = code;
|
||||
assert_device_ignored(li, absinfo);
|
||||
}
|
||||
assert_device_ignored(li, absinfo);
|
||||
|
||||
litest_restore_log_handler(li);
|
||||
libinput_unref(li);
|
||||
|
|
@ -884,7 +856,7 @@ END_TEST
|
|||
START_TEST(abs_mt_device_no_range)
|
||||
{
|
||||
struct libinput *li;
|
||||
int code;
|
||||
int code = _i; /* looped test */
|
||||
/* set x/y so libinput doesn't just reject for missing axes */
|
||||
struct input_absinfo absinfo[] = {
|
||||
{ ABS_X, 0, 10, 0, 0, 0 },
|
||||
|
|
@ -893,21 +865,16 @@ START_TEST(abs_mt_device_no_range)
|
|||
{ ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 },
|
||||
{ ABS_MT_POSITION_X, 0, 10, 0, 0, 0 },
|
||||
{ ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 },
|
||||
{ -1, 0, 0, 0, 0, 0 },
|
||||
{ code, 0, 0, 0, 0, 0 },
|
||||
{ -1, -1, -1, -1, -1, -1 }
|
||||
};
|
||||
|
||||
li = litest_create_context();
|
||||
litest_disable_log_handler(li);
|
||||
|
||||
for (code = ABS_MT_SLOT + 1; code < ABS_CNT; code++) {
|
||||
if (code == ABS_MT_TOOL_TYPE ||
|
||||
code == ABS_MT_TRACKING_ID) /* kernel overrides it */
|
||||
continue;
|
||||
|
||||
absinfo[6].value = code;
|
||||
if (code != ABS_MT_TOOL_TYPE &&
|
||||
code != ABS_MT_TRACKING_ID) /* kernel overrides it */
|
||||
assert_device_ignored(li, absinfo);
|
||||
}
|
||||
|
||||
litest_restore_log_handler(li);
|
||||
libinput_unref(li);
|
||||
|
|
@ -978,6 +945,9 @@ END_TEST
|
|||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
struct range abs_range = { 0, ABS_MISC };
|
||||
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
|
||||
|
||||
litest_add("device:sendevents", device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
litest_add("device:sendevents", device_sendevents_config_invalid, LITEST_ANY, LITEST_ANY);
|
||||
litest_add("device:sendevents", device_sendevents_config_touchpad, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
|
|
@ -1008,9 +978,8 @@ int main (int argc, char **argv)
|
|||
litest_add_no_device("device:invalid devices", abs_device_no_absy);
|
||||
litest_add_no_device("device:invalid devices", abs_mt_device_no_absx);
|
||||
litest_add_no_device("device:invalid devices", abs_mt_device_no_absy);
|
||||
litest_add_no_device("device:invalid devices", abs_device_no_range_hi);
|
||||
litest_add_no_device("device:invalid devices", abs_device_no_range_lo);
|
||||
litest_add_no_device("device:invalid devices", abs_mt_device_no_range);
|
||||
litest_add_ranged_no_device("device:invalid devices", abs_device_no_range, &abs_range);
|
||||
litest_add_ranged_no_device("device:invalid devices", abs_mt_device_no_range, &abs_mt_range);
|
||||
litest_add_no_device("device:invalid devices", abs_device_missing_res);
|
||||
litest_add_no_device("device:invalid devices", abs_mt_device_missing_res);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue