Loading packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ open class ViewScreenshotTestRule( protected fun takeScreenshot( mode: Mode = Mode.WrapContent, viewProvider: (ComponentActivity) -> View, beforeScreenshot: (ComponentActivity) -> Unit = {} ): Bitmap { activityRule.scenario.onActivity { activity -> // Make sure that the activity draws full screen and fits the whole display instead of Loading @@ -103,6 +104,7 @@ open class ViewScreenshotTestRule( val content = activity.requireViewById<ViewGroup>(android.R.id.content) assertEquals(1, content.childCount) contentView = content.getChildAt(0) beforeScreenshot(activity) } return if (isRobolectric) { Loading @@ -120,9 +122,10 @@ open class ViewScreenshotTestRule( fun screenshotTest( goldenIdentifier: String, mode: Mode = Mode.WrapContent, viewProvider: (ComponentActivity) -> View, beforeScreenshot: (ComponentActivity) -> Unit = {}, viewProvider: (ComponentActivity) -> View ) { val bitmap = takeScreenshot(mode, viewProvider) val bitmap = takeScreenshot(mode, viewProvider, beforeScreenshot) screenshotRule.assertBitmapAgainstGolden( bitmap, goldenIdentifier, Loading Loading
packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ open class ViewScreenshotTestRule( protected fun takeScreenshot( mode: Mode = Mode.WrapContent, viewProvider: (ComponentActivity) -> View, beforeScreenshot: (ComponentActivity) -> Unit = {} ): Bitmap { activityRule.scenario.onActivity { activity -> // Make sure that the activity draws full screen and fits the whole display instead of Loading @@ -103,6 +104,7 @@ open class ViewScreenshotTestRule( val content = activity.requireViewById<ViewGroup>(android.R.id.content) assertEquals(1, content.childCount) contentView = content.getChildAt(0) beforeScreenshot(activity) } return if (isRobolectric) { Loading @@ -120,9 +122,10 @@ open class ViewScreenshotTestRule( fun screenshotTest( goldenIdentifier: String, mode: Mode = Mode.WrapContent, viewProvider: (ComponentActivity) -> View, beforeScreenshot: (ComponentActivity) -> Unit = {}, viewProvider: (ComponentActivity) -> View ) { val bitmap = takeScreenshot(mode, viewProvider) val bitmap = takeScreenshot(mode, viewProvider, beforeScreenshot) screenshotRule.assertBitmapAgainstGolden( bitmap, goldenIdentifier, Loading