Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54866bd7 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Small improvements to dialogScreenshotTest {} am: 61d27419 am: 73053860

parents c7cdc8ca 73053860
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -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")
            try {
                screenshotRule.screenshotTest(goldenIdentifier, dialog.window.decorView)
            } finally {
                dialog.dismiss()
            }
        }
    }
}