SubspaceSemanticsNodeInteraction

class SubspaceSemanticsNodeInteraction


Represents a semantics node and the path to fetch it from the semantics tree. One can perform assertions or navigate to other nodes such as onChildren.

An instance of SubspaceSemanticsNodeInteraction can be obtained from onSubspaceNode and convenience methods that use a specific filter.

Summary

Public constructors

Public functions

Unit

Asserts that no item was found or that the item is no longer in the hierarchy.

SubspaceSemanticsNodeInteraction

Asserts that the component was found and is part of the component tree.

SubspaceSemanticsNode
fetchSemanticsNode(errorMessageOnFail: String?)

Returns the semantics node captured by this object.

Extension functions

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has depth that is greater than or equal to expectedMinDepth.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has depth equal to expectedDepth.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has height that is greater than or equal to expectedMinHeight.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has height equal to expectedHeight.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the left position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction
@CanIgnoreReturnValue
SubspaceSemanticsNodeInteraction.assertPositionInRootIsEqualTo(
    expectedX: Dp,
    expectedY: Dp,
    expectedZ: Dp
)

Asserts that the layout of this node has position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction
@CanIgnoreReturnValue
SubspaceSemanticsNodeInteraction.assertPositionIsEqualTo(
    expectedX: Dp,
    expectedY: Dp,
    expectedZ: Dp
)

Asserts that the layout of this node has position that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has rotation in the root composable that is equal to the given rotation.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has rotation that is equal to the given rotation.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the top position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has width that is greater than or equal to expectedMinWidth.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has width equal to expectedWidth.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the x position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the x position that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the y position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the y position that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the z position in the root composable that is equal to the given position.

SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the z position that is equal to the given position.

Vector3

Returns the position of the node relative to its parent layout node.

Vector3

Returns the position of the node relative to the root node.

Quaternion

Returns the rotation of the node relative to its parent layout node.

Quaternion

Returns the rotation of the node relative to the root node.

DpVolumeSize

Returns the size of the node.

Public constructors

SubspaceSemanticsNodeInteraction

Added in 1.0.0-alpha01
SubspaceSemanticsNodeInteraction(
    testContext: SubspaceTestContext,
    matcher: SubspaceSemanticsMatcher
)

Public functions

assertDoesNotExist

Added in 1.0.0-alpha01
fun assertDoesNotExist(): Unit

Asserts that no item was found or that the item is no longer in the hierarchy.

This will synchronize with the UI and fetch all the nodes again to ensure it has latest data.

Throws
kotlin.AssertionError

if the assert fails.

assertExists

Added in 1.0.0-alpha01
@CanIgnoreReturnValue
fun assertExists(errorMessageOnFail: String? = null): SubspaceSemanticsNodeInteraction

Asserts that the component was found and is part of the component tree.

This will synchronize with the UI and fetch all the nodes again to ensure it has latest data. If you are using fetchSemanticsNode you don't need to call this. In fact you would just introduce additional overhead.

Parameters
errorMessageOnFail: String? = null

Error message prefix to be added to the message in case this assert fails. This is typically used by operations that rely on this assert. Example prefix could be: "Failed to perform doOnClick.".

Throws
kotlin.AssertionError

if the assert fails.

fetchSemanticsNode

Added in 1.0.0-alpha01
fun fetchSemanticsNode(errorMessageOnFail: String? = null): SubspaceSemanticsNode

Returns the semantics node captured by this object.

Note: Accessing this object involves synchronization with your UI. If you are accessing this multiple times in one atomic operation, it is better to cache the result instead of calling this API multiple times.

This will fail if there is 0 or multiple nodes matching.

Parameters
errorMessageOnFail: String? = null

Error message prefix to be added to the message in case this fetch fails. This is typically used by operations that rely on this assert. Example prefix could be: "Failed to perform doOnClick.".

Throws
kotlin.AssertionError

if 0 or multiple nodes found.

Extension functions

assertDepthIsAtLeast

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertDepthIsAtLeast(
    expectedMinDepth: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has depth that is greater than or equal to expectedMinDepth.

Parameters
expectedMinDepth: Dp

The minimum depth to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertDepthIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertDepthIsEqualTo(
    expectedDepth: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has depth equal to expectedDepth.

Parameters
expectedDepth: Dp

The depth to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertHeightIsAtLeast

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertHeightIsAtLeast(
    expectedMinHeight: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has height that is greater than or equal to expectedMinHeight.

Parameters
expectedMinHeight: Dp

The minimum height to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertHeightIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertHeightIsEqualTo(
    expectedHeight: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has height equal to expectedHeight.

Parameters
expectedHeight: Dp

The height to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertLeftPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertLeftPositionInRootIsEqualTo(
    expectedLeft: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the left position in the root composable that is equal to the given position.

Parameters
expectedLeft: Dp

The left position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertPositionInRootIsEqualTo(
    expectedX: Dp,
    expectedY: Dp,
    expectedZ: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has position in the root composable that is equal to the given position.

Parameters
expectedX: Dp

The x position to assert.

expectedY: Dp

The y position to assert.

expectedZ: Dp

The z position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertPositionIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertPositionIsEqualTo(
    expectedX: Dp,
    expectedY: Dp,
    expectedZ: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has position that is equal to the given position.

Parameters
expectedX: Dp

The x position to assert.

expectedY: Dp

The y position to assert.

expectedZ: Dp

The z position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertRotationInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertRotationInRootIsEqualTo(
    expected: Quaternion
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has rotation in the root composable that is equal to the given rotation.

Parameters
expected: Quaternion

The rotation to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertRotationIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertRotationIsEqualTo(
    expected: Quaternion
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has rotation that is equal to the given rotation.

Parameters
expected: Quaternion

The rotation to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertTopPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertTopPositionInRootIsEqualTo(
    expectedTop: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the top position in the root composable that is equal to the given position.

Parameters
expectedTop: Dp

The top position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertWidthIsAtLeast

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertWidthIsAtLeast(
    expectedMinWidth: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has width that is greater than or equal to expectedMinWidth.

Parameters
expectedMinWidth: Dp

The minimum width to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertWidthIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertWidthIsEqualTo(
    expectedWidth: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has width equal to expectedWidth.

Parameters
expectedWidth: Dp

The width to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertXPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertXPositionInRootIsEqualTo(
    expectedX: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the x position in the root composable that is equal to the given position.

Parameters
expectedX: Dp

The x position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertXPositionIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertXPositionIsEqualTo(
    expectedX: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the x position that is equal to the given position.

Parameters
expectedX: Dp

The x position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertYPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertYPositionInRootIsEqualTo(
    expectedY: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the y position in the root composable that is equal to the given position.

Parameters
expectedY: Dp

The y position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertYPositionIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertYPositionIsEqualTo(
    expectedY: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the y position that is equal to the given position.

Parameters
expectedY: Dp

The y position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertZPositionInRootIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertZPositionInRootIsEqualTo(
    expectedZ: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the z position in the root composable that is equal to the given position.

Parameters
expectedZ: Dp

The z position to assert.

Throws
kotlin.AssertionError

if comparison fails.

assertZPositionIsEqualTo

@CanIgnoreReturnValue
fun SubspaceSemanticsNodeInteraction.assertZPositionIsEqualTo(
    expectedZ: Dp
): SubspaceSemanticsNodeInteraction

Asserts that the layout of this node has the z position that is equal to the given position.

Parameters
expectedZ: Dp

The z position to assert.

Throws
kotlin.AssertionError

if comparison fails.

fun SubspaceSemanticsNodeInteraction.getPosition(): Vector3

Returns the position of the node relative to its parent layout node.

Additional assertions with custom tolerances may be performed on the individual values.

getPositionInRoot

fun SubspaceSemanticsNodeInteraction.getPositionInRoot(): Vector3

Returns the position of the node relative to the root node.

Additional assertions with custom tolerances may be performed on the individual values.

fun SubspaceSemanticsNodeInteraction.getRotation(): Quaternion

Returns the rotation of the node relative to its parent layout node.

Additional assertions with custom tolerances may be performed on the individual values.

getRotationInRoot

fun SubspaceSemanticsNodeInteraction.getRotationInRoot(): Quaternion

Returns the rotation of the node relative to the root node.

Additional assertions with custom tolerances may be performed on the individual values.

fun SubspaceSemanticsNodeInteraction.getSize(): DpVolumeSize

Returns the size of the node.

Additional assertions with custom tolerances may be performed on the individual values.