END_TEST START_TEST(abs_mt_device_missing_res) { struct libinput *li; struct input_absinfo absinfo[] = { { ABS_X, 0, 10, 0, 0, 10 }, { ABS_Y, 0, 10, 0, 0, 10 }, { ABS_MT_SLOT, 0, 2, 0, 0, 0 }, { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 }, { ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 }, { -1, -1, -1, -1, -1, -1 } }; li = litest_create_context(); litest_disable_log_handler(li); assert_device_ignored(li, absinfo); absinfo[4].resolution = 0; absinfo[5].resolution = 20; assert_device_ignored(li, absinfo); litest_restore_log_handler(li); libinput_unref(li); }
END_TEST START_TEST(abs_mt_device_no_range) { struct libinput *li; 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 }, { ABS_MT_SLOT, 0, 10, 0, 0, 0 }, { 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 }, { code, 0, 0, 0, 0, 0 }, { -1, -1, -1, -1, -1, -1 } }; li = litest_create_context(); litest_disable_log_handler(li); 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); }
END_TEST START_TEST(abs_mt_device_no_absx) { struct libevdev_uinput *uinput; struct libinput *li; struct libinput_device *device; uinput = litest_create_uinput_device("test device", NULL, EV_KEY, BTN_LEFT, EV_KEY, BTN_RIGHT, EV_ABS, ABS_X, EV_ABS, ABS_Y, EV_ABS, ABS_MT_SLOT, EV_ABS, ABS_MT_POSITION_Y, -1); li = litest_create_context(); litest_disable_log_handler(li); device = libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput)); litest_restore_log_handler(li); ck_assert(device == NULL); libinput_unref(li); libevdev_uinput_destroy(uinput); }
END_TEST START_TEST(path_add_invalid_path) { struct libinput *li; struct libinput_event *event; struct libinput_device *device; li = litest_create_context(); litest_disable_log_handler(li); device = libinput_path_add_device(li, "/tmp/"); litest_restore_log_handler(li); ck_assert(device == NULL); libinput_dispatch(li); while ((event = libinput_get_event(li))) ck_abort(); libinput_unref(li); }
END_TEST START_TEST(abs_device_missing_res) { struct libinput *li; struct input_absinfo absinfo[] = { { ABS_X, 0, 10, 0, 0, 10 }, { ABS_Y, 0, 10, 0, 0, 0 }, { -1, -1, -1, -1, -1, -1 } }; li = litest_create_context(); litest_disable_log_handler(li); assert_device_ignored(li, absinfo); absinfo[0].resolution = 0; absinfo[1].resolution = 20; assert_device_ignored(li, absinfo); litest_restore_log_handler(li); libinput_unref(li); }