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) ...@@ -827,7 +827,7 @@ assert_device_ignored(struct libinput *li, struct input_absinfo *absinfo)
-1); -1);
device = libinput_path_add_device(li, device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput)); libevdev_uinput_get_devnode(uinput));
ck_assert(device == NULL); litest_assert_ptr_null(device);
libevdev_uinput_destroy(uinput); libevdev_uinput_destroy(uinput);
} }
......
...@@ -58,8 +58,8 @@ simple_log_handler(struct libinput *libinput, ...@@ -58,8 +58,8 @@ simple_log_handler(struct libinput *libinput,
{ {
log_handler_called++; log_handler_called++;
if (log_handler_context) if (log_handler_context)
ck_assert(libinput == log_handler_context); litest_assert_ptr_eq(libinput, log_handler_context);
ck_assert(format != NULL); litest_assert_notnull(format);
} }
START_TEST(log_default_priority) START_TEST(log_default_priority)
......
...@@ -64,7 +64,7 @@ create_simple_test_device(const char *name, ...) ...@@ -64,7 +64,7 @@ create_simple_test_device(const char *name, ...)
}; };
evdev = libevdev_new(); evdev = libevdev_new();
ck_assert(evdev != NULL); litest_assert_notnull(evdev);
libevdev_set_name(evdev, name); libevdev_set_name(evdev, name);
va_start(args, name); va_start(args, name);
...@@ -82,7 +82,7 @@ create_simple_test_device(const char *name, ...) ...@@ -82,7 +82,7 @@ create_simple_test_device(const char *name, ...)
rc = libevdev_uinput_create_from_device(evdev, rc = libevdev_uinput_create_from_device(evdev,
LIBEVDEV_UINPUT_OPEN_MANAGED, LIBEVDEV_UINPUT_OPEN_MANAGED,
&uinput); &uinput);
ck_assert_int_eq(rc, 0); litest_assert_int_eq(rc, 0);
libevdev_free(evdev); libevdev_free(evdev);
return uinput; return uinput;
......
...@@ -53,7 +53,7 @@ get_accelerated_motion_event(struct libinput *li) ...@@ -53,7 +53,7 @@ get_accelerated_motion_event(struct libinput *li)
return ptrev; return ptrev;
} }
ck_abort_msg("No accelerated pointer motion event found"); litest_abort_msg("No accelerated pointer motion event found");
return NULL; return NULL;
} }
...@@ -90,11 +90,11 @@ test_relative_event(struct litest_device *dev, int dx, int dy) ...@@ -90,11 +90,11 @@ test_relative_event(struct litest_device *dev, int dx, int dy)
actual_dir = atan2(ev_dx, ev_dy); actual_dir = atan2(ev_dx, ev_dy);
/* Check the length of the motion vector (tolerate 1.0 indifference). */ /* 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 /* Check the direction of the motion vector (tolerate 2π/4 radians
* indifference). */ * 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)); libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev));
...@@ -112,7 +112,7 @@ disable_button_scrolling(struct litest_device *device) ...@@ -112,7 +112,7 @@ disable_button_scrolling(struct litest_device *device)
LIBINPUT_CONFIG_SCROLL_NO_SCROLL); LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
expected = LIBINPUT_CONFIG_STATUS_SUCCESS; expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
ck_assert_int_eq(status, expected); litest_assert_int_eq(status, expected);
} }
START_TEST(pointer_motion_relative) START_TEST(pointer_motion_relative)
...@@ -146,16 +146,16 @@ test_absolute_event(struct litest_device *dev, double x, double y) ...@@ -146,16 +146,16 @@ test_absolute_event(struct litest_device *dev, double x, double y)
libinput_dispatch(li); libinput_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), type); litest_assert_int_eq(libinput_event_get_type(event), type);
ptrev = libinput_event_get_pointer_event(event); 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); ex = libinput_event_pointer_get_absolute_x_transformed(ptrev, 100);
ey = libinput_event_pointer_get_absolute_y_transformed(ptrev, 100); ey = libinput_event_pointer_get_absolute_y_transformed(ptrev, 100);
ck_assert_int_eq((int)(ex + 0.5), (int)x); litest_assert_int_eq((int)(ex + 0.5), (int)x);
ck_assert_int_eq((int)(ey + 0.5), (int)y); litest_assert_int_eq((int)(ey + 0.5), (int)y);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
...@@ -192,8 +192,8 @@ test_unaccel_event(struct litest_device *dev, int dx, int dy) ...@@ -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_dx = libinput_event_pointer_get_dx_unaccelerated(ptrev);
ev_dy = libinput_event_pointer_get_dy_unaccelerated(ptrev); ev_dy = libinput_event_pointer_get_dy_unaccelerated(ptrev);
ck_assert_int_eq(dx, ev_dx); litest_assert_int_eq(dx, ev_dx);
ck_assert_int_eq(dy, ev_dy); litest_assert_int_eq(dy, ev_dy);
libinput_event_destroy(event); libinput_event_destroy(event);
...@@ -383,10 +383,10 @@ test_wheel_event(struct litest_device *dev, int which, int amount) ...@@ -383,10 +383,10 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
axis, axis,
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL); 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); expected);
ck_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis), litest_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis),
discrete); discrete);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
......
...@@ -2936,13 +2936,14 @@ END_TEST ...@@ -2936,13 +2936,14 @@ END_TEST
static void static void
enable_edge_scroll(struct litest_device *dev) 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; struct libinput_device *device = dev->libinput_device;
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); expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
litest_assert_int_eq(status, expected);
} }
START_TEST(touchpad_edge_scroll) START_TEST(touchpad_edge_scroll)
...@@ -4265,7 +4266,7 @@ assert_btnevent_from_device(struct litest_device *device, ...@@ -4265,7 +4266,7 @@ assert_btnevent_from_device(struct litest_device *device,
e = libinput_get_event(li); e = libinput_get_event(li);
litest_is_button_event(e, button, state); 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); 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