summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-08-06 13:30:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-08-08 13:58:54 +1000
commitad13116f4e6d919d67e0c2a7f3f5eae4216a4772 (patch)
tree72a782c41f7b1174d0d715bb228021c7c5eb7044
parent031fbc84bd36347c775ca687b78454bfba244198 (diff)
test: fix the pressure offset tests
Unsuprisingly, a normalized [0,1] value will always be between 0 and 1, so bhis gave us a false positive. Check for the real values instead. Those values aren't 100% correct because of a bug in the offset handling which will be fixed in a follow-up commit. The difference is near enough that it doesn't matter here anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--test/test-tablet.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/test/test-tablet.c b/test/test-tablet.c
index 620bd6ec..21983833 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -3611,9 +3611,7 @@ START_TEST(tablet_pressure_offset)
pressure = libinput_event_tablet_tool_get_pressure(tev);
- /* can't use the double_eq here, the pressure value is too tiny */
- ck_assert(pressure > 0.0);
- ck_assert(pressure < 1.0);
+ ck_assert_double_lt(pressure, 0.015);
libinput_event_destroy(event);
}
END_TEST
@@ -3642,7 +3640,7 @@ START_TEST(tablet_pressure_offset_decrease)
litest_tablet_proximity_out(dev);
litest_drain_events(li);
- /* a reduced pressure value must reduce the offset */
+ /* a higher pressure value leaves it as-is */
litest_tablet_proximity_in(dev, 5, 100, axes);
libinput_dispatch(li);
event = libinput_get_event(li);
@@ -3668,9 +3666,9 @@ START_TEST(tablet_pressure_offset_decrease)
pressure = libinput_event_tablet_tool_get_pressure(tev);
- /* can't use the double_eq here, the pressure value is too tiny */
- ck_assert(pressure > 0.0);
- ck_assert(pressure < 1.0);
+ /* offset is 10, value is 15, so that's a around 5% of the
+ * remaining range */
+ ck_assert_double_eq_tol(pressure, 0.05, 0.01);
libinput_event_destroy(event);
}
END_TEST
@@ -3715,9 +3713,8 @@ START_TEST(tablet_pressure_offset_increase)
tev = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
pressure = libinput_event_tablet_tool_get_pressure(tev);
- /* can't use the double_eq here, the pressure value is too tiny */
- ck_assert(pressure > 0.0);
- ck_assert(pressure < 1.0);
+ /* Pressure should be around 10% */
+ ck_assert_double_eq_tol(pressure, 0.10, 0.01);
libinput_event_destroy(event);
litest_drain_events(li);