ArCoreTestRule


class ArCoreTestRule : 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 functions

Unit
addTrackables(vararg trackables: TestTrackable)

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

Unit

Clears the map of UUID instances to Pose instances.

UUID

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

Protected functions

open Unit
open Unit

Public properties

Int

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

List<TestAugmentedImage>

A list of all TestAugmentedImage objects in the environment.

List<TestAugmentedObject>

A list of all TestAugmentedObject objects in the environment.

TestConversationSceneSignal

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

TestArDevice

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

TestFace

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

TestGeospatial

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

TestDepth

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

TestEye

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

TestHand

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

TestRenderViewpoint

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

TestDepth

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

TestRenderViewpoint

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

Map<UUIDPose>

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

List<TestPlane>

A list of all TestPlane objects in the environment.

TestDepth

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

TestEye

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

TestHand

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

TestRenderViewpoint

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

Inherited functions

From org.junit.rules.TestRule
open Statement
apply(base: Statement, description: Description)

Public constructors

ArCoreTestRule

Added in 1.0.0-alpha14
ArCoreTestRule()

Public functions

addTrackables

Added in 1.0.0-alpha14
fun addTrackables(vararg trackables: TestTrackable): Unit

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
vararg trackables: TestTrackable

TestTrackable objects to add

clearPersistedAnchors

Added in 1.0.0-alpha14
fun clearPersistedAnchors(): Unit

Clears the map of UUID instances to Pose instances.

persistAnchor

Added in 1.0.0-alpha14
fun persistAnchor(pose: Pose): UUID

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
pose: Pose

the Pose at which the test will persist an Anchor

Returns
UUID

the UUID of the newly persisted Anchor

Protected functions

after

protected open fun after(): Unit

before

Added in 1.0.0-alpha14
protected open fun before(): Unit

Public properties

anchorResourceLimit

Added in 1.0.0-alpha14
var anchorResourceLimitInt

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

augmentableImages

Added in 1.0.0-alpha14
val augmentableImagesList<TestAugmentedImage>

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.

augmentableObjects

Added in 1.0.0-alpha14
val augmentableObjectsList<TestAugmentedObject>

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.

conversationSceneSignal

Added in 1.0.0-alpha14
@ExperimentalSceneSignalApi
@PreviewSpatialApi
val conversationSceneSignalTestConversationSceneSignal

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

device

Added in 1.0.0-alpha14
val deviceTestArDevice

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.

face

Added in 1.0.0-alpha14
val faceTestFace

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.

geospatial

Added in 1.0.0-alpha14
val geospatialTestGeospatial

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

leftDepth

Added in 1.0.0-alpha14
val leftDepthTestDepth

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

leftEye

Added in 1.0.0-alpha14
val leftEyeTestEye

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.

leftHand

Added in 1.0.0-alpha14
val leftHandTestHand

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.

leftRenderViewpoint

Added in 1.0.0-alpha14
val leftRenderViewpointTestRenderViewpoint

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

monoDepth

Added in 1.0.0-alpha14
val monoDepthTestDepth

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

monoRenderViewpoint

Added in 1.0.0-alpha14
val monoRenderViewpointTestRenderViewpoint

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

persistedAnchorPoses

Added in 1.0.0-alpha14
val persistedAnchorPosesMap<UUIDPose>

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

planes

Added in 1.0.0-alpha14
val planesList<TestPlane>

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.

rightDepth

Added in 1.0.0-alpha14
val rightDepthTestDepth

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

rightEye

Added in 1.0.0-alpha14
val rightEyeTestEye

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.

rightHand

Added in 1.0.0-alpha14
val rightHandTestHand

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.

rightRenderViewpoint

Added in 1.0.0-alpha14
val rightRenderViewpointTestRenderViewpoint

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