TouchExplorerTest: improve error reporting when matching motion events.
Test: atest TouchExplorerTest
Change-Id: Idd0555c8ee9b27fa34b535d97cb9fe145bb3f20a
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/GestureUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/GestureUtils.java
index 7f8a33c..91a7d8e 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/GestureUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/GestureUtils.java
@@ -230,6 +230,11 @@
public void describeTo(Description description) {
description.appendText("Matching to action " + MotionEvent.actionToString(mAction));
}
+
+ public void describeMismatchSafely(MotionEvent event, Description description) {
+ description.appendText(
+ "received " + MotionEvent.actionToString(event.getActionMasked()));
+ }
}
public static Matcher<MotionEvent> isAtPoint(final PointF point) {
@@ -247,6 +252,11 @@
public void describeTo(Description description) {
description.appendText("Matching to point " + point);
}
+
+ public void describeMismatchSafely(MotionEvent event, Description description) {
+ description.appendText(
+ "received (" + event.getX() + ", " + event.getY() + ")");
+ }
};
}
@@ -265,6 +275,12 @@
public void describeTo(Description description) {
description.appendText("Matching to point " + point);
}
+
+ @Override
+ public void describeMismatchSafely(MotionEvent event, Description description) {
+ description.appendText(
+ "received (" + event.getRawX() + ", " + event.getRawY() + ")");
+ }
};
}