test: switch ck_assert over to litest_assert

This is the first step in switching away from the check framework.
Our litest macros already do almost exactly the same anyway so most of
this is a simple sed with a few compiler fixes where things mismatch
(nonnull -> notnull) and (_tol -> _epsilon).

This now generates a whole bunch of integer mismatch warnings: check
casts everything to intmax_t whereas we use typeof, so lots of warnings
especially for enums.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
This commit is contained in:
Peter Hutterer 2024-09-16 16:20:26 +10:00
parent 0bc2bf60d2
commit f89fd6d924
21 changed files with 1726 additions and 1790 deletions

View file

@ -293,61 +293,6 @@ START_TEST(litest_ptr_notnull_trigger_NULL)
} }
END_TEST END_TEST
START_TEST(ck_double_eq_and_ne)
{
ck_assert_double_eq(0.4,0.4);
ck_assert_double_eq(0.4,0.4 + 1E-6);
ck_assert_double_ne(0.4,0.4 + 1E-3);
}
END_TEST
START_TEST(ck_double_lt_gt)
{
ck_assert_double_lt(12.0,13.0);
ck_assert_double_gt(15.4,13.0);
ck_assert_double_le(12.0,12.0);
ck_assert_double_le(12.0,20.0);
ck_assert_double_ge(12.0,12.0);
ck_assert_double_ge(20.0,12.0);
}
END_TEST
START_TEST(ck_double_eq_fails)
{
ck_assert_double_eq(0.41,0.4);
}
END_TEST
START_TEST(ck_double_ne_fails)
{
ck_assert_double_ne(0.4 + 1E-7,0.4);
}
END_TEST
START_TEST(ck_double_lt_fails)
{
ck_assert_double_lt(6,5);
}
END_TEST
START_TEST(ck_double_gt_fails)
{
ck_assert_double_gt(5,6);
}
END_TEST
START_TEST(ck_double_le_fails)
{
ck_assert_double_le(6,5);
}
END_TEST
START_TEST(ck_double_ge_fails)
{
ck_assert_double_ge(5,6);
}
END_TEST
START_TEST(litest_double_eq_and_ne) START_TEST(litest_double_eq_and_ne)
{ {
litest_assert_double_eq(0.4,0.4); litest_assert_double_eq(0.4,0.4);
@ -525,15 +470,6 @@ litest_assert_macros_suite(void)
suite_add_tcase(s, tc); suite_add_tcase(s, tc);
tc = tcase_create("double comparison "); tc = tcase_create("double comparison ");
tcase_add_test(tc, ck_double_eq_and_ne);
tcase_add_test(tc, ck_double_lt_gt);
tcase_add_exit_test(tc, ck_double_eq_fails, 1);
tcase_add_exit_test(tc, ck_double_ne_fails, 1);
tcase_add_exit_test(tc, ck_double_lt_fails, 1);
tcase_add_exit_test(tc, ck_double_gt_fails, 1);
tcase_add_exit_test(tc, ck_double_le_fails, 1);
tcase_add_exit_test(tc, ck_double_ge_fails, 1);
tcase_add_test(tc, litest_double_eq_and_ne); tcase_add_test(tc, litest_double_eq_and_ne);
tcase_add_test(tc, litest_double_lt_gt); tcase_add_test(tc, litest_double_lt_gt);
tcase_add_test_raise_signal(tc, litest_double_eq_fails, SIGABRT); tcase_add_test_raise_signal(tc, litest_double_eq_fails, SIGABRT);

View file

@ -346,7 +346,7 @@ grab_device(struct litest_device *device, bool mode)
list_for_each(p, &ctx->paths, link) { list_for_each(p, &ctx->paths, link) {
if (streq(p->path, devnode)) { if (streq(p->path, devnode)) {
int rc = ioctl(p->fd, EVIOCGRAB, (void*)mode ? 1 : 0); int rc = ioctl(p->fd, EVIOCGRAB, (void*)mode ? 1 : 0);
ck_assert_int_gt(rc, -1); litest_assert_int_gt(rc, -1);
udev_device_unref(udev_device); udev_device_unref(udev_device);
return; return;
} }
@ -4230,7 +4230,7 @@ litest_assert_axis_end_sequence(struct libinput *li,
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_axis_event(event, axis_type, axis, source); ptrev = litest_is_axis_event(event, axis_type, axis, source);
val = litest_event_pointer_get_value(ptrev, axis); val = litest_event_pointer_get_value(ptrev, axis);
ck_assert(val == 0.0); litest_assert(val == 0.0);
if (litest_is_high_res_axis_event(event)) { if (litest_is_high_res_axis_event(event)) {
litest_assert(!last_hi_res_event_found); litest_assert(!last_hi_res_event_found);

View file

@ -42,7 +42,7 @@ START_TEST(device_sendevents_config)
device = dev->libinput_device; device = dev->libinput_device;
modes = libinput_device_config_send_events_get_modes(device); modes = libinput_device_config_send_events_get_modes(device);
ck_assert_int_eq(modes, litest_assert_int_eq(modes,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
} }
END_TEST END_TEST
@ -57,7 +57,7 @@ START_TEST(device_sendevents_config_invalid)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | bit(4)); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | bit(4));
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -78,7 +78,7 @@ START_TEST(device_sendevents_config_touchpad)
device = dev->libinput_device; device = dev->libinput_device;
modes = libinput_device_config_send_events_get_modes(device); modes = libinput_device_config_send_events_get_modes(device);
ck_assert_int_eq(modes, expected); litest_assert_int_eq(modes, expected);
} }
END_TEST END_TEST
@ -101,11 +101,11 @@ START_TEST(device_sendevents_config_touchpad_superset)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
modes); modes);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* DISABLED supersedes the rest, expect the rest to be dropped */ /* DISABLED supersedes the rest, expect the rest to be dropped */
modes = libinput_device_config_send_events_get_mode(device); modes = libinput_device_config_send_events_get_mode(device);
ck_assert_int_eq(modes, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); litest_assert_int_eq(modes, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
} }
END_TEST END_TEST
@ -118,11 +118,11 @@ START_TEST(device_sendevents_config_default)
device = dev->libinput_device; device = dev->libinput_device;
mode = libinput_device_config_send_events_get_mode(device); mode = libinput_device_config_send_events_get_mode(device);
ck_assert_int_eq(mode, litest_assert_int_eq(mode,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
mode = libinput_device_config_send_events_get_default_mode(device); mode = libinput_device_config_send_events_get_default_mode(device);
ck_assert_int_eq(mode, litest_assert_int_eq(mode,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
} }
END_TEST END_TEST
@ -142,7 +142,7 @@ START_TEST(device_disable)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* no event from disabling */ /* no event from disabling */
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -155,13 +155,13 @@ START_TEST(device_disable)
/* create a new device so the resumed fd isn't the same as the /* create a new device so the resumed fd isn't the same as the
suspended one */ suspended one */
tmp = litest_add_device(li, LITEST_KEYBOARD); tmp = litest_add_device(li, LITEST_KEYBOARD);
ck_assert_notnull(tmp); litest_assert_notnull(tmp);
litest_drain_events(li); litest_drain_events(li);
/* no event from resuming */ /* no event from resuming */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
/* event from re-enabled device */ /* event from re-enabled device */
@ -170,8 +170,8 @@ START_TEST(device_disable)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_MOTION); LIBINPUT_EVENT_POINTER_MOTION);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -197,7 +197,7 @@ START_TEST(device_disable_tablet)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* no event from disabling */ /* no event from disabling */
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -214,7 +214,7 @@ START_TEST(device_disable_tablet)
/* no event from resuming */ /* no event from resuming */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
END_TEST END_TEST
@ -232,7 +232,7 @@ START_TEST(device_disable_touchpad)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* no event from disabling */ /* no event from disabling */
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -246,7 +246,7 @@ START_TEST(device_disable_touchpad)
/* no event from resuming */ /* no event from resuming */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
END_TEST END_TEST
@ -264,7 +264,7 @@ START_TEST(device_disable_touch)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* no event from disabling */ /* no event from disabling */
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -278,7 +278,7 @@ START_TEST(device_disable_touch)
/* no event from resuming */ /* no event from resuming */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
END_TEST END_TEST
@ -299,7 +299,7 @@ START_TEST(device_disable_touch_during_touch)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* after disabling sendevents we require a touch up */ /* after disabling sendevents we require a touch up */
litest_dispatch(li); litest_dispatch(li);
@ -325,7 +325,7 @@ START_TEST(device_disable_touch_during_touch)
/* no event from resuming */ /* no event from resuming */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
END_TEST END_TEST
@ -353,12 +353,12 @@ START_TEST(device_disable_events_pending)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* expect above events */ /* expect above events */
litest_wait_for_event(li); litest_wait_for_event(li);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_MOTION); LIBINPUT_EVENT_POINTER_MOTION);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -378,11 +378,11 @@ START_TEST(device_double_disable)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -401,11 +401,11 @@ START_TEST(device_double_enable)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -426,7 +426,7 @@ START_TEST(device_reenable_syspath_changed)
libinput_device_ref(device1); libinput_device_ref(device1);
status = libinput_device_config_send_events_set_mode(device1, status = libinput_device_config_send_events_set_mode(device1,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -437,7 +437,7 @@ START_TEST(device_reenable_syspath_changed)
status = libinput_device_config_send_events_set_mode(device1, status = libinput_device_config_send_events_set_mode(device1,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* can't really check for much here, other than that if we pump /* can't really check for much here, other than that if we pump
events through libinput, none of them should be from the first events through libinput, none of them should be from the first
@ -448,7 +448,7 @@ START_TEST(device_reenable_syspath_changed)
litest_dispatch(li); litest_dispatch(li);
while ((event = libinput_get_event(li))) { while ((event = libinput_get_event(li))) {
ck_assert(libinput_event_get_device(event) != device1); litest_assert(libinput_event_get_device(event) != device1);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -472,7 +472,7 @@ START_TEST(device_reenable_device_removed)
libinput_device_ref(device); libinput_device_ref(device);
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -481,7 +481,7 @@ START_TEST(device_reenable_device_removed)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* can't really check for much here, this really just exercises the /* can't really check for much here, this really just exercises the
code path. */ code path. */
@ -508,17 +508,17 @@ START_TEST(device_disable_release_buttons)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_wait_for_event(li); litest_wait_for_event(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_BUTTON); LIBINPUT_EVENT_POINTER_BUTTON);
ptrevent = libinput_event_get_pointer_event(event); ptrevent = libinput_event_get_pointer_event(event);
ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button(ptrevent),
BTN_LEFT); BTN_LEFT);
ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent),
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -542,17 +542,17 @@ START_TEST(device_disable_release_keys)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_wait_for_event(li); litest_wait_for_event(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_KEYBOARD_KEY); LIBINPUT_EVENT_KEYBOARD_KEY);
kbdevent = libinput_event_get_keyboard_event(event); kbdevent = libinput_event_get_keyboard_event(event);
ck_assert_int_eq(libinput_event_keyboard_get_key(kbdevent), litest_assert_int_eq(libinput_event_keyboard_get_key(kbdevent),
KEY_A); KEY_A);
ck_assert_int_eq(libinput_event_keyboard_get_key_state(kbdevent), litest_assert_int_eq(libinput_event_keyboard_get_key_state(kbdevent),
LIBINPUT_KEY_STATE_RELEASED); LIBINPUT_KEY_STATE_RELEASED);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -581,7 +581,7 @@ START_TEST(device_disable_release_tap)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* tap happened before suspending, so we still expect the event */ /* tap happened before suspending, so we still expect the event */
litest_timeout_tap(); litest_timeout_tap();
@ -598,7 +598,7 @@ START_TEST(device_disable_release_tap)
/* resume, make sure we don't get anything */ /* resume, make sure we don't get anything */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_dispatch(li); litest_dispatch(li);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -628,7 +628,7 @@ START_TEST(device_disable_release_tap_n_drag)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_dispatch(li); litest_dispatch(li);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
@ -665,7 +665,7 @@ START_TEST(device_disable_release_softbutton)
/* disable */ /* disable */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_assert_button_event(li, litest_assert_button_event(li,
BTN_RIGHT, BTN_RIGHT,
@ -681,7 +681,7 @@ START_TEST(device_disable_release_softbutton)
/* resume, make sure we don't get anything */ /* resume, make sure we don't get anything */
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_dispatch(li); litest_dispatch(li);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -705,7 +705,7 @@ START_TEST(device_disable_topsoftbutton)
status = libinput_device_config_send_events_set_mode(device, status = libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_touch_down(dev, 0, 90, 10); litest_touch_down(dev, 0, 90, 10);
@ -715,26 +715,26 @@ START_TEST(device_disable_topsoftbutton)
litest_wait_for_event(li); litest_wait_for_event(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_BUTTON); LIBINPUT_EVENT_POINTER_BUTTON);
ck_assert_ptr_eq(libinput_event_get_device(event), litest_assert_ptr_eq(libinput_event_get_device(event),
trackpoint->libinput_device); trackpoint->libinput_device);
ptrevent = libinput_event_get_pointer_event(event); ptrevent = libinput_event_get_pointer_event(event);
ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button(ptrevent),
BTN_RIGHT); BTN_RIGHT);
ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent),
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_BUTTON); LIBINPUT_EVENT_POINTER_BUTTON);
ck_assert_ptr_eq(libinput_event_get_device(event), litest_assert_ptr_eq(libinput_event_get_device(event),
trackpoint->libinput_device); trackpoint->libinput_device);
ptrevent = libinput_event_get_pointer_event(event); ptrevent = libinput_event_get_pointer_event(event);
ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button(ptrevent),
BTN_RIGHT); BTN_RIGHT);
ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), litest_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent),
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -755,13 +755,13 @@ START_TEST(device_ids)
pid = libevdev_get_id_product(dev->evdev); pid = libevdev_get_id_product(dev->evdev);
vid = libevdev_get_id_vendor(dev->evdev); vid = libevdev_get_id_vendor(dev->evdev);
ck_assert_str_eq(name, litest_assert_str_eq(name,
libinput_device_get_name(dev->libinput_device)); libinput_device_get_name(dev->libinput_device));
ck_assert_int_eq(bus, litest_assert_int_eq(bus,
libinput_device_get_id_bustype(dev->libinput_device)); libinput_device_get_id_bustype(dev->libinput_device));
ck_assert_int_eq(pid, litest_assert_int_eq(pid,
libinput_device_get_id_product(dev->libinput_device)); libinput_device_get_id_product(dev->libinput_device));
ck_assert_int_eq(vid, litest_assert_int_eq(vid,
libinput_device_get_id_vendor(dev->libinput_device)); libinput_device_get_id_vendor(dev->libinput_device));
} }
END_TEST END_TEST
@ -772,7 +772,7 @@ START_TEST(device_get_udev_handle)
struct udev_device *udev_device; struct udev_device *udev_device;
udev_device = libinput_device_get_udev_device(dev->libinput_device); udev_device = libinput_device_get_udev_device(dev->libinput_device);
ck_assert_notnull(udev_device); litest_assert_notnull(udev_device);
udev_device_unref(udev_device); udev_device_unref(udev_device);
} }
END_TEST END_TEST
@ -782,9 +782,9 @@ START_TEST(device_context)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_seat *seat; struct libinput_seat *seat;
ck_assert(dev->libinput == libinput_device_get_context(dev->libinput_device)); litest_assert(dev->libinput == libinput_device_get_context(dev->libinput_device));
seat = libinput_device_get_seat(dev->libinput_device); seat = libinput_device_get_seat(dev->libinput_device);
ck_assert(dev->libinput == libinput_seat_get_context(seat)); litest_assert(dev->libinput == libinput_seat_get_context(seat));
} }
END_TEST END_TEST
@ -794,11 +794,11 @@ START_TEST(device_user_data)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
void *userdata = &dev; /* not referenced */ void *userdata = &dev; /* not referenced */
ck_assert(libinput_device_get_user_data(device) == NULL); litest_assert(libinput_device_get_user_data(device) == NULL);
libinput_device_set_user_data(device, userdata); libinput_device_set_user_data(device, userdata);
ck_assert_ptr_eq(libinput_device_get_user_data(device), userdata); litest_assert_ptr_eq(libinput_device_get_user_data(device), userdata);
libinput_device_set_user_data(device, NULL); libinput_device_set_user_data(device, NULL);
ck_assert(libinput_device_get_user_data(device) == NULL); litest_assert(libinput_device_get_user_data(device) == NULL);
} }
END_TEST END_TEST
@ -810,12 +810,12 @@ START_TEST(device_group_get)
int userdata = 10; int userdata = 10;
group = libinput_device_get_device_group(dev->libinput_device); group = libinput_device_get_device_group(dev->libinput_device);
ck_assert_notnull(group); litest_assert_notnull(group);
libinput_device_group_ref(group); libinput_device_group_ref(group);
libinput_device_group_set_user_data(group, &userdata); libinput_device_group_set_user_data(group, &userdata);
ck_assert_ptr_eq(&userdata, litest_assert_ptr_eq(&userdata,
libinput_device_group_get_user_data(group)); libinput_device_group_get_user_data(group));
libinput_device_group_unref(group); libinput_device_group_unref(group);
@ -831,7 +831,7 @@ START_TEST(device_group_ref)
struct libinput_device_group *group; struct libinput_device_group *group;
group = libinput_device_get_device_group(device); group = libinput_device_get_device_group(device);
ck_assert_notnull(group); litest_assert_notnull(group);
libinput_device_group_ref(group); libinput_device_group_ref(group);
libinput_device_ref(device); libinput_device_ref(device);
@ -840,11 +840,11 @@ START_TEST(device_group_ref)
litest_drain_events(li); litest_drain_events(li);
/* make sure the device is dead but the group is still around */ /* make sure the device is dead but the group is still around */
ck_assert(libinput_device_unref(device) == NULL); litest_assert(libinput_device_unref(device) == NULL);
libinput_device_group_ref(group); libinput_device_group_ref(group);
ck_assert_notnull(libinput_device_group_unref(group)); litest_assert_notnull(libinput_device_group_unref(group));
ck_assert(libinput_device_group_unref(group) == NULL); litest_assert(libinput_device_group_unref(group) == NULL);
litest_destroy_context(li); litest_destroy_context(li);
} }
@ -896,7 +896,7 @@ START_TEST(abs_device_no_absx)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_destroy_context(li); litest_destroy_context(li);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
@ -919,7 +919,7 @@ START_TEST(abs_device_no_absy)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_destroy_context(li); litest_destroy_context(li);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
@ -945,7 +945,7 @@ START_TEST(abs_mt_device_no_absy)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_destroy_context(li); litest_destroy_context(li);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
@ -971,7 +971,7 @@ START_TEST(abs_mt_device_no_absx)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_destroy_context(li); litest_destroy_context(li);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
@ -1135,7 +1135,7 @@ START_TEST(device_wheel_only)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(libinput_device_has_capability(device, litest_assert(libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_POINTER)); LIBINPUT_DEVICE_CAP_POINTER));
} }
END_TEST END_TEST
@ -1179,7 +1179,7 @@ START_TEST(device_udev_tag_wacom_tablet)
prop = udev_device_get_property_value(d, prop = udev_device_get_property_value(d,
"ID_INPUT_TABLET"); "ID_INPUT_TABLET");
ck_assert_notnull(prop); litest_assert_notnull(prop);
udev_device_unref(d); udev_device_unref(d);
} }
END_TEST END_TEST
@ -1201,7 +1201,7 @@ START_TEST(device_nonpointer_rel)
li = litest_create_context(); li = litest_create_context();
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_disable_log_handler(li); litest_disable_log_handler(li);
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
@ -1243,7 +1243,7 @@ START_TEST(device_touchpad_rel)
li = litest_create_context(); li = litest_create_context();
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
@ -1282,7 +1282,7 @@ START_TEST(device_touch_rel)
li = litest_create_context(); li = litest_create_context();
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_disable_log_handler(li); litest_disable_log_handler(li);
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
@ -1320,7 +1320,7 @@ START_TEST(device_abs_rel)
li = litest_create_context(); li = litest_create_context();
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
@ -1389,9 +1389,9 @@ START_TEST(device_quirks_cyborg_rat_mode_button)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
struct libinput *li = dev->libinput; struct libinput *li = dev->libinput;
ck_assert(!libinput_device_pointer_has_button(device, 0x118)); litest_assert(!libinput_device_pointer_has_button(device, 0x118));
ck_assert(!libinput_device_pointer_has_button(device, 0x119)); litest_assert(!libinput_device_pointer_has_button(device, 0x119));
ck_assert(!libinput_device_pointer_has_button(device, 0x11a)); litest_assert(!libinput_device_pointer_has_button(device, 0x11a));
litest_drain_events(li); litest_drain_events(li);
@ -1437,7 +1437,7 @@ START_TEST(device_quirks_logitech_marble_mouse)
litest_drain_events(li); litest_drain_events(li);
ck_assert(!libinput_device_pointer_has_button(dev->libinput_device, litest_assert(!libinput_device_pointer_has_button(dev->libinput_device,
BTN_MIDDLE)); BTN_MIDDLE));
} }
END_TEST END_TEST
@ -1493,17 +1493,17 @@ START_TEST(device_quirks)
dev = litest_add_device(li, LITEST_KEYBOARD_QUIRKED); dev = litest_add_device(li, LITEST_KEYBOARD_QUIRKED);
device = dev->libinput_device; device = dev->libinput_device;
ck_assert(libinput_device_pointer_has_button(device, litest_assert(libinput_device_pointer_has_button(device,
BTN_LEFT)); BTN_LEFT));
ck_assert(libinput_device_pointer_has_button(dev->libinput_device, litest_assert(libinput_device_pointer_has_button(dev->libinput_device,
BTN_RIGHT)); BTN_RIGHT));
ck_assert(!libinput_device_pointer_has_button(device, litest_assert(!libinput_device_pointer_has_button(device,
BTN_MIDDLE)); BTN_MIDDLE));
ck_assert(!libinput_device_keyboard_has_key(dev->libinput_device, litest_assert(!libinput_device_keyboard_has_key(dev->libinput_device,
KEY_F1)); KEY_F1));
ck_assert(!libinput_device_keyboard_has_key(dev->libinput_device, litest_assert(!libinput_device_keyboard_has_key(dev->libinput_device,
KEY_F2)); KEY_F2));
ck_assert(!libinput_device_keyboard_has_key(dev->libinput_device, litest_assert(!libinput_device_keyboard_has_key(dev->libinput_device,
KEY_F3)); KEY_F3));
/* Scrape the debug messages for confirmation that our quirks are /* Scrape the debug messages for confirmation that our quirks are
@ -1520,19 +1520,19 @@ START_TEST(device_quirks)
if (strstr(*message, "disabling INPUT_PROP_POINTING_STICK")) if (strstr(*message, "disabling INPUT_PROP_POINTING_STICK"))
disable_pointingstick = true; disable_pointingstick = true;
if (strstr(*message, "enabling INPUT_PROP_DIRECT")) { if (strstr(*message, "enabling INPUT_PROP_DIRECT")) {
ck_assert(!disable_direct); litest_assert(!disable_direct);
enable_direct = true; enable_direct = true;
} }
if (strstr(*message, "disabling INPUT_PROP_DIRECT")) { if (strstr(*message, "disabling INPUT_PROP_DIRECT")) {
ck_assert(enable_direct); litest_assert(enable_direct);
disable_direct = true; disable_direct = true;
} }
if (strstr(*message, "enabling INPUT_PROP_SEMI_MT")) { if (strstr(*message, "enabling INPUT_PROP_SEMI_MT")) {
ck_assert(disable_semi_mt); litest_assert(disable_semi_mt);
enable_semi_mt = true; enable_semi_mt = true;
} }
if (strstr(*message, "disabling INPUT_PROP_SEMI_MT")) { if (strstr(*message, "disabling INPUT_PROP_SEMI_MT")) {
ck_assert(!enable_semi_mt); litest_assert(!enable_semi_mt);
disable_semi_mt = true; disable_semi_mt = true;
} }
#endif #endif
@ -1540,15 +1540,15 @@ START_TEST(device_quirks)
message++; message++;
} }
ck_assert(disable_key_f1); litest_assert(disable_key_f1);
ck_assert(enable_btn_left); litest_assert(enable_btn_left);
#if HAVE_LIBEVDEV_DISABLE_PROPERTY #if HAVE_LIBEVDEV_DISABLE_PROPERTY
ck_assert(enable_buttonpad); litest_assert(enable_buttonpad);
ck_assert(disable_pointingstick); litest_assert(disable_pointingstick);
ck_assert(enable_direct); litest_assert(enable_direct);
ck_assert(disable_direct); litest_assert(disable_direct);
ck_assert(enable_semi_mt); litest_assert(enable_semi_mt);
ck_assert(disable_semi_mt); litest_assert(disable_semi_mt);
#endif #endif
litest_disable_log_handler(li); litest_disable_log_handler(li);
@ -1577,7 +1577,7 @@ START_TEST(device_capability_at_least_one)
if (libinput_device_has_capability(device, *cap)) if (libinput_device_has_capability(device, *cap))
ncaps++; ncaps++;
} }
ck_assert_int_gt(ncaps, 0); litest_assert_int_gt(ncaps, 0);
} }
END_TEST END_TEST
@ -1587,9 +1587,9 @@ START_TEST(device_capability_check_invalid)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(!libinput_device_has_capability(device, -1)); litest_assert(!libinput_device_has_capability(device, -1));
ck_assert(!libinput_device_has_capability(device, 7)); litest_assert(!libinput_device_has_capability(device, 7));
ck_assert(!libinput_device_has_capability(device, 0xffff)); litest_assert(!libinput_device_has_capability(device, 0xffff));
} }
END_TEST END_TEST
@ -1624,11 +1624,11 @@ START_TEST(device_has_size)
int rc; int rc;
rc = libinput_device_get_size(device, &w, &h); rc = libinput_device_get_size(device, &w, &h);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
/* This matches the current set of test devices but may fail if /* This matches the current set of test devices but may fail if
* newer ones are added */ * newer ones are added */
ck_assert_double_gt(w, 30); litest_assert_double_gt(w, 30);
ck_assert_double_gt(h, 20); litest_assert_double_gt(h, 20);
} }
END_TEST END_TEST
@ -1640,9 +1640,9 @@ START_TEST(device_has_no_size)
int rc; int rc;
rc = libinput_device_get_size(device, &w, &h); rc = libinput_device_get_size(device, &w, &h);
ck_assert_int_eq(rc, -1); litest_assert_int_eq(rc, -1);
ck_assert_double_eq(w, 45); litest_assert_double_eq(w, 45);
ck_assert_double_eq(h, 67); litest_assert_double_eq(h, 67);
} }
END_TEST END_TEST
@ -1653,7 +1653,7 @@ START_TEST(device_get_output)
const char *output_name; const char *output_name;
output_name = libinput_device_get_output_name(device); output_name = libinput_device_get_output_name(device);
ck_assert_str_eq(output_name, "myOutput"); litest_assert_str_eq(output_name, "myOutput");
} }
END_TEST END_TEST
@ -1664,7 +1664,7 @@ START_TEST(device_no_output)
const char *output_name; const char *output_name;
output_name = libinput_device_get_output_name(device); output_name = libinput_device_get_output_name(device);
ck_assert(output_name == NULL); litest_assert(output_name == NULL);
} }
END_TEST END_TEST
@ -1676,7 +1676,7 @@ START_TEST(device_seat_phys_name)
const char *seat_name; const char *seat_name;
seat_name = libinput_seat_get_physical_name(seat); seat_name = libinput_seat_get_physical_name(seat);
ck_assert(streq(seat_name, "seat0")); litest_assert(streq(seat_name, "seat0"));
} }
END_TEST END_TEST
@ -1730,18 +1730,18 @@ START_TEST(device_button_down_remove)
p = libinput_event_get_pointer_event(event); p = libinput_event_get_pointer_event(event);
if (libinput_event_pointer_get_button_state(p)) { if (libinput_event_pointer_get_button_state(p)) {
ck_assert(button_down == 0); litest_assert(button_down == 0);
button_down = libinput_event_pointer_get_button(p); button_down = libinput_event_pointer_get_button(p);
} else { } else {
ck_assert(button_up == 0); litest_assert(button_up == 0);
button_up = libinput_event_pointer_get_button(p); button_up = libinput_event_pointer_get_button(p);
ck_assert_int_eq(button_down, button_up); litest_assert_int_eq(button_down, button_up);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
litest_destroy_context(li); litest_destroy_context(li);
ck_assert_int_eq(have_down, have_up); litest_assert_int_eq(have_down, have_up);
} }
} }
END_TEST END_TEST

View file

@ -94,8 +94,8 @@ test_gesture_swipe_3fg(int cardinal, enum hold_gesture_behaviour hold)
3); 3);
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
@ -106,34 +106,34 @@ test_gesture_swipe_3fg(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
dx = libinput_event_gesture_get_dx_unaccelerated(gevent); dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
dy = libinput_event_gesture_get_dy_unaccelerated(gevent); dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -146,7 +146,7 @@ test_gesture_swipe_3fg(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_SWIPE_END, LIBINPUT_EVENT_GESTURE_SWIPE_END,
3); 3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -231,8 +231,8 @@ test_gesture_swipe_4fg(int cardinal, enum hold_gesture_behaviour hold)
4); 4);
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
@ -243,34 +243,34 @@ test_gesture_swipe_4fg(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
dx = libinput_event_gesture_get_dx_unaccelerated(gevent); dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
dy = libinput_event_gesture_get_dy_unaccelerated(gevent); dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -284,7 +284,7 @@ test_gesture_swipe_4fg(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_SWIPE_END, LIBINPUT_EVENT_GESTURE_SWIPE_END,
4); 4);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -377,9 +377,9 @@ test_gesture_pinch_2fg(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
ck_assert(scale == 1.0); litest_assert(scale == 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -391,10 +391,10 @@ test_gesture_pinch_2fg(int cardinal, enum hold_gesture_behaviour hold)
oldscale = scale; oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale); litest_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent); angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0); litest_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);
@ -407,7 +407,7 @@ test_gesture_pinch_2fg(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END, LIBINPUT_EVENT_GESTURE_PINCH_END,
2); 2);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -491,9 +491,9 @@ test_gesture_pinch_3fg(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
ck_assert(scale == 1.0); litest_assert(scale == 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -505,10 +505,10 @@ test_gesture_pinch_3fg(int cardinal, enum hold_gesture_behaviour hold)
oldscale = scale; oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale); litest_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent); angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0); litest_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);
@ -522,7 +522,7 @@ test_gesture_pinch_3fg(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END, LIBINPUT_EVENT_GESTURE_PINCH_END,
3); 3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -612,9 +612,9 @@ test_gesture_pinch_4fg(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
ck_assert(scale == 1.0); litest_assert(scale == 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -626,10 +626,10 @@ test_gesture_pinch_4fg(int cardinal, enum hold_gesture_behaviour hold)
oldscale = scale; oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale); litest_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent); angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0); litest_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);
@ -644,7 +644,7 @@ test_gesture_pinch_4fg(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END, LIBINPUT_EVENT_GESTURE_PINCH_END,
4); 4);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -737,9 +737,9 @@ test_gesture_spread(int cardinal, enum hold_gesture_behaviour hold)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
ck_assert(scale == 1.0); litest_assert(scale == 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -749,10 +749,10 @@ test_gesture_spread(int cardinal, enum hold_gesture_behaviour hold)
2); 2);
oldscale = scale; oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent); scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale > oldscale); litest_assert(scale > oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent); angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0); litest_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);
@ -765,7 +765,7 @@ test_gesture_spread(int cardinal, enum hold_gesture_behaviour hold)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END, LIBINPUT_EVENT_GESTURE_PINCH_END,
2); 2);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -927,10 +927,10 @@ START_TEST(gestures_cap)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT)) if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT))
ck_assert(!libinput_device_has_capability(device, litest_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_GESTURE)); LIBINPUT_DEVICE_CAP_GESTURE));
else else
ck_assert(libinput_device_has_capability(device, litest_assert(libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_GESTURE)); LIBINPUT_DEVICE_CAP_GESTURE));
} }
END_TEST END_TEST
@ -940,7 +940,7 @@ START_TEST(gestures_nocap)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(!libinput_device_has_capability(device, litest_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_GESTURE)); LIBINPUT_DEVICE_CAP_GESTURE));
} }
END_TEST END_TEST
@ -999,8 +999,8 @@ START_TEST(gestures_swipe_3fg_btntool)
3); 3);
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
@ -1011,34 +1011,34 @@ START_TEST(gestures_swipe_3fg_btntool)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
dx = libinput_event_gesture_get_dx_unaccelerated(gevent); dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
dy = libinput_event_gesture_get_dy_unaccelerated(gevent); dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -1050,7 +1050,7 @@ START_TEST(gestures_swipe_3fg_btntool)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_SWIPE_END, LIBINPUT_EVENT_GESTURE_SWIPE_END,
3); 3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST
@ -1100,7 +1100,7 @@ START_TEST(gestures_swipe_3fg_btntool_pinch_like)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_SWIPE_END, LIBINPUT_EVENT_GESTURE_SWIPE_END,
3); 3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST
@ -1159,8 +1159,8 @@ START_TEST(gestures_swipe_4fg_btntool)
4); 4);
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
@ -1171,34 +1171,34 @@ START_TEST(gestures_swipe_4fg_btntool)
dx = libinput_event_gesture_get_dx(gevent); dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent); dy = libinput_event_gesture_get_dy(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
dx = libinput_event_gesture_get_dx_unaccelerated(gevent); dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
dy = libinput_event_gesture_get_dy_unaccelerated(gevent); dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
if (dir_x == 0.0) if (dir_x == 0.0)
ck_assert(dx == 0.0); litest_assert(dx == 0.0);
else if (dir_x < 0.0) else if (dir_x < 0.0)
ck_assert(dx < 0.0); litest_assert(dx < 0.0);
else if (dir_x > 0.0) else if (dir_x > 0.0)
ck_assert(dx > 0.0); litest_assert(dx > 0.0);
if (dir_y == 0.0) if (dir_y == 0.0)
ck_assert(dy == 0.0); litest_assert(dy == 0.0);
else if (dir_y < 0.0) else if (dir_y < 0.0)
ck_assert(dy < 0.0); litest_assert(dy < 0.0);
else if (dir_y > 0.0) else if (dir_y > 0.0)
ck_assert(dy > 0.0); litest_assert(dy > 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -1210,7 +1210,7 @@ START_TEST(gestures_swipe_4fg_btntool)
gevent = litest_is_gesture_event(event, gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_SWIPE_END, LIBINPUT_EVENT_GESTURE_SWIPE_END,
4); 4);
ck_assert(!libinput_event_gesture_get_cancelled(gevent)); litest_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST
@ -1269,7 +1269,7 @@ START_TEST(gestures_time_usec)
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
3); 3);
time_usec = libinput_event_gesture_get_time_usec(gevent); time_usec = libinput_event_gesture_get_time_usec(gevent);
ck_assert_int_eq(libinput_event_gesture_get_time(gevent), litest_assert_int_eq(libinput_event_gesture_get_time(gevent),
(uint32_t) (time_usec / 1000)); (uint32_t) (time_usec / 1000));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -1371,8 +1371,8 @@ START_TEST(gestures_swipe_3fg_unaccel)
ux = libinput_event_gesture_get_dx_unaccelerated(gevent); ux = libinput_event_gesture_get_dx_unaccelerated(gevent);
uy = libinput_event_gesture_get_dy_unaccelerated(gevent); uy = libinput_event_gesture_get_dy_unaccelerated(gevent);
ck_assert_double_ne(ux, 0.0); litest_assert_double_ne(ux, 0.0);
ck_assert_double_ne(uy, 0.0); litest_assert_double_ne(uy, 0.0);
if (!reference_ux) if (!reference_ux)
reference_ux = ux; reference_ux = ux;
@ -1383,21 +1383,21 @@ START_TEST(gestures_swipe_3fg_unaccel)
* event, but we have rounding errors since we only control * event, but we have rounding errors since we only control
* input data as percentage of the touchpad size. * input data as percentage of the touchpad size.
* so we just eyeball it */ * so we just eyeball it */
ck_assert_double_gt(ux, reference_ux - 2); litest_assert_double_gt(ux, reference_ux - 2);
ck_assert_double_lt(ux, reference_ux + 2); litest_assert_double_lt(ux, reference_ux + 2);
ck_assert_double_gt(uy, reference_uy - 2); litest_assert_double_gt(uy, reference_uy - 2);
ck_assert_double_lt(uy, reference_uy + 2); litest_assert_double_lt(uy, reference_uy + 2);
/* All our touchpads are large enough to make this is a fast /* All our touchpads are large enough to make this is a fast
* swipe, we don't expect deceleration, unaccel should * swipe, we don't expect deceleration, unaccel should
* always be less than accel delta */ * always be less than accel delta */
ck_assert_double_lt(ux, dx); litest_assert_double_lt(ux, dx);
ck_assert_double_lt(ux, dx); litest_assert_double_lt(ux, dx);
/* Check our accelerated delta is within the expected /* Check our accelerated delta is within the expected
* maximum. */ * maximum. */
ck_assert_double_lt(dx, ux * max_factor); litest_assert_double_lt(dx, ux * max_factor);
ck_assert_double_lt(dy, uy * max_factor); litest_assert_double_lt(dy, uy * max_factor);
libinput_event_destroy(event); libinput_event_destroy(event);
} while ((event = libinput_get_event(li))); } while ((event = libinput_get_event(li)));
@ -1413,11 +1413,11 @@ START_TEST(gestures_hold_config_default_disabled)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_config_gesture_hold_is_available(device), litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
0); 0);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
LIBINPUT_CONFIG_HOLD_DISABLED); LIBINPUT_CONFIG_HOLD_DISABLED);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
LIBINPUT_CONFIG_HOLD_DISABLED); LIBINPUT_CONFIG_HOLD_DISABLED);
} }
END_TEST END_TEST
@ -1427,11 +1427,11 @@ START_TEST(gestures_hold_config_default_enabled)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_config_gesture_hold_is_available(device), litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
1); 1);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
LIBINPUT_CONFIG_HOLD_ENABLED); LIBINPUT_CONFIG_HOLD_ENABLED);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device),
LIBINPUT_CONFIG_HOLD_ENABLED); LIBINPUT_CONFIG_HOLD_ENABLED);
} }
END_TEST END_TEST
@ -1441,9 +1441,9 @@ START_TEST(gestures_hold_config_set_invalid)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, -1), litest_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, -1),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, 2), litest_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, 2),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -1453,13 +1453,13 @@ START_TEST(gestures_hold_config_is_available)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_config_gesture_hold_is_available(device), litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
1); 1);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device),
LIBINPUT_CONFIG_HOLD_ENABLED); LIBINPUT_CONFIG_HOLD_ENABLED);
ck_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED), litest_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED),
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device),
LIBINPUT_CONFIG_HOLD_DISABLED); LIBINPUT_CONFIG_HOLD_DISABLED);
} }
END_TEST END_TEST
@ -1469,13 +1469,13 @@ START_TEST(gestures_hold_config_is_not_available)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_config_gesture_hold_is_available(device), litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
0); 0);
ck_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device), litest_assert_int_eq(libinput_device_config_gesture_get_hold_enabled(device),
LIBINPUT_CONFIG_HOLD_DISABLED); LIBINPUT_CONFIG_HOLD_DISABLED);
ck_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_ENABLED), litest_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_ENABLED),
LIBINPUT_CONFIG_STATUS_UNSUPPORTED); LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
ck_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED), litest_assert_int_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED),
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST

View file

@ -64,13 +64,13 @@ START_TEST(keyboard_seat_key_count)
++expected_key_button_count; ++expected_key_button_count;
seat_key_count = seat_key_count =
libinput_event_keyboard_get_seat_key_count(kev); libinput_event_keyboard_get_seat_key_count(kev);
ck_assert_int_eq(expected_key_button_count, seat_key_count); litest_assert_int_eq(expected_key_button_count, seat_key_count);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert_int_eq(seat_key_count, num_devices); litest_assert_int_eq(seat_key_count, num_devices);
for (i = 0; i < num_devices; ++i) for (i = 0; i < num_devices; ++i)
litest_keyboard_key(devices[i], KEY_A, false); litest_keyboard_key(devices[i], KEY_A, false);
@ -78,21 +78,21 @@ START_TEST(keyboard_seat_key_count)
litest_dispatch(libinput); litest_dispatch(libinput);
while ((ev = libinput_get_event(libinput))) { while ((ev = libinput_get_event(libinput))) {
kev = libinput_event_get_keyboard_event(ev); kev = libinput_event_get_keyboard_event(ev);
ck_assert_notnull(kev); litest_assert_notnull(kev);
ck_assert_int_eq(libinput_event_keyboard_get_key(kev), KEY_A); litest_assert_int_eq(libinput_event_keyboard_get_key(kev), KEY_A);
ck_assert_int_eq(libinput_event_keyboard_get_key_state(kev), litest_assert_int_eq(libinput_event_keyboard_get_key_state(kev),
LIBINPUT_KEY_STATE_RELEASED); LIBINPUT_KEY_STATE_RELEASED);
--expected_key_button_count; --expected_key_button_count;
seat_key_count = seat_key_count =
libinput_event_keyboard_get_seat_key_count(kev); libinput_event_keyboard_get_seat_key_count(kev);
ck_assert_int_eq(expected_key_button_count, seat_key_count); litest_assert_int_eq(expected_key_button_count, seat_key_count);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert_int_eq(seat_key_count, 0); litest_assert_int_eq(seat_key_count, 0);
for (i = 0; i < num_devices; ++i) for (i = 0; i < num_devices; ++i)
litest_delete_device(devices[i]); litest_delete_device(devices[i]);
@ -142,12 +142,12 @@ START_TEST(keyboard_ignore_no_pressed_release)
ARRAY_FOR_EACH(expected_states, state) { ARRAY_FOR_EACH(expected_states, state) {
event = libinput_get_event(libinput); event = libinput_get_event(libinput);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY); litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY);
kevent = libinput_event_get_keyboard_event(event); kevent = libinput_event_get_keyboard_event(event);
ck_assert_int_eq(libinput_event_keyboard_get_key(kevent), litest_assert_int_eq(libinput_event_keyboard_get_key(kevent),
KEY_A); KEY_A);
ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), litest_assert_int_eq(libinput_event_keyboard_get_key_state(kevent),
*state); *state);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(libinput); litest_dispatch(libinput);
@ -225,7 +225,7 @@ START_TEST(keyboard_key_auto_release)
/* Mark all released keys until device is removed */ /* Mark all released keys until device is removed */
while (1) { while (1) {
event = libinput_get_event(libinput); event = libinput_get_event(libinput);
ck_assert_notnull(event); litest_assert_notnull(event);
type = libinput_event_get_type(event); type = libinput_event_get_type(event);
if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { if (type == LIBINPUT_EVENT_DEVICE_REMOVED) {
@ -235,25 +235,25 @@ START_TEST(keyboard_key_auto_release)
litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY); litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY);
kevent = libinput_event_get_keyboard_event(event); kevent = libinput_event_get_keyboard_event(event);
ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), litest_assert_int_eq(libinput_event_keyboard_get_key_state(kevent),
LIBINPUT_KEY_STATE_RELEASED); LIBINPUT_KEY_STATE_RELEASED);
key = libinput_event_keyboard_get_key(kevent); key = libinput_event_keyboard_get_key(kevent);
valid_code = 0; valid_code = 0;
for (i = 0; i < ARRAY_LENGTH(keys); ++i) { for (i = 0; i < ARRAY_LENGTH(keys); ++i) {
if (keys[i].code == key) { if (keys[i].code == key) {
ck_assert_int_eq(keys[i].released, 0); litest_assert_int_eq(keys[i].released, 0);
keys[i].released = 1; keys[i].released = 1;
valid_code = 1; valid_code = 1;
} }
} }
ck_assert_int_eq(valid_code, 1); litest_assert_int_eq(valid_code, 1);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
/* Check that all pressed keys has been released. */ /* Check that all pressed keys has been released. */
for (i = 0; i < ARRAY_LENGTH(keys); ++i) { for (i = 0; i < ARRAY_LENGTH(keys); ++i) {
ck_assert_int_eq(keys[i].released, 1); litest_assert_int_eq(keys[i].released, 1);
} }
litest_destroy_context(libinput); litest_destroy_context(libinput);
@ -267,14 +267,14 @@ START_TEST(keyboard_has_key)
unsigned int code; unsigned int code;
int evdev_has, libinput_has; int evdev_has, libinput_has;
ck_assert(libinput_device_has_capability( litest_assert(libinput_device_has_capability(
device, device,
LIBINPUT_DEVICE_CAP_KEYBOARD)); LIBINPUT_DEVICE_CAP_KEYBOARD));
for (code = 0; code < KEY_CNT; code++) { for (code = 0; code < KEY_CNT; code++) {
evdev_has = libevdev_has_event_code(dev->evdev, EV_KEY, code); evdev_has = libevdev_has_event_code(dev->evdev, EV_KEY, code);
libinput_has = libinput_device_keyboard_has_key(device, code); libinput_has = libinput_device_keyboard_has_key(device, code);
ck_assert_int_eq(evdev_has, libinput_has); litest_assert_int_eq(evdev_has, libinput_has);
} }
} }
END_TEST END_TEST
@ -292,7 +292,7 @@ START_TEST(keyboard_keys_bad_device)
for (code = 0; code < KEY_CNT; code++) { for (code = 0; code < KEY_CNT; code++) {
has_key = libinput_device_keyboard_has_key(device, code); has_key = libinput_device_keyboard_has_key(device, code);
ck_assert_int_eq(has_key, -1); litest_assert_int_eq(has_key, -1);
} }
} }
END_TEST END_TEST
@ -319,7 +319,7 @@ START_TEST(keyboard_time_usec)
LIBINPUT_KEY_STATE_PRESSED); LIBINPUT_KEY_STATE_PRESSED);
time_usec = libinput_event_keyboard_get_time_usec(kev); time_usec = libinput_event_keyboard_get_time_usec(kev);
ck_assert_int_eq(libinput_event_keyboard_get_time(kev), litest_assert_int_eq(libinput_event_keyboard_get_time(kev),
(uint32_t) (time_usec / 1000)); (uint32_t) (time_usec / 1000));
libinput_event_destroy(event); libinput_event_destroy(event);
@ -465,22 +465,22 @@ START_TEST(keyboard_no_scroll)
enum libinput_config_status status; enum libinput_config_status status;
method = libinput_device_config_scroll_get_method(device); method = libinput_device_config_scroll_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); litest_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
method = libinput_device_config_scroll_get_default_method(device); method = libinput_device_config_scroll_get_default_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); litest_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_2FG); LIBINPUT_CONFIG_SCROLL_2FG);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_EDGE); LIBINPUT_CONFIG_SCROLL_EDGE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_NO_SCROLL); LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST

View file

@ -72,7 +72,7 @@ START_TEST(log_default_priority)
li = libinput_path_create_context(&simple_interface, NULL); li = libinput_path_create_context(&simple_interface, NULL);
pri = libinput_log_get_priority(li); pri = libinput_log_get_priority(li);
ck_assert_int_eq(pri, LIBINPUT_LOG_PRIORITY_ERROR); litest_assert_int_eq(pri, LIBINPUT_LOG_PRIORITY_ERROR);
libinput_unref(li); libinput_unref(li);
} }
@ -93,7 +93,7 @@ START_TEST(log_handler_invoked)
libinput_path_add_device(li, "/tmp"); libinput_path_add_device(li, "/tmp");
ck_assert_int_gt(log_handler_called, 0); litest_assert_int_gt(log_handler_called, 0);
litest_destroy_context(li); litest_destroy_context(li);
@ -114,7 +114,7 @@ START_TEST(log_handler_NULL)
libinput_path_add_device(li, "/tmp"); libinput_path_add_device(li, "/tmp");
ck_assert_int_eq(log_handler_called, 0); litest_assert_int_eq(log_handler_called, 0);
litest_destroy_context(li); litest_destroy_context(li);
@ -136,13 +136,13 @@ START_TEST(log_priority)
libinput_path_add_device(li, "/tmp"); libinput_path_add_device(li, "/tmp");
ck_assert_int_eq(log_handler_called, 1); litest_assert_int_eq(log_handler_called, 1);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_INFO); libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_INFO);
/* event0 exists on any box we care to run the test suite on and we /* event0 exists on any box we care to run the test suite on and we
* currently prints *something* for each device */ * currently prints *something* for each device */
libinput_path_add_device(li, "/dev/input/event0"); libinput_path_add_device(li, "/dev/input/event0");
ck_assert_int_gt(log_handler_called, 1); litest_assert_int_gt(log_handler_called, 1);
litest_destroy_context(li); litest_destroy_context(li);
@ -193,7 +193,7 @@ START_TEST(log_axisrange_warning)
} }
/* Expect only one message per 5 min */ /* Expect only one message per 5 min */
ck_assert_int_eq(axisrange_log_handler_called, 1); litest_assert_int_eq(axisrange_log_handler_called, 1);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR); libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR);
litest_restore_log_handler(li); litest_restore_log_handler(li);

View file

@ -123,7 +123,7 @@ START_TEST(event_conversion_device_notify)
struct libinput_event *base; struct libinput_event *base;
dn = libinput_event_get_device_notify_event(event); dn = libinput_event_get_device_notify_event(event);
base = libinput_event_device_notify_get_base_event(dn); base = libinput_event_device_notify_get_base_event(dn);
ck_assert(event == base); litest_assert(event == base);
if (type == LIBINPUT_EVENT_DEVICE_ADDED) if (type == LIBINPUT_EVENT_DEVICE_ADDED)
device_added++; device_added++;
@ -131,13 +131,13 @@ START_TEST(event_conversion_device_notify)
device_removed++; device_removed++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
@ -147,8 +147,8 @@ START_TEST(event_conversion_device_notify)
litest_destroy_context(li); litest_destroy_context(li);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
ck_assert_int_gt(device_added, 0); litest_assert_int_gt(device_added, 0);
ck_assert_int_gt(device_removed, 0); litest_assert_int_gt(device_removed, 0);
} }
END_TEST END_TEST
@ -181,7 +181,7 @@ START_TEST(event_conversion_pointer)
struct libinput_event *base; struct libinput_event *base;
p = libinput_event_get_pointer_event(event); p = libinput_event_get_pointer_event(event);
base = libinput_event_pointer_get_base_event(p); base = libinput_event_pointer_get_base_event(p);
ck_assert(event == base); litest_assert(event == base);
if (type == LIBINPUT_EVENT_POINTER_MOTION) if (type == LIBINPUT_EVENT_POINTER_MOTION)
motion++; motion++;
@ -189,20 +189,20 @@ START_TEST(event_conversion_pointer)
button++; button++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(motion, 0); litest_assert_int_gt(motion, 0);
ck_assert_int_gt(button, 0); litest_assert_int_gt(button, 0);
} }
END_TEST END_TEST
@ -233,7 +233,7 @@ START_TEST(event_conversion_pointer_abs)
struct libinput_event *base; struct libinput_event *base;
p = libinput_event_get_pointer_event(event); p = libinput_event_get_pointer_event(event);
base = libinput_event_pointer_get_base_event(p); base = libinput_event_pointer_get_base_event(p);
ck_assert(event == base); litest_assert(event == base);
if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE) if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE)
motion++; motion++;
@ -241,20 +241,20 @@ START_TEST(event_conversion_pointer_abs)
button++; button++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(motion, 0); litest_assert_int_gt(motion, 0);
ck_assert_int_gt(button, 0); litest_assert_int_gt(button, 0);
} }
END_TEST END_TEST
@ -281,24 +281,24 @@ START_TEST(event_conversion_key)
struct libinput_event *base; struct libinput_event *base;
k = libinput_event_get_keyboard_event(event); k = libinput_event_get_keyboard_event(event);
base = libinput_event_keyboard_get_base_event(k); base = libinput_event_keyboard_get_base_event(k);
ck_assert(event == base); litest_assert(event == base);
key++; key++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(key, 0); litest_assert_int_gt(key, 0);
} }
END_TEST END_TEST
@ -333,24 +333,24 @@ START_TEST(event_conversion_touch)
struct libinput_event *base; struct libinput_event *base;
t = libinput_event_get_touch_event(event); t = libinput_event_get_touch_event(event);
base = libinput_event_touch_get_base_event(t); base = libinput_event_touch_get_base_event(t);
ck_assert(event == base); litest_assert(event == base);
touch++; touch++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(touch, 0); litest_assert_int_gt(touch, 0);
} }
END_TEST END_TEST
@ -387,23 +387,23 @@ START_TEST(event_conversion_gesture)
struct libinput_event *base; struct libinput_event *base;
g = libinput_event_get_gesture_event(event); g = libinput_event_get_gesture_event(event);
base = libinput_event_gesture_get_base_event(g); base = libinput_event_gesture_get_base_event(g);
ck_assert(event == base); litest_assert(event == base);
gestures++; gestures++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(gestures, 0); litest_assert_int_gt(gestures, 0);
} }
END_TEST END_TEST
@ -435,23 +435,23 @@ START_TEST(event_conversion_tablet)
struct libinput_event *base; struct libinput_event *base;
t = libinput_event_get_tablet_tool_event(event); t = libinput_event_get_tablet_tool_event(event);
base = libinput_event_tablet_tool_get_base_event(t); base = libinput_event_tablet_tool_get_base_event(t);
ck_assert(event == base); litest_assert(event == base);
events++; events++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(events, 0); litest_assert_int_gt(events, 0);
} }
END_TEST END_TEST
@ -479,23 +479,23 @@ START_TEST(event_conversion_tablet_pad)
p = libinput_event_get_tablet_pad_event(event); p = libinput_event_get_tablet_pad_event(event);
base = libinput_event_tablet_pad_get_base_event(p); base = libinput_event_tablet_pad_get_base_event(p);
ck_assert(event == base); litest_assert(event == base);
events++; events++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_switch_event(event) == NULL); litest_assert(libinput_event_get_switch_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(events, 0); litest_assert_int_gt(events, 0);
} }
END_TEST END_TEST
@ -523,24 +523,24 @@ START_TEST(event_conversion_switch)
struct libinput_event *base; struct libinput_event *base;
s = libinput_event_get_switch_event(event); s = libinput_event_get_switch_event(event);
base = libinput_event_switch_get_base_event(s); base = libinput_event_switch_get_base_event(s);
ck_assert(event == base); litest_assert(event == base);
sw++; sw++;
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_event_get_device_notify_event(event) == NULL); litest_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL); litest_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL); litest_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL); litest_assert(libinput_event_get_touch_event(event) == NULL);
ck_assert(libinput_event_get_gesture_event(event) == NULL); litest_assert(libinput_event_get_gesture_event(event) == NULL);
ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); litest_assert(libinput_event_get_tablet_tool_event(event) == NULL);
ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); litest_assert(libinput_event_get_tablet_pad_event(event) == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_gt(sw, 0); litest_assert_int_gt(sw, 0);
} }
END_TEST END_TEST
@ -552,14 +552,14 @@ START_TEST(context_ref_counting)
* free errors. */ * free errors. */
li = libinput_path_create_context(&simple_interface, NULL); li = libinput_path_create_context(&simple_interface, NULL);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_ptr_eq(libinput_unref(li), NULL); litest_assert_ptr_eq(libinput_unref(li), NULL);
li = libinput_path_create_context(&simple_interface, NULL); li = libinput_path_create_context(&simple_interface, NULL);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_ptr_eq(libinput_ref(li), li); litest_assert_ptr_eq(libinput_ref(li), li);
ck_assert_ptr_eq(libinput_unref(li), li); litest_assert_ptr_eq(libinput_unref(li), li);
ck_assert_ptr_eq(libinput_unref(li), NULL); litest_assert_ptr_eq(libinput_unref(li), NULL);
} }
END_TEST END_TEST
@ -575,12 +575,12 @@ START_TEST(config_status_string)
for (i = 0; i < ARRAY_LENGTH(strs) - 1; i++) for (i = 0; i < ARRAY_LENGTH(strs) - 1; i++)
for (j = i + 1; j < ARRAY_LENGTH(strs); j++) for (j = i + 1; j < ARRAY_LENGTH(strs); j++)
ck_assert_str_ne(strs[i], strs[j]); litest_assert_str_ne(strs[i], strs[j]);
invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID + 1); invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID + 1);
ck_assert(invalid == NULL); litest_assert(invalid == NULL);
invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS - 1); invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS - 1);
ck_assert(invalid == NULL); litest_assert(invalid == NULL);
} }
END_TEST END_TEST
@ -618,7 +618,7 @@ START_TEST(fd_no_event_leak)
path = libevdev_uinput_get_devnode(uinput); path = libevdev_uinput_get_devnode(uinput);
fd = open(path, O_RDWR | O_NONBLOCK | O_CLOEXEC); fd = open(path, O_RDWR | O_NONBLOCK | O_CLOEXEC);
ck_assert_int_gt(fd, -1); litest_assert_int_gt(fd, -1);
li = libinput_path_create_context(&leak_interface, &fd); li = libinput_path_create_context(&leak_interface, &fd);
litest_restore_log_handler(li); /* use the default litest handler */ litest_restore_log_handler(li); /* use the default litest handler */
@ -687,7 +687,7 @@ START_TEST(timer_offset_bug_warning)
litest_dispatch(li); litest_dispatch(li);
/* triggered for touch down and touch up */ /* triggered for touch down and touch up */
ck_assert_int_eq(warning_triggered, 2); litest_assert_int_eq(warning_triggered, 2);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
END_TEST END_TEST
@ -724,7 +724,7 @@ START_TEST(timer_delay_bug_warning)
litest_dispatch(li); litest_dispatch(li);
} }
ck_assert_int_ge(warning_triggered, 1); litest_assert_int_ge(warning_triggered, 1);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
END_TEST END_TEST
@ -813,7 +813,7 @@ START_TEST(udev_absinfo_override)
found_mt_x = false, found_mt_y = false; found_mt_x = false, found_mt_y = false;
ud = libinput_device_get_udev_device(dev->libinput_device); ud = libinput_device_get_udev_device(dev->libinput_device);
ck_assert_notnull(ud); litest_assert_notnull(ud);
/* Custom checks for this special litest device only */ /* Custom checks for this special litest device only */
@ -826,57 +826,57 @@ START_TEST(udev_absinfo_override)
if (streq(key, "EVDEV_ABS_00")) { if (streq(key, "EVDEV_ABS_00")) {
found_x = true; found_x = true;
ck_assert(streq(value, "1:1000:100:10")); litest_assert(streq(value, "1:1000:100:10"));
} }
if (streq(key, "EVDEV_ABS_01")) { if (streq(key, "EVDEV_ABS_01")) {
found_y = true; found_y = true;
ck_assert(streq(value, "2:2000:200:20")); litest_assert(streq(value, "2:2000:200:20"));
} }
if (streq(key, "EVDEV_ABS_35")) { if (streq(key, "EVDEV_ABS_35")) {
found_mt_x = true; found_mt_x = true;
ck_assert(streq(value, "3:3000:300:30")); litest_assert(streq(value, "3:3000:300:30"));
} }
if (streq(key, "EVDEV_ABS_36")) { if (streq(key, "EVDEV_ABS_36")) {
found_mt_y = true; found_mt_y = true;
ck_assert(streq(value, "4:4000:400:40")); litest_assert(streq(value, "4:4000:400:40"));
} }
entry = udev_list_entry_get_next(entry); entry = udev_list_entry_get_next(entry);
} }
udev_device_unref(ud); udev_device_unref(ud);
ck_assert(found_x); litest_assert(found_x);
ck_assert(found_y); litest_assert(found_y);
ck_assert(found_mt_x); litest_assert(found_mt_x);
ck_assert(found_mt_y); litest_assert(found_mt_y);
abs = libevdev_get_abs_info(evdev, ABS_X); abs = libevdev_get_abs_info(evdev, ABS_X);
ck_assert_int_eq(abs->minimum, 1); litest_assert_int_eq(abs->minimum, 1);
ck_assert_int_eq(abs->maximum, 1000); litest_assert_int_eq(abs->maximum, 1000);
ck_assert_int_eq(abs->resolution, 100); litest_assert_int_eq(abs->resolution, 100);
/* if everything goes well, we override the fuzz to 0 */ /* if everything goes well, we override the fuzz to 0 */
ck_assert_int_eq(abs->fuzz, 0); litest_assert_int_eq(abs->fuzz, 0);
abs = libevdev_get_abs_info(evdev, ABS_Y); abs = libevdev_get_abs_info(evdev, ABS_Y);
ck_assert_int_eq(abs->minimum, 2); litest_assert_int_eq(abs->minimum, 2);
ck_assert_int_eq(abs->maximum, 2000); litest_assert_int_eq(abs->maximum, 2000);
ck_assert_int_eq(abs->resolution, 200); litest_assert_int_eq(abs->resolution, 200);
/* if everything goes well, we override the fuzz to 0 */ /* if everything goes well, we override the fuzz to 0 */
ck_assert_int_eq(abs->fuzz, 0); litest_assert_int_eq(abs->fuzz, 0);
abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
ck_assert_int_eq(abs->minimum, 3); litest_assert_int_eq(abs->minimum, 3);
ck_assert_int_eq(abs->maximum, 3000); litest_assert_int_eq(abs->maximum, 3000);
ck_assert_int_eq(abs->resolution, 300); litest_assert_int_eq(abs->resolution, 300);
/* if everything goes well, we override the fuzz to 0 */ /* if everything goes well, we override the fuzz to 0 */
ck_assert_int_eq(abs->fuzz, 0); litest_assert_int_eq(abs->fuzz, 0);
abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y);
ck_assert_int_eq(abs->minimum, 4); litest_assert_int_eq(abs->minimum, 4);
ck_assert_int_eq(abs->maximum, 4000); litest_assert_int_eq(abs->maximum, 4000);
ck_assert_int_eq(abs->resolution, 400); litest_assert_int_eq(abs->resolution, 400);
/* if everything goes well, we override the fuzz to 0 */ /* if everything goes well, we override the fuzz to 0 */
ck_assert_int_eq(abs->fuzz, 0); litest_assert_int_eq(abs->fuzz, 0);
} }
END_TEST END_TEST

View file

@ -42,7 +42,7 @@ START_TEST(pad_cap)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(libinput_device_has_capability(device, litest_assert(libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_TABLET_PAD)); LIBINPUT_DEVICE_CAP_TABLET_PAD));
} }
@ -53,7 +53,7 @@ START_TEST(pad_no_cap)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(!libinput_device_has_capability(device, litest_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_TABLET_PAD)); LIBINPUT_DEVICE_CAP_TABLET_PAD));
} }
END_TEST END_TEST
@ -87,14 +87,14 @@ START_TEST(pad_time)
return; return;
ev = libinput_get_event(li); ev = libinput_get_event(li);
ck_assert_notnull(ev); litest_assert_notnull(ev);
litest_assert_event_type(ev, LIBINPUT_EVENT_TABLET_PAD_BUTTON); litest_assert_event_type(ev, LIBINPUT_EVENT_TABLET_PAD_BUTTON);
pev = libinput_event_get_tablet_pad_event(ev); pev = libinput_event_get_tablet_pad_event(ev);
time = libinput_event_tablet_pad_get_time(pev); time = libinput_event_tablet_pad_get_time(pev);
time_usec = libinput_event_tablet_pad_get_time_usec(pev); time_usec = libinput_event_tablet_pad_get_time_usec(pev);
ck_assert(time != 0); litest_assert(time != 0);
ck_assert(time == time_usec/1000); litest_assert(time == time_usec/1000);
libinput_event_destroy(ev); libinput_event_destroy(ev);
@ -113,9 +113,9 @@ START_TEST(pad_time)
time = libinput_event_tablet_pad_get_time(pev); time = libinput_event_tablet_pad_get_time(pev);
time_usec = libinput_event_tablet_pad_get_time_usec(pev); time_usec = libinput_event_tablet_pad_get_time_usec(pev);
ck_assert(time > oldtime); litest_assert(time > oldtime);
ck_assert(time != 0); litest_assert(time != 0);
ck_assert(time == time_usec/1000); litest_assert(time == time_usec/1000);
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -131,18 +131,18 @@ START_TEST(pad_num_buttons_libwacom)
unsigned int nb_lw, nb; unsigned int nb_lw, nb;
db = libwacom_database_new(); db = libwacom_database_new();
ck_assert_notnull(db); litest_assert_notnull(db);
wacom = libwacom_new_from_usbid(db, wacom = libwacom_new_from_usbid(db,
libevdev_get_id_vendor(dev->evdev), libevdev_get_id_vendor(dev->evdev),
libevdev_get_id_product(dev->evdev), libevdev_get_id_product(dev->evdev),
NULL); NULL);
ck_assert_notnull(wacom); litest_assert_notnull(wacom);
nb_lw = libwacom_get_num_buttons(wacom); nb_lw = libwacom_get_num_buttons(wacom);
nb = libinput_device_tablet_pad_get_num_buttons(device); nb = libinput_device_tablet_pad_get_num_buttons(device);
ck_assert_int_eq(nb, nb_lw); litest_assert_int_eq(nb, nb_lw);
libwacom_destroy(wacom); libwacom_destroy(wacom);
libwacom_database_destroy(db); libwacom_database_destroy(db);
@ -167,7 +167,7 @@ START_TEST(pad_num_buttons)
nbuttons++; nbuttons++;
} }
ck_assert_int_eq(libinput_device_tablet_pad_get_num_buttons(device), litest_assert_int_eq(libinput_device_tablet_pad_get_num_buttons(device),
nbuttons); nbuttons);
} }
END_TEST END_TEST
@ -194,7 +194,7 @@ START_TEST(pad_button_intuos)
/* Skip over the BTN_MOUSE and BTN_JOYSTICK range */ /* Skip over the BTN_MOUSE and BTN_JOYSTICK range */
if ((code >= BTN_MOUSE && code < BTN_JOYSTICK) || if ((code >= BTN_MOUSE && code < BTN_JOYSTICK) ||
(code >= BTN_DIGI)) { (code >= BTN_DIGI)) {
ck_assert(!libevdev_has_event_code(dev->evdev, litest_assert(!libevdev_has_event_code(dev->evdev,
EV_KEY, code)); EV_KEY, code));
continue; continue;
} }
@ -227,7 +227,7 @@ START_TEST(pad_button_intuos)
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
ck_assert_int_ge(count, 1); litest_assert_int_ge(count, 1);
#endif #endif
} }
END_TEST END_TEST
@ -277,7 +277,7 @@ START_TEST(pad_button_bamboo)
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
ck_assert_int_gt(count, 3); litest_assert_int_gt(count, 3);
#endif #endif
} }
END_TEST END_TEST
@ -359,10 +359,10 @@ START_TEST(pad_button_mode_groups)
/* litest virtual devices don't have modes */ /* litest virtual devices don't have modes */
mode = libinput_event_tablet_pad_get_mode(pev); mode = libinput_event_tablet_pad_get_mode(pev);
ck_assert_int_eq(mode, 0); litest_assert_int_eq(mode, 0);
group = libinput_event_tablet_pad_get_mode_group(pev); group = libinput_event_tablet_pad_get_mode_group(pev);
index = libinput_tablet_pad_mode_group_get_index(group); index = libinput_tablet_pad_mode_group_get_index(group);
ck_assert_int_eq(index, 0); litest_assert_int_eq(index, 0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
@ -371,10 +371,10 @@ START_TEST(pad_button_mode_groups)
pev = libinput_event_get_tablet_pad_event(ev); pev = libinput_event_get_tablet_pad_event(ev);
mode = libinput_event_tablet_pad_get_mode(pev); mode = libinput_event_tablet_pad_get_mode(pev);
ck_assert_int_eq(mode, 0); litest_assert_int_eq(mode, 0);
group = libinput_event_tablet_pad_get_mode_group(pev); group = libinput_event_tablet_pad_get_mode_group(pev);
index = libinput_tablet_pad_mode_group_get_index(group); index = libinput_tablet_pad_mode_group_get_index(group);
ck_assert_int_eq(index, 0); litest_assert_int_eq(index, 0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -389,7 +389,7 @@ START_TEST(pad_has_ring)
int nrings; int nrings;
nrings = libinput_device_tablet_pad_get_num_rings(device); nrings = libinput_device_tablet_pad_get_num_rings(device);
ck_assert_int_ge(nrings, 1); litest_assert_int_ge(nrings, 1);
} }
END_TEST END_TEST
@ -439,16 +439,16 @@ START_TEST(pad_ring)
LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER);
degrees = libinput_event_tablet_pad_get_ring_position(pev); degrees = libinput_event_tablet_pad_get_ring_position(pev);
ck_assert_double_ge(degrees, 0.0); litest_assert_double_ge(degrees, 0.0);
ck_assert_double_lt(degrees, 360.0); litest_assert_double_lt(degrees, 360.0);
ck_assert_double_eq(degrees, expected); litest_assert_double_eq(degrees, expected);
libinput_event_destroy(ev); libinput_event_destroy(ev);
expected = fmod(degrees + step_size, 360); expected = fmod(degrees + step_size, 360);
} }
ck_assert_int_eq(nevents, 360/step_size - 1); litest_assert_int_eq(nevents, 360/step_size - 1);
litest_pad_ring_end(dev); litest_pad_ring_end(dev);
} }
@ -475,7 +475,7 @@ START_TEST(pad_ring_finger_up)
LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER);
degrees = libinput_event_tablet_pad_get_ring_position(pev); degrees = libinput_event_tablet_pad_get_ring_position(pev);
ck_assert_double_eq(degrees, -1.0); litest_assert_double_eq(degrees, -1.0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -493,7 +493,7 @@ START_TEST(pad_has_dial)
expected_ndials = 2; expected_ndials = 2;
ndials = libinput_device_tablet_pad_get_num_dials(device); ndials = libinput_device_tablet_pad_get_num_dials(device);
ck_assert_int_eq(ndials, expected_ndials); litest_assert_int_eq(ndials, expected_ndials);
} }
END_TEST END_TEST
@ -524,10 +524,10 @@ START_TEST(pad_dial_low_res)
double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev); double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev);
switch (code) { switch (code) {
case REL_WHEEL: /* inverted */ case REL_WHEEL: /* inverted */
ck_assert_double_eq(v120, -120.0 * direction); litest_assert_double_eq(v120, -120.0 * direction);
break; break;
case REL_DIAL: case REL_DIAL:
ck_assert_double_eq(v120, 120.0 * direction); litest_assert_double_eq(v120, 120.0 * direction);
break; break;
default: default:
litest_abort_msg("Invalid dial code"); litest_abort_msg("Invalid dial code");
@ -561,7 +561,7 @@ START_TEST(pad_dial_hi_res)
struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0); struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0);
double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev); double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev);
ck_assert_double_eq(v120, -increment); /* REL_WHEEL is inverted */ litest_assert_double_eq(v120, -increment); /* REL_WHEEL is inverted */
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
} }
@ -574,7 +574,7 @@ START_TEST(pad_has_strip)
int nstrips; int nstrips;
nstrips = libinput_device_tablet_pad_get_num_strips(device); nstrips = libinput_device_tablet_pad_get_num_strips(device);
ck_assert_int_ge(nstrips, 1); litest_assert_int_ge(nstrips, 1);
} }
END_TEST END_TEST
@ -605,12 +605,12 @@ START_TEST(pad_strip)
LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER);
pos = libinput_event_tablet_pad_get_strip_position(pev); pos = libinput_event_tablet_pad_get_strip_position(pev);
ck_assert_double_ge(pos, 0.0); litest_assert_double_ge(pos, 0.0);
ck_assert_double_lt(pos, 1.0); litest_assert_double_lt(pos, 1.0);
/* rounding errors, mostly caused by small physical range */ /* rounding errors, mostly caused by small physical range */
ck_assert_double_ge(pos, expected - 0.02); litest_assert_double_ge(pos, expected - 0.02);
ck_assert_double_le(pos, expected + 0.02); litest_assert_double_le(pos, expected + 0.02);
libinput_event_destroy(ev); libinput_event_destroy(ev);
@ -625,7 +625,7 @@ START_TEST(pad_strip)
0, 0,
LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER);
pos = libinput_event_tablet_pad_get_strip_position(pev); pos = libinput_event_tablet_pad_get_strip_position(pev);
ck_assert_double_eq(pos, 1.0); litest_assert_double_eq(pos, 1.0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_pad_strip_end(dev); litest_pad_strip_end(dev);
@ -652,7 +652,7 @@ START_TEST(pad_strip_finger_up)
LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER);
pos = libinput_event_tablet_pad_get_strip_position(pev); pos = libinput_event_tablet_pad_get_strip_position(pev);
ck_assert_double_eq(pos, -1.0); litest_assert_double_eq(pos, -1.0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -666,27 +666,27 @@ START_TEST(pad_left_handed_default)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert(libinput_device_config_left_handed_is_available(device)); litest_assert(libinput_device_config_left_handed_is_available(device));
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
0); 0);
status = libinput_device_config_left_handed_set(dev->libinput_device, 1); status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
1); 1);
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
status = libinput_device_config_left_handed_set(dev->libinput_device, 0); status = libinput_device_config_left_handed_set(dev->libinput_device, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
0); 0);
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
#endif #endif
@ -701,31 +701,31 @@ START_TEST(pad_no_left_handed)
/* Without libwacom we default to left-handed being available */ /* Without libwacom we default to left-handed being available */
#if HAVE_LIBWACOM #if HAVE_LIBWACOM
ck_assert(!libinput_device_config_left_handed_is_available(device)); litest_assert(!libinput_device_config_left_handed_is_available(device));
#else #else
ck_assert(libinput_device_config_left_handed_is_available(device)); litest_assert(libinput_device_config_left_handed_is_available(device));
#endif #endif
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
0); 0);
#if HAVE_LIBWACOM #if HAVE_LIBWACOM
status = libinput_device_config_left_handed_set(dev->libinput_device, 1); status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
0); 0);
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
status = libinput_device_config_left_handed_set(dev->libinput_device, 0); status = libinput_device_config_left_handed_set(dev->libinput_device, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
ck_assert_int_eq(libinput_device_config_left_handed_get(device), litest_assert_int_eq(libinput_device_config_left_handed_get(device),
0); 0);
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), litest_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0); 0);
#endif #endif
} }
@ -760,12 +760,12 @@ START_TEST(pad_left_handed_ring)
LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER);
degrees = libinput_event_tablet_pad_get_ring_position(pev); degrees = libinput_event_tablet_pad_get_ring_position(pev);
ck_assert_double_ge(degrees, 0.0); litest_assert_double_ge(degrees, 0.0);
ck_assert_double_lt(degrees, 360.0); litest_assert_double_lt(degrees, 360.0);
/* rounding errors, mostly caused by small physical range */ /* rounding errors, mostly caused by small physical range */
ck_assert_double_ge(degrees, expected - 2); litest_assert_double_ge(degrees, expected - 2);
ck_assert_double_le(degrees, expected + 2); litest_assert_double_le(degrees, expected + 2);
libinput_event_destroy(ev); libinput_event_destroy(ev);
@ -786,19 +786,19 @@ START_TEST(pad_mode_groups)
int i; int i;
ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
ck_assert_int_eq(ngroups, 1); litest_assert_int_eq(ngroups, 1);
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
group = libinput_device_tablet_pad_get_mode_group(device, i); group = libinput_device_tablet_pad_get_mode_group(device, i);
ck_assert_notnull(group); litest_assert_notnull(group);
ck_assert_int_eq(libinput_tablet_pad_mode_group_get_index(group), litest_assert_int_eq(libinput_tablet_pad_mode_group_get_index(group),
i); i);
} }
group = libinput_device_tablet_pad_get_mode_group(device, ngroups); group = libinput_device_tablet_pad_get_mode_group(device, ngroups);
ck_assert(group == NULL); litest_assert(group == NULL);
group = libinput_device_tablet_pad_get_mode_group(device, ngroups + 1); group = libinput_device_tablet_pad_get_mode_group(device, ngroups + 1);
ck_assert(group == NULL); litest_assert(group == NULL);
} }
END_TEST END_TEST
@ -811,14 +811,14 @@ START_TEST(pad_mode_groups_userdata)
void *userdata = &rc; void *userdata = &rc;
group = libinput_device_tablet_pad_get_mode_group(device, 0); group = libinput_device_tablet_pad_get_mode_group(device, 0);
ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == litest_assert(libinput_tablet_pad_mode_group_get_user_data(group) ==
NULL); NULL);
libinput_tablet_pad_mode_group_set_user_data(group, userdata); libinput_tablet_pad_mode_group_set_user_data(group, userdata);
ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == litest_assert(libinput_tablet_pad_mode_group_get_user_data(group) ==
&rc); &rc);
libinput_tablet_pad_mode_group_set_user_data(group, NULL); libinput_tablet_pad_mode_group_set_user_data(group, NULL);
ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == litest_assert(libinput_tablet_pad_mode_group_get_user_data(group) ==
NULL); NULL);
} }
END_TEST END_TEST
@ -831,12 +831,12 @@ START_TEST(pad_mode_groups_ref)
group = libinput_device_tablet_pad_get_mode_group(device, 0); group = libinput_device_tablet_pad_get_mode_group(device, 0);
g = libinput_tablet_pad_mode_group_ref(group); g = libinput_tablet_pad_mode_group_ref(group);
ck_assert_ptr_eq(g, group); litest_assert_ptr_eq(g, group);
/* We don't expect this to be freed. Any leaks should be caught by /* We don't expect this to be freed. Any leaks should be caught by
* valgrind. */ * valgrind. */
g = libinput_tablet_pad_mode_group_unref(group); g = libinput_tablet_pad_mode_group_unref(group);
ck_assert_ptr_eq(g, group); litest_assert_ptr_eq(g, group);
} }
END_TEST END_TEST
@ -849,15 +849,15 @@ START_TEST(pad_mode_group_mode)
unsigned int nmodes, mode; unsigned int nmodes, mode;
ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
ck_assert_int_ge(ngroups, 1); litest_assert_int_ge(ngroups, 1);
group = libinput_device_tablet_pad_get_mode_group(device, 0); group = libinput_device_tablet_pad_get_mode_group(device, 0);
nmodes = libinput_tablet_pad_mode_group_get_num_modes(group); nmodes = libinput_tablet_pad_mode_group_get_num_modes(group);
ck_assert_int_eq(nmodes, 1); litest_assert_int_eq(nmodes, 1);
mode = libinput_tablet_pad_mode_group_get_mode(group); mode = libinput_tablet_pad_mode_group_get_mode(group);
ck_assert_int_lt(mode, nmodes); litest_assert_int_lt(mode, nmodes);
} }
END_TEST END_TEST
@ -870,7 +870,7 @@ START_TEST(pad_mode_group_has)
int i, b, r, s; int i, b, r, s;
ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
ck_assert_int_ge(ngroups, 1); litest_assert_int_ge(ngroups, 1);
nbuttons = libinput_device_tablet_pad_get_num_buttons(device); nbuttons = libinput_device_tablet_pad_get_num_buttons(device);
nrings = libinput_device_tablet_pad_get_num_rings(device); nrings = libinput_device_tablet_pad_get_num_rings(device);
@ -883,11 +883,11 @@ START_TEST(pad_mode_group_has)
i); i);
if (libinput_tablet_pad_mode_group_has_button(group, if (libinput_tablet_pad_mode_group_has_button(group,
b)) { b)) {
ck_assert(!found); litest_assert(!found);
found = true; found = true;
} }
} }
ck_assert(found); litest_assert(found);
} }
for (s = 0; s < nstrips; s++) { for (s = 0; s < nstrips; s++) {
@ -897,11 +897,11 @@ START_TEST(pad_mode_group_has)
i); i);
if (libinput_tablet_pad_mode_group_has_strip(group, if (libinput_tablet_pad_mode_group_has_strip(group,
s)) { s)) {
ck_assert(!found); litest_assert(!found);
found = true; found = true;
} }
} }
ck_assert(found); litest_assert(found);
} }
for (r = 0; r < nrings; r++) { for (r = 0; r < nrings; r++) {
@ -911,11 +911,11 @@ START_TEST(pad_mode_group_has)
i); i);
if (libinput_tablet_pad_mode_group_has_ring(group, if (libinput_tablet_pad_mode_group_has_ring(group,
r)) { r)) {
ck_assert(!found); litest_assert(!found);
found = true; found = true;
} }
} }
ck_assert(found); litest_assert(found);
} }
} }
END_TEST END_TEST
@ -930,7 +930,7 @@ START_TEST(pad_mode_group_has_invalid)
int rc; int rc;
ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
ck_assert_int_ge(ngroups, 1); litest_assert_int_ge(ngroups, 1);
nbuttons = libinput_device_tablet_pad_get_num_buttons(device); nbuttons = libinput_device_tablet_pad_get_num_buttons(device);
nrings = libinput_device_tablet_pad_get_num_rings(device); nrings = libinput_device_tablet_pad_get_num_rings(device);
@ -940,39 +940,39 @@ START_TEST(pad_mode_group_has_invalid)
group = libinput_device_tablet_pad_get_mode_group(device, i); group = libinput_device_tablet_pad_get_mode_group(device, i);
rc = libinput_tablet_pad_mode_group_has_button(group, rc = libinput_tablet_pad_mode_group_has_button(group,
nbuttons); nbuttons);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_button(group, rc = libinput_tablet_pad_mode_group_has_button(group,
nbuttons + 1); nbuttons + 1);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_button(group, rc = libinput_tablet_pad_mode_group_has_button(group,
0x1000000); 0x1000000);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
} }
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
group = libinput_device_tablet_pad_get_mode_group(device, i); group = libinput_device_tablet_pad_get_mode_group(device, i);
rc = libinput_tablet_pad_mode_group_has_strip(group, rc = libinput_tablet_pad_mode_group_has_strip(group,
nstrips); nstrips);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_strip(group, rc = libinput_tablet_pad_mode_group_has_strip(group,
nstrips + 1); nstrips + 1);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_strip(group, rc = libinput_tablet_pad_mode_group_has_strip(group,
0x1000000); 0x1000000);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
} }
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
group = libinput_device_tablet_pad_get_mode_group(device, i); group = libinput_device_tablet_pad_get_mode_group(device, i);
rc = libinput_tablet_pad_mode_group_has_ring(group, rc = libinput_tablet_pad_mode_group_has_ring(group,
nrings); nrings);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_ring(group, rc = libinput_tablet_pad_mode_group_has_ring(group,
nrings + 1); nrings + 1);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_tablet_pad_mode_group_has_ring(group, rc = libinput_tablet_pad_mode_group_has_ring(group,
0x1000000); 0x1000000);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
} }
} }
END_TEST END_TEST
@ -986,14 +986,14 @@ START_TEST(pad_mode_group_has_no_toggle)
int i, b; int i, b;
ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
ck_assert_int_ge(ngroups, 1); litest_assert_int_ge(ngroups, 1);
/* Button must not be toggle buttons */ /* Button must not be toggle buttons */
nbuttons = libinput_device_tablet_pad_get_num_buttons(device); nbuttons = libinput_device_tablet_pad_get_num_buttons(device);
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
group = libinput_device_tablet_pad_get_mode_group(device, i); group = libinput_device_tablet_pad_get_mode_group(device, i);
for (b = 0; b < nbuttons; b++) { for (b = 0; b < nbuttons; b++) {
ck_assert(!libinput_tablet_pad_mode_group_button_is_toggle( litest_assert(!libinput_tablet_pad_mode_group_button_is_toggle(
group, group,
b)); b));
} }

View file

@ -92,13 +92,13 @@ START_TEST(path_create_NULL)
counter.close_func_count = 0; counter.close_func_count = 0;
li = libinput_path_create_context(NULL, NULL); li = libinput_path_create_context(NULL, NULL);
ck_assert(li == NULL); litest_assert(li == NULL);
li = libinput_path_create_context(&counting_interface, &counter); li = libinput_path_create_context(&counting_interface, &counter);
ck_assert_notnull(li); litest_assert_notnull(li);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.open_func_count, 0); litest_assert_int_eq(counter.open_func_count, 0);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
} }
END_TEST END_TEST
@ -113,19 +113,19 @@ START_TEST(path_create_invalid)
counter.close_func_count = 0; counter.close_func_count = 0;
li = libinput_path_create_context(&counting_interface, &counter); li = libinput_path_create_context(&counting_interface, &counter);
ck_assert_notnull(li); litest_assert_notnull(li);
litest_disable_log_handler(li); litest_disable_log_handler(li);
device = libinput_path_add_device(li, path); device = libinput_path_add_device(li, path);
ck_assert(device == NULL); litest_assert(device == NULL);
ck_assert_int_eq(counter.open_func_count, 0); litest_assert_int_eq(counter.open_func_count, 0);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
litest_restore_log_handler(li); litest_restore_log_handler(li);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
} }
END_TEST END_TEST
@ -140,19 +140,19 @@ START_TEST(path_create_invalid_kerneldev)
counter.close_func_count = 0; counter.close_func_count = 0;
li = libinput_path_create_context(&counting_interface, &counter); li = libinput_path_create_context(&counting_interface, &counter);
ck_assert_notnull(li); litest_assert_notnull(li);
litest_disable_log_handler(li); litest_disable_log_handler(li);
device = libinput_path_add_device(li, path); device = libinput_path_add_device(li, path);
ck_assert(device == NULL); litest_assert(device == NULL);
ck_assert_int_eq(counter.open_func_count, 1); litest_assert_int_eq(counter.open_func_count, 1);
ck_assert_int_eq(counter.close_func_count, 1); litest_assert_int_eq(counter.close_func_count, 1);
litest_restore_log_handler(li); litest_restore_log_handler(li);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.close_func_count, 1); litest_assert_int_eq(counter.close_func_count, 1);
} }
END_TEST END_TEST
@ -166,7 +166,7 @@ START_TEST(path_create_invalid_file)
umask(002); umask(002);
fd = mkstemp(path); fd = mkstemp(path);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
close(fd); close(fd);
counter.open_func_count = 0; counter.open_func_count = 0;
@ -177,16 +177,16 @@ START_TEST(path_create_invalid_file)
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, path); device = libinput_path_add_device(li, path);
ck_assert(device == NULL); litest_assert(device == NULL);
ck_assert_int_eq(counter.open_func_count, 0); litest_assert_int_eq(counter.open_func_count, 0);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
litest_restore_log_handler(li); litest_restore_log_handler(li);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
} }
END_TEST END_TEST
@ -206,16 +206,16 @@ START_TEST(path_create_pathmax_file)
li = libinput_path_create_context(&counting_interface, &counter); li = libinput_path_create_context(&counting_interface, &counter);
litest_set_log_handler_bug(li); litest_set_log_handler_bug(li);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, path); device = libinput_path_add_device(li, path);
ck_assert(device == NULL); litest_assert(device == NULL);
ck_assert_int_eq(counter.open_func_count, 0); litest_assert_int_eq(counter.open_func_count, 0);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
litest_restore_log_handler(li); litest_restore_log_handler(li);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.close_func_count, 0); litest_assert_int_eq(counter.close_func_count, 0);
free(path); free(path);
} }
@ -240,21 +240,21 @@ START_TEST(path_create_destroy)
-1); -1);
li = libinput_path_create_context(&counting_interface, &counter); li = libinput_path_create_context(&counting_interface, &counter);
ck_assert_notnull(li); litest_assert_notnull(li);
litest_disable_log_handler(li); litest_disable_log_handler(li);
ck_assert(libinput_get_user_data(li) == &counter); litest_assert(libinput_get_user_data(li) == &counter);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
ck_assert_int_eq(counter.open_func_count, 1); litest_assert_int_eq(counter.open_func_count, 1);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
libinput_unref(li); libinput_unref(li);
ck_assert_int_eq(counter.close_func_count, 1); litest_assert_int_eq(counter.close_func_count, 1);
} }
END_TEST END_TEST
@ -265,11 +265,11 @@ START_TEST(path_force_destroy)
struct libinput_device *device; struct libinput_device *device;
li = libinput_path_create_context(&simple_interface, NULL); li = libinput_path_create_context(&simple_interface, NULL);
ck_assert_notnull(li); litest_assert_notnull(li);
libinput_ref(li); libinput_ref(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput)); libevdev_uinput_get_devnode(dev->uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
while (libinput_unref(li) != NULL) while (libinput_unref(li) != NULL)
; ;
@ -282,10 +282,10 @@ START_TEST(path_set_user_data)
int data1, data2; int data1, data2;
li = libinput_path_create_context(&simple_interface, &data1); li = libinput_path_create_context(&simple_interface, &data1);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert(libinput_get_user_data(li) == &data1); litest_assert(libinput_get_user_data(li) == &data1);
libinput_set_user_data(li, &data2); libinput_set_user_data(li, &data2);
ck_assert(libinput_get_user_data(li) == &data2); litest_assert(libinput_get_user_data(li) == &data2);
libinput_unref(li); libinput_unref(li);
} }
@ -303,16 +303,16 @@ START_TEST(path_added_seat)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
seat = libinput_device_get_seat(device); seat = libinput_device_get_seat(device);
ck_assert_notnull(seat); litest_assert_notnull(seat);
seat_name = libinput_seat_get_logical_name(seat); seat_name = libinput_seat_get_logical_name(seat);
ck_assert_str_eq(seat_name, "default"); litest_assert_str_eq(seat_name, "default");
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -347,30 +347,30 @@ START_TEST(path_seat_change)
rc = libinput_device_set_seat_logical_name(device, rc = libinput_device_set_seat_logical_name(device,
seat2_name); seat2_name);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_REMOVED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_REMOVED);
ck_assert(libinput_event_get_device(event) == device); litest_assert(libinput_event_get_device(event) == device);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED);
ck_assert(libinput_event_get_device(event) != device); litest_assert(libinput_event_get_device(event) != device);
libinput_device_unref(device); libinput_device_unref(device);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
seat2 = libinput_device_get_seat(device); seat2 = libinput_device_get_seat(device);
ck_assert_str_ne(libinput_seat_get_logical_name(seat2), litest_assert_str_ne(libinput_seat_get_logical_name(seat2),
seat1_name); seat1_name);
ck_assert_str_eq(libinput_seat_get_logical_name(seat2), litest_assert_str_eq(libinput_seat_get_logical_name(seat2),
seat2_name); seat2_name);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -393,10 +393,10 @@ START_TEST(path_added_device)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert_notnull(device); litest_assert_notnull(device);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -413,10 +413,10 @@ START_TEST(path_add_device)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert_notnull(device); litest_assert_notnull(device);
sysname1 = safe_strdup(libinput_device_get_sysname(device)); sysname1 = safe_strdup(libinput_device_get_sysname(device));
libinput_event_destroy(event); libinput_event_destroy(event);
@ -424,19 +424,19 @@ START_TEST(path_add_device)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput)); libevdev_uinput_get_devnode(dev->uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert_notnull(device); litest_assert_notnull(device);
sysname2 = safe_strdup(libinput_device_get_sysname(device)); sysname2 = safe_strdup(libinput_device_get_sysname(device));
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_str_eq(sysname1, sysname2); litest_assert_str_eq(sysname1, sysname2);
free(sysname1); free(sysname1);
free(sysname2); free(sysname2);
@ -453,7 +453,7 @@ START_TEST(path_add_invalid_path)
litest_disable_log_handler(li); litest_disable_log_handler(li);
device = libinput_path_add_device(li, "/tmp/"); device = libinput_path_add_device(li, "/tmp/");
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_dispatch(li); litest_dispatch(li);
@ -473,16 +473,16 @@ START_TEST(path_device_sysname)
litest_dispatch(dev->libinput); litest_dispatch(dev->libinput);
ev = libinput_get_event(dev->libinput); ev = libinput_get_event(dev->libinput);
ck_assert_notnull(ev); litest_assert_notnull(ev);
litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
ck_assert_notnull(device); litest_assert_notnull(device);
sysname = libinput_device_get_sysname(device); sysname = libinput_device_get_sysname(device);
ck_assert_notnull(sysname); litest_assert_notnull(sysname);
ck_assert_int_gt(strlen(sysname), 1); litest_assert_int_gt(strlen(sysname), 1);
ck_assert(strchr(sysname, '/') == NULL); litest_assert(strchr(sysname, '/') == NULL);
ck_assert(strneq(sysname, "event", 5)); litest_assert(strneq(sysname, "event", 5));
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -498,7 +498,7 @@ START_TEST(path_remove_device)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput)); libevdev_uinput_get_devnode(dev->uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_drain_events(li); litest_drain_events(li);
libinput_path_remove_device(device); libinput_path_remove_device(device);
@ -514,7 +514,7 @@ START_TEST(path_remove_device)
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_eq(remove_event, 1); litest_assert_int_eq(remove_event, 1);
} }
END_TEST END_TEST
@ -528,7 +528,7 @@ START_TEST(path_double_remove_device)
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput)); libevdev_uinput_get_devnode(dev->uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_drain_events(li); litest_drain_events(li);
libinput_path_remove_device(device); libinput_path_remove_device(device);
@ -545,7 +545,7 @@ START_TEST(path_double_remove_device)
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_eq(remove_event, 1); litest_assert_int_eq(remove_event, 1);
} }
END_TEST END_TEST
@ -565,11 +565,11 @@ START_TEST(path_suspend)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
libinput_suspend(li); libinput_suspend(li);
libinput_resume(li); libinput_resume(li);
@ -595,11 +595,11 @@ START_TEST(path_double_suspend)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
libinput_suspend(li); libinput_suspend(li);
libinput_suspend(li); libinput_suspend(li);
@ -626,11 +626,11 @@ START_TEST(path_double_resume)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
libinput_suspend(li); libinput_suspend(li);
libinput_resume(li); libinput_resume(li);
@ -665,11 +665,11 @@ START_TEST(path_add_device_suspend_resume)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1)); libevdev_uinput_get_devnode(uinput1));
ck_assert_notnull(device); litest_assert_notnull(device);
libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput2)); libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput2));
litest_dispatch(li); litest_dispatch(li);
@ -681,7 +681,7 @@ START_TEST(path_add_device_suspend_resume)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libinput_suspend(li); libinput_suspend(li);
litest_dispatch(li); litest_dispatch(li);
@ -693,7 +693,7 @@ START_TEST(path_add_device_suspend_resume)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libinput_resume(li); libinput_resume(li);
litest_dispatch(li); litest_dispatch(li);
@ -705,7 +705,7 @@ START_TEST(path_add_device_suspend_resume)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libevdev_uinput_destroy(uinput1); libevdev_uinput_destroy(uinput1);
libevdev_uinput_destroy(uinput2); libevdev_uinput_destroy(uinput2);
@ -737,14 +737,14 @@ START_TEST(path_add_device_suspend_resume_fail)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1)); libevdev_uinput_get_devnode(uinput1));
ck_assert_notnull(device); litest_assert_notnull(device);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput2)); libevdev_uinput_get_devnode(uinput2));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_dispatch(li); litest_dispatch(li);
@ -755,7 +755,7 @@ START_TEST(path_add_device_suspend_resume_fail)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libinput_suspend(li); libinput_suspend(li);
litest_dispatch(li); litest_dispatch(li);
@ -767,12 +767,12 @@ START_TEST(path_add_device_suspend_resume_fail)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
/* now drop one of the devices */ /* now drop one of the devices */
libevdev_uinput_destroy(uinput1); libevdev_uinput_destroy(uinput1);
rc = libinput_resume(li); rc = libinput_resume(li);
ck_assert_int_eq(rc, -1); litest_assert_int_eq(rc, -1);
litest_dispatch(li); litest_dispatch(li);
@ -789,7 +789,7 @@ START_TEST(path_add_device_suspend_resume_fail)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libevdev_uinput_destroy(uinput2); libevdev_uinput_destroy(uinput2);
libinput_unref(li); libinput_unref(li);
@ -820,11 +820,11 @@ START_TEST(path_add_device_suspend_resume_remove_device)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1)); libevdev_uinput_get_devnode(uinput1));
ck_assert_notnull(device); litest_assert_notnull(device);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput2)); libevdev_uinput_get_devnode(uinput2));
@ -838,7 +838,7 @@ START_TEST(path_add_device_suspend_resume_remove_device)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
libinput_suspend(li); libinput_suspend(li);
litest_dispatch(li); litest_dispatch(li);
@ -850,7 +850,7 @@ START_TEST(path_add_device_suspend_resume_remove_device)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 2); litest_assert_int_eq(nevents, 2);
/* now drop and remove one of the devices */ /* now drop and remove one of the devices */
libevdev_uinput_destroy(uinput2); libevdev_uinput_destroy(uinput2);
@ -858,7 +858,7 @@ START_TEST(path_add_device_suspend_resume_remove_device)
libinput_device_unref(device); libinput_device_unref(device);
rc = libinput_resume(li); rc = libinput_resume(li);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
litest_dispatch(li); litest_dispatch(li);
@ -869,7 +869,7 @@ START_TEST(path_add_device_suspend_resume_remove_device)
nevents++; nevents++;
} }
ck_assert_int_eq(nevents, 1); litest_assert_int_eq(nevents, 1);
libevdev_uinput_destroy(uinput1); libevdev_uinput_destroy(uinput1);
libinput_unref(li); libinput_unref(li);
@ -891,11 +891,11 @@ START_TEST(path_device_gone)
-1); -1);
li = libinput_path_create_context(&simple_interface, NULL); li = libinput_path_create_context(&simple_interface, NULL);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_drain_events(li); litest_drain_events(li);
@ -904,7 +904,7 @@ START_TEST(path_device_gone)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_REMOVED); litest_assert_event_type(event, LIBINPUT_EVENT_DEVICE_REMOVED);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -934,24 +934,24 @@ START_TEST(path_seat_recycle)
-1); -1);
li = libinput_path_create_context(&simple_interface, userdata); li = libinput_path_create_context(&simple_interface, userdata);
ck_assert_notnull(li); litest_assert_notnull(li);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert_notnull(device); litest_assert_notnull(device);
litest_dispatch(li); litest_dispatch(li);
ev = libinput_get_event(li); ev = libinput_get_event(li);
ck_assert_notnull(ev); litest_assert_notnull(ev);
litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
ck_assert_notnull(device); litest_assert_notnull(device);
saved_seat = libinput_device_get_seat(device); saved_seat = libinput_device_get_seat(device);
libinput_seat_set_user_data(saved_seat, &data); libinput_seat_set_user_data(saved_seat, &data);
libinput_seat_ref(saved_seat); libinput_seat_ref(saved_seat);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_notnull(saved_seat); litest_assert_notnull(saved_seat);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -963,20 +963,20 @@ START_TEST(path_seat_recycle)
litest_dispatch(li); litest_dispatch(li);
ev = libinput_get_event(li); ev = libinput_get_event(li);
ck_assert_notnull(ev); litest_assert_notnull(ev);
litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED); litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
ck_assert_notnull(device); litest_assert_notnull(device);
seat = libinput_device_get_seat(device); seat = libinput_device_get_seat(device);
user_data = libinput_seat_get_user_data(seat); user_data = libinput_seat_get_user_data(seat);
if (user_data == &data) { if (user_data == &data) {
found = 1; found = 1;
ck_assert(seat == saved_seat); litest_assert(seat == saved_seat);
} }
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert(found == 1); litest_assert(found == 1);
libinput_unref(li); libinput_unref(li);
@ -992,7 +992,7 @@ START_TEST(path_udev_assign_seat)
litest_set_log_handler_bug(li); litest_set_log_handler_bug(li);
rc = libinput_udev_assign_seat(li, "foo"); rc = libinput_udev_assign_seat(li, "foo");
ck_assert_int_eq(rc, -1); litest_assert_int_eq(rc, -1);
litest_restore_log_handler(li); litest_restore_log_handler(li);
} }
END_TEST END_TEST
@ -1006,11 +1006,11 @@ START_TEST(path_ignore_device)
dev = litest_create(LITEST_IGNORED_MOUSE, NULL, NULL, NULL, NULL); dev = litest_create(LITEST_IGNORED_MOUSE, NULL, NULL, NULL, NULL);
path = libevdev_uinput_get_devnode(dev->uinput); path = libevdev_uinput_get_devnode(dev->uinput);
ck_assert_notnull(path); litest_assert_notnull(path);
li = litest_create_context(); li = litest_create_context();
device = libinput_path_add_device(li, path); device = libinput_path_add_device(li, path);
ck_assert(device == NULL); litest_assert(device == NULL);
litest_destroy_context(li); litest_destroy_context(li);
litest_delete_device(dev); litest_delete_device(dev);

View file

@ -69,7 +69,7 @@ test_relative_event(struct litest_device *dev, double dx, double dy)
prop = udev_device_get_property_value(ud, "MOUSE_DPI"); prop = udev_device_get_property_value(ud, "MOUSE_DPI");
if (prop) { if (prop) {
dpi = parse_mouse_dpi_property(prop); dpi = parse_mouse_dpi_property(prop);
ck_assert_int_ne(dpi, 0); litest_assert_int_ne(dpi, 0);
dx *= 1000.0/dpi; dx *= 1000.0/dpi;
dy *= 1000.0/dpi; dy *= 1000.0/dpi;
@ -214,11 +214,11 @@ START_TEST(pointer_motion_relative_min_decel)
evx = libinput_event_pointer_get_dx(ptrev); evx = libinput_event_pointer_get_dx(ptrev);
evy = libinput_event_pointer_get_dy(ptrev); evy = libinput_event_pointer_get_dy(ptrev);
ck_assert((evx == 0.0) == (dx == 0)); litest_assert((evx == 0.0) == (dx == 0));
ck_assert((evy == 0.0) == (dy == 0)); litest_assert((evy == 0.0) == (dy == 0));
len = hypot(evx, evy); len = hypot(evx, evy);
ck_assert_double_ge(fabs(len), 0.3); litest_assert_double_ge(fabs(len), 0.3);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -296,9 +296,9 @@ START_TEST(pointer_absolute_initial_state)
ev1 = libinput_get_event(libinput1); ev1 = libinput_get_event(libinput1);
ev2 = libinput_get_event(libinput2); ev2 = libinput_get_event(libinput2);
ck_assert_int_eq(libinput_event_get_type(ev1), litest_assert_int_eq(libinput_event_get_type(ev1),
LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE);
ck_assert_int_eq(libinput_event_get_type(ev1), litest_assert_int_eq(libinput_event_get_type(ev1),
libinput_event_get_type(ev2)); libinput_event_get_type(ev2));
p1 = libinput_event_get_pointer_event(ev1); p1 = libinput_event_get_pointer_event(ev1);
@ -460,7 +460,7 @@ START_TEST(pointer_button_auto_release)
/* Mark all released buttons until device is removed */ /* Mark all released buttons until device is removed */
while (1) { while (1) {
event = libinput_get_event(libinput); event = libinput_get_event(libinput);
ck_assert_notnull(event); litest_assert_notnull(event);
type = libinput_event_get_type(event); type = libinput_event_get_type(event);
if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { if (type == LIBINPUT_EVENT_DEVICE_REMOVED) {
@ -470,25 +470,25 @@ START_TEST(pointer_button_auto_release)
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_BUTTON); litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_BUTTON);
pevent = libinput_event_get_pointer_event(event); pevent = libinput_event_get_pointer_event(event);
ck_assert_int_eq(libinput_event_pointer_get_button_state(pevent), litest_assert_int_eq(libinput_event_pointer_get_button_state(pevent),
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
button = libinput_event_pointer_get_button(pevent); button = libinput_event_pointer_get_button(pevent);
valid_code = 0; valid_code = 0;
for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { for (i = 0; i < ARRAY_LENGTH(buttons); ++i) {
if (buttons[i].code == button) { if (buttons[i].code == button) {
ck_assert_int_eq(buttons[i].released, 0); litest_assert_int_eq(buttons[i].released, 0);
buttons[i].released = 1; buttons[i].released = 1;
valid_code = 1; valid_code = 1;
} }
} }
ck_assert_int_eq(valid_code, 1); litest_assert_int_eq(valid_code, 1);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
/* Check that all pressed buttons has been released. */ /* Check that all pressed buttons has been released. */
for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { for (i = 0; i < ARRAY_LENGTH(buttons); ++i) {
ck_assert_int_eq(buttons[i].released, 1); litest_assert_int_eq(buttons[i].released, 1);
} }
litest_destroy_context(libinput); litest_destroy_context(libinput);
@ -501,11 +501,11 @@ START_TEST(pointer_button_has_no_button)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
unsigned int code; unsigned int code;
ck_assert(!libinput_device_has_capability(device, litest_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_POINTER)); LIBINPUT_DEVICE_CAP_POINTER));
for (code = BTN_LEFT; code < KEY_OK; code++) for (code = BTN_LEFT; code < KEY_OK; code++)
ck_assert_int_eq(-1, litest_assert_int_eq(-1,
libinput_device_pointer_has_button(device, code)); libinput_device_pointer_has_button(device, code));
} }
END_TEST END_TEST
@ -689,7 +689,7 @@ START_TEST(pointer_scroll_wheel)
litest_drain_events(dev->libinput); litest_drain_events(dev->libinput);
/* make sure we hit at least one of the below two conditions */ /* make sure we hit at least one of the below two conditions */
ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || litest_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) ||
libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL));
if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) {
@ -973,9 +973,9 @@ START_TEST(pointer_scroll_natural_defaults)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); litest_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0);
} }
END_TEST END_TEST
@ -986,8 +986,8 @@ START_TEST(pointer_scroll_natural_defaults_noscroll)
if (libinput_device_config_scroll_has_natural_scroll(dev->libinput_device)) if (libinput_device_config_scroll_has_natural_scroll(dev->libinput_device))
return; return;
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0);
} }
END_TEST END_TEST
@ -997,12 +997,12 @@ START_TEST(pointer_scroll_natural_enable_config)
enum libinput_config_status status; enum libinput_config_status status;
status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1);
status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
} }
END_TEST END_TEST
@ -1016,7 +1016,7 @@ START_TEST(pointer_scroll_natural_wheel)
libinput_device_config_scroll_set_natural_scroll_enabled(device, 1); libinput_device_config_scroll_set_natural_scroll_enabled(device, 1);
/* make sure we hit at least one of the below two conditions */ /* make sure we hit at least one of the below two conditions */
ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || litest_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) ||
libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL));
if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) {
@ -1059,10 +1059,10 @@ START_TEST(pointer_scroll_has_axis_invalid)
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
0); 0);
ck_assert_int_eq(libinput_event_pointer_has_axis(pev, -1), 0); litest_assert_int_eq(libinput_event_pointer_has_axis(pev, -1), 0);
ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 2), 0); litest_assert_int_eq(libinput_event_pointer_has_axis(pev, 2), 0);
ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 3), 0); litest_assert_int_eq(libinput_event_pointer_has_axis(pev, 3), 0);
ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 0xffff), 0); litest_assert_int_eq(libinput_event_pointer_has_axis(pev, 0xffff), 0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST
@ -1078,7 +1078,7 @@ START_TEST(pointer_scroll_with_rotation)
libinput_device_config_rotation_set_angle(device, angle); libinput_device_config_rotation_set_angle(device, angle);
/* make sure we hit at least one of the below two conditions */ /* make sure we hit at least one of the below two conditions */
ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || litest_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) ||
libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL));
if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) {
@ -1136,22 +1136,22 @@ START_TEST(pointer_seat_button_count)
} }
tev = libinput_event_get_pointer_event(ev); tev = libinput_event_get_pointer_event(ev);
ck_assert_notnull(tev); litest_assert_notnull(tev);
ck_assert_int_eq(libinput_event_pointer_get_button(tev), litest_assert_int_eq(libinput_event_pointer_get_button(tev),
BTN_LEFT); BTN_LEFT);
ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), litest_assert_int_eq(libinput_event_pointer_get_button_state(tev),
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
++expected_seat_button_count; ++expected_seat_button_count;
seat_button_count = seat_button_count =
libinput_event_pointer_get_seat_button_count(tev); libinput_event_pointer_get_seat_button_count(tev);
ck_assert_int_eq(expected_seat_button_count, seat_button_count); litest_assert_int_eq(expected_seat_button_count, seat_button_count);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert_int_eq(seat_button_count, num_devices); litest_assert_int_eq(seat_button_count, num_devices);
for (i = 0; i < num_devices; ++i) for (i = 0; i < num_devices; ++i)
litest_button_click_debounced(devices[i], litest_button_click_debounced(devices[i],
@ -1169,22 +1169,22 @@ START_TEST(pointer_seat_button_count)
} }
tev = libinput_event_get_pointer_event(ev); tev = libinput_event_get_pointer_event(ev);
ck_assert_notnull(tev); litest_assert_notnull(tev);
ck_assert_int_eq(libinput_event_pointer_get_button(tev), litest_assert_int_eq(libinput_event_pointer_get_button(tev),
BTN_LEFT); BTN_LEFT);
ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), litest_assert_int_eq(libinput_event_pointer_get_button_state(tev),
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
--expected_seat_button_count; --expected_seat_button_count;
seat_button_count = seat_button_count =
libinput_event_pointer_get_seat_button_count(tev); libinput_event_pointer_get_seat_button_count(tev);
ck_assert_int_eq(expected_seat_button_count, seat_button_count); litest_assert_int_eq(expected_seat_button_count, seat_button_count);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert_int_eq(seat_button_count, 0); litest_assert_int_eq(seat_button_count, 0);
for (i = 0; i < num_devices; ++i) for (i = 0; i < num_devices; ++i)
litest_delete_device(devices[i]); litest_delete_device(devices[i]);
@ -1201,16 +1201,16 @@ START_TEST(pointer_no_calibration)
float calibration[6] = {0}; float calibration[6] = {0};
rc = libinput_device_config_calibration_has_matrix(d); rc = libinput_device_config_calibration_has_matrix(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_device_config_calibration_get_matrix(d, calibration); rc = libinput_device_config_calibration_get_matrix(d, calibration);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_device_config_calibration_get_default_matrix(d, rc = libinput_device_config_calibration_get_default_matrix(d,
calibration); calibration);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
status = libinput_device_config_calibration_set_matrix(d, status = libinput_device_config_calibration_set_matrix(d,
calibration); calibration);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -1225,13 +1225,13 @@ START_TEST(pointer_left_handed_defaults)
return; return;
rc = libinput_device_config_left_handed_is_available(d); rc = libinput_device_config_left_handed_is_available(d);
ck_assert_int_ne(rc, 0); litest_assert_int_ne(rc, 0);
rc = libinput_device_config_left_handed_get(d); rc = libinput_device_config_left_handed_get(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_device_config_left_handed_get_default(d); rc = libinput_device_config_left_handed_get_default(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
} }
END_TEST END_TEST
@ -1243,7 +1243,7 @@ START_TEST(pointer_left_handed)
enum libinput_config_status status; enum libinput_config_status status;
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_button_click_debounced(dev, li, BTN_LEFT, 1); litest_button_click_debounced(dev, li, BTN_LEFT, 1);
@ -1291,7 +1291,7 @@ START_TEST(pointer_left_handed_during_click)
/* Change while button is down, expect correct release event */ /* Change while button is down, expect correct release event */
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click_debounced(dev, li, BTN_LEFT, 0); litest_button_click_debounced(dev, li, BTN_LEFT, 0);
@ -1321,7 +1321,7 @@ START_TEST(pointer_left_handed_during_click_multiple_buttons)
litest_dispatch(li); litest_dispatch(li);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* No left-handed until all buttons were down */ /* No left-handed until all buttons were down */
litest_button_click_debounced(dev, li, BTN_RIGHT, 1); litest_button_click_debounced(dev, li, BTN_RIGHT, 1);
@ -1350,7 +1350,7 @@ START_TEST(pointer_left_handed_disable_with_button_down)
enum libinput_config_status status; enum libinput_config_status status;
status = libinput_device_config_left_handed_set(dev->libinput_device, 1); status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_button_click_debounced(dev, li, BTN_LEFT, 1); litest_button_click_debounced(dev, li, BTN_LEFT, 1);
@ -1438,17 +1438,17 @@ START_TEST(pointer_scroll_button_noscroll)
enum libinput_config_status status; enum libinput_config_status status;
methods = libinput_device_config_scroll_get_method(device); methods = libinput_device_config_scroll_get_method(device);
ck_assert_int_eq((methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN), 0); litest_assert_int_eq((methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN), 0);
button = libinput_device_config_scroll_get_button(device); button = libinput_device_config_scroll_get_button(device);
ck_assert_int_eq(button, 0); litest_assert_int_eq(button, 0);
button = libinput_device_config_scroll_get_default_button(device); button = libinput_device_config_scroll_get_default_button(device);
ck_assert_int_eq(button, 0); litest_assert_int_eq(button, 0);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_scroll_set_button(device, BTN_LEFT); status = libinput_device_config_scroll_set_button(device, BTN_LEFT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -1509,9 +1509,9 @@ START_TEST(pointer_scroll_button_middle_emulation)
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_scroll_set_button(device, BTN_MIDDLE); status = libinput_device_config_scroll_set_button(device, BTN_MIDDLE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -1583,14 +1583,14 @@ litest_enable_scroll_button_lock(struct litest_device *dev,
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_scroll_set_button(device, button); status = libinput_device_config_scroll_set_button(device, button);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_scroll_set_button_lock(device, status = libinput_device_config_scroll_set_button_lock(device,
LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED); LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
START_TEST(pointer_scroll_button_lock) START_TEST(pointer_scroll_button_lock)
@ -1646,9 +1646,9 @@ START_TEST(pointer_scroll_button_lock_defaults)
enum libinput_config_scroll_button_lock_state state; enum libinput_config_scroll_button_lock_state state;
state = libinput_device_config_scroll_get_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
state = libinput_device_config_scroll_get_default_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_default_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
} }
END_TEST END_TEST
@ -1659,26 +1659,26 @@ START_TEST(pointer_scroll_button_lock_config)
enum libinput_config_scroll_button_lock_state state; enum libinput_config_scroll_button_lock_state state;
state = libinput_device_config_scroll_get_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
state = libinput_device_config_scroll_get_default_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_default_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
status = libinput_device_config_scroll_set_button_lock(dev->libinput_device, status = libinput_device_config_scroll_set_button_lock(dev->libinput_device,
LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
state = libinput_device_config_scroll_get_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED);
status = libinput_device_config_scroll_set_button_lock(dev->libinput_device, status = libinput_device_config_scroll_set_button_lock(dev->libinput_device,
LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED); LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
state = libinput_device_config_scroll_get_button_lock(dev->libinput_device); state = libinput_device_config_scroll_get_button_lock(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
status = libinput_device_config_scroll_set_button_lock(dev->libinput_device, status = libinput_device_config_scroll_set_button_lock(dev->libinput_device,
LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED + 1); LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED + 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2104,16 +2104,16 @@ START_TEST(pointer_scroll_nowheel_defaults)
expected = LIBINPUT_CONFIG_SCROLL_NO_SCROLL; expected = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
method = libinput_device_config_scroll_get_method(device); method = libinput_device_config_scroll_get_method(device);
ck_assert_int_eq(method, expected); litest_assert_int_eq(method, expected);
method = libinput_device_config_scroll_get_default_method(device); method = libinput_device_config_scroll_get_default_method(device);
ck_assert_int_eq(method, expected); litest_assert_int_eq(method, expected);
if (method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) { if (method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
button = libinput_device_config_scroll_get_button(device); button = libinput_device_config_scroll_get_button(device);
ck_assert_int_eq(button, BTN_MIDDLE); litest_assert_int_eq(button, BTN_MIDDLE);
button = libinput_device_config_scroll_get_default_button(device); button = libinput_device_config_scroll_get_default_button(device);
ck_assert_int_eq(button, BTN_MIDDLE); litest_assert_int_eq(button, BTN_MIDDLE);
} }
} }
END_TEST END_TEST
@ -2126,12 +2126,12 @@ START_TEST(pointer_scroll_defaults_logitech_marble)
uint32_t button; uint32_t button;
method = libinput_device_config_scroll_get_method(device); method = libinput_device_config_scroll_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); litest_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
method = libinput_device_config_scroll_get_default_method(device); method = libinput_device_config_scroll_get_default_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); litest_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
button = libinput_device_config_scroll_get_button(device); button = libinput_device_config_scroll_get_button(device);
ck_assert_int_eq(button, BTN_SIDE); litest_assert_int_eq(button, BTN_SIDE);
} }
END_TEST END_TEST
@ -2142,36 +2142,36 @@ START_TEST(pointer_accel_defaults)
enum libinput_config_status status; enum libinput_config_status status;
double speed; double speed;
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0); 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0); 0.0);
for (speed = -2.0; speed < -1.0; speed += 0.2) { for (speed = -2.0; speed < -1.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
speed); speed);
ck_assert_int_eq(status, litest_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0); 0.0);
} }
for (speed = -1.0; speed <= 1.0; speed += 0.2) { for (speed = -1.0; speed <= 1.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
speed); speed);
ck_assert_int_eq(status, litest_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
speed); speed);
} }
for (speed = 1.2; speed <= 2.0; speed += 0.2) { for (speed = 1.2; speed <= 2.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
speed); speed);
ck_assert_int_eq(status, litest_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
1.0); 1.0);
} }
@ -2184,14 +2184,14 @@ START_TEST(pointer_accel_invalid)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
NAN); NAN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
INFINITY); INFINITY);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2202,22 +2202,22 @@ START_TEST(pointer_accel_defaults_absolute)
enum libinput_config_status status; enum libinput_config_status status;
double speed; double speed;
ck_assert(!libinput_device_config_accel_is_available(device)); litest_assert(!libinput_device_config_accel_is_available(device));
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0); 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0); 0.0);
for (speed = -2.0; speed <= 2.0; speed += 0.2) { for (speed = -2.0; speed <= 2.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device, status = libinput_device_config_accel_set_speed(device,
speed); speed);
if (speed >= -1.0 && speed <= 1.0) if (speed >= -1.0 && speed <= 1.0)
ck_assert_int_eq(status, litest_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_UNSUPPORTED); LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
else else
ck_assert_int_eq(status, litest_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0); 0.0);
} }
} }
@ -2228,10 +2228,10 @@ START_TEST(pointer_accel_defaults_absolute_relative)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0); 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0); 0.0);
} }
END_TEST END_TEST
@ -2260,14 +2260,14 @@ START_TEST(pointer_accel_direction_change)
pev = libinput_event_get_pointer_event(event); pev = libinput_event_get_pointer_event(event);
delta = libinput_event_pointer_get_dx(pev); delta = libinput_event_pointer_get_dx(pev);
ck_assert_double_le(delta, 0.0); litest_assert_double_le(delta, 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
} while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE); } while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE);
pev = libinput_event_get_pointer_event(event); pev = libinput_event_get_pointer_event(event);
delta = libinput_event_pointer_get_dx(pev); delta = libinput_event_pointer_get_dx(pev);
ck_assert_double_gt(delta, 0.0); litest_assert_double_gt(delta, 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST
@ -2280,39 +2280,39 @@ START_TEST(pointer_accel_profile_defaults)
enum libinput_config_accel_profile profile; enum libinput_config_accel_profile profile;
uint32_t profiles; uint32_t profiles;
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
profile = libinput_device_config_accel_get_default_profile(device); profile = libinput_device_config_accel_get_default_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
profiles = libinput_device_config_accel_get_profiles(device); profiles = libinput_device_config_accel_get_profiles(device);
ck_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); litest_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
ck_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); litest_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
ck_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); litest_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
profile = libinput_device_config_accel_get_default_profile(device); profile = libinput_device_config_accel_get_default_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
} }
END_TEST END_TEST
@ -2330,16 +2330,16 @@ START_TEST(pointer_accel_config_reset_to_defaults)
}; };
ARRAY_FOR_EACH(profiles, profile) { ARRAY_FOR_EACH(profiles, profile) {
ck_assert_int_eq(libinput_device_config_accel_set_speed(device, 1.0), litest_assert_int_eq(libinput_device_config_accel_set_speed(device, 1.0),
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), 1.0); litest_assert_double_eq(libinput_device_config_accel_get_speed(device), 1.0);
struct libinput_config_accel *config = struct libinput_config_accel *config =
libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
ck_assert_int_eq(libinput_device_config_accel_apply(device, config), litest_assert_int_eq(libinput_device_config_accel_apply(device, config),
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device), litest_assert_double_eq(libinput_device_config_accel_get_speed(device),
default_speed); default_speed);
libinput_config_accel_destroy(config); libinput_config_accel_destroy(config);
} }
@ -2374,15 +2374,15 @@ START_TEST(pointer_accel_config)
{ 1, { 1.0, 2.0, 1e10, 2.6 }, invalid }, { 1, { 1.0, 2.0, 1e10, 2.6 }, invalid },
}; };
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
struct libinput_config_accel *config_custom_default = struct libinput_config_accel *config_custom_default =
libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
struct libinput_config_accel *config_custom_changed = struct libinput_config_accel *config_custom_changed =
libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
ck_assert_ptr_nonnull(config_custom_default); litest_assert_ptr_notnull(config_custom_default);
ck_assert_ptr_nonnull(config_custom_changed); litest_assert_ptr_notnull(config_custom_changed);
ARRAY_FOR_EACH(tests, t) { ARRAY_FOR_EACH(tests, t) {
ARRAY_FOR_EACH(accel_types, accel_type) { ARRAY_FOR_EACH(accel_types, accel_type) {
@ -2391,17 +2391,17 @@ START_TEST(pointer_accel_config)
t->step, t->step,
ARRAY_LENGTH(t->points), ARRAY_LENGTH(t->points),
t->points); t->points);
ck_assert_int_eq(status, t->expected_status); litest_assert_int_eq(status, t->expected_status);
status = libinput_device_config_accel_apply(device, config_custom_changed); status = libinput_device_config_accel_apply(device, config_custom_changed);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
status = libinput_device_config_accel_apply(device, config_custom_default); status = libinput_device_config_accel_apply(device, config_custom_default);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
} }
} }
@ -2416,23 +2416,23 @@ START_TEST(pointer_accel_profile_invalid)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert(libinput_device_config_accel_is_available(device)); litest_assert(libinput_device_config_accel_is_available(device));
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1); LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2443,25 +2443,25 @@ START_TEST(pointer_accel_profile_noaccel)
enum libinput_config_status status; enum libinput_config_status status;
enum libinput_config_accel_profile profile; enum libinput_config_accel_profile profile;
ck_assert(!libinput_device_config_accel_is_available(device)); litest_assert(!libinput_device_config_accel_is_available(device));
profile = libinput_device_config_accel_get_default_profile(device); profile = libinput_device_config_accel_get_default_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
profile = libinput_device_config_accel_get_profile(device); profile = libinput_device_config_accel_get_profile(device);
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); litest_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1); LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_accel_set_profile(device, status = libinput_device_config_accel_set_profile(device,
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2811,25 +2811,25 @@ START_TEST(middlebutton_default_enabled)
return; return;
available = libinput_device_config_middle_emulation_is_available(device); available = libinput_device_config_middle_emulation_is_available(device);
ck_assert(available); litest_assert(available);
state = libinput_device_config_middle_emulation_get_enabled(device); state = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
state = libinput_device_config_middle_emulation_get_default_enabled( state = libinput_device_config_middle_emulation_get_default_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_middle_emulation_set_enabled(device, 3); status = libinput_device_config_middle_emulation_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2842,24 +2842,24 @@ START_TEST(middlebutton_default_clickpad)
int available; int available;
available = libinput_device_config_middle_emulation_is_available(device); available = libinput_device_config_middle_emulation_is_available(device);
ck_assert(available); litest_assert(available);
state = libinput_device_config_middle_emulation_get_enabled(device); state = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
state = libinput_device_config_middle_emulation_get_default_enabled( state = libinput_device_config_middle_emulation_get_default_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_middle_emulation_set_enabled(device, 3); status = libinput_device_config_middle_emulation_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -2876,17 +2876,17 @@ START_TEST(middlebutton_default_touchpad)
return; return;
available = libinput_device_config_middle_emulation_is_available(device); available = libinput_device_config_middle_emulation_is_available(device);
ck_assert(!available); litest_assert(!available);
if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) if (libinput_device_pointer_has_button(device, BTN_MIDDLE))
return; return;
state = libinput_device_config_middle_emulation_get_enabled( state = libinput_device_config_middle_emulation_get_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
state = libinput_device_config_middle_emulation_get_default_enabled( state = libinput_device_config_middle_emulation_get_default_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
} }
END_TEST END_TEST
@ -2898,14 +2898,14 @@ START_TEST(middlebutton_default_alps)
int available; int available;
available = libinput_device_config_middle_emulation_is_available(device); available = libinput_device_config_middle_emulation_is_available(device);
ck_assert(available); litest_assert(available);
state = libinput_device_config_middle_emulation_get_enabled( state = libinput_device_config_middle_emulation_get_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
state = libinput_device_config_middle_emulation_get_default_enabled( state = libinput_device_config_middle_emulation_get_default_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
} }
END_TEST END_TEST
@ -2918,18 +2918,18 @@ START_TEST(middlebutton_default_disabled)
int available; int available;
available = libinput_device_config_middle_emulation_is_available(device); available = libinput_device_config_middle_emulation_is_available(device);
ck_assert(!available); litest_assert(!available);
state = libinput_device_config_middle_emulation_get_enabled(device); state = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
state = libinput_device_config_middle_emulation_get_default_enabled( state = libinput_device_config_middle_emulation_get_default_enabled(
device); device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -2987,7 +2987,7 @@ START_TEST(middlebutton_button_scrolling)
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
ck_assert_double_gt(litest_event_pointer_get_value(pev, litest_assert_double_gt(litest_event_pointer_get_value(pev,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL),
0.0); 0.0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
@ -3134,7 +3134,7 @@ START_TEST(pointer_time_usec)
ptrev = litest_is_motion_event(event); ptrev = litest_is_motion_event(event);
time_usec = libinput_event_pointer_get_time_usec(ptrev); time_usec = libinput_event_pointer_get_time_usec(ptrev);
ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), litest_assert_int_eq(libinput_event_pointer_get_time(ptrev),
(uint32_t) (time_usec / 1000)); (uint32_t) (time_usec / 1000));
libinput_event_destroy(event); libinput_event_destroy(event);

View file

@ -95,7 +95,7 @@ START_TEST(quirks_invalid_dir)
log_handler, log_handler,
NULL, NULL,
QLOG_LIBINPUT_LOGGING); QLOG_LIBINPUT_LOGGING);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
} }
END_TEST END_TEST
@ -109,7 +109,7 @@ START_TEST(quirks_empty_dir)
log_handler, log_handler,
NULL, NULL,
QLOG_LIBINPUT_LOGGING); QLOG_LIBINPUT_LOGGING);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -126,7 +126,7 @@ START_TEST(quirks_section_empty)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -142,7 +142,7 @@ START_TEST(quirks_section_double)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -160,7 +160,7 @@ START_TEST(quirks_section_missing_match)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -178,7 +178,7 @@ START_TEST(quirks_section_missing_attr)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -198,7 +198,7 @@ START_TEST(quirks_section_match_after_attr)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -218,7 +218,7 @@ START_TEST(quirks_section_duplicate_match)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -240,7 +240,7 @@ START_TEST(quirks_section_duplicate_attr)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -260,7 +260,7 @@ START_TEST(quirks_parse_error_section)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -279,7 +279,7 @@ START_TEST(quirks_parse_error_trailing_whitespace)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -298,7 +298,7 @@ START_TEST(quirks_parse_error_unknown_match)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -317,7 +317,7 @@ START_TEST(quirks_parse_error_unknown_attr)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -336,7 +336,7 @@ START_TEST(quirks_parse_error_unknown_model)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -355,7 +355,7 @@ START_TEST(quirks_parse_error_unknown_prefix)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -374,7 +374,7 @@ START_TEST(quirks_parse_error_model_not_one)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -393,7 +393,7 @@ START_TEST(quirks_parse_comment_inline)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -415,7 +415,7 @@ START_TEST(quirks_parse_comment_empty)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -435,7 +435,7 @@ START_TEST(quirks_parse_string_quotes_single)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -455,7 +455,7 @@ START_TEST(quirks_parse_string_quotes_double)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -491,7 +491,7 @@ START_TEST(quirks_parse_bustype)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -511,7 +511,7 @@ START_TEST(quirks_parse_bustype_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -538,7 +538,7 @@ START_TEST(quirks_parse_vendor)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -570,7 +570,7 @@ START_TEST(quirks_parse_vendor_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -598,7 +598,7 @@ START_TEST(quirks_parse_product)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -641,7 +641,7 @@ START_TEST(quirks_parse_product_too_many)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
END_TEST END_TEST
@ -672,7 +672,7 @@ START_TEST(quirks_parse_product_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -700,7 +700,7 @@ START_TEST(quirks_parse_version)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -732,7 +732,7 @@ START_TEST(quirks_parse_version_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -772,7 +772,7 @@ START_TEST(quirks_parse_name)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -795,7 +795,7 @@ START_TEST(quirks_parse_name_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -835,7 +835,7 @@ START_TEST(quirks_parse_uniq)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -858,7 +858,7 @@ START_TEST(quirks_parse_uniq_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -902,7 +902,7 @@ START_TEST(quirks_parse_udev)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -931,7 +931,7 @@ START_TEST(quirks_parse_udev_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -955,7 +955,7 @@ START_TEST(quirks_parse_dmi)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
quirks_context_unref(ctx); quirks_context_unref(ctx);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
@ -987,7 +987,7 @@ START_TEST(quirks_parse_dmi_invalid)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL); litest_assert(ctx == NULL);
cleanup_data_dir(dd); cleanup_data_dir(dd);
} }
} }
@ -1036,9 +1036,9 @@ test_attr_parse(struct litest_device *dev,
if (ctx != NULL) { if (ctx != NULL) {
struct quirks *q; struct quirks *q;
q = quirks_fetch_for_device(ctx, ud); q = quirks_fetch_for_device(ctx, ud);
ck_assert_notnull(q); litest_assert_notnull(q);
ck_assert(func(q, which, data)); litest_assert(func(q, which, data));
ck_assert(quirks_has_quirk(q, which)); litest_assert(quirks_has_quirk(q, which));
quirks_unref(q); quirks_unref(q);
quirks_context_unref(ctx); quirks_context_unref(ctx);
result = true; result = true;
@ -1084,12 +1084,12 @@ START_TEST(quirks_parse_dimension_attr)
t->str, t->str,
(qparsefunc)quirks_get_dimensions, (qparsefunc)quirks_get_dimensions,
&dim); &dim);
ck_assert_int_eq(rc, t->success); litest_assert_int_eq(rc, t->success);
if (!rc) if (!rc)
continue; continue;
ck_assert_int_eq(dim.x, t->w); litest_assert_int_eq(dim.x, t->w);
ck_assert_int_eq(dim.y, t->h); litest_assert_int_eq(dim.y, t->h);
} }
} }
} }
@ -1136,12 +1136,12 @@ START_TEST(quirks_parse_range_attr)
t->str, t->str,
(qparsefunc)quirks_get_range, (qparsefunc)quirks_get_range,
&r); &r);
ck_assert_int_eq(rc, t->success); litest_assert_int_eq(rc, t->success);
if (!rc) if (!rc)
continue; continue;
ck_assert_int_eq(r.lower, t->lo); litest_assert_int_eq(r.lower, t->lo);
ck_assert_int_eq(r.upper, t->hi); litest_assert_int_eq(r.upper, t->hi);
} }
} }
} }
@ -1183,11 +1183,11 @@ START_TEST(quirks_parse_uint_attr)
t->str, t->str,
(qparsefunc)quirks_get_uint32, (qparsefunc)quirks_get_uint32,
&v); &v);
ck_assert_int_eq(rc, t->success); litest_assert_int_eq(rc, t->success);
if (!rc) if (!rc)
continue; continue;
ck_assert_int_eq(v, t->val); litest_assert_int_eq(v, t->val);
} }
} }
} }
@ -1235,11 +1235,11 @@ START_TEST(quirks_parse_double_attr)
t->str, t->str,
(qparsefunc)quirks_get_double, (qparsefunc)quirks_get_double,
&v); &v);
ck_assert_int_eq(rc, t->success); litest_assert_int_eq(rc, t->success);
if (!rc) if (!rc)
continue; continue;
ck_assert_double_eq(v, t->val); litest_assert_double_eq(v, t->val);
} }
} }
} }
@ -1287,9 +1287,9 @@ START_TEST(quirks_parse_string_attr)
(qparsefunc)quirks_get_string, (qparsefunc)quirks_get_string,
&do_not_use); &do_not_use);
if (*a == t->where) if (*a == t->where)
ck_assert_int_eq(rc, true); litest_assert_int_eq(rc, true);
else else
ck_assert_int_eq(rc, false); litest_assert_int_eq(rc, false);
} }
} }
} }
@ -1326,11 +1326,11 @@ START_TEST(quirks_parse_bool_attr)
t->str, t->str,
(qparsefunc)quirks_get_bool, (qparsefunc)quirks_get_bool,
&v); &v);
ck_assert(rc == t->success); litest_assert(rc == t->success);
if (!rc) if (!rc)
continue; continue;
ck_assert(v == t->val); litest_assert(v == t->val);
} }
} }
} }
@ -1347,25 +1347,25 @@ START_TEST(quirks_parse_integration_attr)
"internal", "internal",
(qparsefunc)quirks_get_string, (qparsefunc)quirks_get_string,
&do_not_use); &do_not_use);
ck_assert(rc); litest_assert(rc);
rc = test_attr_parse(dev, rc = test_attr_parse(dev,
QUIRK_ATTR_KEYBOARD_INTEGRATION, QUIRK_ATTR_KEYBOARD_INTEGRATION,
"external", "external",
(qparsefunc)quirks_get_string, (qparsefunc)quirks_get_string,
&do_not_use); &do_not_use);
ck_assert(rc); litest_assert(rc);
rc = test_attr_parse(dev, rc = test_attr_parse(dev,
QUIRK_ATTR_TRACKPOINT_INTEGRATION, QUIRK_ATTR_TRACKPOINT_INTEGRATION,
"internal", "internal",
(qparsefunc)quirks_get_string, (qparsefunc)quirks_get_string,
&do_not_use); &do_not_use);
ck_assert(rc); litest_assert(rc);
rc = test_attr_parse(dev, rc = test_attr_parse(dev,
QUIRK_ATTR_TRACKPOINT_INTEGRATION, QUIRK_ATTR_TRACKPOINT_INTEGRATION,
"external", "external",
(qparsefunc)quirks_get_string, (qparsefunc)quirks_get_string,
&do_not_use); &do_not_use);
ck_assert(rc); litest_assert(rc);
} }
END_TEST END_TEST
@ -1387,13 +1387,13 @@ START_TEST(quirks_model_one)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
q = quirks_fetch_for_device(ctx, ud); q = quirks_fetch_for_device(ctx, ud);
ck_assert_notnull(q); litest_assert_notnull(q);
ck_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset)); litest_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset));
ck_assert(isset == true); litest_assert(isset == true);
quirks_unref(q); quirks_unref(q);
quirks_context_unref(ctx); quirks_context_unref(ctx);
@ -1420,13 +1420,13 @@ START_TEST(quirks_model_zero)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
q = quirks_fetch_for_device(ctx, ud); q = quirks_fetch_for_device(ctx, ud);
ck_assert_notnull(q); litest_assert_notnull(q);
ck_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset)); litest_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset));
ck_assert(isset == false); litest_assert(isset == false);
quirks_unref(q); quirks_unref(q);
quirks_context_unref(ctx); quirks_context_unref(ctx);
@ -1458,7 +1458,7 @@ START_TEST(quirks_model_override)
"ModelAppleTouchpad=%d\n", "ModelAppleTouchpad=%d\n",
set ? 0 : 1, set ? 0 : 1,
set ? 1 : 0); set ? 1 : 0);
ck_assert_int_ne(rc, -1); litest_assert_int_ne(rc, -1);
dd = make_data_dir(quirks_file); dd = make_data_dir(quirks_file);
@ -1467,13 +1467,13 @@ START_TEST(quirks_model_override)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
q = quirks_fetch_for_device(ctx, ud); q = quirks_fetch_for_device(ctx, ud);
ck_assert_notnull(q); litest_assert_notnull(q);
ck_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset)); litest_assert(quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &isset));
ck_assert(isset == set); litest_assert(isset == set);
quirks_unref(q); quirks_unref(q);
quirks_context_unref(ctx); quirks_context_unref(ctx);
@ -1494,11 +1494,11 @@ START_TEST(quirks_model_alps)
exists = quirks_get_bool(q, QUIRK_MODEL_ALPS_SERIAL_TOUCHPAD, &value); exists = quirks_get_bool(q, QUIRK_MODEL_ALPS_SERIAL_TOUCHPAD, &value);
if (strstr(libinput_device_get_name(device), "ALPS")) { if (strstr(libinput_device_get_name(device), "ALPS")) {
ck_assert(exists); litest_assert(exists);
ck_assert(value); litest_assert(value);
} else { } else {
ck_assert(!exists); litest_assert(!exists);
ck_assert(!value); litest_assert(!value);
} }
} }
END_TEST END_TEST
@ -1513,11 +1513,11 @@ START_TEST(quirks_model_wacom)
exists = quirks_get_bool(q, QUIRK_MODEL_WACOM_TOUCHPAD, &value); exists = quirks_get_bool(q, QUIRK_MODEL_WACOM_TOUCHPAD, &value);
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) { if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) {
ck_assert(exists); litest_assert(exists);
ck_assert(value); litest_assert(value);
} else { } else {
ck_assert(!exists); litest_assert(!exists);
ck_assert(!value); litest_assert(!value);
} }
} }
END_TEST END_TEST
@ -1532,11 +1532,11 @@ START_TEST(quirks_model_apple)
exists = quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &value); exists = quirks_get_bool(q, QUIRK_MODEL_APPLE_TOUCHPAD, &value);
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE) { if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE) {
ck_assert(exists); litest_assert(exists);
ck_assert(value); litest_assert(value);
} else { } else {
ck_assert(!exists); litest_assert(!exists);
ck_assert(!value); litest_assert(!value);
} }
} }
END_TEST END_TEST
@ -1552,26 +1552,26 @@ START_TEST(quirks_model_synaptics_serial)
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL && if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL &&
libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL) { libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL) {
ck_assert(exists); litest_assert(exists);
ck_assert(value); litest_assert(value);
} else { } else {
ck_assert(!exists); litest_assert(!exists);
ck_assert(!value); litest_assert(!value);
} }
} }
END_TEST END_TEST
START_TEST(quirks_call_NULL) START_TEST(quirks_call_NULL)
{ {
ck_assert(!quirks_fetch_for_device(NULL, NULL)); litest_assert(!quirks_fetch_for_device(NULL, NULL));
ck_assert(!quirks_get_uint32(NULL, 0, NULL)); litest_assert(!quirks_get_uint32(NULL, 0, NULL));
ck_assert(!quirks_get_int32(NULL, 0, NULL)); litest_assert(!quirks_get_int32(NULL, 0, NULL));
ck_assert(!quirks_get_range(NULL, 0, NULL)); litest_assert(!quirks_get_range(NULL, 0, NULL));
ck_assert(!quirks_get_dimensions(NULL, 0, NULL)); litest_assert(!quirks_get_dimensions(NULL, 0, NULL));
ck_assert(!quirks_get_double(NULL, 0, NULL)); litest_assert(!quirks_get_double(NULL, 0, NULL));
ck_assert(!quirks_get_string(NULL, 0, NULL)); litest_assert(!quirks_get_string(NULL, 0, NULL));
ck_assert(!quirks_get_bool(NULL, 0, NULL)); litest_assert(!quirks_get_bool(NULL, 0, NULL));
} }
END_TEST END_TEST
@ -1589,7 +1589,7 @@ START_TEST(quirks_ctx_ref)
log_handler, log_handler,
NULL, NULL,
QLOG_CUSTOM_LOG_PRIORITIES); QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx); litest_assert_notnull(ctx);
ctx2 = quirks_context_ref(ctx); ctx2 = quirks_context_ref(ctx);
litest_assert_ptr_eq(ctx, ctx2); litest_assert_ptr_eq(ctx, ctx2);
ctx2 = quirks_context_unref(ctx); ctx2 = quirks_context_unref(ctx);

View file

@ -51,12 +51,12 @@ START_TEST(switch_has_cap)
/* Need to check for this specific device here because the /* Need to check for this specific device here because the
* unreliable tablet mode switch removes the capability too */ * unreliable tablet mode switch removes the capability too */
if (dev->which == LITEST_TABLET_MODE_UNRELIABLE) { if (dev->which == LITEST_TABLET_MODE_UNRELIABLE) {
ck_assert(!libinput_device_has_capability(dev->libinput_device, litest_assert(!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_SWITCH)); LIBINPUT_DEVICE_CAP_SWITCH));
return; return;
} }
ck_assert(libinput_device_has_capability(dev->libinput_device, litest_assert(libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_SWITCH)); LIBINPUT_DEVICE_CAP_SWITCH));
} }
@ -69,7 +69,7 @@ START_TEST(switch_has_lid_switch)
if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_LID)) if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_LID))
return; return;
ck_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device, litest_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device,
LIBINPUT_SWITCH_LID), LIBINPUT_SWITCH_LID),
1); 1);
} }
@ -99,9 +99,9 @@ START_TEST(switch_has_tablet_mode_switch)
LIBINPUT_SWITCH_TABLET_MODE); LIBINPUT_SWITCH_TABLET_MODE);
if (!tablet_mode_switch_is_reliable(dev)) if (!tablet_mode_switch_is_reliable(dev))
ck_assert_int_ne(has_switch, 1); litest_assert_int_ne(has_switch, 1);
else else
ck_assert_int_eq(has_switch, 1); litest_assert_int_eq(has_switch, 1);
} }
END_TEST END_TEST
@ -215,7 +215,7 @@ START_TEST(switch_down_on_init)
libinput_event_destroy(event); libinput_event_destroy(event);
while ((event = libinput_get_event(li))) { while ((event = libinput_get_event(li))) {
ck_assert_int_ne(libinput_event_get_type(event), litest_assert_int_ne(libinput_event_get_type(event),
LIBINPUT_EVENT_SWITCH_TOGGLE); LIBINPUT_EVENT_SWITCH_TOGGLE);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -255,7 +255,7 @@ START_TEST(switch_not_down_on_init)
litest_dispatch(li); litest_dispatch(li);
while ((event = libinput_get_event(li)) != NULL) { while ((event = libinput_get_event(li)) != NULL) {
ck_assert_int_ne(libinput_event_get_type(event), litest_assert_int_ne(libinput_event_get_type(event),
LIBINPUT_EVENT_SWITCH_TOGGLE); LIBINPUT_EVENT_SWITCH_TOGGLE);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -741,9 +741,9 @@ START_TEST(lid_update_hw_on_key)
/* Separate direct libevdev context to check if the HW event goes /* Separate direct libevdev context to check if the HW event goes
* through */ * through */
fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK); fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
ck_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0); litest_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0);
ck_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1); litest_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1);
/* Typing on the keyboard should trigger a lid open event */ /* Typing on the keyboard should trigger a lid open event */
litest_event(keyboard, EV_KEY, KEY_A, 1); litest_event(keyboard, EV_KEY, KEY_A, 1);
@ -753,17 +753,17 @@ START_TEST(lid_update_hw_on_key)
litest_drain_events(li); litest_drain_events(li);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SW); litest_assert_int_eq(event.type, EV_SW);
ck_assert_int_eq(event.code, SW_LID); litest_assert_int_eq(event.code, SW_LID);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SYN); litest_assert_int_eq(event.type, EV_SYN);
ck_assert_int_eq(event.code, SYN_REPORT); litest_assert_int_eq(event.code, SYN_REPORT);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, -EAGAIN); litest_assert_int_eq(rc, -EAGAIN);
litest_delete_device(keyboard); litest_delete_device(keyboard);
close(fd); close(fd);
@ -790,9 +790,9 @@ START_TEST(lid_update_hw_on_key_closed_on_init)
/* Separate direct libevdev context to check if the HW event goes /* Separate direct libevdev context to check if the HW event goes
* through */ * through */
fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK); fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
ck_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0); litest_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0);
ck_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1); litest_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1);
keyboard = litest_add_device(sw->libinput, LITEST_KEYBOARD); keyboard = litest_add_device(sw->libinput, LITEST_KEYBOARD);
@ -806,7 +806,7 @@ START_TEST(lid_update_hw_on_key_closed_on_init)
/* don't expect a switch waiting for us, this is run for an /* don't expect a switch waiting for us, this is run for an
* unreliable device */ * unreliable device */
while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) {
ck_assert_int_ne(libinput_next_event_type(li), litest_assert_int_ne(libinput_next_event_type(li),
LIBINPUT_EVENT_SWITCH_TOGGLE); LIBINPUT_EVENT_SWITCH_TOGGLE);
libinput_event_destroy(libinput_get_event(li)); libinput_event_destroy(libinput_get_event(li));
} }
@ -820,17 +820,17 @@ START_TEST(lid_update_hw_on_key_closed_on_init)
/* Make sure kernel state has updated */ /* Make sure kernel state has updated */
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SW); litest_assert_int_eq(event.type, EV_SW);
ck_assert_int_eq(event.code, SW_LID); litest_assert_int_eq(event.code, SW_LID);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SYN); litest_assert_int_eq(event.type, EV_SYN);
ck_assert_int_eq(event.code, SYN_REPORT); litest_assert_int_eq(event.code, SYN_REPORT);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, -EAGAIN); litest_assert_int_eq(rc, -EAGAIN);
litest_destroy_context(li); litest_destroy_context(li);
litest_delete_device(keyboard); litest_delete_device(keyboard);
@ -869,9 +869,9 @@ START_TEST(lid_update_hw_on_key_multiple_keyboards)
/* Separate direct libevdev context to check if the HW event goes /* Separate direct libevdev context to check if the HW event goes
* through */ * through */
fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK); fd = open(libevdev_uinput_get_devnode(sw->uinput), O_RDONLY|O_NONBLOCK);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
ck_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0); litest_assert_int_eq(libevdev_new_from_fd(fd, &evdev), 0);
ck_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1); litest_assert_int_eq(libevdev_get_event_value(evdev, EV_SW, SW_LID), 1);
/* Typing on the second keyboard should trigger a lid open event */ /* Typing on the second keyboard should trigger a lid open event */
litest_event(keyboard2, EV_KEY, KEY_A, 1); litest_event(keyboard2, EV_KEY, KEY_A, 1);
@ -881,17 +881,17 @@ START_TEST(lid_update_hw_on_key_multiple_keyboards)
litest_drain_events(li); litest_drain_events(li);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SW); litest_assert_int_eq(event.type, EV_SW);
ck_assert_int_eq(event.code, SW_LID); litest_assert_int_eq(event.code, SW_LID);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS); litest_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SUCCESS);
ck_assert_int_eq(event.type, EV_SYN); litest_assert_int_eq(event.type, EV_SYN);
ck_assert_int_eq(event.code, SYN_REPORT); litest_assert_int_eq(event.code, SYN_REPORT);
ck_assert_int_eq(event.value, 0); litest_assert_int_eq(event.value, 0);
rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event); rc = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &event);
ck_assert_int_eq(rc, -EAGAIN); litest_assert_int_eq(rc, -EAGAIN);
litest_delete_device(keyboard1); litest_delete_device(keyboard1);
litest_delete_device(keyboard2); litest_delete_device(keyboard2);
@ -1000,7 +1000,7 @@ START_TEST(tablet_mode_disable_touchpad_on_resume)
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert(have_switch_toggle); litest_assert(have_switch_toggle);
litest_touch_down(touchpad, 0, 50, 50); litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10);
@ -1217,7 +1217,7 @@ START_TEST(tablet_mode_disable_keyboard_on_resume)
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert(have_switch_toggle); litest_assert(have_switch_toggle);
litest_keyboard_key(keyboard, KEY_A, true); litest_keyboard_key(keyboard, KEY_A, true);
litest_keyboard_key(keyboard, KEY_A, false); litest_keyboard_key(keyboard, KEY_A, false);

File diff suppressed because it is too large Load diff

View file

@ -54,7 +54,7 @@ START_TEST(totem_type)
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
tool = libinput_event_tablet_tool_get_tool(t); tool = libinput_event_tablet_tool_get_tool(t);
ck_assert_int_eq(libinput_tablet_tool_get_type(tool), litest_assert_int_eq(libinput_tablet_tool_get_type(tool),
LIBINPUT_TABLET_TOOL_TYPE_TOTEM); LIBINPUT_TABLET_TOOL_TYPE_TOTEM);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -78,9 +78,9 @@ START_TEST(totem_axes)
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
tool = libinput_event_tablet_tool_get_tool(t); tool = libinput_event_tablet_tool_get_tool(t);
ck_assert(libinput_tablet_tool_has_rotation(tool)); litest_assert(libinput_tablet_tool_has_rotation(tool));
ck_assert(libinput_tablet_tool_has_size(tool)); litest_assert(libinput_tablet_tool_has_size(tool));
ck_assert(libinput_tablet_tool_has_button(tool, BTN_0)); litest_assert(libinput_tablet_tool_has_button(tool, BTN_0));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -101,14 +101,14 @@ START_TEST(totem_proximity_in_out)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t),
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_TIP); LIBINPUT_EVENT_TABLET_TOOL_TIP);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_DOWN); LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -119,14 +119,14 @@ START_TEST(totem_proximity_in_out)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_TIP); LIBINPUT_EVENT_TABLET_TOOL_TIP);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_UP); LIBINPUT_TABLET_TOOL_TIP_UP);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t),
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -163,30 +163,30 @@ START_TEST(totem_proximity_in_on_init)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t),
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
x = libinput_event_tablet_tool_get_x(t); x = libinput_event_tablet_tool_get_x(t);
y = libinput_event_tablet_tool_get_y(t); y = libinput_event_tablet_tool_get_y(t);
ck_assert_double_gt(x, w/2 - 1); litest_assert_double_gt(x, w/2 - 1);
ck_assert_double_lt(x, w/2 + 1); litest_assert_double_lt(x, w/2 + 1);
ck_assert_double_gt(y, h/2 - 1); litest_assert_double_gt(y, h/2 - 1);
ck_assert_double_lt(y, h/2 + 1); litest_assert_double_lt(y, h/2 + 1);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_TIP); LIBINPUT_EVENT_TABLET_TOOL_TIP);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_DOWN); LIBINPUT_TABLET_TOOL_TIP_DOWN);
x = libinput_event_tablet_tool_get_x(t); x = libinput_event_tablet_tool_get_x(t);
y = libinput_event_tablet_tool_get_y(t); y = libinput_event_tablet_tool_get_y(t);
ck_assert_double_gt(x, w/2 - 1); litest_assert_double_gt(x, w/2 - 1);
ck_assert_double_lt(x, w/2 + 1); litest_assert_double_lt(x, w/2 + 1);
ck_assert_double_gt(y, h/2 - 1); litest_assert_double_gt(y, h/2 - 1);
ck_assert_double_lt(y, h/2 + 1); litest_assert_double_lt(y, h/2 + 1);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -218,14 +218,14 @@ START_TEST(totem_proximity_out_on_suspend)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_TIP); LIBINPUT_EVENT_TABLET_TOOL_TIP);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_UP); LIBINPUT_TABLET_TOOL_TIP_UP);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t),
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -254,14 +254,14 @@ START_TEST(totem_motion)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
ck_assert(libinput_event_tablet_tool_x_has_changed(t)); litest_assert(libinput_event_tablet_tool_x_has_changed(t));
ck_assert(libinput_event_tablet_tool_y_has_changed(t)); litest_assert(libinput_event_tablet_tool_y_has_changed(t));
current_x = libinput_event_tablet_tool_get_x(t); current_x = libinput_event_tablet_tool_get_x(t);
current_y = libinput_event_tablet_tool_get_y(t); current_y = libinput_event_tablet_tool_get_y(t);
if (i != 0) { if (i != 0) {
ck_assert_double_gt(current_x, old_x); litest_assert_double_gt(current_x, old_x);
ck_assert_double_lt(current_y, old_y); litest_assert_double_lt(current_y, old_y);
} }
old_x = current_x; old_x = current_x;
old_y = current_y; old_y = current_y;
@ -298,12 +298,12 @@ START_TEST(totem_rotation)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
ck_assert(!libinput_event_tablet_tool_x_has_changed(t)); litest_assert(!libinput_event_tablet_tool_x_has_changed(t));
ck_assert(!libinput_event_tablet_tool_y_has_changed(t)); litest_assert(!libinput_event_tablet_tool_y_has_changed(t));
ck_assert(libinput_event_tablet_tool_rotation_has_changed(t)); litest_assert(libinput_event_tablet_tool_rotation_has_changed(t));
r = libinput_event_tablet_tool_get_rotation(t); r = libinput_event_tablet_tool_get_rotation(t);
ck_assert_double_lt(r, old_r); litest_assert_double_lt(r, old_r);
old_r = r; old_r = r;
libinput_event_destroy(event); libinput_event_destroy(event);
@ -322,12 +322,12 @@ START_TEST(totem_rotation)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
ck_assert(!libinput_event_tablet_tool_x_has_changed(t)); litest_assert(!libinput_event_tablet_tool_x_has_changed(t));
ck_assert(!libinput_event_tablet_tool_y_has_changed(t)); litest_assert(!libinput_event_tablet_tool_y_has_changed(t));
ck_assert(libinput_event_tablet_tool_rotation_has_changed(t)); litest_assert(libinput_event_tablet_tool_rotation_has_changed(t));
r = libinput_event_tablet_tool_get_rotation(t); r = libinput_event_tablet_tool_get_rotation(t);
ck_assert_double_gt(r, old_r); litest_assert_double_gt(r, old_r);
old_r = r; old_r = r;
libinput_event_destroy(event); libinput_event_destroy(event);
@ -350,14 +350,14 @@ START_TEST(totem_size)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert(libinput_event_tablet_tool_size_major_has_changed(t)); litest_assert(libinput_event_tablet_tool_size_major_has_changed(t));
ck_assert(libinput_event_tablet_tool_size_minor_has_changed(t)); litest_assert(libinput_event_tablet_tool_size_minor_has_changed(t));
smaj = libinput_event_tablet_tool_get_size_major(t); smaj = libinput_event_tablet_tool_get_size_major(t);
smin = libinput_event_tablet_tool_get_size_minor(t); smin = libinput_event_tablet_tool_get_size_minor(t);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_double_eq(smaj, 71.8); litest_assert_double_eq(smaj, 71.8);
ck_assert_double_eq(smin, 71.8); litest_assert_double_eq(smin, 71.8);
litest_drain_events(li); litest_drain_events(li);
} }
@ -377,10 +377,10 @@ START_TEST(totem_button)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
ck_assert_int_eq(libinput_event_tablet_tool_get_button(t), BTN_0); litest_assert_int_eq(libinput_event_tablet_tool_get_button(t), BTN_0);
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_button_state(t),
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_DOWN); LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -389,10 +389,10 @@ START_TEST(totem_button)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
ck_assert_int_eq(libinput_event_tablet_tool_get_button(t), BTN_0); litest_assert_int_eq(libinput_event_tablet_tool_get_button(t), BTN_0);
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_button_state(t),
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_DOWN); LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -422,7 +422,7 @@ START_TEST(totem_button_down_on_init)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(t),
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -430,7 +430,7 @@ START_TEST(totem_button_down_on_init)
event = libinput_get_event(li); event = libinput_get_event(li);
t = litest_is_tablet_event(event, t = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_TIP); LIBINPUT_EVENT_TABLET_TOOL_TIP);
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t), litest_assert_int_eq(libinput_event_tablet_tool_get_tip_state(t),
LIBINPUT_TABLET_TOOL_TIP_DOWN); LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event); libinput_event_destroy(event);

View file

@ -50,7 +50,7 @@ START_TEST(touch_frame_events)
have_frame_event++; have_frame_event++;
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_eq(have_frame_event, 1); litest_assert_int_eq(have_frame_event, 1);
litest_touch_down(dev, 1, 10, 10); litest_touch_down(dev, 1, 10, 10);
litest_dispatch(li); litest_dispatch(li);
@ -60,7 +60,7 @@ START_TEST(touch_frame_events)
have_frame_event++; have_frame_event++;
libinput_event_destroy(event); libinput_event_destroy(event);
} }
ck_assert_int_eq(have_frame_event, 2); litest_assert_int_eq(have_frame_event, 2);
} }
END_TEST END_TEST
@ -129,7 +129,7 @@ START_TEST(touch_abs_transform)
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
ck_assert(tested); litest_assert(tested);
litest_delete_device(dev); litest_delete_device(dev);
} }
@ -148,9 +148,9 @@ touch_assert_seat_slot(struct libinput *li,
ev = libinput_get_event(li); ev = libinput_get_event(li);
tev = litest_is_touch_event(ev, type); tev = litest_is_touch_event(ev, type);
slot = libinput_event_touch_get_slot(tev); slot = libinput_event_touch_get_slot(tev);
ck_assert_int_eq(slot, slot); litest_assert_int_eq(slot, slot);
slot = libinput_event_touch_get_seat_slot(tev); slot = libinput_event_touch_get_seat_slot(tev);
ck_assert_int_eq(slot, seat_slot); litest_assert_int_eq(slot, seat_slot);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ev = libinput_get_event(li); ev = libinput_get_event(li);
@ -242,13 +242,13 @@ START_TEST(touch_many_slots)
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert_notnull(ev); litest_assert_notnull(ev);
ck_assert_int_gt(slot_count, 0); litest_assert_int_gt(slot_count, 0);
litest_dispatch(libinput); litest_dispatch(libinput);
do { do {
type = libinput_event_get_type(ev); type = libinput_event_get_type(ev);
ck_assert_int_ne(type, LIBINPUT_EVENT_TOUCH_DOWN); litest_assert_int_ne(type, LIBINPUT_EVENT_TOUCH_DOWN);
if (type == LIBINPUT_EVENT_TOUCH_UP) if (type == LIBINPUT_EVENT_TOUCH_UP)
slot_count--; slot_count--;
@ -256,7 +256,7 @@ START_TEST(touch_many_slots)
litest_dispatch(libinput); litest_dispatch(libinput);
} while ((ev = libinput_get_event(libinput))); } while ((ev = libinput_get_event(libinput)));
ck_assert_int_eq(slot_count, 0); litest_assert_int_eq(slot_count, 0);
litest_delete_device(dev); litest_delete_device(dev);
} }
@ -286,12 +286,12 @@ START_TEST(touch_double_touch_down_up)
while ((ev = libinput_get_event(libinput))) { while ((ev = libinput_get_event(libinput))) {
switch (libinput_event_get_type(ev)) { switch (libinput_event_get_type(ev)) {
case LIBINPUT_EVENT_TOUCH_DOWN: case LIBINPUT_EVENT_TOUCH_DOWN:
ck_assert(!got_down); litest_assert(!got_down);
got_down = true; got_down = true;
break; break;
case LIBINPUT_EVENT_TOUCH_UP: case LIBINPUT_EVENT_TOUCH_UP:
ck_assert(got_down); litest_assert(got_down);
ck_assert(!got_up); litest_assert(!got_up);
got_up = true; got_up = true;
break; break;
default: default:
@ -302,8 +302,8 @@ START_TEST(touch_double_touch_down_up)
litest_dispatch(libinput); litest_dispatch(libinput);
} }
ck_assert(got_down); litest_assert(got_down);
ck_assert(got_up); litest_assert(got_up);
} }
END_TEST END_TEST
@ -340,8 +340,8 @@ START_TEST(touch_calibration_scale)
x = libinput_event_touch_get_x_transformed(tev, width); x = libinput_event_touch_get_x_transformed(tev, width);
y = libinput_event_touch_get_y_transformed(tev, height); y = libinput_event_touch_get_y_transformed(tev, height);
ck_assert_int_eq(round(x), round(width * matrix[0])); litest_assert_int_eq(round(x), round(width * matrix[0]));
ck_assert_int_eq(round(y), round(height * matrix[4])); litest_assert_int_eq(round(y), round(height * matrix[4]));
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_drain_events(li); litest_drain_events(li);
@ -470,10 +470,10 @@ START_TEST(touch_calibration_translation)
y = libinput_event_touch_get_y_transformed(tev, height); y = libinput_event_touch_get_y_transformed(tev, height);
/* sigh. rounding errors */ /* sigh. rounding errors */
ck_assert_int_ge(round(x), width + round(width * matrix[2]) - 1); litest_assert_int_ge(round(x), width + round(width * matrix[2]) - 1);
ck_assert_int_ge(round(y), height + round(height * matrix[5]) - 1); litest_assert_int_ge(round(y), height + round(height * matrix[5]) - 1);
ck_assert_int_le(round(x), width + round(width * matrix[2]) + 1); litest_assert_int_le(round(x), width + round(width * matrix[2]) + 1);
ck_assert_int_le(round(y), height + round(height * matrix[5]) + 1); litest_assert_int_le(round(y), height + round(height * matrix[5]) + 1);
libinput_event_destroy(ev); libinput_event_destroy(ev);
litest_drain_events(li); litest_drain_events(li);
@ -491,18 +491,18 @@ START_TEST(touch_calibrated_screen_path)
int rc; int rc;
rc = libinput_device_config_calibration_has_matrix(dev->libinput_device); rc = libinput_device_config_calibration_has_matrix(dev->libinput_device);
ck_assert_int_eq(rc, 1); litest_assert_int_eq(rc, 1);
rc = libinput_device_config_calibration_get_matrix(dev->libinput_device, rc = libinput_device_config_calibration_get_matrix(dev->libinput_device,
matrix); matrix);
ck_assert_int_eq(rc, 1); litest_assert_int_eq(rc, 1);
ck_assert_double_eq(matrix[0], 1.2); litest_assert_double_eq(matrix[0], 1.2);
ck_assert_double_eq(matrix[1], 3.4); litest_assert_double_eq(matrix[1], 3.4);
ck_assert_double_eq(matrix[2], 5.6); litest_assert_double_eq(matrix[2], 5.6);
ck_assert_double_eq(matrix[3], 7.8); litest_assert_double_eq(matrix[3], 7.8);
ck_assert_double_eq(matrix[4], 9.10); litest_assert_double_eq(matrix[4], 9.10);
ck_assert_double_eq(matrix[5], 11.12); litest_assert_double_eq(matrix[5], 11.12);
} }
END_TEST END_TEST
@ -516,19 +516,19 @@ START_TEST(touch_calibration_config)
int rc; int rc;
rc = libinput_device_config_calibration_has_matrix(dev->libinput_device); rc = libinput_device_config_calibration_has_matrix(dev->libinput_device);
ck_assert_int_eq(rc, 1); litest_assert_int_eq(rc, 1);
/* Twice so we have every to-fro combination */ /* Twice so we have every to-fro combination */
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
status = libinput_device_config_calibration_set_matrix(dev->libinput_device, identity); status = libinput_device_config_calibration_set_matrix(dev->libinput_device, identity);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
libinput_device_config_calibration_get_matrix(dev->libinput_device, matrix); libinput_device_config_calibration_get_matrix(dev->libinput_device, matrix);
ck_assert_int_eq(memcmp(matrix, identity, sizeof(matrix)), 0); litest_assert_int_eq(memcmp(matrix, identity, sizeof(matrix)), 0);
status = libinput_device_config_calibration_set_matrix(dev->libinput_device, nonidentity); status = libinput_device_config_calibration_set_matrix(dev->libinput_device, nonidentity);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
libinput_device_config_calibration_get_matrix(dev->libinput_device, matrix); libinput_device_config_calibration_get_matrix(dev->libinput_device, matrix);
ck_assert_int_eq(memcmp(matrix, nonidentity, sizeof(matrix)), 0); litest_assert_int_eq(memcmp(matrix, nonidentity, sizeof(matrix)), 0);
} }
} }
@ -560,11 +560,11 @@ START_TEST(touch_calibrated_screen_udev)
int rc; int rc;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
@ -589,19 +589,19 @@ START_TEST(touch_calibrated_screen_udev)
litest_drain_events(li); litest_drain_events(li);
ck_assert_notnull(device); litest_assert_notnull(device);
rc = libinput_device_config_calibration_has_matrix(device); rc = libinput_device_config_calibration_has_matrix(device);
ck_assert_int_eq(rc, 1); litest_assert_int_eq(rc, 1);
rc = libinput_device_config_calibration_get_matrix(device, matrix); rc = libinput_device_config_calibration_get_matrix(device, matrix);
ck_assert_int_eq(rc, 1); litest_assert_int_eq(rc, 1);
ck_assert_double_eq(matrix[0], 1.2); litest_assert_double_eq(matrix[0], 1.2);
ck_assert_double_eq(matrix[1], 3.4); litest_assert_double_eq(matrix[1], 3.4);
ck_assert_double_eq(matrix[2], 5.6); litest_assert_double_eq(matrix[2], 5.6);
ck_assert_double_eq(matrix[3], 7.8); litest_assert_double_eq(matrix[3], 7.8);
ck_assert_double_eq(matrix[4], 9.10); litest_assert_double_eq(matrix[4], 9.10);
ck_assert_double_eq(matrix[5], 11.12); litest_assert_double_eq(matrix[5], 11.12);
libinput_device_unref(device); libinput_device_unref(device);
@ -619,16 +619,16 @@ START_TEST(touch_no_left_handed)
int rc; int rc;
rc = libinput_device_config_left_handed_is_available(d); rc = libinput_device_config_left_handed_is_available(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_device_config_left_handed_get(d); rc = libinput_device_config_left_handed_get(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
rc = libinput_device_config_left_handed_get_default(d); rc = libinput_device_config_left_handed_get_default(d);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
status = libinput_device_config_left_handed_set(d, 0); status = libinput_device_config_left_handed_set(d, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -644,12 +644,12 @@ START_TEST(fake_mt_exists)
event = libinput_get_event(li); event = libinput_get_event(li);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(!libinput_device_has_capability(device, litest_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_TOUCH)); LIBINPUT_DEVICE_CAP_TOUCH));
/* This test may need fixing if we add other fake-mt devices that /* This test may need fixing if we add other fake-mt devices that
* have different capabilities */ * have different capabilities */
ck_assert(libinput_device_has_capability(device, litest_assert(libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_POINTER)); LIBINPUT_DEVICE_CAP_POINTER));
libinput_event_destroy(event); libinput_event_destroy(event);
@ -687,7 +687,7 @@ START_TEST(touch_protocol_a_init)
litest_wait_for_event(li); litest_wait_for_event(li);
ck_assert(libinput_device_has_capability(device, litest_assert(libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_TOUCH)); LIBINPUT_DEVICE_CAP_TOUCH));
} }
END_TEST END_TEST
@ -733,8 +733,8 @@ START_TEST(touch_protocol_a_touch)
x = libinput_event_touch_get_x(tev); x = libinput_event_touch_get_x(tev);
y = libinput_event_touch_get_y(tev); y = libinput_event_touch_get_y(tev);
ck_assert_int_gt(x, oldx); litest_assert_int_gt(x, oldx);
ck_assert_int_lt(y, oldy); litest_assert_int_lt(y, oldy);
oldx = x; oldx = x;
oldy = y; oldy = y;
@ -781,7 +781,7 @@ START_TEST(touch_protocol_a_2fg_touch)
ev = libinput_get_event(li); ev = libinput_get_event(li);
tev = libinput_event_get_touch_event(ev); tev = libinput_event_get_touch_event(ev);
ck_assert_int_eq(libinput_event_touch_get_slot(tev), 0); litest_assert_int_eq(libinput_event_touch_get_slot(tev), 0);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ev = libinput_get_event(li); ev = libinput_get_event(li);
@ -790,7 +790,7 @@ START_TEST(touch_protocol_a_2fg_touch)
ev = libinput_get_event(li); ev = libinput_get_event(li);
tev = libinput_event_get_touch_event(ev); tev = libinput_event_get_touch_event(ev);
ck_assert_int_eq(libinput_event_touch_get_slot(tev), 1); litest_assert_int_eq(libinput_event_touch_get_slot(tev), 1);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ev = libinput_get_event(li); ev = libinput_get_event(li);
@ -854,7 +854,7 @@ START_TEST(touch_initial_state)
t1 = litest_is_touch_event(ev1, 0); t1 = litest_is_touch_event(ev1, 0);
t2 = litest_is_touch_event(ev2, 0); t2 = litest_is_touch_event(ev2, 0);
ck_assert_int_eq(libinput_event_get_type(ev1), litest_assert_int_eq(libinput_event_get_type(ev1),
libinput_event_get_type(ev2)); libinput_event_get_type(ev2));
if (libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_UP || if (libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_UP ||
@ -895,7 +895,7 @@ START_TEST(touch_time_usec)
event = libinput_get_event(li); event = libinput_get_event(li);
tev = litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN); tev = litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN);
time_usec = libinput_event_touch_get_time_usec(tev); time_usec = libinput_event_touch_get_time_usec(tev);
ck_assert_int_eq(libinput_event_touch_get_time(tev), litest_assert_int_eq(libinput_event_touch_get_time(tev),
(uint32_t) (time_usec / 1000)); (uint32_t) (time_usec / 1000));
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -952,19 +952,19 @@ START_TEST(touch_fuzz_property)
const char *prop; const char *prop;
int fuzz = 0; int fuzz = 0;
ck_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_X), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_X), 0);
ck_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_Y), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_Y), 0);
d = libinput_device_get_udev_device(dev->libinput_device); d = libinput_device_get_udev_device(dev->libinput_device);
prop = udev_device_get_property_value(d, "LIBINPUT_FUZZ_00"); prop = udev_device_get_property_value(d, "LIBINPUT_FUZZ_00");
ck_assert_notnull(prop); litest_assert_notnull(prop);
ck_assert(safe_atoi(prop, &fuzz)); litest_assert(safe_atoi(prop, &fuzz));
ck_assert_int_eq(fuzz, 10); /* device-specific */ litest_assert_int_eq(fuzz, 10); /* device-specific */
prop = udev_device_get_property_value(d, "LIBINPUT_FUZZ_01"); prop = udev_device_get_property_value(d, "LIBINPUT_FUZZ_01");
ck_assert_notnull(prop); litest_assert_notnull(prop);
ck_assert(safe_atoi(prop, &fuzz)); litest_assert(safe_atoi(prop, &fuzz));
ck_assert_int_eq(fuzz, 12); /* device-specific */ litest_assert_int_eq(fuzz, 12); /* device-specific */
udev_device_unref(d); udev_device_unref(d);
} }
@ -1030,14 +1030,14 @@ START_TEST(touch_invalid_range_over)
t = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); t = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN);
x = libinput_event_touch_get_x(t); x = libinput_event_touch_get_x(t);
y = libinput_event_touch_get_y(t); y = libinput_event_touch_get_y(t);
ck_assert_double_eq(x, 300); /* device has resolution 10 */ litest_assert_double_eq(x, 300); /* device has resolution 10 */
ck_assert_double_eq(y, 300); /* device has resolution 10 */ litest_assert_double_eq(y, 300); /* device has resolution 10 */
/* Expect the percentage to be correct too, even if > 100% */ /* Expect the percentage to be correct too, even if > 100% */
x = libinput_event_touch_get_x_transformed(t, 100); x = libinput_event_touch_get_x_transformed(t, 100);
y = libinput_event_touch_get_y_transformed(t, 100); y = libinput_event_touch_get_y_transformed(t, 100);
ck_assert_double_eq(round(x), 200); litest_assert_double_eq(round(x), 200);
ck_assert_double_eq(round(y), 120); litest_assert_double_eq(round(y), 120);
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -1069,14 +1069,14 @@ START_TEST(touch_invalid_range_under)
t = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); t = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN);
x = libinput_event_touch_get_x(t); x = libinput_event_touch_get_x(t);
y = libinput_event_touch_get_y(t); y = libinput_event_touch_get_y(t);
ck_assert_double_eq(x, -150); /* device has resolution 10 */ litest_assert_double_eq(x, -150); /* device has resolution 10 */
ck_assert_double_eq(y, -100); /* device has resolution 10 */ litest_assert_double_eq(y, -100); /* device has resolution 10 */
/* Expect the percentage to be correct too, even if > 100% */ /* Expect the percentage to be correct too, even if > 100% */
x = libinput_event_touch_get_x_transformed(t, 100); x = libinput_event_touch_get_x_transformed(t, 100);
y = libinput_event_touch_get_y_transformed(t, 100); y = libinput_event_touch_get_y_transformed(t, 100);
ck_assert_double_eq(round(x), -100); litest_assert_double_eq(round(x), -100);
ck_assert_double_eq(round(y), -40); litest_assert_double_eq(round(y), -40);
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -1087,7 +1087,7 @@ START_TEST(touch_count_st)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_touch_get_touch_count(device), 1); litest_assert_int_eq(libinput_device_touch_get_touch_count(device), 1);
} }
END_TEST END_TEST
@ -1097,7 +1097,7 @@ START_TEST(touch_count_mt)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
struct libevdev *evdev = dev->evdev; struct libevdev *evdev = dev->evdev;
ck_assert_int_eq(libinput_device_touch_get_touch_count(device), litest_assert_int_eq(libinput_device_touch_get_touch_count(device),
libevdev_get_num_slots(evdev)); libevdev_get_num_slots(evdev));
} }
END_TEST END_TEST
@ -1107,7 +1107,7 @@ START_TEST(touch_count_unknown)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_touch_get_touch_count(device), 0); litest_assert_int_eq(libinput_device_touch_get_touch_count(device), 0);
} }
END_TEST END_TEST
@ -1116,7 +1116,7 @@ START_TEST(touch_count_invalid)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
ck_assert_int_eq(libinput_device_touch_get_touch_count(device), -1); litest_assert_int_eq(libinput_device_touch_get_touch_count(device), -1);
} }
END_TEST END_TEST

View file

@ -65,20 +65,20 @@ START_TEST(touchpad_click_defaults_clickfinger)
/* call this test for apple touchpads */ /* call this test for apple touchpads */
methods = libinput_device_config_click_get_methods(device); methods = libinput_device_config_click_get_methods(device);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
method = libinput_device_config_click_get_method(device); method = libinput_device_config_click_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
method = libinput_device_config_click_get_default_method(device); method = libinput_device_config_click_get_default_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_NONE); LIBINPUT_CONFIG_CLICK_METHOD_NONE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST
@ -89,9 +89,9 @@ START_TEST(touchpad_click_default_clickfinger_map)
enum libinput_config_clickfinger_button_map map; enum libinput_config_clickfinger_button_map map;
map = libinput_device_config_click_get_clickfinger_button_map(device); map = libinput_device_config_click_get_clickfinger_button_map(device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
map = libinput_device_config_click_get_default_clickfinger_button_map(device); map = libinput_device_config_click_get_default_clickfinger_button_map(device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
} }
END_TEST END_TEST
@ -104,23 +104,23 @@ START_TEST(touchpad_click_set_clickfinger_map)
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM; map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
status = libinput_device_config_click_set_clickfinger_button_map(device, map); status = libinput_device_config_click_set_clickfinger_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
map = libinput_device_config_click_get_clickfinger_button_map(dev->libinput_device); map = libinput_device_config_click_get_clickfinger_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM);
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR; map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
status = libinput_device_config_click_set_clickfinger_button_map(device, map); status = libinput_device_config_click_set_clickfinger_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
map = libinput_device_config_click_get_clickfinger_button_map(dev->libinput_device); map = libinput_device_config_click_get_clickfinger_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR); litest_assert_int_eq(map, LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR);
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM - 1; map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM - 1;
status = libinput_device_config_click_set_clickfinger_button_map(device, map); status = libinput_device_config_click_set_clickfinger_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR + 1; map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR + 1;
status = libinput_device_config_click_set_clickfinger_button_map(device, map); status = libinput_device_config_click_set_clickfinger_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -134,20 +134,20 @@ START_TEST(touchpad_click_defaults_btnarea)
/* call this test for non-apple clickpads */ /* call this test for non-apple clickpads */
methods = libinput_device_config_click_get_methods(device); methods = libinput_device_config_click_get_methods(device);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
method = libinput_device_config_click_get_method(device); method = libinput_device_config_click_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
method = libinput_device_config_click_get_default_method(device); method = libinput_device_config_click_get_default_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_NONE); LIBINPUT_CONFIG_CLICK_METHOD_NONE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST
@ -165,19 +165,19 @@ START_TEST(touchpad_click_defaults_none)
/* call this test for non-clickpads and non-touchpads */ /* call this test for non-clickpads and non-touchpads */
methods = libinput_device_config_click_get_methods(device); methods = libinput_device_config_click_get_methods(device);
ck_assert_int_eq(methods, 0); litest_assert_int_eq(methods, 0);
method = libinput_device_config_click_get_method(device); method = libinput_device_config_click_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE);
method = libinput_device_config_click_get_default_method(device); method = libinput_device_config_click_get_default_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -969,18 +969,18 @@ START_TEST(touchpad_clickfinger_appletouch_config)
enum libinput_config_status status; enum libinput_config_status status;
methods = libinput_device_config_click_get_methods(device); methods = libinput_device_config_click_get_methods(device);
ck_assert(!(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)); litest_assert(!(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS));
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
method = libinput_device_config_click_get_method(device); method = libinput_device_config_click_get_method(device);
ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_click_set_method(device, status = libinput_device_config_click_set_method(device,
LIBINPUT_CONFIG_CLICK_METHOD_NONE); LIBINPUT_CONFIG_CLICK_METHOD_NONE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST
@ -1238,7 +1238,7 @@ START_TEST(clickpad_finger_pin)
double dist; double dist;
abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
ck_assert_notnull(abs); litest_assert_notnull(abs);
if (abs->resolution == 0) if (abs->resolution == 0)
return; return;
@ -1493,7 +1493,7 @@ START_TEST(clickpad_softbutton_left_1st_fg_move)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *p; struct libinput_event_pointer *p;
@ -1513,8 +1513,8 @@ START_TEST(clickpad_softbutton_left_1st_fg_move)
event = libinput_get_event(li); event = libinput_get_event(li);
} }
ck_assert(x/nevents < 0); litest_assert(x/nevents < 0);
ck_assert(y/nevents > 0); litest_assert(y/nevents > 0);
litest_event(dev, EV_KEY, BTN_LEFT, 0); litest_event(dev, EV_KEY, BTN_LEFT, 0);
litest_event(dev, EV_SYN, SYN_REPORT, 0); litest_event(dev, EV_SYN, SYN_REPORT, 0);
@ -1558,7 +1558,7 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *p; struct libinput_event_pointer *p;
double x, y; double x, y;
@ -1572,8 +1572,8 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
/* Ignore events only containing an unaccelerated motion /* Ignore events only containing an unaccelerated motion
* vector. */ * vector. */
if (x != 0 || y != 0) { if (x != 0 || y != 0) {
ck_assert(x > 0); litest_assert(x > 0);
ck_assert(y == 0); litest_assert(y == 0);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
@ -1588,7 +1588,7 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *p; struct libinput_event_pointer *p;
double x, y; double x, y;
@ -1599,8 +1599,8 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
x = libinput_event_pointer_get_dx(p); x = libinput_event_pointer_get_dx(p);
y = libinput_event_pointer_get_dy(p); y = libinput_event_pointer_get_dy(p);
ck_assert(x == 0); litest_assert(x == 0);
ck_assert(y > 0); litest_assert(y > 0);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);
@ -1978,7 +1978,7 @@ START_TEST(clickpad_middleemulation_config_delayed)
int enabled; int enabled;
enabled = libinput_device_config_middle_emulation_get_enabled(device); enabled = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert(!enabled); litest_assert(!enabled);
litest_touch_down(dev, 0, 30, 95); litest_touch_down(dev, 0, 30, 95);
litest_event(dev, EV_KEY, BTN_LEFT, 1); litest_event(dev, EV_KEY, BTN_LEFT, 1);
@ -1988,16 +1988,16 @@ START_TEST(clickpad_middleemulation_config_delayed)
/* actual config is delayed, but status is immediate */ /* actual config is delayed, but status is immediate */
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
enabled = libinput_device_config_middle_emulation_get_enabled(device); enabled = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert(enabled); litest_assert(enabled);
status = libinput_device_config_middle_emulation_set_enabled(device, status = libinput_device_config_middle_emulation_set_enabled(device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
enabled = libinput_device_config_middle_emulation_get_enabled(device); enabled = libinput_device_config_middle_emulation_get_enabled(device);
ck_assert(!enabled); litest_assert(!enabled);
} }
END_TEST END_TEST
@ -2230,8 +2230,8 @@ START_TEST(touchpad_non_clickpad_detection)
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
methods = libinput_device_config_click_get_methods(device); methods = libinput_device_config_click_get_methods(device);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); litest_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
libinput_path_remove_device(device); libinput_path_remove_device(device);

View file

@ -173,7 +173,7 @@ START_TEST(touchpad_doubletap)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_lt(oldtime, curtime); litest_assert_int_lt(oldtime, curtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -181,7 +181,7 @@ START_TEST(touchpad_doubletap)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_lt(oldtime, curtime); litest_assert_int_lt(oldtime, curtime);
oldtime = curtime; oldtime = curtime;
event = libinput_get_event(li); event = libinput_get_event(li);
@ -190,7 +190,7 @@ START_TEST(touchpad_doubletap)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_lt(oldtime, curtime); litest_assert_int_lt(oldtime, curtime);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -270,7 +270,7 @@ START_TEST(touchpad_multitap)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -278,7 +278,7 @@ START_TEST(touchpad_multitap)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
litest_timeout_tapndrag(); litest_timeout_tapndrag();
@ -361,7 +361,7 @@ START_TEST(touchpad_multitap_n_drag_move)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -369,7 +369,7 @@ START_TEST(touchpad_multitap_n_drag_move)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -379,7 +379,7 @@ START_TEST(touchpad_multitap_n_drag_move)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
litest_assert_only_typed_events(li, litest_assert_only_typed_events(li,
LIBINPUT_EVENT_POINTER_MOTION); LIBINPUT_EVENT_POINTER_MOTION);
@ -475,7 +475,7 @@ START_TEST(touchpad_multitap_n_drag_2fg)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -483,7 +483,7 @@ START_TEST(touchpad_multitap_n_drag_2fg)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -493,7 +493,7 @@ START_TEST(touchpad_multitap_n_drag_2fg)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10); litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10);
@ -589,7 +589,7 @@ START_TEST(touchpad_multitap_n_drag_click)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -597,7 +597,7 @@ START_TEST(touchpad_multitap_n_drag_click)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -696,7 +696,7 @@ START_TEST(touchpad_multitap_timeout)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
rtime = libinput_event_pointer_get_time(ptrev); rtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
} }
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -782,7 +782,7 @@ START_TEST(touchpad_multitap_n_drag_timeout)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -790,7 +790,7 @@ START_TEST(touchpad_multitap_n_drag_timeout)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -800,7 +800,7 @@ START_TEST(touchpad_multitap_n_drag_timeout)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10); litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10);
@ -989,7 +989,7 @@ START_TEST(touchpad_multitap_n_drag_tap)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -997,7 +997,7 @@ START_TEST(touchpad_multitap_n_drag_tap)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -1007,7 +1007,7 @@ START_TEST(touchpad_multitap_n_drag_tap)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10); litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10);
@ -1104,7 +1104,7 @@ START_TEST(touchpad_multitap_n_drag_tap_click)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -1112,7 +1112,7 @@ START_TEST(touchpad_multitap_n_drag_tap_click)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -1122,7 +1122,7 @@ START_TEST(touchpad_multitap_n_drag_tap_click)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10); litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10);
@ -1225,7 +1225,7 @@ START_TEST(touchpad_tap_n_drag)
*/ */
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_is_button_event(event, litest_is_button_event(event,
button, button,
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
@ -2326,7 +2326,7 @@ START_TEST(touchpad_2fg_tap)
rtime = libinput_event_pointer_get_time_usec(ptrev); rtime = libinput_event_pointer_get_time_usec(ptrev);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -2381,7 +2381,7 @@ START_TEST(touchpad_2fg_tap_inverted)
rtime = libinput_event_pointer_get_time_usec(ptrev); rtime = libinput_event_pointer_get_time_usec(ptrev);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -2924,7 +2924,7 @@ START_TEST(touchpad_3fg_tap)
rtime = libinput_event_pointer_get_time_usec(ptrev); rtime = libinput_event_pointer_get_time_usec(ptrev);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
} }
} }
@ -2980,7 +2980,7 @@ START_TEST(touchpad_3fg_tap_tap_again)
rtime = libinput_event_pointer_get_time_usec(ptrev); rtime = libinput_event_pointer_get_time_usec(ptrev);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
} }
} }
END_TEST END_TEST
@ -3670,7 +3670,7 @@ START_TEST(touchpad_tap_is_available)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1); litest_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1);
} }
END_TEST END_TEST
@ -3678,13 +3678,13 @@ START_TEST(touchpad_tap_is_not_available)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
ck_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0);
ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_DISABLED); LIBINPUT_CONFIG_TAP_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, litest_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
LIBINPUT_CONFIG_TAP_ENABLED), LIBINPUT_CONFIG_TAP_ENABLED),
LIBINPUT_CONFIG_STATUS_UNSUPPORTED); LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, litest_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device,
LIBINPUT_CONFIG_TAP_DISABLED), LIBINPUT_CONFIG_TAP_DISABLED),
LIBINPUT_CONFIG_STATUS_SUCCESS); LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
@ -3696,9 +3696,9 @@ START_TEST(touchpad_tap_default_disabled)
/* this test is only run on specific devices */ /* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_DISABLED); LIBINPUT_CONFIG_TAP_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_DISABLED); LIBINPUT_CONFIG_TAP_DISABLED);
} }
END_TEST END_TEST
@ -3709,9 +3709,9 @@ START_TEST(touchpad_tap_default_enabled)
/* this test is only run on specific devices */ /* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_ENABLED); LIBINPUT_CONFIG_TAP_ENABLED);
ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_ENABLED); LIBINPUT_CONFIG_TAP_ENABLED);
} }
END_TEST END_TEST
@ -3720,9 +3720,9 @@ START_TEST(touchpad_tap_invalid)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2), litest_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1), litest_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -3733,10 +3733,10 @@ START_TEST(touchpad_tap_default_map)
enum libinput_config_tap_button_map map; enum libinput_config_tap_button_map map;
map = libinput_device_config_tap_get_button_map(dev->libinput_device); map = libinput_device_config_tap_get_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
map = libinput_device_config_tap_get_default_button_map(dev->libinput_device); map = libinput_device_config_tap_get_default_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
} }
END_TEST END_TEST
@ -3747,16 +3747,16 @@ START_TEST(touchpad_tap_map_unsupported)
enum libinput_config_status status; enum libinput_config_status status;
map = libinput_device_config_tap_get_button_map(dev->libinput_device); map = libinput_device_config_tap_get_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
map = libinput_device_config_tap_get_default_button_map(dev->libinput_device); map = libinput_device_config_tap_get_default_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
status = libinput_device_config_tap_set_button_map(dev->libinput_device, status = libinput_device_config_tap_set_button_map(dev->libinput_device,
LIBINPUT_CONFIG_TAP_MAP_LMR); LIBINPUT_CONFIG_TAP_MAP_LMR);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_tap_set_button_map(dev->libinput_device, status = libinput_device_config_tap_set_button_map(dev->libinput_device,
LIBINPUT_CONFIG_TAP_MAP_LRM); LIBINPUT_CONFIG_TAP_MAP_LRM);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -3769,23 +3769,23 @@ START_TEST(touchpad_tap_set_map)
map = LIBINPUT_CONFIG_TAP_MAP_LRM; map = LIBINPUT_CONFIG_TAP_MAP_LRM;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
map = libinput_device_config_tap_get_button_map(dev->libinput_device); map = libinput_device_config_tap_get_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
map = LIBINPUT_CONFIG_TAP_MAP_LMR; map = LIBINPUT_CONFIG_TAP_MAP_LMR;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
map = libinput_device_config_tap_get_button_map(dev->libinput_device); map = libinput_device_config_tap_get_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR);
map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1; map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1; map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -3798,19 +3798,19 @@ START_TEST(touchpad_tap_set_map_no_tapping)
map = LIBINPUT_CONFIG_TAP_MAP_LRM; map = LIBINPUT_CONFIG_TAP_MAP_LRM;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
map = LIBINPUT_CONFIG_TAP_MAP_LMR; map = LIBINPUT_CONFIG_TAP_MAP_LMR;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1; map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1; map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1;
status = libinput_device_config_tap_set_button_map(device, map); status = libinput_device_config_tap_set_button_map(device, map);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -3821,10 +3821,10 @@ START_TEST(touchpad_tap_get_map_no_tapping)
enum libinput_config_tap_button_map map; enum libinput_config_tap_button_map map;
map = libinput_device_config_tap_get_button_map(device); map = libinput_device_config_tap_get_button_map(device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
map = libinput_device_config_tap_get_default_button_map(device); map = libinput_device_config_tap_get_default_button_map(device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM);
} }
END_TEST END_TEST
@ -3847,7 +3847,7 @@ START_TEST(touchpad_tap_map_delayed)
litest_set_tap_map(dev->libinput_device, litest_set_tap_map(dev->libinput_device,
LIBINPUT_CONFIG_TAP_MAP_LMR); LIBINPUT_CONFIG_TAP_MAP_LMR);
map = libinput_device_config_tap_get_button_map(dev->libinput_device); map = libinput_device_config_tap_get_button_map(dev->libinput_device);
ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR); litest_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
litest_touch_up(dev, 1); litest_touch_up(dev, 1);
@ -3871,9 +3871,9 @@ START_TEST(touchpad_drag_default_disabled)
/* this test is only run on specific devices */ /* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_DISABLED); LIBINPUT_CONFIG_DRAG_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_DISABLED); LIBINPUT_CONFIG_DRAG_DISABLED);
} }
END_TEST END_TEST
@ -3884,9 +3884,9 @@ START_TEST(touchpad_drag_default_enabled)
/* this test is only run on specific devices */ /* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_ENABLED); LIBINPUT_CONFIG_DRAG_ENABLED);
ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_ENABLED); LIBINPUT_CONFIG_DRAG_ENABLED);
} }
END_TEST END_TEST
@ -3895,9 +3895,9 @@ START_TEST(touchpad_drag_config_invalid)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
ck_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, 2), litest_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, 2),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, -1), litest_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, -1),
LIBINPUT_CONFIG_STATUS_INVALID); LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -3907,16 +3907,16 @@ START_TEST(touchpad_drag_config_unsupported)
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
enum libinput_config_status status; enum libinput_config_status status;
ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_DISABLED); LIBINPUT_CONFIG_DRAG_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), litest_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device),
LIBINPUT_CONFIG_DRAG_DISABLED); LIBINPUT_CONFIG_DRAG_DISABLED);
status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device, status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device,
LIBINPUT_CONFIG_DRAG_ENABLED); LIBINPUT_CONFIG_DRAG_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device, status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device,
LIBINPUT_CONFIG_DRAG_DISABLED); LIBINPUT_CONFIG_DRAG_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
END_TEST END_TEST
@ -3931,22 +3931,22 @@ START_TEST(touchpad_drag_config_enabledisable)
litest_disable_tap_drag(dev->libinput_device); litest_disable_tap_drag(dev->libinput_device);
state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED);
litest_enable_tap_drag(dev->libinput_device); litest_enable_tap_drag(dev->libinput_device);
state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED);
/* same thing with tapping disabled */ /* same thing with tapping disabled */
litest_enable_tap(dev->libinput_device); litest_enable_tap(dev->libinput_device);
litest_disable_tap_drag(dev->libinput_device); litest_disable_tap_drag(dev->libinput_device);
state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED);
litest_enable_tap_drag(dev->libinput_device); litest_enable_tap_drag(dev->libinput_device);
state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED);
} }
END_TEST END_TEST
@ -4095,7 +4095,7 @@ START_TEST(touchpad_drag_disabled_immediate)
release_time = libinput_event_pointer_get_time(ptrev); release_time = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(ev); libinput_event_destroy(ev);
ck_assert_int_gt(release_time, press_time); litest_assert_int_gt(release_time, press_time);
} }
END_TEST END_TEST
@ -4175,7 +4175,7 @@ START_TEST(touchpad_drag_disabled_multitap_no_drag)
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_gt(curtime, oldtime); litest_assert_int_gt(curtime, oldtime);
event = libinput_get_event(li); event = libinput_get_event(li);
ptrev = litest_is_button_event(event, ptrev = litest_is_button_event(event,
@ -4183,7 +4183,7 @@ START_TEST(touchpad_drag_disabled_multitap_no_drag)
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
curtime = libinput_event_pointer_get_time(ptrev); curtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_ge(curtime, oldtime); litest_assert_int_ge(curtime, oldtime);
oldtime = curtime; oldtime = curtime;
} }
@ -4199,39 +4199,39 @@ START_TEST(touchpad_drag_lock_default_disabled)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
/* ENABLED is a legacy spelling for ENABLED_TIMEOUT */ /* ENABLED is a legacy spelling for ENABLED_TIMEOUT */
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
3); 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -4241,30 +4241,30 @@ START_TEST(touchpad_drag_lock_default_unavailable)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), litest_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device),
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_TIMEOUT);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY); LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_tap_set_drag_lock_enabled(device, status = libinput_device_config_tap_set_drag_lock_enabled(device,
3); 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST

View file

@ -70,7 +70,7 @@ START_TEST(touchpad_1fg_motion)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *ptrev; struct libinput_event_pointer *ptrev;
@ -105,7 +105,7 @@ START_TEST(touchpad_2fg_no_motion)
event = libinput_get_event(li); event = libinput_get_event(li);
while (event) { while (event) {
ck_assert_int_ne(libinput_event_get_type(event), litest_assert_int_ne(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_MOTION); LIBINPUT_EVENT_POINTER_MOTION);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -189,7 +189,7 @@ START_TEST(touchpad_2fg_scroll_initially_diagonal)
if (!litest_has_2fg_scroll(dev)) if (!litest_has_2fg_scroll(dev))
return; return;
ck_assert_int_eq(libinput_device_get_size(dev->libinput_device, &w, &h), 0); litest_assert_int_eq(libinput_device_get_size(dev->libinput_device, &w, &h), 0);
ratio = w/h; ratio = w/h;
litest_enable_2fg_scroll(dev); litest_enable_2fg_scroll(dev);
litest_drain_events(li); litest_drain_events(li);
@ -229,14 +229,14 @@ START_TEST(touchpad_2fg_scroll_initially_diagonal)
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
ck_assert(!libinput_event_pointer_has_axis(ptrev, litest_assert(!libinput_event_pointer_has_axis(ptrev,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)); LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL));
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
expected_nevents--; expected_nevents--;
} while (event); } while (event);
ck_assert_int_eq(expected_nevents, 0); litest_assert_int_eq(expected_nevents, 0);
litest_touch_up(dev, 1); litest_touch_up(dev, 1);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
@ -276,17 +276,17 @@ is_single_axis_2fg_scroll(struct litest_device *dev,
* the same axis value (0.0). */ * the same axis value (0.0). */
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
ptrev = litest_is_axis_event(event, ptrev = litest_is_axis_event(event,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
on_axis, on_axis,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
ck_assert(val == (litest_event_pointer_get_value(ptrev, off_axis) == 0.0)); litest_assert(val == (litest_event_pointer_get_value(ptrev, off_axis) == 0.0));
break; break;
} }
ck_assert(has_on_axis); litest_assert(has_on_axis);
ck_assert(!has_off_axis); litest_assert(!has_off_axis);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -318,14 +318,14 @@ START_TEST(touchpad_2fg_scroll_axis_lock)
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
test_2fg_scroll(dev, delta[i][0], delta[i][1], false); test_2fg_scroll(dev, delta[i][0], delta[i][1], false);
ck_assert(is_single_axis_2fg_scroll(dev, axis)); litest_assert(is_single_axis_2fg_scroll(dev, axis));
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
test_2fg_scroll(dev, delta[i][1], delta[i][0], false); test_2fg_scroll(dev, delta[i][1], delta[i][0], false);
ck_assert(is_single_axis_2fg_scroll(dev, axis)); litest_assert(is_single_axis_2fg_scroll(dev, axis));
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
} }
@ -352,7 +352,7 @@ START_TEST(touchpad_2fg_scroll_axis_lock_switch)
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS);
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
ck_assert(is_single_axis_2fg_scroll(dev, axis)); litest_assert(is_single_axis_2fg_scroll(dev, axis));
litest_drain_events(li); litest_drain_events(li);
msleep(200); msleep(200);
@ -373,7 +373,7 @@ START_TEST(touchpad_2fg_scroll_axis_lock_switch)
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS);
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
ck_assert(is_single_axis_2fg_scroll(dev, axis)); litest_assert(is_single_axis_2fg_scroll(dev, axis));
litest_drain_events(li); litest_drain_events(li);
/* Move in a clear diagonal direction to ensure the lock releases */ /* Move in a clear diagonal direction to ensure the lock releases */
@ -382,7 +382,7 @@ START_TEST(touchpad_2fg_scroll_axis_lock_switch)
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS);
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
ck_assert(!is_single_axis_2fg_scroll(dev, axis)); litest_assert(!is_single_axis_2fg_scroll(dev, axis));
litest_touch_up(dev, 1); litest_touch_up(dev, 1);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
@ -407,7 +407,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
last_low_res_event_found = false; last_low_res_event_found = false;
/* We want to move > 5 mm. */ /* We want to move > 5 mm. */
ck_assert_int_eq(libinput_device_get_size(dev->libinput_device, litest_assert_int_eq(libinput_device_get_size(dev->libinput_device,
&width, &width,
&height), 0); &height), 0);
y_move = 100.0/height * 7; y_move = 100.0/height * 7;
@ -424,7 +424,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *ptrev; struct libinput_event_pointer *ptrev;
@ -447,12 +447,12 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
last_low_res_event_found = true; last_low_res_event_found = true;
} }
ck_assert(axisval >= 0.0); litest_assert(axisval >= 0.0);
/* this is to verify we test the right thing, if the value /* this is to verify we test the right thing, if the value
is greater than scroll.threshold we triggered the wrong is greater than scroll.threshold we triggered the wrong
condition */ condition */
ck_assert(axisval < 5.0); litest_assert(axisval < 5.0);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -603,9 +603,9 @@ START_TEST(touchpad_scroll_natural_defaults)
int enabled = libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE; int enabled = libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE;
ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); litest_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), enabled); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), enabled);
ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), enabled); litest_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), enabled);
} }
END_TEST END_TEST
@ -615,12 +615,12 @@ START_TEST(touchpad_scroll_natural_enable_config)
enum libinput_config_status status; enum libinput_config_status status;
status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1);
status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0);
} }
END_TEST END_TEST
@ -854,11 +854,11 @@ START_TEST(touchpad_scroll_defaults)
should_have_2fg = true; should_have_2fg = true;
method = libinput_device_config_scroll_get_methods(device); method = libinput_device_config_scroll_get_methods(device);
ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE); litest_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE);
if (should_have_2fg) if (should_have_2fg)
ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG); litest_assert(method & LIBINPUT_CONFIG_SCROLL_2FG);
else else
ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0); litest_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0);
if (should_have_2fg) if (should_have_2fg)
expected = LIBINPUT_CONFIG_SCROLL_2FG; expected = LIBINPUT_CONFIG_SCROLL_2FG;
@ -866,20 +866,20 @@ START_TEST(touchpad_scroll_defaults)
expected = LIBINPUT_CONFIG_SCROLL_EDGE; expected = LIBINPUT_CONFIG_SCROLL_EDGE;
method = libinput_device_config_scroll_get_method(device); method = libinput_device_config_scroll_get_method(device);
ck_assert_int_eq(method, expected); litest_assert_int_eq(method, expected);
method = libinput_device_config_scroll_get_default_method(device); method = libinput_device_config_scroll_get_default_method(device);
ck_assert_int_eq(method, expected); litest_assert_int_eq(method, expected);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_EDGE); LIBINPUT_CONFIG_SCROLL_EDGE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_scroll_set_method(device, status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_2FG); LIBINPUT_CONFIG_SCROLL_2FG);
if (should_have_2fg) if (should_have_2fg)
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
else else
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
END_TEST END_TEST
@ -892,7 +892,7 @@ START_TEST(touchpad_edge_scroll_timeout)
int nevents = 0; int nevents = 0;
double mm; /* one mm in percent of the device */ double mm; /* one mm in percent of the device */
ck_assert_int_eq(libinput_device_get_size(dev->libinput_device, litest_assert_int_eq(libinput_device_get_size(dev->libinput_device,
&width, &width,
&height), 0); &height), 0);
mm = 100.0/height; mm = 100.0/height;
@ -940,14 +940,14 @@ START_TEST(touchpad_edge_scroll_timeout)
0); 0);
value = litest_event_pointer_get_value(ptrev, value = litest_event_pointer_get_value(ptrev,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
ck_assert_double_lt(value, 5.0); litest_assert_double_lt(value, 5.0);
libinput_event_destroy(event); libinput_event_destroy(event);
nevents++; nevents++;
} }
/* we sent 20 events but allow for some to be swallowed by rounding /* we sent 20 events but allow for some to be swallowed by rounding
* errors, the hysteresis, etc. */ * errors, the hysteresis, etc. */
ck_assert_int_ge(nevents, 10); litest_assert_int_ge(nevents, 10);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -1020,7 +1020,7 @@ START_TEST(touchpad_edge_scroll_source)
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
ck_assert_int_eq(litest_event_pointer_get_axis_source(ptrev), litest_assert_int_eq(litest_event_pointer_get_axis_source(ptrev),
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
@ -2371,7 +2371,7 @@ START_TEST(touchpad_left_handed)
return; return;
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_button_click(dev, BTN_LEFT, 1); litest_button_click(dev, BTN_LEFT, 1);
@ -2414,10 +2414,10 @@ START_TEST(touchpad_left_handed_appletouch)
struct libinput_device *d = dev->libinput_device; struct libinput_device *d = dev->libinput_device;
enum libinput_config_status status; enum libinput_config_status status;
ck_assert_int_eq(libinput_device_config_left_handed_is_available(d), 0); litest_assert_int_eq(libinput_device_config_left_handed_is_available(d), 0);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
ck_assert_int_eq(libinput_device_config_left_handed_get(d), 0); litest_assert_int_eq(libinput_device_config_left_handed_get(d), 0);
} }
END_TEST END_TEST
@ -2432,7 +2432,7 @@ START_TEST(touchpad_left_handed_clickpad)
return; return;
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90); litest_touch_down(dev, 0, 10, 90);
@ -2486,7 +2486,7 @@ START_TEST(touchpad_left_handed_clickfinger)
return; return;
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_touch_down(dev, 0, 10, 90); litest_touch_down(dev, 0, 10, 90);
@ -2533,7 +2533,7 @@ START_TEST(touchpad_left_handed_tapping)
litest_disable_hold_gestures(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -2568,7 +2568,7 @@ START_TEST(touchpad_left_handed_tapping_2fg)
litest_disable_hold_gestures(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -2606,7 +2606,7 @@ START_TEST(touchpad_left_handed_delayed)
litest_dispatch(li); litest_dispatch(li);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click(dev, BTN_LEFT, 0); litest_button_click(dev, BTN_LEFT, 0);
@ -2626,7 +2626,7 @@ START_TEST(touchpad_left_handed_delayed)
litest_dispatch(li); litest_dispatch(li);
status = libinput_device_config_left_handed_set(d, 0); status = libinput_device_config_left_handed_set(d, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click(dev, BTN_RIGHT, 0); litest_button_click(dev, BTN_RIGHT, 0);
litest_button_click(dev, BTN_LEFT, 0); litest_button_click(dev, BTN_LEFT, 0);
@ -2662,7 +2662,7 @@ START_TEST(touchpad_left_handed_clickpad_delayed)
litest_dispatch(li); litest_dispatch(li);
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click(dev, BTN_LEFT, 0); litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
@ -2681,7 +2681,7 @@ START_TEST(touchpad_left_handed_clickpad_delayed)
litest_dispatch(li); litest_dispatch(li);
status = libinput_device_config_left_handed_set(d, 0); status = libinput_device_config_left_handed_set(d, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_button_click(dev, BTN_LEFT, 0); litest_button_click(dev, BTN_LEFT, 0);
litest_touch_up(dev, 0); litest_touch_up(dev, 0);
@ -2717,7 +2717,7 @@ START_TEST(touchpad_left_handed_rotation)
return; return;
status = libinput_device_config_left_handed_set(d, 1); status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
@ -2727,7 +2727,7 @@ START_TEST(touchpad_left_handed_rotation)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
do { do {
struct libinput_event_pointer *p; struct libinput_event_pointer *p;
double x, y, ux, uy; double x, y, ux, uy;
@ -2740,15 +2740,15 @@ START_TEST(touchpad_left_handed_rotation)
uy = libinput_event_pointer_get_dy_unaccelerated(p); uy = libinput_event_pointer_get_dy_unaccelerated(p);
if (rotate) { if (rotate) {
ck_assert_double_lt(x, 0); litest_assert_double_lt(x, 0);
ck_assert_double_gt(y, 0); litest_assert_double_gt(y, 0);
ck_assert_double_lt(ux, 0); litest_assert_double_lt(ux, 0);
ck_assert_double_gt(uy, 0); litest_assert_double_gt(uy, 0);
} else { } else {
ck_assert_double_gt(x, 0); litest_assert_double_gt(x, 0);
ck_assert_double_lt(y, 0); litest_assert_double_lt(y, 0);
ck_assert_double_gt(ux, 0); litest_assert_double_gt(ux, 0);
ck_assert_double_lt(uy, 0); litest_assert_double_lt(uy, 0);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
@ -3434,7 +3434,7 @@ START_TEST(touchpad_trackpoint_mb_click)
status = libinput_device_config_scroll_set_method( status = libinput_device_config_scroll_set_method(
trackpoint->libinput_device, trackpoint->libinput_device,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_drain_events(li); litest_drain_events(li);
litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */ litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */
@ -3535,7 +3535,7 @@ START_TEST(touchpad_trackpoint_buttons_2fg_scroll)
0); 0);
val = litest_event_pointer_get_value(pev, val = litest_event_pointer_get_value(pev,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
ck_assert(val != 0.0); litest_assert(val != 0.0);
libinput_event_destroy(e); libinput_event_destroy(e);
} }
@ -3558,7 +3558,7 @@ START_TEST(touchpad_trackpoint_buttons_2fg_scroll)
0); 0);
val = litest_event_pointer_get_value(pev, val = litest_event_pointer_get_value(pev,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
ck_assert(val != 0.0); litest_assert(val != 0.0);
libinput_event_destroy(e); libinput_event_destroy(e);
} }
@ -3660,7 +3660,7 @@ START_TEST(touchpad_initial_state)
p1 = litest_is_motion_event(ev1); p1 = litest_is_motion_event(ev1);
p2 = litest_is_motion_event(ev2); p2 = litest_is_motion_event(ev2);
ck_assert_int_eq(libinput_event_get_type(ev1), litest_assert_int_eq(libinput_event_get_type(ev1),
libinput_event_get_type(ev2)); libinput_event_get_type(ev2));
litest_assert_double_eq(libinput_event_pointer_get_dx(p1), litest_assert_double_eq(libinput_event_pointer_get_dx(p1),
@ -4686,25 +4686,25 @@ START_TEST(touchpad_dwt_config_default_on)
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM ||
libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) { libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) {
ck_assert(!libinput_device_config_dwt_is_available(device)); litest_assert(!libinput_device_config_dwt_is_available(device));
return; return;
} }
ck_assert(libinput_device_config_dwt_is_available(device)); litest_assert(libinput_device_config_dwt_is_available(device));
state = libinput_device_config_dwt_get_enabled(device); state = libinput_device_config_dwt_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED);
state = libinput_device_config_dwt_get_default_enabled(device); state = libinput_device_config_dwt_get_default_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED);
status = libinput_device_config_dwt_set_enabled(device, status = libinput_device_config_dwt_set_enabled(device,
LIBINPUT_CONFIG_DWT_ENABLED); LIBINPUT_CONFIG_DWT_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwt_set_enabled(device, status = libinput_device_config_dwt_set_enabled(device,
LIBINPUT_CONFIG_DWT_DISABLED); LIBINPUT_CONFIG_DWT_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwt_set_enabled(device, 3); status = libinput_device_config_dwt_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -4716,25 +4716,25 @@ START_TEST(touchpad_dwtp_config_default_on)
enum libinput_config_dwtp_state state; enum libinput_config_dwtp_state state;
if (litest_touchpad_is_external(dev)) { if (litest_touchpad_is_external(dev)) {
ck_assert(!libinput_device_config_dwtp_is_available(device)); litest_assert(!libinput_device_config_dwtp_is_available(device));
return; return;
} }
ck_assert(libinput_device_config_dwtp_is_available(device)); litest_assert(libinput_device_config_dwtp_is_available(device));
state = libinput_device_config_dwtp_get_enabled(device); state = libinput_device_config_dwtp_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED);
state = libinput_device_config_dwtp_get_default_enabled(device); state = libinput_device_config_dwtp_get_default_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED);
status = libinput_device_config_dwtp_set_enabled(device, status = libinput_device_config_dwtp_set_enabled(device,
LIBINPUT_CONFIG_DWTP_ENABLED); LIBINPUT_CONFIG_DWTP_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwtp_set_enabled(device, status = libinput_device_config_dwtp_set_enabled(device,
LIBINPUT_CONFIG_DWTP_DISABLED); LIBINPUT_CONFIG_DWTP_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwtp_set_enabled(device, 3); status = libinput_device_config_dwtp_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -4745,21 +4745,21 @@ START_TEST(touchpad_dwt_config_default_off)
enum libinput_config_status status; enum libinput_config_status status;
enum libinput_config_dwt_state state; enum libinput_config_dwt_state state;
ck_assert(!libinput_device_config_dwt_is_available(device)); litest_assert(!libinput_device_config_dwt_is_available(device));
state = libinput_device_config_dwt_get_enabled(device); state = libinput_device_config_dwt_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED);
state = libinput_device_config_dwt_get_default_enabled(device); state = libinput_device_config_dwt_get_default_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED);
status = libinput_device_config_dwt_set_enabled(device, status = libinput_device_config_dwt_set_enabled(device,
LIBINPUT_CONFIG_DWT_ENABLED); LIBINPUT_CONFIG_DWT_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_dwt_set_enabled(device, status = libinput_device_config_dwt_set_enabled(device,
LIBINPUT_CONFIG_DWT_DISABLED); LIBINPUT_CONFIG_DWT_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwt_set_enabled(device, 3); status = libinput_device_config_dwt_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -4770,21 +4770,21 @@ START_TEST(touchpad_dwtp_config_default_off)
enum libinput_config_status status; enum libinput_config_status status;
enum libinput_config_dwtp_state state; enum libinput_config_dwtp_state state;
ck_assert(!libinput_device_config_dwtp_is_available(device)); litest_assert(!libinput_device_config_dwtp_is_available(device));
state = libinput_device_config_dwtp_get_enabled(device); state = libinput_device_config_dwtp_get_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED);
state = libinput_device_config_dwtp_get_default_enabled(device); state = libinput_device_config_dwtp_get_default_enabled(device);
ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED); litest_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED);
status = libinput_device_config_dwtp_set_enabled(device, status = libinput_device_config_dwtp_set_enabled(device,
LIBINPUT_CONFIG_DWTP_ENABLED); LIBINPUT_CONFIG_DWTP_ENABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
status = libinput_device_config_dwtp_set_enabled(device, status = libinput_device_config_dwtp_set_enabled(device,
LIBINPUT_CONFIG_DWTP_DISABLED); LIBINPUT_CONFIG_DWTP_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_dwtp_set_enabled(device, 3); status = libinput_device_config_dwtp_set_enabled(device, 3);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -5134,7 +5134,7 @@ START_TEST(touchpad_dwt_apple)
struct litest_device *apple_keyboard; struct litest_device *apple_keyboard;
struct libinput *li = touchpad->libinput; struct libinput *li = touchpad->libinput;
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
apple_keyboard = litest_add_device(li, LITEST_APPLE_KEYBOARD); apple_keyboard = litest_add_device(li, LITEST_APPLE_KEYBOARD);
litest_drain_events(li); litest_drain_events(li);
@ -5159,7 +5159,7 @@ START_TEST(touchpad_dwt_acer_hawaii)
struct litest_device *keyboard, *hawaii_keyboard; struct litest_device *keyboard, *hawaii_keyboard;
struct libinput *li = touchpad->libinput; struct libinput *li = touchpad->libinput;
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
/* Only the hawaii keyboard can trigger DWT */ /* Only the hawaii keyboard can trigger DWT */
keyboard = litest_add_device(li, LITEST_KEYBOARD); keyboard = litest_add_device(li, LITEST_KEYBOARD);
@ -5198,7 +5198,7 @@ START_TEST(touchpad_dwt_multiple_keyboards)
struct litest_device *k1, *k2; struct litest_device *k1, *k2;
struct libinput *li = touchpad->libinput; struct libinput *li = touchpad->libinput;
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
enable_dwt(touchpad); enable_dwt(touchpad);
@ -5239,7 +5239,7 @@ START_TEST(touchpad_dwt_remove_before_keyboard)
struct libinput *li = keyboard->libinput; struct libinput *li = keyboard->libinput;
touchpad = litest_add_device(li, LITEST_SYNAPTICS_RMI4); touchpad = litest_add_device(li, LITEST_SYNAPTICS_RMI4);
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
litest_dispatch(li); litest_dispatch(li);
@ -5255,7 +5255,7 @@ START_TEST(touchpad_dwt_multiple_keyboards_bothkeys)
struct litest_device *k1, *k2; struct litest_device *k1, *k2;
struct libinput *li = touchpad->libinput; struct libinput *li = touchpad->libinput;
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
enable_dwt(touchpad); enable_dwt(touchpad);
@ -5284,7 +5284,7 @@ START_TEST(touchpad_dwt_multiple_keyboards_bothkeys_modifier)
struct litest_device *k1, *k2; struct litest_device *k1, *k2;
struct libinput *li = touchpad->libinput; struct libinput *li = touchpad->libinput;
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
enable_dwt(touchpad); enable_dwt(touchpad);
@ -5321,9 +5321,9 @@ START_TEST(touchpad_dwt_multiple_keyboards_remove)
int which = _i; /* ranged test */ int which = _i; /* ranged test */
struct litest_device *removed, *remained; struct litest_device *removed, *remained;
ck_assert_int_le(which, 1); litest_assert_int_le(which, 1);
ck_assert(has_disable_while_typing(touchpad)); litest_assert(has_disable_while_typing(touchpad));
enable_dwt(touchpad); enable_dwt(touchpad);
@ -5854,8 +5854,8 @@ START_TEST(touchpad_slot_swap)
struct libinput_event_pointer *ptrev; struct libinput_event_pointer *ptrev;
ptrev = litest_is_motion_event(event); ptrev = litest_is_motion_event(event);
ck_assert_double_eq(libinput_event_pointer_get_dx(ptrev), 0.0); litest_assert_double_eq(libinput_event_pointer_get_dx(ptrev), 0.0);
ck_assert_double_lt(libinput_event_pointer_get_dy(ptrev), 1.0); litest_assert_double_lt(libinput_event_pointer_get_dy(ptrev), 1.0);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -5907,7 +5907,7 @@ START_TEST(touchpad_time_usec)
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
struct libinput_event_pointer *ptrev; struct libinput_event_pointer *ptrev;
@ -5916,7 +5916,7 @@ START_TEST(touchpad_time_usec)
ptrev = litest_is_motion_event(event); ptrev = litest_is_motion_event(event);
utime = libinput_event_pointer_get_time_usec(ptrev); utime = libinput_event_pointer_get_time_usec(ptrev);
ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), litest_assert_int_eq(libinput_event_pointer_get_time(ptrev),
(uint32_t) (utime / 1000)); (uint32_t) (utime / 1000));
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -5954,8 +5954,8 @@ START_TEST(touchpad_jump_finger_motion)
ptrev = litest_is_motion_event(event); ptrev = litest_is_motion_event(event);
dx = libinput_event_pointer_get_dx(ptrev); dx = libinput_event_pointer_get_dx(ptrev);
dy = libinput_event_pointer_get_dy(ptrev); dy = libinput_event_pointer_get_dy(ptrev);
ck_assert_int_lt(abs((int)dx), 20); litest_assert_int_lt(abs((int)dx), 20);
ck_assert_int_lt(abs((int)dy), 20); litest_assert_int_lt(abs((int)dy), 20);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -5994,8 +5994,8 @@ START_TEST(touchpad_jump_delta)
ptrev = litest_is_motion_event(event); ptrev = litest_is_motion_event(event);
dx = libinput_event_pointer_get_dx(ptrev); dx = libinput_event_pointer_get_dx(ptrev);
dy = libinput_event_pointer_get_dy(ptrev); dy = libinput_event_pointer_get_dy(ptrev);
ck_assert_int_lt(abs((int)dx), 20); litest_assert_int_lt(abs((int)dx), 20);
ck_assert_int_lt(abs((int)dy), 20); litest_assert_int_lt(abs((int)dy), 20);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
@ -6015,7 +6015,7 @@ START_TEST(touchpad_disabled_on_mouse)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
dev->libinput_device, dev->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -6052,7 +6052,7 @@ START_TEST(touchpad_disabled_on_mouse_suspend_mouse)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
dev->libinput_device, dev->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -6066,7 +6066,7 @@ START_TEST(touchpad_disabled_on_mouse_suspend_mouse)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
mouse->libinput_device, mouse->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -6095,7 +6095,7 @@ START_TEST(touchpad_disabled_double_mouse)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
dev->libinput_device, dev->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -6141,7 +6141,7 @@ START_TEST(touchpad_disabled_double_mouse_one_suspended)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
dev->libinput_device, dev->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -6156,7 +6156,7 @@ START_TEST(touchpad_disabled_double_mouse_one_suspended)
status = libinput_device_config_send_events_set_mode( status = libinput_device_config_send_events_set_mode(
mouse1->libinput_device, mouse1->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 0, 20, 30);
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10);
@ -7255,13 +7255,13 @@ START_TEST(touchpad_fuzz)
struct libevdev *evdev = dev->evdev; struct libevdev *evdev = dev->evdev;
/* We expect our udev callout to always set this to 0 */ /* We expect our udev callout to always set this to 0 */
ck_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_X), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_X), 0);
ck_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_Y), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_Y), 0);
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X)) if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X))
ck_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_X), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_X), 0);
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
ck_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_Y), 0); litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_Y), 0);
} }
END_TEST END_TEST

View file

@ -38,12 +38,12 @@ START_TEST(trackball_rotation_config_defaults)
struct libinput_device *device = dev->libinput_device; struct libinput_device *device = dev->libinput_device;
int angle; int angle;
ck_assert(libinput_device_config_rotation_is_available(device)); litest_assert(libinput_device_config_rotation_is_available(device));
angle = libinput_device_config_rotation_get_angle(device); angle = libinput_device_config_rotation_get_angle(device);
ck_assert_int_eq(angle, 0); litest_assert_int_eq(angle, 0);
angle = libinput_device_config_rotation_get_default_angle(device); angle = libinput_device_config_rotation_get_default_angle(device);
ck_assert_int_eq(angle, 0); litest_assert_int_eq(angle, 0);
} }
END_TEST END_TEST
@ -54,11 +54,11 @@ START_TEST(trackball_rotation_config_invalid_range)
enum libinput_config_status status; enum libinput_config_status status;
status = libinput_device_config_rotation_set_angle(device, 360); status = libinput_device_config_rotation_set_angle(device, 360);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_rotation_set_angle(device, 361); status = libinput_device_config_rotation_set_angle(device, 361);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
status = libinput_device_config_rotation_set_angle(device, -1); status = libinput_device_config_rotation_set_angle(device, -1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
} }
END_TEST END_TEST
@ -69,21 +69,21 @@ START_TEST(trackball_rotation_config_no_rotation)
enum libinput_config_status status; enum libinput_config_status status;
int angle; int angle;
ck_assert(!libinput_device_config_rotation_is_available(device)); litest_assert(!libinput_device_config_rotation_is_available(device));
angle = libinput_device_config_rotation_get_angle(device); angle = libinput_device_config_rotation_get_angle(device);
ck_assert_int_eq(angle, 0); litest_assert_int_eq(angle, 0);
angle = libinput_device_config_rotation_get_default_angle(device); angle = libinput_device_config_rotation_get_default_angle(device);
ck_assert_int_eq(angle, 0); litest_assert_int_eq(angle, 0);
/* 0 always succeeds */ /* 0 always succeeds */
status = libinput_device_config_rotation_set_angle(device, 0); status = libinput_device_config_rotation_set_angle(device, 0);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
for (angle = 1; angle < 360; angle++) { for (angle = 1; angle < 360; angle++) {
status = libinput_device_config_rotation_set_angle(device, status = libinput_device_config_rotation_set_angle(device,
angle); angle);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
} }
} }
END_TEST END_TEST
@ -95,12 +95,12 @@ START_TEST(trackball_rotation_config_right_angle)
enum libinput_config_status status; enum libinput_config_status status;
int angle; int angle;
ck_assert(libinput_device_config_rotation_is_available(device)); litest_assert(libinput_device_config_rotation_is_available(device));
for (angle = 0; angle < 360; angle += 90) { for (angle = 0; angle < 360; angle += 90) {
status = libinput_device_config_rotation_set_angle(device, status = libinput_device_config_rotation_set_angle(device,
angle); angle);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
} }
END_TEST END_TEST
@ -112,12 +112,12 @@ START_TEST(trackball_rotation_config_odd_angle)
enum libinput_config_status status; enum libinput_config_status status;
int angle; int angle;
ck_assert(libinput_device_config_rotation_is_available(device)); litest_assert(libinput_device_config_rotation_is_available(device));
for (angle = 0; angle < 360; angle++) { for (angle = 0; angle < 360; angle++) {
status = libinput_device_config_rotation_set_angle(device, status = libinput_device_config_rotation_set_angle(device,
angle); angle);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
} }
} }
END_TEST END_TEST
@ -151,20 +151,20 @@ START_TEST(trackball_rotation_x)
switch (angle) { switch (angle) {
case 0: case 0:
ck_assert_double_eq(dx, 1.0); litest_assert_double_eq(dx, 1.0);
ck_assert_double_eq(dy, 0.0); litest_assert_double_eq(dy, 0.0);
break; break;
case 90: case 90:
ck_assert_double_eq(dx, 0.0); litest_assert_double_eq(dx, 0.0);
ck_assert_double_eq(dy, 1.0); litest_assert_double_eq(dy, 1.0);
break; break;
case 180: case 180:
ck_assert_double_eq(dx, -1.0); litest_assert_double_eq(dx, -1.0);
ck_assert_double_eq(dy, 0.0); litest_assert_double_eq(dy, 0.0);
break; break;
case 270: case 270:
ck_assert_double_eq(dx, 0.0); litest_assert_double_eq(dx, 0.0);
ck_assert_double_eq(dy, -1.0); litest_assert_double_eq(dy, -1.0);
break; break;
} }
libinput_event_destroy(event); libinput_event_destroy(event);
@ -201,20 +201,20 @@ START_TEST(trackball_rotation_y)
switch (angle) { switch (angle) {
case 0: case 0:
ck_assert_double_eq(dx, 0.0); litest_assert_double_eq(dx, 0.0);
ck_assert_double_eq(dy, 1.0); litest_assert_double_eq(dy, 1.0);
break; break;
case 90: case 90:
ck_assert_double_eq(dx, -1.0); litest_assert_double_eq(dx, -1.0);
ck_assert_double_eq(dy, 0.0); litest_assert_double_eq(dy, 0.0);
break; break;
case 180: case 180:
ck_assert_double_eq(dx, 0.0); litest_assert_double_eq(dx, 0.0);
ck_assert_double_eq(dy, -1.0); litest_assert_double_eq(dy, -1.0);
break; break;
case 270: case 270:
ck_assert_double_eq(dx, 1.0); litest_assert_double_eq(dx, 1.0);
ck_assert_double_eq(dy, 0.0); litest_assert_double_eq(dy, 0.0);
break; break;
} }
libinput_event_destroy(event); libinput_event_destroy(event);
@ -249,8 +249,8 @@ START_TEST(trackball_rotation_accel)
dx = libinput_event_pointer_get_dx(ptrev); dx = libinput_event_pointer_get_dx(ptrev);
dy = libinput_event_pointer_get_dy(ptrev); dy = libinput_event_pointer_get_dy(ptrev);
ck_assert_double_lt(dx, 0.0); litest_assert_double_lt(dx, 0.0);
ck_assert_double_gt(dy, 0.0); litest_assert_double_gt(dy, 0.0);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
END_TEST END_TEST

View file

@ -69,7 +69,7 @@ START_TEST(trackpoint_middlebutton)
rtime = libinput_event_pointer_get_time(ptrev); rtime = libinput_event_pointer_get_time(ptrev);
libinput_event_destroy(event); libinput_event_destroy(event);
ck_assert_int_lt(ptime, rtime); litest_assert_int_lt(ptime, rtime);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
} }
@ -135,7 +135,7 @@ START_TEST(trackpoint_middlebutton_noscroll)
litest_assert_button_event(li, BTN_MIDDLE, 1); litest_assert_button_event(li, BTN_MIDDLE, 1);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION); litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -165,7 +165,7 @@ START_TEST(trackpoint_scroll_source)
while ((event = libinput_get_event(li))) { while ((event = libinput_get_event(li))) {
ptrev = libinput_event_get_pointer_event(event); ptrev = libinput_event_get_pointer_event(event);
ck_assert_int_eq(litest_event_pointer_get_axis_source(ptrev), litest_assert_int_eq(litest_event_pointer_get_axis_source(ptrev),
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -189,7 +189,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
/* touchpad right-handed, trackpoint left-handed */ /* touchpad right-handed, trackpoint left-handed */
status = libinput_device_config_left_handed_set( status = libinput_device_config_left_handed_set(
trackpoint->libinput_device, 1); trackpoint->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5); litest_touch_down(touchpad, 0, 5, 5);
litest_dispatch(li); litest_dispatch(li);
@ -201,7 +201,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
BTN_RIGHT, BTN_RIGHT,
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_button_click_debounced(touchpad, li, BTN_LEFT, false); litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
@ -211,7 +211,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
BTN_RIGHT, BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_delete_device(trackpoint); litest_delete_device(trackpoint);
@ -234,7 +234,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
/* touchpad left-handed, trackpoint right-handed */ /* touchpad left-handed, trackpoint right-handed */
status = libinput_device_config_left_handed_set( status = libinput_device_config_left_handed_set(
touchpad->libinput_device, 1); touchpad->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5); litest_touch_down(touchpad, 0, 5, 5);
litest_dispatch(li); litest_dispatch(li);
@ -244,7 +244,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
event = libinput_get_event(li); event = libinput_get_event(li);
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_button_click_debounced(touchpad, li, BTN_LEFT, false); litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
@ -254,7 +254,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
BTN_LEFT, BTN_LEFT,
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_delete_device(trackpoint); litest_delete_device(trackpoint);
@ -277,10 +277,10 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
/* touchpad left-handed, trackpoint left-handed */ /* touchpad left-handed, trackpoint left-handed */
status = libinput_device_config_left_handed_set( status = libinput_device_config_left_handed_set(
touchpad->libinput_device, 1); touchpad->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_left_handed_set( status = libinput_device_config_left_handed_set(
trackpoint->libinput_device, 1); trackpoint->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); litest_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5); litest_touch_down(touchpad, 0, 5, 5);
litest_dispatch(li); litest_dispatch(li);
@ -292,7 +292,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
BTN_RIGHT, BTN_RIGHT,
LIBINPUT_BUTTON_STATE_PRESSED); LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_button_click_debounced(touchpad, li, BTN_LEFT, false); litest_button_click_debounced(touchpad, li, BTN_LEFT, false);
@ -302,7 +302,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
BTN_RIGHT, BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED); LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device); litest_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event); libinput_event_destroy(event);
litest_delete_device(trackpoint); litest_delete_device(trackpoint);

View file

@ -57,17 +57,17 @@ START_TEST(udev_create_NULL)
udev = udev_new(); udev = udev_new();
li = libinput_udev_create_context(NULL, NULL, NULL); li = libinput_udev_create_context(NULL, NULL, NULL);
ck_assert(li == NULL); litest_assert(li == NULL);
li = libinput_udev_create_context(&simple_interface, NULL, NULL); li = libinput_udev_create_context(&simple_interface, NULL, NULL);
ck_assert(li == NULL); litest_assert(li == NULL);
li = libinput_udev_create_context(NULL, NULL, udev); li = libinput_udev_create_context(NULL, NULL, udev);
ck_assert(li == NULL); litest_assert(li == NULL);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1); litest_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -82,19 +82,19 @@ START_TEST(udev_create_seat0)
int fd; int fd;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li); fd = libinput_get_fd(li);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
/* expect at least one event */ /* expect at least one event */
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
libinput_event_destroy(event); libinput_event_destroy(event);
libinput_unref(li); libinput_unref(li);
@ -110,19 +110,19 @@ START_TEST(udev_create_empty_seat)
int fd; int fd;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
/* expect a libinput reference, but no events */ /* expect a libinput reference, but no events */
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seatdoesntexist"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seatdoesntexist"), 0);
fd = libinput_get_fd(li); fd = libinput_get_fd(li);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert(event == NULL); litest_assert(event == NULL);
libinput_event_destroy(event); libinput_event_destroy(event);
libinput_unref(li); libinput_unref(li);
@ -140,13 +140,13 @@ START_TEST(udev_create_seat_too_long)
seatname[sizeof(seatname) - 1] = '\0'; seatname[sizeof(seatname) - 1] = '\0';
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
litest_set_log_handler_bug(li); litest_set_log_handler_bug(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, seatname), -1); litest_assert_int_eq(libinput_udev_assign_seat(li, seatname), -1);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
@ -162,13 +162,13 @@ START_TEST(udev_set_user_data)
int data1, data2; int data1, data2;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, &data1, udev); li = libinput_udev_create_context(&simple_interface, &data1, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert(libinput_get_user_data(li) == &data1); litest_assert(libinput_get_user_data(li) == &data1);
libinput_set_user_data(li, &data2); libinput_set_user_data(li, &data2);
ck_assert(libinput_get_user_data(li) == &data2); litest_assert(libinput_get_user_data(li) == &data2);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -186,11 +186,11 @@ START_TEST(udev_added_seat_default)
struct litest_device *dev; struct litest_device *dev;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
/* Drop any events from other devices */ /* Drop any events from other devices */
@ -204,10 +204,10 @@ START_TEST(udev_added_seat_default)
event = libinput_get_event(li); event = libinput_get_event(li);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
seat = libinput_device_get_seat(device); seat = libinput_device_get_seat(device);
ck_assert_notnull(seat); litest_assert_notnull(seat);
seat_name = libinput_seat_get_logical_name(seat); seat_name = libinput_seat_get_logical_name(seat);
ck_assert_str_eq(seat_name, "default"); litest_assert_str_eq(seat_name, "default");
libinput_event_destroy(event); libinput_event_destroy(event);
libinput_unref(li); libinput_unref(li);
@ -230,11 +230,11 @@ START_TEST(udev_change_seat)
struct litest_device *dev; struct litest_device *dev;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
/* Drop any events from other devices */ /* Drop any events from other devices */
@ -260,29 +260,29 @@ START_TEST(udev_change_seat)
/* Changing the logical seat name will remove and re-add the device */ /* Changing the logical seat name will remove and re-add the device */
rc = libinput_device_set_seat_logical_name(device, rc = libinput_device_set_seat_logical_name(device,
seat2_name); seat2_name);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_DEVICE_REMOVED); LIBINPUT_EVENT_DEVICE_REMOVED);
ck_assert(libinput_event_get_device(event) == device); litest_assert(libinput_event_get_device(event) == device);
libinput_event_destroy(event); libinput_event_destroy(event);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_int_eq(libinput_event_get_type(event), litest_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_DEVICE_ADDED); LIBINPUT_EVENT_DEVICE_ADDED);
ck_assert(libinput_event_get_device(event) != device); litest_assert(libinput_event_get_device(event) != device);
libinput_device_unref(device); libinput_device_unref(device);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
seat2 = libinput_device_get_seat(device); seat2 = libinput_device_get_seat(device);
ck_assert_str_ne(libinput_seat_get_logical_name(seat2), litest_assert_str_ne(libinput_seat_get_logical_name(seat2),
seat1_name); seat1_name);
ck_assert_str_eq(libinput_seat_get_logical_name(seat2), litest_assert_str_eq(libinput_seat_get_logical_name(seat2),
seat2_name); seat2_name);
libinput_event_destroy(event); libinput_event_destroy(event);
@ -303,19 +303,19 @@ START_TEST(udev_double_suspend)
int fd; int fd;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li); fd = libinput_get_fd(li);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
/* expect at least one event */ /* expect at least one event */
ck_assert_int_ge(litest_dispatch(li), 0); litest_assert_int_ge(litest_dispatch(li), 0);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
libinput_suspend(li); libinput_suspend(li);
libinput_suspend(li); libinput_suspend(li);
@ -335,19 +335,19 @@ START_TEST(udev_double_resume)
int fd; int fd;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li); fd = libinput_get_fd(li);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
/* expect at least one event */ /* expect at least one event */
ck_assert_int_ge(litest_dispatch(li), 0); litest_assert_int_ge(litest_dispatch(li), 0);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
libinput_suspend(li); libinput_suspend(li);
libinput_resume(li); libinput_resume(li);
@ -387,31 +387,31 @@ START_TEST(udev_suspend_resume)
int num_devices = 0; int num_devices = 0;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li); fd = libinput_get_fd(li);
ck_assert_int_ge(fd, 0); litest_assert_int_ge(fd, 0);
/* Check that at least one device was discovered after creation. */ /* Check that at least one device was discovered after creation. */
ck_assert_int_ge(litest_dispatch(li), 0); litest_assert_int_ge(litest_dispatch(li), 0);
process_events_count_devices(li, &num_devices); process_events_count_devices(li, &num_devices);
ck_assert_int_gt(num_devices, 0); litest_assert_int_gt(num_devices, 0);
/* Check that after a suspend, no devices are left. */ /* Check that after a suspend, no devices are left. */
libinput_suspend(li); libinput_suspend(li);
ck_assert_int_ge(litest_dispatch(li), 0); litest_assert_int_ge(litest_dispatch(li), 0);
process_events_count_devices(li, &num_devices); process_events_count_devices(li, &num_devices);
ck_assert_int_eq(num_devices, 0); litest_assert_int_eq(num_devices, 0);
/* Check that after a resume, at least one device is discovered. */ /* Check that after a resume, at least one device is discovered. */
libinput_resume(li); libinput_resume(li);
ck_assert_int_ge(litest_dispatch(li), 0); litest_assert_int_ge(litest_dispatch(li), 0);
process_events_count_devices(li, &num_devices); process_events_count_devices(li, &num_devices);
ck_assert_int_gt(num_devices, 0); litest_assert_int_gt(num_devices, 0);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -425,13 +425,13 @@ START_TEST(udev_resume_before_seat)
int rc; int rc;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
rc = libinput_resume(li); rc = libinput_resume(li);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -445,14 +445,14 @@ START_TEST(udev_suspend_resume_before_seat)
int rc; int rc;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
libinput_suspend(li); libinput_suspend(li);
rc = libinput_resume(li); rc = libinput_resume(li);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -468,11 +468,11 @@ START_TEST(udev_device_sysname)
struct udev *udev; struct udev *udev;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
@ -485,10 +485,10 @@ START_TEST(udev_device_sysname)
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
sysname = libinput_device_get_sysname(device); sysname = libinput_device_get_sysname(device);
ck_assert_notnull(sysname); litest_assert_notnull(sysname);
ck_assert_int_gt(strlen(sysname), 1); litest_assert_int_gt(strlen(sysname), 1);
ck_assert(strchr(sysname, '/') == NULL); litest_assert(strchr(sysname, '/') == NULL);
ck_assert(strneq(sysname, "event", 5)); litest_assert(strneq(sysname, "event", 5));
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
@ -510,11 +510,11 @@ START_TEST(udev_seat_recycle)
void *user_data; void *user_data;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
while ((ev = libinput_get_event(li))) { while ((ev = libinput_get_event(li))) {
@ -524,7 +524,7 @@ START_TEST(udev_seat_recycle)
break; break;
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
ck_assert_notnull(device); litest_assert_notnull(device);
saved_seat = libinput_device_get_seat(device); saved_seat = libinput_device_get_seat(device);
libinput_seat_set_user_data(saved_seat, &data); libinput_seat_set_user_data(saved_seat, &data);
libinput_seat_ref(saved_seat); libinput_seat_ref(saved_seat);
@ -536,7 +536,7 @@ START_TEST(udev_seat_recycle)
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
ck_assert_notnull(saved_seat); litest_assert_notnull(saved_seat);
libinput_suspend(li); libinput_suspend(li);
@ -549,13 +549,13 @@ START_TEST(udev_seat_recycle)
switch (libinput_event_get_type(ev)) { switch (libinput_event_get_type(ev)) {
case LIBINPUT_EVENT_DEVICE_ADDED: case LIBINPUT_EVENT_DEVICE_ADDED:
device = libinput_event_get_device(ev); device = libinput_event_get_device(ev);
ck_assert_notnull(device); litest_assert_notnull(device);
seat = libinput_device_get_seat(device); seat = libinput_device_get_seat(device);
user_data = libinput_seat_get_user_data(seat); user_data = libinput_seat_get_user_data(seat);
if (user_data == &data) { if (user_data == &data) {
found = 1; found = 1;
ck_assert(seat == saved_seat); litest_assert(seat == saved_seat);
} }
break; break;
default: default:
@ -565,7 +565,7 @@ START_TEST(udev_seat_recycle)
libinput_event_destroy(ev); libinput_event_destroy(ev);
} }
ck_assert(found == 1); litest_assert(found == 1);
libinput_unref(li); libinput_unref(li);
udev_unref(udev); udev_unref(udev);
@ -579,15 +579,15 @@ START_TEST(udev_path_add_device)
struct libinput_device *device; struct libinput_device *device;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_set_log_handler_bug(li); litest_set_log_handler_bug(li);
device = libinput_path_add_device(li, "/dev/input/event0"); device = libinput_path_add_device(li, "/dev/input/event0");
ck_assert(device == NULL); litest_assert(device == NULL);
litest_restore_log_handler(li); litest_restore_log_handler(li);
libinput_unref(li); libinput_unref(li);
@ -603,17 +603,17 @@ START_TEST(udev_path_remove_device)
struct libinput_event *event; struct libinput_event *event;
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED); litest_wait_for_event_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED);
event = libinput_get_event(li); event = libinput_get_event(li);
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
ck_assert_notnull(device); litest_assert_notnull(device);
/* no effect bug a bug log msg */ /* no effect bug a bug log msg */
litest_set_log_handler_bug(li); litest_set_log_handler_bug(li);
@ -639,17 +639,17 @@ START_TEST(udev_ignore_device)
devname = libevdev_get_name(dev->evdev); devname = libevdev_get_name(dev->evdev);
udev = udev_new(); udev = udev_new();
ck_assert_notnull(udev); litest_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev); li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li); litest_assert_notnull(li);
litest_restore_log_handler(li); litest_restore_log_handler(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); litest_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_dispatch(li); litest_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
ck_assert_notnull(event); litest_assert_notnull(event);
while (event) { while (event) {
if (libinput_event_get_type(event) == if (libinput_event_get_type(event) ==
LIBINPUT_EVENT_DEVICE_ADDED) { LIBINPUT_EVENT_DEVICE_ADDED) {
@ -657,7 +657,7 @@ START_TEST(udev_ignore_device)
device = libinput_event_get_device(event); device = libinput_event_get_device(event);
name = libinput_device_get_name(device); name = libinput_device_get_name(device);
ck_assert_str_ne(devname, name); litest_assert_str_ne(devname, name);
} }
libinput_event_destroy(event); libinput_event_destroy(event);
litest_dispatch(li); litest_dispatch(li);