diff options
| author | 2024-09-30 16:13:02 +0000 | |
|---|---|---|
| committer | 2024-09-30 16:13:02 +0000 | |
| commit | 45f85e804cbdf28854dfdd0a2b5ab489a609cc07 (patch) | |
| tree | 3c216c7e454e7aeac99171fbae16374d5a92934c | |
| parent | 45b826a7c78becc879181b9b075713067712b1fc (diff) | |
Disable ModesEmptyShadeFix in tests
This fixes the tests that are failing when modes_ui_empty_shade is
turned on.
For the view model tests, the new visibility should act the same as the
old one, so I kept the tests and I'm just getting the value from the
correct flow depending on the flag.
For the NSSL tests, they can just be disabled as we have equivalent
tests in the EmptyShadeViewModelTest.
Bug: 369859363
Bug: 366003631
Flag: TEST_ONLY
Test: presubmit with flag in staging
Change-Id: I66234cc1a6da9088fec19ee55b7081c56b947fc7
2 files changed, 26 insertions, 12 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt index d12d6f6b885d..f40bfbdeb54b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt @@ -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 + ) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index bb9f12b4de31..8a3e5510b561 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -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); |