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

Commit 5a52e10a authored by AI test gen's avatar AI test gen
Browse files

Add test for transitions between non-dual shade modes

Adds a unit test to verify that when the shade mode changes between different non-dual modes (e.g., from Single to Split and back), the scene correctly remains on the Shade scene.

This covers a scenario mentioned in the related change, improving test coverage for device configuration changes like rotations that can trigger shade mode transitions.


Please help fill out the survey for feedback: https://docs.google.com/forms/d/e/1FAIpQLSeKFKpHImCAqZIa_OR801cw72HQUreM2oGM25C3mKKT2tBFnw/viewform?usp=pp_url&entry.1586624956=ag/35405901

Please feel free to use your domain knowledge to make changes to the generated tests to make it more valuable for your team.
Original Change: ag/34973966
Test: ATP tests passed http://go/forrest-run/L60400030017375431
Bug: 431235865
Flag: TEST_ONLY



Change-Id: If0792d21ebe67c10bce056c5521598915a0fc76f
parent d221d2cf
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -332,6 +332,37 @@ class NotificationsShadeOverlayContentViewModelTest : SysuiTestCase() {
            assertThat(currentOverlays).doesNotContain(Overlays.NotificationsShade)
        }

    @Test
    fun shadeModeChanged_betweenNonDualModes_remainsOnShadeScene() =
        kosmos.runTest {
            val currentScene by collectLastValue(sceneInteractor.currentScene)
            val currentOverlays by collectLastValue(sceneInteractor.currentOverlays)

            // GIVEN the shade is an overlay in dual shade mode
            enableDualShade()
            shadeInteractor.expandNotificationsShade("test")
            assertThat(currentOverlays).contains(Overlays.NotificationsShade)

            // WHEN switching to a non-dual (single) shade mode
            enableSingleShade()

            // THEN the scene snaps to Shade
            assertThat(currentScene).isEqualTo(Scenes.Shade)
            assertThat(currentOverlays).doesNotContain(Overlays.NotificationsShade)

            // WHEN switching to another non-dual (split) shade mode
            enableSplitShade()

            // THEN the scene remains on Shade
            assertThat(currentScene).isEqualTo(Scenes.Shade)

            // WHEN switching back to the first non-dual (single) shade mode
            enableSingleShade()

            // THEN the scene still remains on Shade
            assertThat(currentScene).isEqualTo(Scenes.Shade)
        }

    private fun Kosmos.lockDevice() {
        val currentScene by collectLastValue(sceneInteractor.currentScene)
        powerInteractor.setAsleepForTest()