diff options
| author | 2022-07-05 11:11:18 +0000 | |
|---|---|---|
| committer | 2022-07-05 11:11:18 +0000 | |
| commit | 73053860e29e0c9a8cd41bd9fc9b6b70e5a6d655 (patch) | |
| tree | bed2fc48845f00eab2fa01d4852a002c4a98a9fa | |
| parent | 8650ccaeea73325e5e433f4a8d3b6406fc2d2d3c (diff) | |
| parent | 61d27419aaddc7d09f00532a1a26b48aa1f5a3c2 (diff) | |
Small improvements to dialogScreenshotTest {} am: 61d27419aa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19134647
Change-Id: I1a9f7e074ec36ff9f55cbacbadc6fe67b6a32d70
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt index 35812e39677d..6a80c486d515 100644 --- a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +++ b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt @@ -60,11 +60,17 @@ class ViewScreenshotTestRule(testSpec: ScreenshotTestSpec) : TestRule { ) { var dialog: Dialog? = null activityRule.scenario.onActivity { activity -> - // Make sure that the dialog draws full screen and fits the whole display instead of the - // system bars. dialog = dialogProvider(activity).apply { + // Make sure that the dialog draws full screen and fits the whole display + // instead of the system bars. window.setDecorFitsSystemWindows(false) + + // Disable enter/exit animations. + create() + window.setWindowAnimations(0) + + // Show the dialog. show() } } @@ -74,7 +80,11 @@ class ViewScreenshotTestRule(testSpec: ScreenshotTestSpec) : TestRule { activityRule.scenario.onActivity { // Check that the content is what we expected. val dialog = dialog ?: error("dialog is null") - screenshotRule.screenshotTest(goldenIdentifier, dialog.window.decorView) + try { + screenshotRule.screenshotTest(goldenIdentifier, dialog.window.decorView) + } finally { + dialog.dismiss() + } } } } |