test: don't use enum values in ck_assert macros directly

Unfortunately, typeof(enum something) != typeof(ENUM_VALUE) and produces a
-Wsign-compare warning

Preemptively fix this, it'll show up in the upcoming litest_asssert macros
otherwise.

This fix only applies to helper functions, tests themselves wont (yet) be
switched to the new macros and don't need fixing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-05-04 11:29:49 +10:00
parent 7b965b63c0
commit d81a677f6d
2 changed files with 8 additions and 6 deletions

View file

@ -1506,10 +1506,10 @@ litest_is_button_event(struct libinput_event *event,
enum libinput_button_state state)
{
struct libinput_event_pointer *ptrev;
enum libinput_event_type type = LIBINPUT_EVENT_POINTER_BUTTON;
ck_assert(event != NULL);
ck_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_BUTTON);
ck_assert_int_eq(libinput_event_get_type(event), type);
ptrev = libinput_event_get_pointer_event(event);
ck_assert_int_eq(libinput_event_pointer_get_button(ptrev),
button);

View file

@ -105,12 +105,14 @@ static void
disable_button_scrolling(struct litest_device *device)
{
struct libinput_device *dev = device->libinput_device;
enum libinput_config_status status;
enum libinput_config_status status,
expected;
status = libinput_device_config_scroll_set_method(dev,
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
ck_assert_int_eq(status, expected);
}
START_TEST(pointer_motion_relative)
@ -138,14 +140,14 @@ test_absolute_event(struct litest_device *dev, double x, double y)
struct libinput_event *event;
struct libinput_event_pointer *ptrev;
double ex, ey;
enum libinput_event_type type = LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE;
litest_touch_down(dev, 0, x, y);
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE);
ck_assert_int_eq(libinput_event_get_type(event), type);
ptrev = libinput_event_get_pointer_event(event);
ck_assert(ptrev != NULL);