mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-03 14:18:09 +02:00
test: replace manual "almost equal" with the new double epsilon
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
This commit is contained in:
parent
237b15b401
commit
9a5f888795
1 changed files with 8 additions and 12 deletions
|
|
@ -410,28 +410,24 @@ START_TEST(touch_calibration_rotation)
|
|||
y = libinput_event_touch_get_y_transformed(tev, height);
|
||||
|
||||
/* rounding errors... */
|
||||
#define almost_equal(a_, b_) \
|
||||
{ ck_assert_int_ge((a_) + 0.5, (b_) - 1); \
|
||||
ck_assert_int_le((a_) + 0.5, (b_) + 1); }
|
||||
switch(i) {
|
||||
case 0: /* 0 deg */
|
||||
almost_equal(x, width * 0.8);
|
||||
almost_equal(y, height * 0.2);
|
||||
litest_assert_double_eq_epsilon(x, width * 0.8, 1.0);
|
||||
litest_assert_double_eq_epsilon(y, height * 0.2, 1.0);
|
||||
break;
|
||||
case 1: /* 90 deg cw */
|
||||
almost_equal(x, width * 0.8);
|
||||
almost_equal(y, height * 0.8);
|
||||
litest_assert_double_eq_epsilon(x, width * 0.8, 1.0);
|
||||
litest_assert_double_eq_epsilon(y, height * 0.8, 1.0);
|
||||
break;
|
||||
case 2: /* 180 deg cw */
|
||||
almost_equal(x, width * 0.2);
|
||||
almost_equal(y, height * 0.8);
|
||||
litest_assert_double_eq_epsilon(x, width * 0.2, 1.0);
|
||||
litest_assert_double_eq_epsilon(y, height * 0.8, 1.0);
|
||||
break;
|
||||
case 3: /* 270 deg cw */
|
||||
almost_equal(x, width * 0.2);
|
||||
almost_equal(y, height * 0.2);
|
||||
litest_assert_double_eq_epsilon(x, width * 0.2, 1.0);
|
||||
litest_assert_double_eq_epsilon(y, height * 0.2, 1.0);
|
||||
break;
|
||||
}
|
||||
#undef almost_equal
|
||||
|
||||
libinput_event_destroy(ev);
|
||||
litest_drain_events(li);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue