Slide 66
Slide 66 text
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
class ProjectCardScreenshotTest(
private val config: DeviceConfig
) {
companion object {
@JvmStatic
@Parameters
fun testParamsProvider() = listOf(
DeviceConfig("Small_Phone_Font_Small", RobolectricDeviceQualifiers.SmallPhone, 0.5f),
DeviceConfig("Small_Phone_Font_Normal", RobolectricDeviceQualifiers.SmallPhone, 1.0f),
DeviceConfig("Medium_Tablet_Font_Large", RobolectricDeviceQualifiers.MediumTablet, 2.0f),
)
}
@Test
fun screenshotTest() {
RuntimeEnvironment.setFontScale(config.fontScale)
RuntimeEnvironment.setQualifiers(config.qualifier)
...
}
}
Use Parameterized Runner for testing
multiple device configuration