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

Commit f60634dd authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Controls UI - Do not save empty structures" into rvc-dev am: 55bd691d...

Merge "Controls UI - Do not save empty structures" into rvc-dev am: 55bd691d am: 99532ba1 am: ea8c5ec0 am: 1f6c7ceb

Change-Id: I64fbcfb376ea2df96458b7fb8e62457068c583a0
parents 16c3ba8c 1f6c7ceb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -493,10 +493,12 @@ private object Favorites {
                updatedStructure
            } else { s }

            if (!newStructure.controls.isEmpty()) {
                structures.add(newStructure)
            }
        }

        if (!replaced) {
        if (!replaced && !updatedStructure.controls.isEmpty()) {
            structures.add(updatedStructure)
        }

+11 −1
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ class ControlsControllerImplTest : SysuiTestCase() {
    }

    @Test
    fun testReplaceFavoritesForStructure_noFavorites() {
    fun testReplaceFavoritesForStructure_noExistingFavorites() {
        controller.replaceFavoritesForStructure(TEST_STRUCTURE_INFO)
        delayableExecutor.runAllReady()

@@ -530,6 +530,16 @@ class ControlsControllerImplTest : SysuiTestCase() {
            controller.getFavoritesForComponent(TEST_COMPONENT))
    }

    @Test
    fun testReplaceFavoritesForStructure_doNotStoreEmptyStructure() {
        controller.replaceFavoritesForStructure(
            StructureInfo(TEST_COMPONENT, "Home", emptyList<ControlInfo>()))
        delayableExecutor.runAllReady()

        assertEquals(0, controller.countFavoritesForComponent(TEST_COMPONENT))
        assertEquals(emptyList<ControlInfo>(), controller.getFavoritesForComponent(TEST_COMPONENT))
    }

    @Test
    fun testReplaceFavoritesForStructure_differentComponentsAreFilteredOut() {
        controller.replaceFavoritesForStructure(TEST_STRUCTURE_INFO)