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

Commit 0c826019 authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Override quick settings columns resources in tests

This makes the tests device independent

Test: QSColumnsRepositoryTest
Flag: TEST_ONLY
Fixes: 383094587
Change-Id: I64b65b8d323384dbfe1959b132d89d8db1110bcd
parent 127461b4
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.kosmos.testCase
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.shade.data.repository.fakeShadeRepository
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
@@ -35,7 +34,17 @@ import org.junit.runner.RunWith
@SmallTest
@RunWith(AndroidJUnit4::class)
class QSColumnsRepositoryTest : SysuiTestCase() {
    private val kosmos = testKosmos()
    private val kosmos =
        testKosmos().apply {
            testCase.context.orCreateTestableResources.addOverride(
                R.integer.quick_settings_dual_shade_num_columns,
                2,
            )
            testCase.context.orCreateTestableResources.addOverride(
                R.integer.quick_settings_split_shade_num_columns,
                3,
            )
        }
    private lateinit var underTest: QSColumnsRepository

    @Before
@@ -63,7 +72,7 @@ class QSColumnsRepositoryTest : SysuiTestCase() {
            testScope.runTest {
                val latest by collectLastValue(underTest.dualShadeColumns)

                assertThat(latest).isEqualTo(4)
                assertThat(latest).isEqualTo(2)
            }
        }

@@ -72,9 +81,8 @@ class QSColumnsRepositoryTest : SysuiTestCase() {
        with(kosmos) {
            testScope.runTest {
                val latest by collectLastValue(underTest.splitShadeColumns)
                fakeShadeRepository.setShadeLayoutWide(true)

                assertThat(latest).isEqualTo(4)
                assertThat(latest).isEqualTo(3)
            }
        }