Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +19 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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 Loading @@ -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) Loading @@ -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) Loading @@ -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 Loading @@ -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 Loading @@ -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) Loading @@ -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) Loading @@ -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) Loading @@ -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) Loading Loading @@ -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) Loading Loading @@ -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 ) } packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -383,6 +384,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test @DisableFlags(ModesEmptyShadeFix.FLAG_NAME) public void updateEmptyView_dndSuppressing() { when(mEmptyShadeView.willBeGone()).thenReturn(true); Loading @@ -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); Loading @@ -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); Loading Loading @@ -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); Loading @@ -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); Loading Loading @@ -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); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +19 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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 Loading @@ -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) Loading @@ -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) Loading @@ -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 Loading @@ -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 Loading @@ -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) Loading @@ -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) Loading @@ -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) Loading @@ -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) Loading Loading @@ -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) Loading Loading @@ -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 ) }
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -383,6 +384,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test @DisableFlags(ModesEmptyShadeFix.FLAG_NAME) public void updateEmptyView_dndSuppressing() { when(mEmptyShadeView.willBeGone()).thenReturn(true); Loading @@ -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); Loading @@ -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); Loading Loading @@ -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); Loading @@ -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); Loading Loading @@ -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); Loading