Function

performTouchInput

Executes the touch gesture specified in the given block.

touchInputSwipeUp

@Sampled
fun touchInputSwipeUp() {
    composeTestRule.onNodeWithTag("myComponent").performTouchInput { swipeUp() }
}

touchInputClickOffCenter

@Sampled
fun touchInputClickOffCenter() {
    composeTestRule.onNodeWithTag("myComponent").performTouchInput {
        click(percentOffset(.2f, .5f))
    }
}

touchInputAssertDuringClick

@Sampled
fun touchInputAssertDuringClick() {
    composeTestRule
        .onNodeWithTag("myComponent")
        .performTouchInput { down(topLeft) }
        .assertHasClickAction()
        .performTouchInput { up() }
}

touchInputClickAndDrag

@Sampled
fun touchInputClickAndDrag() {
    composeTestRule.onNodeWithTag("myComponent").performTouchInput {
        click()
        advanceEventTime(100)
        swipeUp()
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: