ArCoreTestRule


public final class ArCoreTestRule extends ExternalResource


A JUnit Rule for creating a test environment for ARCore for Jetpack XR applications. This rule allows you to write unit tests where you alter the state of the perception system.

Summary

Public constructors

Public methods

final void

Adds the given TestTrackable objects and registers them with this ArCoreTestRule.

final void

Clears the map of UUID instances to Pose instances.

final int

The maximum number of androidx.xr.arcore.Anchor objects that can be loaded at once in the runtime.

final @NonNull List<@NonNull TestAugmentedImage>

A list of all TestAugmentedImage objects in the environment.

final @NonNull List<@NonNull TestAugmentedObject>

A list of all TestAugmentedObject objects in the environment.

final @NonNull TestConversationSceneSignal

A test representation of the device's Conversation Scene Signal.

final @NonNull TestArDevice

The object representing the user's device in the environment.

final @NonNull TestFace

The object representing the user's face in the environment.

final @NonNull TestGeospatial

A test representation of the device's androidx.xr.arcore.Geospatial status.

final @NonNull TestDepth

A test representation of the device's left androidx.xr.arcore.Depth data.

final @NonNull TestEye

The object representing the user's left eye in the environment.

final @NonNull TestHand

The object representing the user's left hand in the environment.

final @NonNull TestRenderViewpoint

A test representation of the device's left androidx.xr.arcore.RenderViewpoint.

final @NonNull TestDepth

A test representation of the device's mono androidx.xr.arcore.Depth data.

final @NonNull TestRenderViewpoint

A test representation of the device's mono androidx.xr.arcore.RenderViewpoint.

final @NonNull Map<@NonNull UUID, @NonNull Pose>

A Map of UUID to Anchor Poses stored outside the session.

final @NonNull List<@NonNull TestPlane>

A list of all TestPlane objects in the environment.

final @NonNull TestDepth

A test representation of the device's right androidx.xr.arcore.Depth data.

final @NonNull TestEye

The object representing the user's right eye in the environment.

final @NonNull TestHand

The object representing the user's right hand in the environment.

final @NonNull TestRenderViewpoint

A test representation of the device's right androidx.xr.arcore.RenderViewpoint.

final @NonNull UUID

Supply the Pose of an androidx.xr.arcore.Anchor to be persisted outside the androidx.xr.runtime.Session.

final void

The maximum number of androidx.xr.arcore.Anchor objects that can be loaded at once in the runtime.

Protected methods

void
void

Inherited methods

From org.junit.rules.TestRule

Public constructors

ArCoreTestRule

Added in 1.0.0-alpha14
public ArCoreTestRule()

Public methods

addTrackables

Added in 1.0.0-alpha14
public final void addTrackables(@NonNull TestTrackable... trackables)

Adds the given TestTrackable objects and registers them with this ArCoreTestRule.

Objects that are added are not removed during the lifetime of the test. Instead, their TrackingState will be updated based on their TestTrackable.isVisible property and the androidx.xr.runtime.Session configuration.

Parameters
@NonNull TestTrackable... trackables

TestTrackable objects to add

clearPersistedAnchors

Added in 1.0.0-alpha14
public final void clearPersistedAnchors()

Clears the map of UUID instances to Pose instances.

getAnchorResourceLimit

Added in 1.0.0-alpha14
public final int getAnchorResourceLimit()

The maximum number of androidx.xr.arcore.Anchor objects that can be loaded at once in the runtime. Defaults to 6.

getAugmentableImages

Added in 1.0.0-alpha14
public final @NonNull List<@NonNull TestAugmentedImagegetAugmentableImages()

A list of all TestAugmentedImage objects in the environment. Tracking must be configured via androidx.xr.runtime.Session.configure in order for an added object to be ingested by the runtime.

getAugmentableObjects

Added in 1.0.0-alpha14
public final @NonNull List<@NonNull TestAugmentedObjectgetAugmentableObjects()

A list of all TestAugmentedObject objects in the environment. Tracking must be configured via androidx.xr.runtime.Session.configure in order for an added object to be ingested by the runtime.

getConversationSceneSignal

Added in 1.0.0-alpha14
public final @NonNull TestConversationSceneSignal getConversationSceneSignal()

A test representation of the device's Conversation Scene Signal.

getDevice

Added in 1.0.0-alpha14
public final @NonNull TestArDevice getDevice()

The object representing the user's device in the environment. androidx.xr.runtime.DeviceTrackingMode.LAST_KNOWN must be configured for it to be ingested by the runtime.

getFace

Added in 1.0.0-alpha14
public final @NonNull TestFace getFace()

The object representing the user's face in the environment. Config.faceTracking must be set to androidx.xr.runtime.FaceTrackingMode.MESHES or androidx.xr.runtime.FaceTrackingMode.BLEND_SHAPES for it to be integrated by the runtime. TestTrackable.isVisible must be set to true for the face's pose to update in the API.

getGeospatial

Added in 1.0.0-alpha14
public final @NonNull TestGeospatial getGeospatial()

A test representation of the device's androidx.xr.arcore.Geospatial status.

getLeftDepth

Added in 1.0.0-alpha14
public final @NonNull TestDepth getLeftDepth()

A test representation of the device's left androidx.xr.arcore.Depth data.

getLeftEye

Added in 1.0.0-alpha14
public final @NonNull TestEye getLeftEye()

The object representing the user's left eye in the environment. androidx.xr.runtime.EyeTrackingMode.COARSE_TRACKING or androidx.xr.runtime.EyeTrackingMode.FINE_TRACKING must be configured for it to be ingested by the runtime. TestEye.isOpen must be set to true for the eye's pose to update in the API.

getLeftHand

Added in 1.0.0-alpha14
public final @NonNull TestHand getLeftHand()

The object representing the user's left hand in the environment. androidx.xr.runtime.HandTrackingMode.BOTH must be configured for it to be ingested by the runtime. TestHand.isVisible must be set to true for the hand's pose to update in the API.

getLeftRenderViewpoint

Added in 1.0.0-alpha14
public final @NonNull TestRenderViewpoint getLeftRenderViewpoint()

A test representation of the device's left androidx.xr.arcore.RenderViewpoint.

getMonoDepth

Added in 1.0.0-alpha14
public final @NonNull TestDepth getMonoDepth()

A test representation of the device's mono androidx.xr.arcore.Depth data.

getMonoRenderViewpoint

Added in 1.0.0-alpha14
public final @NonNull TestRenderViewpoint getMonoRenderViewpoint()

A test representation of the device's mono androidx.xr.arcore.RenderViewpoint.

getPersistedAnchorPoses

Added in 1.0.0-alpha14
public final @NonNull Map<@NonNull UUID, @NonNull PosegetPersistedAnchorPoses()

A Map of UUID to Anchor Poses stored outside the session.

getPlanes

Added in 1.0.0-alpha14
public final @NonNull List<@NonNull TestPlanegetPlanes()

A list of all TestPlane objects in the environment. Tracking must be configured via androidx.xr.runtime.Session.configure in order for an added plane to be ingested by the runtime.

getRightDepth

Added in 1.0.0-alpha14
public final @NonNull TestDepth getRightDepth()

A test representation of the device's right androidx.xr.arcore.Depth data.

getRightEye

Added in 1.0.0-alpha14
public final @NonNull TestEye getRightEye()

The object representing the user's right eye in the environment. androidx.xr.runtime.EyeTrackingMode.COARSE_TRACKING or androidx.xr.runtime.EyeTrackingMode.FINE_TRACKING must be configured for it to be ingested by the runtime. TestEye.isOpen must be set to true for the eye's pose to update in the API.

getRightHand

Added in 1.0.0-alpha14
public final @NonNull TestHand getRightHand()

The object representing the user's right hand in the environment. androidx.xr.runtime.HandTrackingMode.BOTH must be configured for it to be ingested by the runtime. TestHand.isVisible must be set to true for the hand's pose to update in the API.

getRightRenderViewpoint

Added in 1.0.0-alpha14
public final @NonNull TestRenderViewpoint getRightRenderViewpoint()

A test representation of the device's right androidx.xr.arcore.RenderViewpoint.

persistAnchor

Added in 1.0.0-alpha14
public final @NonNull UUID persistAnchor(@NonNull Pose pose)

Supply the Pose of an androidx.xr.arcore.Anchor to be persisted outside the androidx.xr.runtime.Session. Persisted Anchors can be loaded by their UUID.

Parameters
@NonNull Pose pose

the Pose at which the test will persist an Anchor

Returns
@NonNull UUID

the UUID of the newly persisted Anchor

setAnchorResourceLimit

Added in 1.0.0-alpha14
public final void setAnchorResourceLimit(int value)

The maximum number of androidx.xr.arcore.Anchor objects that can be loaded at once in the runtime. Defaults to 6.

Protected methods

after

protected void after()

before

Added in 1.0.0-alpha14
protected void before()