Commit 13c7b47d authored by Peter Hutterer's avatar Peter Hutterer

test: convert all helper functions to use the litest macros

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent b8af89f1
......@@ -827,7 +827,7 @@ assert_device_ignored(struct libinput *li, struct input_absinfo *absinfo)
-1);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device == NULL);
litest_assert_ptr_null(device);
libevdev_uinput_destroy(uinput);
}
......
......@@ -58,8 +58,8 @@ simple_log_handler(struct libinput *libinput,
{
log_handler_called++;
if (log_handler_context)
ck_assert(libinput == log_handler_context);
ck_assert(format != NULL);
litest_assert_ptr_eq(libinput, log_handler_context);
litest_assert_notnull(format);
}
START_TEST(log_default_priority)
......
......@@ -64,7 +64,7 @@ create_simple_test_device(const char *name, ...)
};
evdev = libevdev_new();
ck_assert(evdev != NULL);
litest_assert_notnull(evdev);
libevdev_set_name(evdev, name);
va_start(args, name);
......@@ -82,7 +82,7 @@ create_simple_test_device(const char *name, ...)
rc = libevdev_uinput_create_from_device(evdev,
LIBEVDEV_UINPUT_OPEN_MANAGED,
&uinput);
ck_assert_int_eq(rc, 0);
litest_assert_int_eq(rc, 0);
libevdev_free(evdev);
return uinput;
......
......@@ -53,7 +53,7 @@ get_accelerated_motion_event(struct libinput *li)
return ptrev;
}
ck_abort_msg("No accelerated pointer motion event found");
litest_abort_msg("No accelerated pointer motion event found");
return NULL;
}
......@@ -90,11 +90,11 @@ test_relative_event(struct litest_device *dev, int dx, int dy)
actual_dir = atan2(ev_dx, ev_dy);
/* Check the length of the motion vector (tolerate 1.0 indifference). */
ck_assert(fabs(expected_length) >= actual_length);
litest_assert(fabs(expected_length) >= actual_length);
/* Check the direction of the motion vector (tolerate 2π/4 radians
* indifference). */
ck_assert(fabs(expected_dir - actual_dir) < M_PI_2);
litest_assert(fabs(expected_dir - actual_dir) < M_PI_2);
libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev));
......@@ -112,7 +112,7 @@ disable_button_scrolling(struct litest_device *device)
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
ck_assert_int_eq(status, expected);
litest_assert_int_eq(status, expected);
}
START_TEST(pointer_motion_relative)
......@@ -146,16 +146,16 @@ test_absolute_event(struct litest_device *dev, double x, double y)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event), type);
litest_assert_notnull(event);
litest_assert_int_eq(libinput_event_get_type(event), type);
ptrev = libinput_event_get_pointer_event(event);
ck_assert(ptrev != NULL);
litest_assert(ptrev != NULL);
ex = libinput_event_pointer_get_absolute_x_transformed(ptrev, 100);
ey = libinput_event_pointer_get_absolute_y_transformed(ptrev, 100);
ck_assert_int_eq((int)(ex + 0.5), (int)x);
ck_assert_int_eq((int)(ey + 0.5), (int)y);
litest_assert_int_eq((int)(ex + 0.5), (int)x);
litest_assert_int_eq((int)(ey + 0.5), (int)y);
libinput_event_destroy(event);
}
......@@ -192,8 +192,8 @@ test_unaccel_event(struct litest_device *dev, int dx, int dy)
ev_dx = libinput_event_pointer_get_dx_unaccelerated(ptrev);
ev_dy = libinput_event_pointer_get_dy_unaccelerated(ptrev);
ck_assert_int_eq(dx, ev_dx);
ck_assert_int_eq(dy, ev_dy);
litest_assert_int_eq(dx, ev_dx);
litest_assert_int_eq(dy, ev_dy);
libinput_event_destroy(event);
......@@ -383,10 +383,10 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
axis,
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
ck_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev, axis),
litest_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev, axis),
expected);
ck_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis),
discrete);
litest_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis),
discrete);
libinput_event_destroy(event);
}
......
......@@ -2936,13 +2936,14 @@ END_TEST
static void
enable_edge_scroll(struct litest_device *dev)
{
enum libinput_config_status status;
enum libinput_config_status status, expected;
struct libinput_device *device = dev->libinput_device;
status = libinput_device_config_scroll_set_method(device,
LIBINPUT_CONFIG_SCROLL_EDGE);
ck_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_SUCCESS);
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
litest_assert_int_eq(status, expected);
}
START_TEST(touchpad_edge_scroll)
......@@ -4265,7 +4266,7 @@ assert_btnevent_from_device(struct litest_device *device,
e = libinput_get_event(li);
litest_is_button_event(e, button, state);
ck_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device);
litest_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device);
libinput_event_destroy(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment