Google is committed to advancing racial equity for Black communities. See how.

GestureScope

class GestureScope : BaseGestureScope
kotlin.Any
   ↳ androidx.ui.test.BaseGestureScope
   ↳ androidx.ui.test.GestureScope

The receiver scope for injecting gestures on the semanticsNode identified by the corresponding SemanticsNodeInteraction. Gestures can be injected by calling methods defined on GestureScope, such as sendSwipeUp. The SemanticsNodeInteraction can be found by one of the finder methods such as findByTag.

Example usage:

findByTag("myWidget")
   .doGesture {
       sendSwipeUp()
   }

Summary

Extension functions
From androidx.ui.test
Unit
GestureScope.sendClick(position: Offset = center)

Performs a click gesture at the given position on the associated component, or in the center if the position is omitted.

Unit
GestureScope.sendDoubleClick(position: Offset = center, delay: Duration = doubleClickDelay)

Performs a double click gesture at the given position on the associated component, or in the center if the position is omitted.

Unit
GestureScope.sendLongClick(position: Offset = center, duration: Duration = LongPressTimeout + 100.milliseconds)

Performs a long click gesture at the given position on the associated component, or in the center if the position is omitted.

Unit
GestureScope.sendPinch(start0: Offset, end0: Offset, start1: Offset, end1: Offset, duration: Duration = 400.milliseconds)

Performs a pinch gesture on the associated component.

Unit
GestureScope.sendSwipe(start: Offset, end: Offset, duration: Duration = 200.milliseconds)

Performs the swipe gesture on the associated component.

Unit

Performs a swipe down gesture on the associated component.

Unit

Performs a swipe left gesture on the associated component.

Unit

Performs a swipe right gesture on the associated component.

Unit

Performs a swipe up gesture on the associated component.

Unit
GestureScope.sendSwipeWithVelocity(start: Offset, end: Offset, @FloatRange(0.0) endVelocity: Float, duration: Duration = 200.milliseconds)

Performs the swipe gesture on the associated component, such that the velocity when the gesture is finished is roughly equal to endVelocity.

Inherited extension functions
From androidx.ui.test
Offset

Transforms the position to global coordinates, as defined by globalBounds

Offset
BaseGestureScope.percentOffset(@FloatRange(-1.0, 1.0) x: Float = 0f, @FloatRange(-1.0, 1.0) y: Float = 0f)

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

Inherited extension properties
From androidx.ui.test
Float

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

Offset

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

Offset

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

Offset

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

Offset

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

Offset

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

Offset

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

Float

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

Float

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

PxBounds

Returns the global bounds of the component we're interacting with

Int

Shorthand for size.height

Float

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

Float

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

IntSize

Returns the size of the component we're interacting with

Float

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

Offset

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

Offset

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

Offset

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

Int

Shorthand for size.width