Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +1 −3 Original line number Diff line number Diff line Loading @@ -2861,9 +2861,7 @@ class SceneContainerStartableTest : SysuiTestCase() { ) private fun fakeHeadsUpRowRepository(key: String, isPinned: Boolean) = FakeHeadsUpRowRepository(key = key, elementKey = Any()).apply { this.isPinned.value = isPinned } FakeHeadsUpRowRepository(key = key, elementKey = Any(), isPinned = isPinned) private fun setFingerprintSensorType(fingerprintSensorType: FingerprintSensorType) { kosmos.fingerprintPropertyRepository.setProperties( Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt +4 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.Notification import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_LOW import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -43,6 +42,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.domain.interactor.lockScreenNotificationMinimalismSetting import com.android.systemui.statusbar.notification.headsup.PinnedStatus import com.android.systemui.statusbar.notification.shared.NotificationMinimalism import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.testKosmos Loading Loading @@ -394,7 +394,7 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() { assertThatTopUnseenKey().isEqualTo(solo1.key) // TEST: even being pinned doesn't take effect immediately hunRepo1.isPinned.value = true hunRepo1.pinnedStatus.value = PinnedStatus.PinnedBySystem testScheduler.advanceTimeBy(0.5.seconds) onBeforeTransformGroupsListener.onBeforeTransformGroups(listEntryList) assertThatTopUnseenKey().isEqualTo(solo1.key) Loading @@ -406,8 +406,8 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() { // TEST: repeat; being heads up and pinned for 1 second triggers seen kosmos.headsUpNotificationRepository.orderedHeadsUpRows.value = listOf(hunRepo2) hunRepo1.isPinned.value = false hunRepo2.isPinned.value = true hunRepo1.pinnedStatus.value = PinnedStatus.NotPinned hunRepo2.pinnedStatus.value = PinnedStatus.PinnedBySystem testScheduler.advanceTimeBy(1.seconds) onBeforeTransformGroupsListener.onBeforeTransformGroups(listEntryList) assertThatTopUnseenKey().isEqualTo(null) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt +35 −14 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.data.repository.notificationsKeyguardViewStateRepository import com.android.systemui.statusbar.notification.headsup.PinnedStatus import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.testKosmos Loading Loading @@ -102,7 +103,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { } @Test fun hasPinnedRows_rowGetsPinned_true() = fun hasPinnedRows_rowGetsPinnedNormally_true() = testScope.runTest { val hasPinnedRows by collectLastValue(underTest.hasPinnedRows) // GIVEN no rows are pinned Loading @@ -115,8 +116,30 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { headsUpRepository.setNotifications(rows) runCurrent() // WHEN a row gets pinned rows[0].isPinned.value = true // WHEN a row gets pinned normally rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN hasPinnedRows updates to true assertThat(hasPinnedRows).isTrue() } @Test fun hasPinnedRows_rowGetsPinnedByUser_true() = testScope.runTest { val hasPinnedRows by collectLastValue(underTest.hasPinnedRows) // GIVEN no rows are pinned val rows = arrayListOf( fakeHeadsUpRowRepository("key 0"), fakeHeadsUpRowRepository("key 1"), fakeHeadsUpRowRepository("key 2"), ) headsUpRepository.setNotifications(rows) runCurrent() // WHEN a row gets pinned due to a chip tap rows[0].pinnedStatus.value = PinnedStatus.PinnedByUser runCurrent() // THEN hasPinnedRows updates to true Loading @@ -138,7 +161,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // THEN that row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN hasPinnedRows updates to false Loading Loading @@ -246,7 +269,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN all rows gets pinned rows[2].isPinned.value = true rows[2].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN no rows are filtered Loading @@ -271,7 +294,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { assertThat(activeHeadsUpRows).containsExactly(rows[0], rows[1], rows[2]) // WHEN all rows gets pinned rows[2].isPinned.value = true rows[2].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN no change Loading Loading @@ -329,7 +352,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN a row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN the unpinned row is filtered Loading @@ -351,7 +374,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN a row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN all rows are still present Loading @@ -372,15 +395,15 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { headsUpRepository.setNotifications(rows) runCurrent() rows[0].isPinned.value = true rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() assertThat(pinnedHeadsUpRows).containsExactly(rows[0]) rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() assertThat(pinnedHeadsUpRows).isEmpty() rows[0].isPinned.value = true rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() assertThat(pinnedHeadsUpRows).containsExactly(rows[0]) } Loading Loading @@ -485,7 +508,5 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { } private fun fakeHeadsUpRowRepository(key: String, isPinned: Boolean = false) = FakeHeadsUpRowRepository(key = key, elementKey = Any()).apply { this.isPinned.value = isPinned } FakeHeadsUpRowRepository(key = key, isPinned = isPinned) } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import kotlinx.coroutines.flow.StateFlowKt; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; Loading Loading @@ -318,6 +319,8 @@ public class HeadsUpManagerImplTest extends SysuiTestCase { mContext); final HeadsUpManagerImpl.HeadsUpEntry headsUpEntry = mock( HeadsUpManagerImpl.HeadsUpEntry.class); when(headsUpEntry.getPinnedStatus()) .thenReturn(StateFlowKt.MutableStateFlow(PinnedStatus.NotPinned)); headsUpEntry.mEntry = notifEntry; hum.onEntryRemoved(headsUpEntry, "test"); Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; Loading Loading @@ -91,7 +92,7 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { ExpandableNotificationRowDragController controller = createSpyController(); mRow.setDragController(controller); mRow.setHeadsUp(true); mRow.setPinned(true); mRow.setPinnedStatus(PinnedStatus.PinnedBySystem); mRow.doLongClickCallback(0, 0); mRow.doDragCallback(0, 0); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +1 −3 Original line number Diff line number Diff line Loading @@ -2861,9 +2861,7 @@ class SceneContainerStartableTest : SysuiTestCase() { ) private fun fakeHeadsUpRowRepository(key: String, isPinned: Boolean) = FakeHeadsUpRowRepository(key = key, elementKey = Any()).apply { this.isPinned.value = isPinned } FakeHeadsUpRowRepository(key = key, elementKey = Any(), isPinned = isPinned) private fun setFingerprintSensorType(fingerprintSensorType: FingerprintSensorType) { kosmos.fingerprintPropertyRepository.setProperties( Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt +4 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.Notification import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_LOW import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -43,6 +42,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.domain.interactor.lockScreenNotificationMinimalismSetting import com.android.systemui.statusbar.notification.headsup.PinnedStatus import com.android.systemui.statusbar.notification.shared.NotificationMinimalism import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.testKosmos Loading Loading @@ -394,7 +394,7 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() { assertThatTopUnseenKey().isEqualTo(solo1.key) // TEST: even being pinned doesn't take effect immediately hunRepo1.isPinned.value = true hunRepo1.pinnedStatus.value = PinnedStatus.PinnedBySystem testScheduler.advanceTimeBy(0.5.seconds) onBeforeTransformGroupsListener.onBeforeTransformGroups(listEntryList) assertThatTopUnseenKey().isEqualTo(solo1.key) Loading @@ -406,8 +406,8 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() { // TEST: repeat; being heads up and pinned for 1 second triggers seen kosmos.headsUpNotificationRepository.orderedHeadsUpRows.value = listOf(hunRepo2) hunRepo1.isPinned.value = false hunRepo2.isPinned.value = true hunRepo1.pinnedStatus.value = PinnedStatus.NotPinned hunRepo2.pinnedStatus.value = PinnedStatus.PinnedBySystem testScheduler.advanceTimeBy(1.seconds) onBeforeTransformGroupsListener.onBeforeTransformGroups(listEntryList) assertThatTopUnseenKey().isEqualTo(null) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt +35 −14 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.data.repository.notificationsKeyguardViewStateRepository import com.android.systemui.statusbar.notification.headsup.PinnedStatus import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.testKosmos Loading Loading @@ -102,7 +103,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { } @Test fun hasPinnedRows_rowGetsPinned_true() = fun hasPinnedRows_rowGetsPinnedNormally_true() = testScope.runTest { val hasPinnedRows by collectLastValue(underTest.hasPinnedRows) // GIVEN no rows are pinned Loading @@ -115,8 +116,30 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { headsUpRepository.setNotifications(rows) runCurrent() // WHEN a row gets pinned rows[0].isPinned.value = true // WHEN a row gets pinned normally rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN hasPinnedRows updates to true assertThat(hasPinnedRows).isTrue() } @Test fun hasPinnedRows_rowGetsPinnedByUser_true() = testScope.runTest { val hasPinnedRows by collectLastValue(underTest.hasPinnedRows) // GIVEN no rows are pinned val rows = arrayListOf( fakeHeadsUpRowRepository("key 0"), fakeHeadsUpRowRepository("key 1"), fakeHeadsUpRowRepository("key 2"), ) headsUpRepository.setNotifications(rows) runCurrent() // WHEN a row gets pinned due to a chip tap rows[0].pinnedStatus.value = PinnedStatus.PinnedByUser runCurrent() // THEN hasPinnedRows updates to true Loading @@ -138,7 +161,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // THEN that row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN hasPinnedRows updates to false Loading Loading @@ -246,7 +269,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN all rows gets pinned rows[2].isPinned.value = true rows[2].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN no rows are filtered Loading @@ -271,7 +294,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { assertThat(activeHeadsUpRows).containsExactly(rows[0], rows[1], rows[2]) // WHEN all rows gets pinned rows[2].isPinned.value = true rows[2].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() // THEN no change Loading Loading @@ -329,7 +352,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN a row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN the unpinned row is filtered Loading @@ -351,7 +374,7 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { runCurrent() // WHEN a row gets unpinned rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() // THEN all rows are still present Loading @@ -372,15 +395,15 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { headsUpRepository.setNotifications(rows) runCurrent() rows[0].isPinned.value = true rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() assertThat(pinnedHeadsUpRows).containsExactly(rows[0]) rows[0].isPinned.value = false rows[0].pinnedStatus.value = PinnedStatus.NotPinned runCurrent() assertThat(pinnedHeadsUpRows).isEmpty() rows[0].isPinned.value = true rows[0].pinnedStatus.value = PinnedStatus.PinnedBySystem runCurrent() assertThat(pinnedHeadsUpRows).containsExactly(rows[0]) } Loading Loading @@ -485,7 +508,5 @@ class HeadsUpNotificationInteractorTest : SysuiTestCase() { } private fun fakeHeadsUpRowRepository(key: String, isPinned: Boolean = false) = FakeHeadsUpRowRepository(key = key, elementKey = Any()).apply { this.isPinned.value = isPinned } FakeHeadsUpRowRepository(key = key, isPinned = isPinned) }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import kotlinx.coroutines.flow.StateFlowKt; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; Loading Loading @@ -318,6 +319,8 @@ public class HeadsUpManagerImplTest extends SysuiTestCase { mContext); final HeadsUpManagerImpl.HeadsUpEntry headsUpEntry = mock( HeadsUpManagerImpl.HeadsUpEntry.class); when(headsUpEntry.getPinnedStatus()) .thenReturn(StateFlowKt.MutableStateFlow(PinnedStatus.NotPinned)); headsUpEntry.mEntry = notifEntry; hum.onEntryRemoved(headsUpEntry, "test"); Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; Loading Loading @@ -91,7 +92,7 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { ExpandableNotificationRowDragController controller = createSpyController(); mRow.setDragController(controller); mRow.setHeadsUp(true); mRow.setPinned(true); mRow.setPinnedStatus(PinnedStatus.PinnedBySystem); mRow.doLongClickCallback(0, 0); mRow.doDragCallback(0, 0); Loading