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

Commit 01958ea8 authored by Zekan Qian's avatar Zekan Qian Committed by Android (Google) Code Review
Browse files

Merge "Refactor widget folder"

parents de3e29a3 4f191eca
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -26,9 +26,9 @@ import com.android.settingslib.spa.framework.common.SettingsPageProvider
import com.android.settingslib.spa.framework.compose.navigator
import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.gallery.R
import com.android.settingslib.spa.widget.Illustration
import com.android.settingslib.spa.widget.IllustrationModel
import com.android.settingslib.spa.widget.ResourceType
import com.android.settingslib.spa.widget.illustration.Illustration
import com.android.settingslib.spa.widget.illustration.IllustrationModel
import com.android.settingslib.spa.widget.illustration.ResourceType
import com.android.settingslib.spa.widget.preference.Preference
import com.android.settingslib.spa.widget.preference.PreferenceModel

+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.settingslib.spa.widget
package com.android.settingslib.spa.widget.illustration

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
+4 −10
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.settingslib.spa.widget
package com.android.settingslib.spa.widget.chart

import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.SemanticsPropertyKey
@@ -24,12 +24,6 @@ import androidx.compose.ui.test.SemanticsMatcher
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settingslib.spa.widget.chart.BarChart
import com.android.settingslib.spa.widget.chart.BarChartData
import com.android.settingslib.spa.widget.chart.LineChart
import com.android.settingslib.spa.widget.chart.LineChartData
import com.android.settingslib.spa.widget.chart.PieChart
import com.android.settingslib.spa.widget.chart.PieChartData
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -39,10 +33,10 @@ class ChartTest {
    @get:Rule
    val composeTestRule = createComposeRule()

    private val Chart = SemanticsPropertyKey<String>("Chart")
    private var SemanticsPropertyReceiver.chart by Chart
    private val chart = SemanticsPropertyKey<String>("Chart")
    private var SemanticsPropertyReceiver.chart by chart
    private fun hasChart(chart: String): SemanticsMatcher =
        SemanticsMatcher.expectValue(Chart, chart)
        SemanticsMatcher.expectValue(this.chart, chart)

    @Test
    fun line_chart_displayed() {
+7 −7
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.settingslib.spa.widget
package com.android.settingslib.spa.widget.illustration

import androidx.annotation.DrawableRes
import androidx.annotation.RawRes
@@ -39,8 +39,8 @@ class IllustrationTest {
    @get:Rule
    val composeTestRule = createComposeRule()

    private val DrawableId = SemanticsPropertyKey<Int>("DrawableResId")
    private var SemanticsPropertyReceiver.drawableId by DrawableId
    private val drawableId = SemanticsPropertyKey<Int>("DrawableResId")
    private var SemanticsPropertyReceiver.drawableId by drawableId

    @Test
    fun image_displayed() {
@@ -54,7 +54,7 @@ class IllustrationTest {
        }

        fun hasDrawable(@DrawableRes id: Int): SemanticsMatcher =
            SemanticsMatcher.expectValue(DrawableId, id)
            SemanticsMatcher.expectValue(drawableId, id)

        val isIllustrationNode = hasAnyAncestor(hasDrawable(resId))
        composeTestRule.onAllNodes(hasDrawable(resId))
@@ -62,8 +62,8 @@ class IllustrationTest {
            .assertIsDisplayed()
    }

    private val RawId = SemanticsPropertyKey<Int>("RawResId")
    private var SemanticsPropertyReceiver.rawId by RawId
    private val rawId = SemanticsPropertyKey<Int>("RawResId")
    private var SemanticsPropertyReceiver.rawId by rawId

    @Test
    fun empty_lottie_not_displayed() {
@@ -77,7 +77,7 @@ class IllustrationTest {
        }

        fun hasRaw(@RawRes id: Int): SemanticsMatcher =
            SemanticsMatcher.expectValue(RawId, id)
            SemanticsMatcher.expectValue(rawId, id)

        val isIllustrationNode = hasAnyAncestor(hasRaw(resId))
        composeTestRule.onAllNodes(hasRaw(resId))