Slide 37
Slide 37 text
Compose UI Test with JUnit 5
@RegisterExtension
val composeExtension = createComposeExtension()
@CsvSource(
// Dark mode | Font scale
" false, 1.0",
" false, 2.0",
" true, 1.0",
" true, 2.0",
)
@ParameterizedTest(name = "dark={0}, font={1}")
fun test(darkTheme: Boolean, fontScale: Float) = composeExtension.use {
setContent {
DK24ShowcaseTheme(
darkTheme = darkTheme,
fontScale = fontScale,
) {
Greeting("DroidKaigi", onNameUpdated = {})
}
}
onNodeWithText("Hello DroidKaigi").assertExists()
}
@RegisterExtension
val composeExtension = createComposeExtension()
@CsvSource(
// Dark mode | Font scale
" false, 1.0",
" false, 2.0",
" true, 1.0",
" true, 2.0",
)
@ParameterizedTest(name = "dark={0}, font={1}")
fun test(darkTheme: Boolean, fontScale: Float) = composeExtension.use {
setContent {
DK24ShowcaseTheme(
darkTheme = darkTheme,
fontScale = fontScale,
) {
Greeting("DroidKaigi", onNameUpdated = {})
}
}
onNodeWithText("Hello DroidKaigi").assertExists()
}