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

Commit e5ec8c16 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Chips] Fix OngoingActivityChipsViewModel tests for visible keys.

We only allow 3 chips if ChipsModernization is enabled, and the visibleChipKeys tests weren't taking that into account.

Fixes: 400832147
Bug: 364653005
Flag: TEST_ONLY
Test: atest OngoingActivityChipsWithNotifsViewModelTest
Change-Id: Ic33004bdae22c597aa1bf451326f202fc2429603
parent 31d71959
Loading
Loading
Loading
Loading
+65 −2
Original line number Diff line number Diff line
@@ -931,7 +931,40 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
        }

    @Test
    fun visibleChipKeys_fourPromotedNotifs_topThreeInList() =
    @DisableChipsModernization
    fun visibleChipKeys_chipsModOff_threePromotedNotifs_topTwoInList() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.visibleChipKeys)

            setNotifs(
                listOf(
                    activeNotificationModel(
                        key = "firstNotif",
                        statusBarChipIcon = createStatusBarIconViewOrNull(),
                        promotedContent =
                            PromotedNotificationContentModel.Builder("firstNotif").build(),
                    ),
                    activeNotificationModel(
                        key = "secondNotif",
                        statusBarChipIcon = createStatusBarIconViewOrNull(),
                        promotedContent =
                            PromotedNotificationContentModel.Builder("secondNotif").build(),
                    ),
                    activeNotificationModel(
                        key = "thirdNotif",
                        statusBarChipIcon = createStatusBarIconViewOrNull(),
                        promotedContent =
                            PromotedNotificationContentModel.Builder("thirdNotif").build(),
                    ),
                )
            )

            assertThat(latest).containsExactly("firstNotif", "secondNotif").inOrder()
        }

    @Test
    @EnableChipsModernization
    fun visibleChipKeys_chipsModOn_fourPromotedNotifs_topThreeInList() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.visibleChipKeys)

@@ -1069,7 +1102,37 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
        }

    @Test
    fun visibleChipKeys_screenRecordAndCallAndPromotedNotifs_topThreeInList() =
    @DisableChipsModernization
    fun visibleChipKeys_chipsModOff_screenRecordAndCallAndPromotedNotifs_topTwoInList() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.visibleChipKeys)

            val callNotificationKey = "call"
            addOngoingCallState(callNotificationKey)
            screenRecordState.value = ScreenRecordModel.Recording
            activeNotificationListRepository.addNotif(
                activeNotificationModel(
                    key = "notif1",
                    statusBarChipIcon = createStatusBarIconViewOrNull(),
                    promotedContent = PromotedNotificationContentModel.Builder("notif1").build(),
                )
            )
            activeNotificationListRepository.addNotif(
                activeNotificationModel(
                    key = "notif2",
                    statusBarChipIcon = createStatusBarIconViewOrNull(),
                    promotedContent = PromotedNotificationContentModel.Builder("notif2").build(),
                )
            )

            assertThat(latest)
                .containsExactly(ScreenRecordChipViewModel.KEY, callNotificationKey)
                .inOrder()
        }

    @Test
    @EnableChipsModernization
    fun visibleChipKeys_chipsModOn_screenRecordAndCallAndPromotedNotifs_topThreeInList() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.visibleChipKeys)