Merge "Refactor widget folder"
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
@@ -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))
|
||||
Reference in New Issue
Block a user