summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2024-10-24 09:49:18 -0700
committer Mady Mellor <madym@google.com> 2024-10-25 17:36:14 +0000
commit3c6b659827dcdaf19744d9f52626ad91bcc24ea3 (patch)
treec49c2c9381b3afe25526774c62ed14f10185fb2f
parentac9181e1293efe56f6e87619593f26bd01949bc5 (diff)
Use the screenshot theme on wmshell screenshot tests
* This ensures screenshots in the tests are taken with light & dark theme * Additionally, set a background color on the activity in our user education test -- otherwise the colors in the education views match the background of the activity and we miss the outline of the arrow & rounded corners on the view Flag: EXEMPT test change Test: atest --request-upload-result WMShellRobolectricScreenshotTests:com.android.wm.shell.bubbles.BubbleEducationViewScreenshotTest & inspect the screenshots in the uploaded result (ran on acloud device) Bug: 375030558 Change-Id: Ide7eb87b8d05fb3b8930ec21644ca5429a41c34a
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp4
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/AndroidManifestRobolectric.xml1
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/dark_portrait_bubbles_education.pngbin52888 -> 57190 bytes
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/light_portrait_bubbles_education.pngbin52888 -> 57414 bytes
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/bubbles/BubbleEducationViewScreenshotTest.kt8
5 files changed, 12 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp b/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp
index b6db6d93499d..61c09f2c396b 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp
@@ -29,6 +29,8 @@ android_app {
static_libs: [
"WindowManager-Shell",
"platform-screenshot-diff-core",
+ "ScreenshotComposeUtilsLib", // ComposableScreenshotTestRule & Theme.PlatformUi.Screenshot
+ "SystemUI-res", // Theme.SystemUI (dragged in by ScreenshotComposeUtilsLib)
],
asset_dirs: ["goldens/robolectric"],
manifest: "AndroidManifestRobolectric.xml",
@@ -63,6 +65,8 @@ android_test {
],
static_libs: [
"WindowManager-Shell",
+ "ScreenshotComposeUtilsLib", // ComposableScreenshotTestRule & Theme.PlatformUi.Screenshot
+ "SystemUI-res", // Theme.SystemUI (dragged in by ScreenshotComposeUtilsLib)
"junit",
"androidx.test.runner",
"androidx.test.rules",
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/AndroidManifestRobolectric.xml b/libs/WindowManager/Shell/multivalentScreenshotTests/AndroidManifestRobolectric.xml
index b4bdaeaf0eac..72d0d5e4feb0 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/AndroidManifestRobolectric.xml
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/AndroidManifestRobolectric.xml
@@ -18,6 +18,7 @@
<application android:debuggable="true" android:supportsRtl="true">
<activity
android:name="platform.test.screenshot.ScreenshotActivity"
+ android:theme="@style/Theme.PlatformUi.Screenshot"
android:exported="true">
</activity>
</application>
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/dark_portrait_bubbles_education.png b/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/dark_portrait_bubbles_education.png
index 736bca7f5a7c..5b429c0eaf7c 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/dark_portrait_bubbles_education.png
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/dark_portrait_bubbles_education.png
Binary files differ
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/light_portrait_bubbles_education.png b/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/light_portrait_bubbles_education.png
index 736bca7f5a7c..6028fa21a8fd 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/light_portrait_bubbles_education.png
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/goldens/onDevice/phone/light_portrait_bubbles_education.png
Binary files differ
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/bubbles/BubbleEducationViewScreenshotTest.kt b/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/bubbles/BubbleEducationViewScreenshotTest.kt
index f09969d253d3..8cf3ce91fbcc 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/bubbles/BubbleEducationViewScreenshotTest.kt
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/bubbles/BubbleEducationViewScreenshotTest.kt
@@ -15,10 +15,12 @@
*/
package com.android.wm.shell.bubbles
+import android.graphics.Color
import android.view.LayoutInflater
+import android.view.ViewGroup
+import com.android.wm.shell.R
import com.android.wm.shell.shared.bubbles.BubblePopupView
import com.android.wm.shell.testing.goldenpathmanager.WMShellGoldenPathManager
-import com.android.wm.shell.R
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -48,6 +50,10 @@ class BubbleEducationViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
fun bubblesEducation() {
screenshotRule.screenshotTest("bubbles_education") { activity ->
activity.actionBar?.hide()
+ // Set the background color of the activity to be something not from the theme to
+ // ensure good contrast between the education view and the background
+ val rootView = activity.window.decorView.findViewById(android.R.id.content) as ViewGroup
+ rootView.setBackgroundColor(Color.RED)
val view =
LayoutInflater.from(activity)
.inflate(R.layout.bubble_bar_stack_education, null) as BubblePopupView