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

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

Merge "Factor in overscroll in compose force QS expansion tests" into main

parents c9af6aee f9887246
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -16,8 +16,11 @@

package com.android.systemui.qs.composefragment.viewmodel

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.testing.TestableLooper.RunWithLooper
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryBypassRepository
import com.android.systemui.kosmos.testScope
import com.android.systemui.statusbar.StatusBarState
@@ -35,6 +38,7 @@ import platform.test.runner.parameterized.Parameters
class QSFragmentComposeViewModelForceQSTest(private val testData: TestData) :
    AbstractQSFragmentComposeViewModelTest() {

    @DisableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL)
    @Test
    fun forceQs_orRealExpansion() =
        with(kosmos) {
@@ -56,6 +60,34 @@ class QSFragmentComposeViewModelForceQSTest(private val testData: TestData) :
            }
        }

    @EnableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL)
    @Test
    fun forceQs_orRealExpansion_withNoExpansionOnOverscroll() =
        with(kosmos) {
            testScope.testWithinLifecycle {
                with(testData) {
                    sysuiStatusBarStateController.setState(statusBarState)
                    underTest.isQsExpanded = expanded
                    underTest.isStackScrollerOverscrolling = stackScrollerOverScrolling
                    fakeDeviceEntryBypassRepository.setBypassEnabled(bypassEnabled)
                    underTest.isTransitioningToFullShade = transitioningToFullShade
                    underTest.isInSplitShade = inSplitShade

                    underTest.setQsExpansionValue(EXPANSION)

                    runCurrent()
                    assertThat(underTest.expansionState.progress)
                        .isEqualTo(
                            if (expectedForceQS) {
                                1f
                            } else {
                                if (stackScrollerOverScrolling) 0 else EXPANSION
                            }
                        )
                }
            }
        }

    data class TestData(
        val statusBarState: Int,
        val expanded: Boolean,