Loading libs/input/tests/TestEventMatchers.h +0 −4 Original line number Diff line number Diff line Loading @@ -27,12 +27,8 @@ namespace android { namespace { using ::testing::Matcher; } // namespace /** * This file contains a copy of Matchers from .../inputflinger/tests/TestEventMatchers.h. Ideally, * implementations must not be duplicated. Loading services/inputflinger/tests/TestEventMatchers.h +20 −15 Original line number Diff line number Diff line Loading @@ -32,7 +32,13 @@ namespace android { namespace { struct PointF { float x; float y; auto operator<=>(const PointF&) const = default; }; namespace internal { template <typename T> static bool valuesMatch(T value1, T value2) { Loading @@ -43,17 +49,11 @@ static bool valuesMatch(T value1, T value2) { } } struct PointF { float x; float y; auto operator<=>(const PointF&) const = default; }; inline std::string pointFToString(const PointF& p) { return std::string("(") + std::to_string(p.x) + ", " + std::to_string(p.y) + ")"; } } // namespace } // namespace internal /// Source class WithSourceMatcher { Loading Loading @@ -453,8 +453,10 @@ public: } if (mPointers != actualPointers) { *os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString) << ", but got " << dumpMap(actualPointers, constToString, pointFToString); *os << "expected pointers " << dumpMap(mPointers, constToString, internal::pointFToString) << ", but got " << dumpMap(actualPointers, constToString, internal::pointFToString); return false; } return true; Loading @@ -469,15 +471,17 @@ public: } if (mPointers != actualPointers) { *os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString) << ", but got " << dumpMap(actualPointers, constToString, pointFToString); *os << "expected pointers " << dumpMap(mPointers, constToString, internal::pointFToString) << ", but got " << dumpMap(actualPointers, constToString, internal::pointFToString); return false; } return true; } void DescribeTo(std::ostream* os) const { *os << "with pointers " << dumpMap(mPointers, constToString, pointFToString); *os << "with pointers " << dumpMap(mPointers, constToString, internal::pointFToString); } void DescribeNegationTo(std::ostream* os) const { *os << "wrong pointers"; } Loading Loading @@ -721,8 +725,9 @@ public: } const PointerCoords& coords = event.pointerCoords[mPointerIndex]; bool matches = valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) && valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); bool matches = internal::valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) && internal::valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); if (!matches) { *os << "expected relative motion (" << mRelX << ", " << mRelY << ") at pointer index " << mPointerIndex << ", but got (" Loading services/inputflinger/tests/fuzzers/FuzzedInputStream.h +0 −2 Original line number Diff line number Diff line Loading @@ -18,10 +18,8 @@ namespace android { namespace { static constexpr int32_t MAX_RANDOM_POINTERS = 4; static constexpr int32_t MAX_RANDOM_DEVICES = 4; } // namespace int getFuzzedMotionAction(FuzzedDataProvider& fdp) { int actionMasked = fdp.PickValueInArray<int>({ Loading Loading
libs/input/tests/TestEventMatchers.h +0 −4 Original line number Diff line number Diff line Loading @@ -27,12 +27,8 @@ namespace android { namespace { using ::testing::Matcher; } // namespace /** * This file contains a copy of Matchers from .../inputflinger/tests/TestEventMatchers.h. Ideally, * implementations must not be duplicated. Loading
services/inputflinger/tests/TestEventMatchers.h +20 −15 Original line number Diff line number Diff line Loading @@ -32,7 +32,13 @@ namespace android { namespace { struct PointF { float x; float y; auto operator<=>(const PointF&) const = default; }; namespace internal { template <typename T> static bool valuesMatch(T value1, T value2) { Loading @@ -43,17 +49,11 @@ static bool valuesMatch(T value1, T value2) { } } struct PointF { float x; float y; auto operator<=>(const PointF&) const = default; }; inline std::string pointFToString(const PointF& p) { return std::string("(") + std::to_string(p.x) + ", " + std::to_string(p.y) + ")"; } } // namespace } // namespace internal /// Source class WithSourceMatcher { Loading Loading @@ -453,8 +453,10 @@ public: } if (mPointers != actualPointers) { *os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString) << ", but got " << dumpMap(actualPointers, constToString, pointFToString); *os << "expected pointers " << dumpMap(mPointers, constToString, internal::pointFToString) << ", but got " << dumpMap(actualPointers, constToString, internal::pointFToString); return false; } return true; Loading @@ -469,15 +471,17 @@ public: } if (mPointers != actualPointers) { *os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString) << ", but got " << dumpMap(actualPointers, constToString, pointFToString); *os << "expected pointers " << dumpMap(mPointers, constToString, internal::pointFToString) << ", but got " << dumpMap(actualPointers, constToString, internal::pointFToString); return false; } return true; } void DescribeTo(std::ostream* os) const { *os << "with pointers " << dumpMap(mPointers, constToString, pointFToString); *os << "with pointers " << dumpMap(mPointers, constToString, internal::pointFToString); } void DescribeNegationTo(std::ostream* os) const { *os << "wrong pointers"; } Loading Loading @@ -721,8 +725,9 @@ public: } const PointerCoords& coords = event.pointerCoords[mPointerIndex]; bool matches = valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) && valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); bool matches = internal::valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) && internal::valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); if (!matches) { *os << "expected relative motion (" << mRelX << ", " << mRelY << ") at pointer index " << mPointerIndex << ", but got (" Loading
services/inputflinger/tests/fuzzers/FuzzedInputStream.h +0 −2 Original line number Diff line number Diff line Loading @@ -18,10 +18,8 @@ namespace android { namespace { static constexpr int32_t MAX_RANDOM_POINTERS = 4; static constexpr int32_t MAX_RANDOM_DEVICES = 4; } // namespace int getFuzzedMotionAction(FuzzedDataProvider& fdp) { int actionMasked = fdp.PickValueInArray<int>({ Loading