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

Commit 2d20afe1 authored by amehfooz's avatar amehfooz
Browse files

[SB][ComposeIcons] Sort icons based on ordered slot names

Test: SystemStatusIconsViewModelTest
Bug: 418830269
Flag: com.android.systemui.status_bar_system_status_icons_in_compose
Change-Id: I40eeeda1e57d741bae969f9173431a8b66f81638
parent 11986e35
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.pipeline.shared.ui.viewmodel

import android.content.Context
import android.graphics.Color
import android.graphics.Rect
import android.graphics.RectF
@@ -86,7 +87,7 @@ class FakeHomeStatusBarViewModel(

    override val systemStatusIconsViewModelFactory: SystemStatusIconsViewModel.Factory =
        object : SystemStatusIconsViewModel.Factory {
            override fun create(): SystemStatusIconsViewModel =
            override fun create(context: Context): SystemStatusIconsViewModel =
                mock(SystemStatusIconsViewModel::class.java)
        }

+6 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.systemstatusicons.airplane.ui.viewmodel

import android.content.testableContext
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
@@ -32,7 +33,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.repository.connectivi
import com.android.systemui.statusbar.pipeline.shared.data.repository.fake
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -41,7 +41,7 @@ import org.junit.runner.RunWith
class AirplaneModeIconViewModelTest : SysuiTestCase() {

    private val kosmos = testKosmos().useUnconfinedTestDispatcher()
    private val underTest = kosmos.airplaneModeIconViewModelFactory.create()

    private val fakeConnectivityRepository = kosmos.connectivityRepository.fake
    private val expectedAirplaneIcon =
        Icon.Resource(
@@ -49,9 +49,9 @@ class AirplaneModeIconViewModelTest : SysuiTestCase() {
            contentDescription = ContentDescription.Resource(R.string.accessibility_airplane_mode),
        )

    @Before
    fun setUp() {
        underTest.activateIn(kosmos.testScope)
    private val underTest =
        kosmos.airplaneModeIconViewModelFactory.create(kosmos.testableContext).apply {
            activateIn(kosmos.testScope)
        }

    @Test
+11 −15
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.systemstatusicons.bluetooth.ui.viewmodel

import android.bluetooth.BluetoothProfile
import android.content.testableContext
import android.platform.test.annotations.EnableFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
@@ -33,11 +34,9 @@ import com.android.systemui.statusbar.policy.bluetooth.data.repository.bluetooth
import com.android.systemui.statusbar.systemstatusicons.SystemStatusIconsInCompose
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever

@SmallTest
@@ -46,17 +45,14 @@ import org.mockito.kotlin.whenever
class BluetoothIconViewModelTest : SysuiTestCase() {

    private val kosmos = testKosmos().useUnconfinedTestDispatcher()
    @Mock private lateinit var cachedDevice: CachedBluetoothDevice
    private lateinit var underTest: BluetoothIconViewModel

    @Before
    fun setUp() {
        MockitoAnnotations.openMocks(this)
        whenever(cachedDevice.isConnected).thenReturn(true)
        whenever(cachedDevice.maxConnectionState).thenReturn(BluetoothProfile.STATE_CONNECTED)

        underTest = kosmos.bluetoothIconViewModelFactory.create()
        underTest.activateIn(kosmos.testScope)
    private val cachedDevice =
        mock<CachedBluetoothDevice>().apply {
            whenever(isConnected).thenReturn(true)
            whenever(maxConnectionState).thenReturn(BluetoothProfile.STATE_CONNECTED)
        }
    private val underTest =
        kosmos.bluetoothIconViewModelFactory.create(kosmos.testableContext).apply {
            activateIn(kosmos.testScope)
        }

    @Test
+5 −7
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.systemstatusicons.ethernet.ui.viewmodel

import android.content.testableContext
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.settingslib.AccessibilityContentDescriptions
@@ -32,7 +33,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.repository.connectivi
import com.android.systemui.statusbar.pipeline.shared.data.repository.fake
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -45,11 +45,9 @@ class EthernetIconViewModelTest : SysuiTestCase() {
        kosmos.connectivityRepository.fake
    }

    private val underTest = kosmos.ethernetIconViewModelFactory.create()

    @Before
    fun setUp() {
        underTest.activateIn(kosmos.testScope)
    private val underTest =
        kosmos.ethernetIconViewModelFactory.create(kosmos.testableContext).apply {
            activateIn(kosmos.testScope)
        }

    @Test
+5 −7
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.systemstatusicons.ringer.ui.viewmodel

import android.content.testableContext
import android.media.AudioManager
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
@@ -31,7 +32,6 @@ import com.android.systemui.res.R
import com.android.systemui.testKosmos
import com.android.systemui.volume.data.repository.fakeAudioRepository
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@@ -40,11 +40,9 @@ import org.junit.runner.RunWith
class MuteIconViewModelTest : SysuiTestCase() {

    private val kosmos = testKosmos().useUnconfinedTestDispatcher()
    private val underTest = kosmos.muteIconViewModelFactory.create()

    @Before
    fun setUp() {
        underTest.activateIn(kosmos.testScope)
    private val underTest =
        kosmos.muteIconViewModelFactory.create(kosmos.testableContext).apply {
            activateIn(kosmos.testScope)
        }

    @Test
Loading