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

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

Merge "Disable ModesEmptyShadeFix in tests" into main

parents b8b1dcc1 45f85e80
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ package com.android.systemui.statusbar.notification.stack.ui.viewmodel
import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.FlagsParameterization
import androidx.test.filters.SmallTest
import com.android.app.tracing.coroutines.flow.map
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.DisableSceneContainer
@@ -40,6 +41,7 @@ import com.android.systemui.statusbar.data.repository.fakeRemoteInputRepository
import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs
import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix
import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor
import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository
import com.android.systemui.statusbar.policy.data.repository.fakeUserSetupRepository
@@ -150,7 +152,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_trueWhenNoNotifs() =
        testScope.runTest {
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()
            val shouldIncludeFooterView by collectFooterViewVisibility()

            // WHEN has no notifs
@@ -165,7 +167,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_falseWhenNotifs() =
        testScope.runTest {
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()

            // WHEN has notifs
            activeNotificationListRepository.setActiveNotifs(count = 2)
@@ -178,7 +180,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_falseWhenQsExpandedDefault() =
        testScope.runTest {
            val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShow by collectEmptyShadeViewVisibility()

            // WHEN has no notifs
            activeNotificationListRepository.setActiveNotifs(count = 0)
@@ -193,7 +195,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_trueWhenQsExpandedInSplitShade() =
        testScope.runTest {
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()
            val shouldIncludeFooterView by collectFooterViewVisibility()

            // WHEN has no notifs
@@ -214,7 +216,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_trueWhenLockedShade() =
        testScope.runTest {
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()
            val shouldIncludeFooterView by collectFooterViewVisibility()

            // WHEN has no notifs
@@ -231,7 +233,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_falseWhenKeyguard() =
        testScope.runTest {
            val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShow by collectEmptyShadeViewVisibility()

            // WHEN has no notifs
            activeNotificationListRepository.setActiveNotifs(count = 0)
@@ -246,7 +248,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    @Test
    fun shouldShowEmptyShadeView_falseWhenStartingToSleep() =
        testScope.runTest {
            val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShow by collectEmptyShadeViewVisibility()

            // WHEN has no notifs
            activeNotificationListRepository.setActiveNotifs(count = 0)
@@ -264,7 +266,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    fun shouldIncludeFooterView_trueWhenShade() =
        testScope.runTest {
            val shouldIncludeFooterView by collectFooterViewVisibility()
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()

            // WHEN has notifs
            activeNotificationListRepository.setActiveNotifs(count = 2)
@@ -282,7 +284,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    fun shouldIncludeFooterView_trueWhenLockedShade() =
        testScope.runTest {
            val shouldIncludeFooterView by collectFooterViewVisibility()
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()

            // WHEN has notifs
            activeNotificationListRepository.setActiveNotifs(count = 2)
@@ -370,7 +372,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    fun shouldIncludeFooterView_trueWhenQsExpandedSplitShade() =
        testScope.runTest {
            val shouldIncludeFooterView by collectFooterViewVisibility()
            val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView)
            val shouldShowEmptyShadeView by collectEmptyShadeViewVisibility()

            // WHEN has notifs
            activeNotificationListRepository.setActiveNotifs(count = 2)
@@ -614,4 +616,11 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
            if (SceneContainerFlag.isEnabled) underTest.shouldShowFooterView
            else underTest.shouldIncludeFooterView
        )

    private fun TestScope.collectEmptyShadeViewVisibility() =
        collectLastValue(
            if (ModesEmptyShadeFix.isEnabled)
                underTest.shouldShowEmptyShadeViewAnimated.map { it.value }
            else underTest.shouldShowEmptyShadeView
        )
}
+7 −2
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager;
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix;
import com.android.systemui.statusbar.notification.emptyshade.ui.view.EmptyShadeView;
import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor;
import com.android.systemui.statusbar.notification.footer.ui.view.FooterView;
@@ -383,6 +384,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(ModesEmptyShadeFix.FLAG_NAME)
    public void updateEmptyView_dndSuppressing() {
        when(mEmptyShadeView.willBeGone()).thenReturn(true);

@@ -394,6 +396,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(ModesEmptyShadeFix.FLAG_NAME)
    public void updateEmptyView_dndNotSuppressing() {
        mStackScroller.setEmptyShadeView(mEmptyShadeView);
        when(mEmptyShadeView.willBeGone()).thenReturn(true);
@@ -406,6 +409,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(ModesEmptyShadeFix.FLAG_NAME)
    public void updateEmptyView_noNotificationsToDndSuppressing() {
        mStackScroller.setEmptyShadeView(mEmptyShadeView);
        when(mEmptyShadeView.willBeGone()).thenReturn(true);
@@ -717,7 +721,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, ModesEmptyShadeFix.FLAG_NAME})
    public void testReInflatesFooterViews() {
        when(mEmptyShadeView.getTextResource()).thenReturn(R.string.empty_shade_text);
        clearInvocations(mStackScroller);
@@ -728,6 +732,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    @EnableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags(ModesEmptyShadeFix.FLAG_NAME)
    public void testReInflatesEmptyShadeView() {
        when(mEmptyShadeView.getTextResource()).thenReturn(R.string.empty_shade_text);
        clearInvocations(mStackScroller);
@@ -1189,7 +1194,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, ModesEmptyShadeFix.FLAG_NAME})
    public void hasFilteredOutSeenNotifs_updateEmptyShadeView() {
        mStackScroller.setHasFilteredOutSeenNotifications(true);
        mStackScroller.updateEmptyShadeView(true, false);