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.

ArDeviceTester

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

FaceTester

The object representing the user's face.

GeospatialTester

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

DepthTester

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

EyeTester

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

HandTester

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

RenderViewpointTester

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

DepthTester

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

RenderViewpointTester

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.

List<TestQrCode>

A list of all TestQrCode objects in the environment.

DepthTester

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

EyeTester

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

HandTester

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

RenderViewpointTester

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-alpha15
ArCoreTestRule()

Public functions

addTrackables

Added in 1.0.0-alpha15
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-alpha15
fun clearPersistedAnchors(): Unit

Clears the map of UUID instances to Pose instances.

persistAnchor

Added in 1.0.0-alpha15
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-alpha15
protected open fun before(): Unit

Public properties

anchorResourceLimit

Added in 1.0.0-alpha15
var anchorResourceLimitInt

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

augmentedImages

Added in 1.0.0-alpha15
val augmentedImagesList<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.

augmentedObjects

Added in 1.0.0-alpha15
val augmentedObjectsList<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.

deviceTester

Added in 1.0.0-alpha15
val deviceTesterArDeviceTester

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.

faceTester

Added in 1.0.0-alpha15
val faceTesterFaceTester

The object representing the user's face. Config.faceTracking must be set to androidx.xr.runtime.FaceTrackingMode.BLEND_SHAPES for it to be integrated by the runtime. FaceTester.isValid must be set to true for the face's blend shape and confidence values to update in the API.

geospatialTester

Added in 1.0.0-alpha15
val geospatialTesterGeospatialTester

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

leftDepthTester

Added in 1.0.0-alpha15
val leftDepthTesterDepthTester

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

leftEyeTester

Added in 1.0.0-alpha15
val leftEyeTesterEyeTester

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. EyeTester.isOpen must be set to true for the eye's pose to update in the API.

leftHandTester

Added in 1.0.0-alpha15
val leftHandTesterHandTester

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. HandTester.isVisible must be set to true for the hand's pose to update in the API.

leftRenderViewpointTester

Added in 1.0.0-alpha15
val leftRenderViewpointTesterRenderViewpointTester

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

monoDepthTester

Added in 1.0.0-alpha15
val monoDepthTesterDepthTester

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

monoRenderViewpointTester

Added in 1.0.0-alpha15
val monoRenderViewpointTesterRenderViewpointTester

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

persistedAnchorPoses

Added in 1.0.0-alpha15
val persistedAnchorPosesMap<UUIDPose>

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

planes

Added in 1.0.0-alpha15
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.

qrCodes

Added in 1.0.0-alpha15
val qrCodesList<TestQrCode>

A list of all TestQrCode 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.

rightDepthTester

Added in 1.0.0-alpha15
val rightDepthTesterDepthTester

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

rightEyeTester

Added in 1.0.0-alpha15
val rightEyeTesterEyeTester

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. EyeTester.isOpen must be set to true for the eye's pose to update in the API.

rightHandTester

Added in 1.0.0-alpha15
val rightHandTesterHandTester

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. HandTester.isVisible must be set to true for the hand's pose to update in the API.

rightRenderViewpointTester

Added in 1.0.0-alpha15
val rightRenderViewpointTesterRenderViewpointTester

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