ThemedComposeRule
class ThemedComposeRule(theme: (content: () -> Unit) -> Unit, delegate: ComposeContentTestRule = createComposeRule()) : ComposeContentTestRule(source)
A compose rule that wraps every setContent in the app's theme, replacing per-test setContent { AppTheme { ... } } boilerplate.
@get:Rule val composeRule = ThemedComposeRule(theme = { content -> AppTheme(content = content) })
@Test fun showsTitle() {
composeRule.setContent { Title("Ready") }
composeRule.waitForText("Ready")
}Content copied to clipboard
Parameters
theme
Wraps test content, for example in the app theme or a dark-mode variant.
delegate
The rule to wrap; defaults to createComposeRule().