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

Commit cc0eedd6 authored by Jiaming Cheng's avatar Jiaming Cheng
Browse files

[flexiglass] Fix NotificationShelfTest with SceneContainerFlag

When SceneContainerFlag is enabled, NotificationShelf.isAlignedToEnd()
now relies on the internal mAlignedToEnd field (set via
setAlignedToEnd()) instead of primarily using
mAmbientState.getUseSplitShade().

This cl updates the prepareShelfSpy helper in the test to also call
shelfSpy.setAlignedToEnd() to ensure the shelf's alignment state is
correctly configured when SceneContainerFlag is enabled.

Bug: 416716454
Flag: com.android.systemui.scene_container
Test: com.android.systemui.statusbar.notification.stack.NotificationShelfTest
     Locally run this test and verify all the tests are passed with the
     `@EnableSceneContainer` annotation.
Change-Id: Ib3a41fd4aff7414270082eecf7ff035aca6e0b93
parent c246888e
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator
import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.StatusBarIconView
@@ -460,6 +461,12 @@ open class NotificationShelfTest : SysuiTestCase() {
        val shelfSpy = spy(shelf)
        whenever(shelfSpy.isLayoutRtl).thenReturn(rtl)
        whenever(ambientState.useSplitShade).thenReturn(splitShade)

        // Ensure mAlignedToEnd is set when SceneContainerFlag is enabled.
        if (SceneContainerFlag.isEnabled) {
            shelfSpy.setAlignedToEnd(splitShade)
        }

        shelfSpy.layout(0, 0, width, 5)
        shelfSpy.mShelfIcons.layout(0, 0, width, 5)
        iconContainerPadding?.let {
@@ -980,7 +987,8 @@ open class NotificationShelfTest : SysuiTestCase() {
    ) {
        val sbnMock: StatusBarNotification = mock()
        val mockEntry = mock<NotificationEntry>().apply { whenever(this.sbn).thenReturn(sbnMock) }
        val row = when (NotificationBundleUi.isEnabled) {
        val row =
            when (NotificationBundleUi.isEnabled) {
                true -> ExpandableNotificationRow(mContext, null, UserHandle.CURRENT)
                false -> ExpandableNotificationRow(mContext, null, mockEntry)
            }