mirror of
http://180.163.74.83:13000/zhangzhenghao/MPVN_Android.git
synced 2025-12-15 08:34:28 +00:00
26 lines
747 B
Kotlin
26 lines
747 B
Kotlin
|
|
package com.example.smarthome
|
||
|
|
|
||
|
|
import androidx.compose.runtime.CompositionLocalProvider
|
||
|
|
import androidx.compose.ui.platform.LocalDensity
|
||
|
|
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||
|
|
import androidx.compose.ui.unit.Density
|
||
|
|
import com.example.smarthome.ui.ControlPanel
|
||
|
|
import org.junit.Rule
|
||
|
|
import org.junit.Test
|
||
|
|
|
||
|
|
class UiAdaptationTest {
|
||
|
|
@get:Rule
|
||
|
|
val rule = createAndroidComposeRule<MainActivity>()
|
||
|
|
|
||
|
|
@Test
|
||
|
|
fun dpiAdaptation160to640() {
|
||
|
|
listOf(160f, 240f, 320f, 480f, 640f).forEach { dpi ->
|
||
|
|
rule.setContent {
|
||
|
|
CompositionLocalProvider(LocalDensity provides Density(dpi / 160f)) {
|
||
|
|
ControlPanel(roomIndex = 0)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|