Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebf4917c authored by Arpit Singh's avatar Arpit Singh
Browse files

Use EXPECT_NEAR for float values in expectTap

There are some tests failures due to mismatch in float precision
values.

Bug: 388925244
Test: atest libgui_test
Flag: TEST_ONLY
Change-Id: I38a5039f2c9c288cd4e573573b985c6e3cf6b7ec
parent a29a2d14
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ sp<IInputFlinger> getInputFlinger() {
// We use the top 10 layers as a way to haphazardly place ourselves above anything else.
static const int LAYER_BASE = INT32_MAX - 10;
static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s;
static constexpr float EPSILON = MotionEvent::ROUNDING_PRECISION;

class SynchronousWindowInfosReportedListener : public gui::BnWindowInfosReportedListener {
public:
@@ -203,8 +204,8 @@ public:
        ASSERT_EQ(InputEventType::MOTION, ev->getType());
        MotionEvent* mev = static_cast<MotionEvent*>(ev);
        EXPECT_EQ(AMOTION_EVENT_ACTION_DOWN, mev->getAction());
        EXPECT_EQ(x, mev->getX(0));
        EXPECT_EQ(y, mev->getY(0));
        EXPECT_NEAR(x, mev->getX(0), EPSILON);
        EXPECT_NEAR(y, mev->getY(0), EPSILON);
        EXPECT_EQ(0, mev->getFlags() & VERIFIED_MOTION_EVENT_FLAGS);

        ev = consumeEvent();