Loading packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt +12 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { DefaultComponentsLayoutManager( BOTTOM_BAR, headerComponents = listOf(COMPONENT_1), footerComponents = listOf(COMPONENT_2), footerComponents = listOf(COMPONENT_5, COMPONENT_2), ) @Test Loading @@ -48,10 +48,18 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { val component2 = ComponentState(COMPONENT_2, kosmos.mockVolumePanelUiComponent, false) val component3 = ComponentState(COMPONENT_3, kosmos.mockVolumePanelUiComponent, false) val component4 = ComponentState(COMPONENT_4, kosmos.mockVolumePanelUiComponent, false) val component5 = ComponentState(COMPONENT_5, kosmos.mockVolumePanelUiComponent, false) val layout = underTest.layout( VolumePanelState(0, false, false), setOf(bottomBarComponentState, component1, component2, component3, component4) setOf( bottomBarComponentState, component1, component2, component3, component4, component5, ) ) Truth.assertThat(layout.bottomBarComponent).isEqualTo(bottomBarComponentState) Loading @@ -59,7 +67,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { .containsExactlyElementsIn(listOf(component1)) .inOrder() Truth.assertThat(layout.footerComponents) .containsExactlyElementsIn(listOf(component2)) .containsExactlyElementsIn(listOf(component5, component2)) .inOrder() Truth.assertThat(layout.contentComponents) .containsExactlyElementsIn(listOf(component3, component4)) Loading @@ -85,5 +93,6 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { const val COMPONENT_2: VolumePanelComponentKey = "test_component:2" const val COMPONENT_3: VolumePanelComponentKey = "test_component:3" const val COMPONENT_4: VolumePanelComponentKey = "test_component:4" const val COMPONENT_5: VolumePanelComponentKey = "test_component:5" } } packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/DefaultComponentsLayoutManager.kt +10 −4 Original line number Diff line number Diff line Loading @@ -46,12 +46,18 @@ constructor( !footerComponents.contains(it.key) && it.key != bottomBar } val headerComponents = components.filter { headerComponents.contains(it.key) } val footerComponents = components.filter { footerComponents.contains(it.key) } val headerComponents = components .filter { it.key in headerComponents } .sortedBy { headerComponents.indexOf(it.key) } val footerComponents = components .filter { it.key in footerComponents } .sortedBy { footerComponents.indexOf(it.key) } return ComponentsLayout( headerComponents = headerComponents.sortedBy { it.key }, headerComponents = headerComponents, contentComponents = contentComponents.sortedBy { it.key }, footerComponents = footerComponents.sortedBy { it.key }, footerComponents = footerComponents, bottomBarComponent = components.find { it.key == bottomBar } ?: error( "VolumePanelComponents.BOTTOM_BAR must be present in the default " + Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt +12 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { DefaultComponentsLayoutManager( BOTTOM_BAR, headerComponents = listOf(COMPONENT_1), footerComponents = listOf(COMPONENT_2), footerComponents = listOf(COMPONENT_5, COMPONENT_2), ) @Test Loading @@ -48,10 +48,18 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { val component2 = ComponentState(COMPONENT_2, kosmos.mockVolumePanelUiComponent, false) val component3 = ComponentState(COMPONENT_3, kosmos.mockVolumePanelUiComponent, false) val component4 = ComponentState(COMPONENT_4, kosmos.mockVolumePanelUiComponent, false) val component5 = ComponentState(COMPONENT_5, kosmos.mockVolumePanelUiComponent, false) val layout = underTest.layout( VolumePanelState(0, false, false), setOf(bottomBarComponentState, component1, component2, component3, component4) setOf( bottomBarComponentState, component1, component2, component3, component4, component5, ) ) Truth.assertThat(layout.bottomBarComponent).isEqualTo(bottomBarComponentState) Loading @@ -59,7 +67,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { .containsExactlyElementsIn(listOf(component1)) .inOrder() Truth.assertThat(layout.footerComponents) .containsExactlyElementsIn(listOf(component2)) .containsExactlyElementsIn(listOf(component5, component2)) .inOrder() Truth.assertThat(layout.contentComponents) .containsExactlyElementsIn(listOf(component3, component4)) Loading @@ -85,5 +93,6 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() { const val COMPONENT_2: VolumePanelComponentKey = "test_component:2" const val COMPONENT_3: VolumePanelComponentKey = "test_component:3" const val COMPONENT_4: VolumePanelComponentKey = "test_component:4" const val COMPONENT_5: VolumePanelComponentKey = "test_component:5" } }
packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/DefaultComponentsLayoutManager.kt +10 −4 Original line number Diff line number Diff line Loading @@ -46,12 +46,18 @@ constructor( !footerComponents.contains(it.key) && it.key != bottomBar } val headerComponents = components.filter { headerComponents.contains(it.key) } val footerComponents = components.filter { footerComponents.contains(it.key) } val headerComponents = components .filter { it.key in headerComponents } .sortedBy { headerComponents.indexOf(it.key) } val footerComponents = components .filter { it.key in footerComponents } .sortedBy { footerComponents.indexOf(it.key) } return ComponentsLayout( headerComponents = headerComponents.sortedBy { it.key }, headerComponents = headerComponents, contentComponents = contentComponents.sortedBy { it.key }, footerComponents = footerComponents.sortedBy { it.key }, footerComponents = footerComponents, bottomBarComponent = components.find { it.key == bottomBar } ?: error( "VolumePanelComponents.BOTTOM_BAR must be present in the default " + Loading