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

Commit bda2f8ea authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Late initialize TransitionViewModels in tests" into main

parents 7941a8e4 39789724
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -44,7 +45,12 @@ class AlternateBouncerToLockscreenTransitionViewModelTest : SysuiTestCase() {
    val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
    val fingerprintPropertyRepository = kosmos.fingerprintPropertyRepository

    val underTest = kosmos.alternateBouncerToLockscreenTransitionViewModel
    private lateinit var underTest: AlternateBouncerToLockscreenTransitionViewModel

    @Before
    fun setup() {
        underTest = kosmos.alternateBouncerToLockscreenTransitionViewModel
    }

    @Test
    fun lockscreenAlpha_zeroInitialAlpha() =
@@ -56,7 +62,7 @@ class AlternateBouncerToLockscreenTransitionViewModelTest : SysuiTestCase() {
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.ALTERNATE_BOUNCER,
                to = KeyguardState.LOCKSCREEN,
                testScope
                testScope,
            )

            assertThat(alpha[0]).isEqualTo(0f)
@@ -110,14 +116,14 @@ class AlternateBouncerToLockscreenTransitionViewModelTest : SysuiTestCase() {

    private fun step(
        value: Float,
        state: TransitionState = TransitionState.RUNNING
        state: TransitionState = TransitionState.RUNNING,
    ): TransitionStep {
        return TransitionStep(
            from = KeyguardState.ALTERNATE_BOUNCER,
            to = KeyguardState.LOCKSCREEN,
            value = value,
            transitionState = state,
            ownerName = "AlternateBouncerToLockscreenTransitionViewModelTest"
            ownerName = "AlternateBouncerToLockscreenTransitionViewModelTest",
        )
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -39,7 +40,12 @@ class AodToGoneTransitionViewModelTest : SysuiTestCase() {
    val kosmos = testKosmos()
    val testScope = kosmos.testScope
    val repository = kosmos.fakeKeyguardTransitionRepository
    val underTest = kosmos.aodToGoneTransitionViewModel
    private lateinit var underTest: AodToGoneTransitionViewModel

    @Before
    fun setup() {
        underTest = kosmos.aodToGoneTransitionViewModel
    }

    @Test
    fun lockscreenAlpha() =
+10 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
import com.google.common.truth.Truth
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -37,7 +38,13 @@ class AodToOccludedTransitionViewModelTest : SysuiTestCase() {
    private val kosmos = testKosmos()
    private val testScope = kosmos.testScope
    private val repository = kosmos.fakeKeyguardTransitionRepository
    private val underTest = kosmos.aodToOccludedTransitionViewModel

    private lateinit var underTest: AodToOccludedTransitionViewModel

    @Before
    fun setup() {
        underTest = kosmos.aodToOccludedTransitionViewModel
    }

    @Test
    fun deviceEntryParentViewHides() =
@@ -56,14 +63,14 @@ class AodToOccludedTransitionViewModelTest : SysuiTestCase() {

    private fun step(
        value: Float,
        state: TransitionState = TransitionState.RUNNING
        state: TransitionState = TransitionState.RUNNING,
    ): TransitionStep {
        return TransitionStep(
            from = KeyguardState.AOD,
            to = KeyguardState.OCCLUDED,
            value = value,
            transitionState = state,
            ownerName = "AodToOccludedTransitionViewModelTest"
            ownerName = "AodToOccludedTransitionViewModelTest",
        )
    }
}
+10 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -37,7 +38,13 @@ class DozingToLockscreenTransitionViewModelTest : SysuiTestCase() {
    val kosmos = testKosmos()
    val testScope = kosmos.testScope
    val repository = kosmos.fakeKeyguardTransitionRepository
    val underTest = kosmos.dozingToLockscreenTransitionViewModel

    private lateinit var underTest: DozingToLockscreenTransitionViewModel

    @Before
    fun setup() {
        underTest = kosmos.dozingToLockscreenTransitionViewModel
    }

    @Test
    fun lockscreenAlpha() =
@@ -89,14 +96,14 @@ class DozingToLockscreenTransitionViewModelTest : SysuiTestCase() {

    private fun step(
        value: Float,
        state: TransitionState = TransitionState.RUNNING
        state: TransitionState = TransitionState.RUNNING,
    ): TransitionStep {
        return TransitionStep(
            from = KeyguardState.DOZING,
            to = KeyguardState.LOCKSCREEN,
            value = value,
            transitionState = state,
            ownerName = "DozingToLockscreenTransitionViewModelTest"
            ownerName = "DozingToLockscreenTransitionViewModelTest",
        )
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.google.common.collect.Range
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -47,10 +48,15 @@ class GoneToAodTransitionViewModelTest : SysuiTestCase() {
    private val kosmos = testKosmos()
    private val testScope = kosmos.testScope
    private val repository = kosmos.fakeKeyguardTransitionRepository
    private val underTest = kosmos.goneToAodTransitionViewModel
    private val fingerprintPropertyRepository = kosmos.fingerprintPropertyRepository
    private val biometricSettingsRepository = kosmos.biometricSettingsRepository
    private val powerRepository = kosmos.powerRepository
    private lateinit var underTest: GoneToAodTransitionViewModel

    @Before
    fun setup() {
        underTest = kosmos.goneToAodTransitionViewModel
    }

    @Test
    fun enterFromTopTranslationY_whenNotOnFold() =
Loading