ActivitySpaceTester


public final class ActivitySpaceTester


A test-only data accessor for ActivitySpace that enables direct manipulation and inspection of its internal state.

Summary

Public methods

final HitTestResult

The HitTestResult to be returned by subsequent calls to ActivitySpace.hitTest.

final @NonNull BoundingBox

The recommended box for content to be placed in when in Full Space Mode.

final void

The HitTestResult to be returned by subsequent calls to ActivitySpace.hitTest.

final void

The recommended box for content to be placed in when in Full Space Mode.

final void

Sets the ActivitySpace bounds, invoking all registered listeners with the new bounds.

final void

Simulates a change to the underlying space's origin.

Public methods

getHitTestResult

Added in 1.0.0-alpha16
public final HitTestResult getHitTestResult()

The HitTestResult to be returned by subsequent calls to ActivitySpace.hitTest.

This property is typically used for testing or simulation purposes, allowing you to define the outcome of hit tests performed within the ActivitySpace.

Setting a non-null value describes the location and normal of the closest object hit, relative to the origin of the hit test ray. Set to null to simulate the hit test not intersecting with any objects.

getRecommendedContentBoxInFullSpace

Added in 1.0.0-alpha16
public final @NonNull BoundingBox getRecommendedContentBoxInFullSpace()

The recommended box for content to be placed in when in Full Space Mode.

The box is relative to the ActivitySpace's coordinate system. It is not scaled by the ActivitySpace's transform. The dimensions are always in meters. This provides a device-specific default volume that developers can use to size their content appropriately.

setHitTestResult

Added in 1.0.0-alpha16
public final void setHitTestResult(HitTestResult value)

The HitTestResult to be returned by subsequent calls to ActivitySpace.hitTest.

This property is typically used for testing or simulation purposes, allowing you to define the outcome of hit tests performed within the ActivitySpace.

Setting a non-null value describes the location and normal of the closest object hit, relative to the origin of the hit test ray. Set to null to simulate the hit test not intersecting with any objects.

setRecommendedContentBoxInFullSpace

Added in 1.0.0-alpha16
public final void setRecommendedContentBoxInFullSpace(@NonNull BoundingBox value)

The recommended box for content to be placed in when in Full Space Mode.

The box is relative to the ActivitySpace's coordinate system. It is not scaled by the ActivitySpace's transform. The dimensions are always in meters. This provides a device-specific default volume that developers can use to size their content appropriately.

triggerOnBoundsChanged

Added in 1.0.0-alpha16
public final void triggerOnBoundsChanged(@NonNull FloatSize3d bounds)

Sets the ActivitySpace bounds, invoking all registered listeners with the new bounds.

Parameters
@NonNull FloatSize3d bounds

The new bounds to propagate to the listeners.

triggerOnOriginChanged

Added in 1.0.0-alpha16
public final void triggerOnOriginChanged()

Simulates a change to the underlying space's origin.

This function manually triggers any listeners registered via ActivitySpace.addOriginChangedListener, allowing tests to verify that the application correctly responds to spatial updates from the system.