3232
3333namespace android {
3434
35- namespace {
35+ struct PointF {
36+ float x;
37+ float y;
38+ auto operator <=>(const PointF&) const = default ;
39+ };
40+
41+ namespace internal {
3642
3743template <typename T>
3844static bool valuesMatch (T value1, T value2) {
@@ -43,17 +49,11 @@ static bool valuesMatch(T value1, T value2) {
4349 }
4450}
4551
46- struct PointF {
47- float x;
48- float y;
49- auto operator <=>(const PointF&) const = default ;
50- };
51-
5252inline std::string pointFToString (const PointF& p) {
5353 return std::string (" (" ) + std::to_string (p.x ) + " , " + std::to_string (p.y ) + " )" ;
5454}
5555
56- } // namespace
56+ } // namespace internal
5757
5858// / Source
5959class WithSourceMatcher {
@@ -453,8 +453,10 @@ class WithPointersMatcher {
453453 }
454454
455455 if (mPointers != actualPointers) {
456- *os << " expected pointers " << dumpMap (mPointers , constToString, pointFToString)
457- << " , but got " << dumpMap (actualPointers, constToString, pointFToString);
456+ *os << " expected pointers "
457+ << dumpMap (mPointers , constToString, internal::pointFToString)
458+ << " , but got "
459+ << dumpMap (actualPointers, constToString, internal::pointFToString);
458460 return false ;
459461 }
460462 return true ;
@@ -469,15 +471,17 @@ class WithPointersMatcher {
469471 }
470472
471473 if (mPointers != actualPointers) {
472- *os << " expected pointers " << dumpMap (mPointers , constToString, pointFToString)
473- << " , but got " << dumpMap (actualPointers, constToString, pointFToString);
474+ *os << " expected pointers "
475+ << dumpMap (mPointers , constToString, internal::pointFToString)
476+ << " , but got "
477+ << dumpMap (actualPointers, constToString, internal::pointFToString);
474478 return false ;
475479 }
476480 return true ;
477481 }
478482
479483 void DescribeTo (std::ostream* os) const {
480- *os << " with pointers " << dumpMap (mPointers , constToString, pointFToString);
484+ *os << " with pointers " << dumpMap (mPointers , constToString, internal:: pointFToString);
481485 }
482486
483487 void DescribeNegationTo (std::ostream* os) const { *os << " wrong pointers" ; }
@@ -721,8 +725,9 @@ class WithRelativeMotionMatcher {
721725 }
722726
723727 const PointerCoords& coords = event.pointerCoords [mPointerIndex ];
724- bool matches = valuesMatch (mRelX , coords.getAxisValue (AMOTION_EVENT_AXIS_RELATIVE_X)) &&
725- valuesMatch (mRelY , coords.getAxisValue (AMOTION_EVENT_AXIS_RELATIVE_Y));
728+ bool matches =
729+ internal::valuesMatch (mRelX , coords.getAxisValue (AMOTION_EVENT_AXIS_RELATIVE_X)) &&
730+ internal::valuesMatch (mRelY , coords.getAxisValue (AMOTION_EVENT_AXIS_RELATIVE_Y));
726731 if (!matches) {
727732 *os << " expected relative motion (" << mRelX << " , " << mRelY << " ) at pointer index "
728733 << mPointerIndex << " , but got ("
0 commit comments