Disable Ui rendering tests on watch
bug:18630784
bug:18670714
They do not correctly account for CircularDisplayMask, which may be
present.
Change-Id: Ia181d989670756030b28449ed1cdf6269b1010c8
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
index 052b251..783e710 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
@@ -38,7 +38,7 @@
*/
public abstract class ActivityTestBase extends
ActivityInstrumentationTestCase2<DrawActivity> {
- public static final String TAG_NAME = "ActivityTestBase";
+ public static final String TAG = "ActivityTestBase";
public static final boolean DEBUG = false;
public static final boolean USE_RS = false;
public static final int TEST_WIDTH = 180;
@@ -97,7 +97,7 @@
for (TestCase testCase : testCases) {
if (!testCase.wasTestRan) {
- Log.w(TAG_NAME, getName() + " not all of the tests were ran");
+ Log.w(TAG, getName() + " not all of the tests ran");
break;
}
}
@@ -213,6 +213,11 @@
* every test case is tested against it.
*/
public void runWithComparer(BitmapComparer bitmapComparer) {
+ if (getActivity().getOnWatch()) {
+ Log.d(TAG, getName() + "skipped");
+ return;
+ }
+
if (mTestCases.size() == 0) {
throw new IllegalStateException("Need at least one test to run");
}
@@ -231,6 +236,11 @@
* the verifier given.
*/
public void runWithVerifier(BitmapVerifier bitmapVerifier) {
+ if (getActivity().getOnWatch()) {
+ Log.d(TAG, getName() + "skipped");
+ return;
+ }
+
if (mTestCases.size() == 0) {
throw new IllegalStateException("Need at least one test to run");
}
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
index d24377b..166b6ff 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
@@ -17,18 +17,14 @@
import android.annotation.Nullable;
import android.app.Activity;
-import android.content.Context;
+import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.webkit.WebView;
-
import com.android.cts.uirendering.R;
/**
@@ -41,10 +37,17 @@
private Handler mHandler;
private View mView;
+ private boolean mOnWatch;
public void onCreate(Bundle bundle){
super.onCreate(bundle);
mHandler = new RenderSpecHandler();
+ int uiMode = getResources().getConfiguration().uiMode;
+ mOnWatch = (uiMode & Configuration.UI_MODE_TYPE_WATCH) == Configuration.UI_MODE_TYPE_WATCH;
+ }
+
+ public boolean getOnWatch() {
+ return mOnWatch;
}
public void enqueueRenderSpecAndWait(int layoutId, CanvasClient canvasClient, String webViewUrl,