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

Commit edcd7eaa authored by Ang Li's avatar Ang Li Committed by Android (Google) Code Review
Browse files

Merge "Add test for focal area collection on finished transition to lockscreen" into main

parents 859372e2 c3b3527d
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -328,6 +328,57 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() {
            assertThat(shouldCollectFocalArea).isFalse()
        }

    @Test
    @DisableSceneContainer
    fun shouldCollectFocalArea_whenTransitioningToLockscreen_sceneContainerDisabled() =
        testScope.runTest {
            val shouldCollectFocalArea by collectLastValue(underTest.shouldCollectFocalArea)
            // Initially true due to onStart
            assertThat(shouldCollectFocalArea).isTrue()

            // Transition away from lockscreen, should stop collecting
            kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    TransitionStep(
                        from = LOCKSCREEN,
                        to = GONE,
                        transitionState = TransitionState.STARTED
                    )
                ),
                testScope,
            )
            runCurrent()
            assertThat(shouldCollectFocalArea).isFalse()

            // Transition back to lockscreen starts, should start collecting
            kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    TransitionStep(
                        from = GONE,
                        to = LOCKSCREEN,
                        transitionState = TransitionState.STARTED
                    )
                ),
                testScope,
            )
            runCurrent()
            assertThat(shouldCollectFocalArea).isTrue()

            // Transition to lockscreen finishes, should continue collecting (tests the merge)
            kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    TransitionStep(
                        from = GONE,
                        to = LOCKSCREEN,
                        transitionState = TransitionState.FINISHED
                    )
                ),
                testScope,
            )
            runCurrent()
            assertThat(shouldCollectFocalArea).isTrue()
        }

    @Test
    @EnableSceneContainer
    fun shouldNotCollectFocalArea_isIdleInLockscreenWithDualShadeOverlays() =