summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-01-22 09:19:04 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-01-22 09:19:04 -0800
commit978e6f321cf809edc304637ed70d55332d9ab98a (patch)
treeb6fa3ca9c0ca2c6142cd19251905767c6bbab3bc
parentb1e8c9fae6e5537a95281b3137e04c7b9951bcb3 (diff)
parentebf4917cc44a1423e79529795f9c394dd44045be (diff)
Merge "Use EXPECT_NEAR for float values in expectTap" into main
-rw-r--r--libs/gui/tests/EndToEndNativeInputTest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index 06f00a4d74..8062a2e6a2 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -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();