summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-05-04 11:29:49 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-05-18 20:55:48 +1000
commitd81a677f6dc921ddebbc446b06e92c69a0699a37 (patch)
treeda317f09da98ec53b2647d914505855c07ae77b2
parent7b965b63c03015ed350d1308277868b7e4644ca4 (diff)
downloadlibinput-d81a677f6dc921ddebbc446b06e92c69a0699a37.tar.gz
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>
-rw-r--r--test/litest.c4
-rw-r--r--test/pointer.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/test/litest.c b/test/litest.c
index b755d0de..24a25de0 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -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);
diff --git a/test/pointer.c b/test/pointer.c
index 43c21ba3..4b93c25d 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -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);