# ActivitySpaceTester

Artifact: [androidx.xr.scenecore:scenecore-testing](https://developer.android.com/jetpack/androidx/releases/xr-scenecore) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/testing/ActivitySpaceTester.kt+class:androidx.xr.scenecore.testing.ActivitySpaceTester) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
public final class ActivitySpaceTester
```

<br />

*** ** * ** ***

A test-only data accessor for `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace` that enables direct manipulation and inspection of its internal state.

## Summary

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#getHitTestResult()()` The `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` to be returned by subsequent calls to `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/BoundingBox` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#getRecommendedContentBoxInFullSpace()()` The recommended box for content to be placed in when in Full Space Mode. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#setHitTestResult(androidx.xr.scenecore.HitTestResult)(https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult value)` The `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` to be returned by subsequent calls to `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)`. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#setRecommendedContentBoxInFullSpace(androidx.xr.runtime.math.BoundingBox)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/BoundingBox value)` The recommended box for content to be placed in when in Full Space Mode. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#triggerOnBoundsChanged(androidx.xr.runtime.math.FloatSize3d)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/FloatSize3d bounds)` Sets the `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace` bounds, invoking all registered listeners with the new bounds. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/ActivitySpaceTester#triggerOnOriginChanged()()` Simulates a change to the underlying space's origin. |

## Public methods

### getHitTestResult

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public final HitTestResult getHitTestResult()
```

The `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` to be returned by subsequent calls to `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)`.

This property is typically used for testing or simulation purposes, allowing you to define the outcome of hit tests performed within the `https://developer.android.com/reference/androidx/xr/scenecore/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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
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 `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace`'s coordinate system. It is not scaled by the `https://developer.android.com/reference/androidx/xr/scenecore/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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public final void setHitTestResult(HitTestResult value)
```

The `https://developer.android.com/reference/androidx/xr/scenecore/HitTestResult` to be returned by subsequent calls to `https://developer.android.com/reference/androidx/xr/scenecore/BaseScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int)`.

This property is typically used for testing or simulation purposes, allowing you to define the outcome of hit tests performed within the `https://developer.android.com/reference/androidx/xr/scenecore/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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
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 `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace`'s coordinate system. It is not scaled by the `https://developer.android.com/reference/androidx/xr/scenecore/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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public final void triggerOnBoundsChanged(@NonNull FloatSize3d bounds)
```

Sets the `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace` bounds, invoking all registered listeners with the new bounds.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/FloatSize3d bounds` | The new bounds to propagate to the listeners. |

### triggerOnOriginChanged

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public final void triggerOnOriginChanged()
```

Simulates a change to the underlying space's origin.

This function manually triggers any listeners registered via `https://developer.android.com/reference/androidx/xr/scenecore/ActivitySpace#addOriginChangedListener(java.util.concurrent.Executor,java.lang.Runnable)`, allowing tests to verify that the application correctly responds to spatial updates from the system.