Add missing reset() calls
We need to reset() after each test to ensure teardown happens. The
activity itself is shared between tests, so verify that in onPause
we did not miss a cleanup call.
Fixes: 145095000
Test: this
Change-Id: I2edbc885991f38e5f3fa87e5e0dc4a94d0f59761
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 ab5af62..83b09c1 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
@@ -223,6 +223,7 @@
mBitmapAsserter.assertBitmapsAreSimilar(idealBitmap, testCaseBitmap, bitmapComparer,
getName(), testCase.getDebugString());
}
+ getActivity().reset();
}
/**
@@ -271,6 +272,7 @@
getName(), testCase.getDebugString());
}
}
+ getActivity().reset();
}
/**
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.kt b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.kt
index 8176ba9..a5d40cf 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.kt
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.kt
@@ -16,7 +16,6 @@
package android.uirendering.cts.testinfrastructure
import android.app.Activity
-import android.app.UiModeManager
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.graphics.Point
@@ -216,8 +215,8 @@
override fun onPause() {
super.onPause()
- mViewInitializer?.run {
- teardownView()
+ if (mViewInitializer != null) {
+ throw IllegalStateException("Failed to reset() after running test")
}
}