Commit 4bd1d5c6 authored by Jonas Ådahl's avatar Jonas Ådahl

test: Use ck_assert_double_ for checking doubles in some places

Signed-off-by: Jonas Ådahl's avatarJonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent eb146677
......@@ -2223,9 +2223,9 @@ litest_assert_scroll(struct libinput *li,
}
} else {
/* Last scroll event, must be 0 */
litest_assert_int_eq(
ck_assert_double_eq(
libinput_event_pointer_get_axis_value(ptrev, axis),
0);
0.0);
}
libinput_event_destroy(event);
event = next_event;
......
......@@ -897,15 +897,18 @@ START_TEST(pointer_accel_defaults)
double speed;
ck_assert(libinput_device_config_accel_is_available(device));
ck_assert(libinput_device_config_accel_get_default_speed(device) == 0.0);
ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0);
for (speed = -2.0; speed < -1.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device,
speed);
ck_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0);
}
for (speed = -1.0; speed <= 1.0; speed += 0.2) {
......@@ -913,7 +916,8 @@ START_TEST(pointer_accel_defaults)
speed);
ck_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_SUCCESS);
ck_assert(libinput_device_config_accel_get_speed(device) == speed);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
speed);
}
for (speed = 1.2; speed <= -2.0; speed += 0.2) {
......@@ -921,7 +925,8 @@ START_TEST(pointer_accel_defaults)
speed);
ck_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert(libinput_device_config_accel_get_speed(device) == 1.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
1.0);
}
}
......@@ -952,8 +957,10 @@ START_TEST(pointer_accel_defaults_absolute)
double speed;
ck_assert(!libinput_device_config_accel_is_available(device));
ck_assert(libinput_device_config_accel_get_default_speed(device) == 0.0);
ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0);
for (speed = -2.0; speed <= 2.0; speed += 0.2) {
status = libinput_device_config_accel_set_speed(device,
......@@ -964,7 +971,8 @@ START_TEST(pointer_accel_defaults_absolute)
else
ck_assert_int_eq(status,
LIBINPUT_CONFIG_STATUS_INVALID);
ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0);
}
}
END_TEST
......@@ -975,8 +983,10 @@ START_TEST(pointer_accel_defaults_absolute_relative)
struct libinput_device *device = dev->libinput_device;
ck_assert(libinput_device_config_accel_is_available(device));
ck_assert(libinput_device_config_accel_get_default_speed(device) == 0.0);
ck_assert(libinput_device_config_accel_get_speed(device) == 0.0);
ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device),
0.0);
ck_assert_double_eq(libinput_device_config_accel_get_speed(device),
0.0);
}
END_TEST
......@@ -1008,7 +1018,7 @@ START_TEST(pointer_accel_direction_change)
pev = libinput_event_get_pointer_event(event);
delta = libinput_event_pointer_get_dx(pev);
ck_assert(delta <= 0.0);
ck_assert_double_le(delta, 0.0);
max_accel = delta;
libinput_event_destroy(event);
event = libinput_get_event(li);
......@@ -1016,8 +1026,8 @@ START_TEST(pointer_accel_direction_change)
pev = libinput_event_get_pointer_event(event);
delta = libinput_event_pointer_get_dx(pev);
ck_assert(delta > 0.0);
ck_assert(delta < -max_accel);
ck_assert_double_gt(delta, 0.0);
ck_assert_double_lt(delta, -max_accel);
libinput_event_destroy(event);
}
END_TEST
......
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