Fix CTS testTouchEvent for watches.
On watches, skip the touch-outside-screen part of the test,
because all watch activities are fullscreen, so there is no
"outside" to click.
Bug: 15455341
Change-Id: I2db93e6efbe6c275897d8c70e6f82708113f47dc
diff --git a/tests/tests/app/src/android/app/cts/DialogTest.java b/tests/tests/app/src/android/app/cts/DialogTest.java
index 56e731b..6df2eee 100644
--- a/tests/tests/app/src/android/app/cts/DialogTest.java
+++ b/tests/tests/app/src/android/app/cts/DialogTest.java
@@ -393,25 +393,28 @@
d.isOnTouchEventCalled = false;
assertTrue(d.isShowing());
- // Send a touch event outside the activity. This time the dialog will be dismissed
- // because closeOnTouchOutside is true.
- d.setCanceledOnTouchOutside(true);
+ // Watch activities cover the entire screen, so there is no way to touch outside.
+ if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+ // Send a touch event outside the activity. This time the dialog will be dismissed
+ // because closeOnTouchOutside is true.
+ d.setCanceledOnTouchOutside(true);
- touchMotionEvent = MotionEvent.obtain(now, now + 1, MotionEvent.ACTION_DOWN,
- 1, 100, 0);
- mInstrumentation.sendPointerSync(touchMotionEvent);
+ touchMotionEvent = MotionEvent.obtain(now, now + 1, MotionEvent.ACTION_DOWN,
+ 1, 100, 0);
+ mInstrumentation.sendPointerSync(touchMotionEvent);
- new PollingCheck(TEST_TIMEOUT) {
- protected boolean check() {
- return d.dispatchTouchEventResult;
- }
- }.run();
+ new PollingCheck(TEST_TIMEOUT) {
+ protected boolean check() {
+ return d.dispatchTouchEventResult;
+ }
+ }.run();
- assertMotionEventEquals(touchMotionEvent, d.touchEvent);
+ assertMotionEventEquals(touchMotionEvent, d.touchEvent);
- assertTrue(d.isOnTouchEventCalled);
- assertMotionEventEquals(touchMotionEvent, d.onTouchEvent);
- assertFalse(d.isShowing());
+ assertTrue(d.isOnTouchEventCalled);
+ assertMotionEventEquals(touchMotionEvent, d.onTouchEvent);
+ assertFalse(d.isShowing());
+ }
}
public void testTrackballEvent() {