{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

RotaryInjectionScope

@ExperimentalTestApi
public interface RotaryInjectionScope extends InjectionScope


The receiver scope of rotary input injection lambda from performRotaryScrollInput.

A rotary event can be sent with rotateToScrollVertically or rotateToScrollHorizontally. All events sent by these methods are batched together and sent as a whole after performRotaryScrollInput has executed its code block.

Example of performing a scroll with three events:

import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performRotaryScrollInput

composeTestRule.onNodeWithTag("myComponent")
    .performRotaryScrollInput {
        rotateToScrollVertically(3.0f)
        rotateToScrollVertically(10.0f)
        rotateToScrollVertically(2.0f)
    }

Summary

Public methods

abstract void
rotateToScrollHorizontally(float horizontalScrollPixels)

Sends a scroll event that represents a rotation that will result in a scroll distance of horizontalScrollPixels.

abstract void
rotateToScrollVertically(float verticalScrollPixels)

Sends a scroll event that represents a rotation that will result in a scroll distance of verticalScrollPixels.

Inherited methods

From androidx.compose.ui.unit.Density
abstract float

The logical density of the display.

abstract float

Current user preference for the scaling factor for fonts.

default int

Convert Dp to Int by rounding

default int

Convert Sp to Int by rounding

default @NonNull Dp

Convert Sp to Dp.

default @NonNull Dp
orgKt.toDp(int receiver)

Convert an Int pixel value to Dp.

default @NonNull Dp
orgKt.toDp(float receiver)

Convert a Float pixel value to a Dp

default @NonNull DpSize

Convert a Size to a DpSize.

default float
orgKt.toPx(@NonNull Dp receiver)

Convert Dp to pixels.

default float

Convert Sp to pixels.

default @NonNull Rect

Convert a DpRect to a Rect.

default @NonNull Size

Convert a DpSize to a Size.

default @NonNull TextUnit
orgKt.toSp(@NonNull Dp receiver)

Convert Dp to Sp.

default @NonNull TextUnit
orgKt.toSp(int receiver)

Convert an Int pixel value to Sp.

default @NonNull TextUnit
orgKt.toSp(float receiver)

Convert a Float pixel value to a Sp

From androidx.compose.ui.test.InjectionScope
abstract void
advanceEventTime(long durationMillis)

Adds the given durationMillis to the current event time, delaying the next event by that time.

default float

The y-coordinate for the bottom of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The center of the bottom edge of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The bottom left corner of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The bottom right corner of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The center of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The center of the left edge of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The center of the right edge of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default float

The x-coordinate for the center of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default float

The y-coordinate for the center of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default long

The default time between two successive events.

default int

The height of the node in px.

default float

The x-coordinate for the left edge of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default float

The x-coordinate for the right edge of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default float

The y-coordinate for the bottom of the node we're interacting with in px, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The center of the top edge of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The top left corner of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

default @NonNull Offset

The top right corner of the node we're interacting with, in the node's local coordinate system, where (0, 0) is the top left corner of the node.

abstract @NonNull ViewConfiguration

The ViewConfiguration in use by the SemanticsNode from the SemanticsNodeInteraction on which the input injection method is called.

abstract @NonNull IntSize

The size of the visible part of the node we're interacting with in px, i.e. its clipped bounds.

default int

The width of the node in px.

default @NonNull Offset
percentOffset(float x, float y)

Creates an Offset relative to the size of the node we're interacting with.

Public methods

rotateToScrollHorizontally

abstract void rotateToScrollHorizontally(float horizontalScrollPixels)

Sends a scroll event that represents a rotation that will result in a scroll distance of horizontalScrollPixels. The event will be sent at the current event time. Positive horizontalScrollPixels values will correspond to rotating the scroll wheel clockwise, negative values correspond to rotating the scroll wheel anticlockwise.

Parameters
float horizontalScrollPixels

The amount of scroll, in pixels

rotateToScrollVertically

abstract void rotateToScrollVertically(float verticalScrollPixels)

Sends a scroll event that represents a rotation that will result in a scroll distance of verticalScrollPixels. The event will be sent at the current event time. Positive verticalScrollPixels values will correspond to rotating the scroll wheel clockwise, negative values correspond to rotating the scroll wheel anticlockwise.

Parameters
float verticalScrollPixels

The amount of scroll, in pixels