/* Expect only one message per 5 min */
ck_assert_int_eq(axisrange_log_handler_called, 1);
+ libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR);
litest_restore_log_handler(li);
axisrange_log_handler_called = 0;
}
EV_KEY, BTN_LEFT,
-1, -1);
li = libinput_path_create_context(&simple_interface, NULL);
+ litest_restore_log_handler(li); /* use the default litest handler */
libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput));
libinput_dispatch(li);
.close_restricted = close_restricted_leak,
};
-LIBINPUT_ATTRIBUTE_PRINTF(3, 0)
-static void
-simple_log_handler(struct libinput *libinput,
- enum libinput_log_priority priority,
- const char *format,
- va_list args)
-{
- vfprintf(stderr, format, args);
-}
-
START_TEST(fd_no_event_leak)
{
struct libevdev_uinput *uinput;
ck_assert_int_gt(fd, -1);
li = libinput_path_create_context(&leak_interface, &fd);
- libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG);
- libinput_log_set_handler(li, simple_log_handler);
+ litest_restore_log_handler(li); /* use the default litest handler */
/* Add the device, trigger an event, then remove it again.
* Without it, we get a SYN_DROPPED immediately and no events.
li = libinput_path_create_context(&simple_interface, NULL);
ck_assert(li != NULL);
+
+ litest_disable_log_handler(li);
+
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
ck_assert_int_eq(open_func_count, 0);
ck_assert_int_eq(close_func_count, 0);
+ litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 0);
li = libinput_path_create_context(&simple_interface, NULL);
ck_assert(li != NULL);
+
+ litest_disable_log_handler(li);
+
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
ck_assert_int_eq(open_func_count, 1);
ck_assert_int_eq(close_func_count, 1);
+ litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 1);
li = libinput_path_create_context(&simple_interface, NULL);
unlink(path);
+ litest_disable_log_handler(li);
+
ck_assert(li != NULL);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
ck_assert_int_eq(open_func_count, 0);
ck_assert_int_eq(close_func_count, 0);
+ litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 0);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
+
+ litest_disable_log_handler(li);
+
ck_assert(libinput_get_user_data(li) == userdata);
device = libinput_path_add_device(li,
dev = litest_current_device();
libinput = dev->libinput;
+ litest_disable_log_handler(libinput);
/* note: this test is a false negative, libevdev will filter
* tracking IDs re-used in the same slot. */
-
litest_touch_down(dev, 0, 0, 0);
litest_touch_down(dev, 0, 0, 0);
litest_touch_up(dev, 0);
litest_touch_up(dev, 0);
-
libinput_dispatch(libinput);
+ litest_restore_log_handler(libinput);
while ((ev = libinput_get_event(libinput))) {
switch (libinput_event_get_type(ev)) {