# SubspaceSemanticsMatcher

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


```
class SubspaceSemanticsMatcher
```

<br />

*** ** * ** ***

Wrapper for semantics matcher lambdas that allows building a description string explaining to the developer what conditions were being tested.

This class encapsulates a predicate that evaluates a `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo` node to verify whether it matches the expected semantic properties. It is primarily used by the testing framework to locate nodes within a Subspace hierarchy.

```kotlin
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.unit.dp
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.subspace.SpatialPanel
import androidx.xr.compose.subspace.layout.SubspaceModifier
import androidx.xr.compose.subspace.semantics.testTag
import androidx.xr.compose.testing.assertPositionInRootIsEqualTo
import androidx.xr.compose.testing.onSubspaceNode
import androidx.xr.compose.testing.onSubspaceNodeWithTag

var count = 0

composeTestRule.setContent {
    Subspace {
        SpatialPanel(SubspaceModifier.testTag("spatialPanel")) {
            Button(onClick = { count++ }) { Text("Increment") }
        }
    }
}

// Assert subspace node existence, position, and dimensions in the Spatial hierarchy
composeTestRule
    .onSubspaceNodeWithTag("spatialPanel")
    .assertExists()
    .assertPositionInRootIsEqualTo(0.dp, 0.dp, 0.dp)

// Interact with the 2D Compose node nested within the Spatial container
composeTestRule.onNodeWithText("Increment").performClick()

composeTestRule.waitForIdle()

// Verify outcomes
assert(count == 1)
```

```kotlin
import androidx.compose.ui.unit.dp
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.subspace.SpatialPanel
import androidx.xr.compose.subspace.layout.SubspaceModifier
import androidx.xr.compose.subspace.layout.height
import androidx.xr.compose.subspace.layout.width
import androidx.xr.compose.subspace.semantics.testTag
import androidx.xr.compose.testing.assertHeightIsEqualTo
import androidx.xr.compose.testing.assertPositionInRootIsEqualTo
import androidx.xr.compose.testing.assertWidthIsEqualTo
import androidx.xr.compose.testing.onSubspaceNode
import androidx.xr.compose.testing.onSubspaceNodeWithTag

composeTestRule.setContent {
    Subspace {
        SpatialPanel(SubspaceModifier.width(100.dp).height(100.dp).testTag("myPanel")) {}
    }
}

// Check existence and exact spatial dimensions in DP using semantic matchers
composeTestRule
    .onSubspaceNodeWithTag("myPanel")
    .assertExists()
    .assertPositionInRootIsEqualTo(0.dp, 0.dp, 0.dp)
    .assertWidthIsEqualTo(100.dp)
    .assertHeightIsEqualTo(100.dp)
```

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)(key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>, expectedValue: T)` Builds a predicate that tests whether the value of the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)` is equal to `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#keyIsDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)(key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>)` Builds a predicate that tests whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyIsDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is defined in semantics. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#keyNotDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)(key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>)` Builds a predicate that tests whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyNotDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is NOT defined in semantics. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#SubspaceSemanticsMatcher(kotlin.String,kotlin.Function1)( description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, matcher: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |

| ### Public functions |
|---|---|
| `infix https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#and(androidx.xr.compose.testing.SubspaceSemanticsMatcher)(other: https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher)` Combines this matcher with `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#and(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` using a short-circuiting logical AND. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matches(androidx.xr.compose.subspace.node.SubspaceSemanticsInfo)(node: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo)` Returns whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matches(androidx.xr.compose.subspace.node.SubspaceSemanticsInfo)` is matched by this matcher. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matchesAny(kotlin.collections.Iterable)(nodes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo>)` Returns whether at least one of the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matchesAny(kotlin.collections.Iterable)` is matched by this matcher. |
| `operator https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#not()()` Inverts the evaluation logic of this matcher using a logical NOT. |
| `infix https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#or(androidx.xr.compose.testing.SubspaceSemanticsMatcher)(other: https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher)` Combines this matcher with `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#or(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` using a short-circuiting logical OR. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#description()` A human-readable explanation of the condition being tested, used in test failure messages. |

## Public companion functions

### expectValue

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

```
fun <T : Any?> expectValue(key: SemanticsPropertyKey<T>, expectedValue: T): SubspaceSemanticsMatcher
```

Builds a predicate that tests whether the value of the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)` is equal to `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)`.

**Nullability \& Edge Cases:** If the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)` is not present in a node's semantics configuration, the comparison evaluates whether `null == expectedValue`. Therefore, passing `null` as the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)` successfully matches nodes where the key is entirely omitted, as well as nodes where the key is present but has a value of `null`.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey` to look up in the node's configuration. |
| `expectedValue: T` | The expected property value to verify against. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` for the specified key-value condition. |

### keyIsDefined

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

```
fun <T : Any?> keyIsDefined(key: SemanticsPropertyKey<T>): SubspaceSemanticsMatcher
```

Builds a predicate that tests whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyIsDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is defined in semantics.

**Edge Cases:** This check simply verifies the pre-existence of the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyIsDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` mapping in the node's configuration regardless of its underlying assigned value.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey` to inspect. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` verifying the presence of the key. |

### keyNotDefined

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

```
fun <T : Any?> keyNotDefined(key: SemanticsPropertyKey<T>): SubspaceSemanticsMatcher
```

Builds a predicate that tests whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyNotDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is NOT defined in semantics.

**Edge Cases:** This check validates that the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher.Companion#keyNotDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` mapping is completely absent from the node's configuration.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey<T>` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyKey` to inspect. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` verifying the absence of the key. |

## Public constructors

### SubspaceSemanticsMatcher

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

```
SubspaceSemanticsMatcher(
    description: String,
    matcher: (SubspaceSemanticsInfo) -> Boolean
)
```

| Parameters |
|---|---|
| `description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A human-readable explanation of the condition being tested, used in test failure messages. |
| `matcher: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | The predicate function that evaluates a given `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo`. |

## Public functions

### and

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

```
infix fun and(other: SubspaceSemanticsMatcher): SubspaceSemanticsMatcher
```

Combines this matcher with `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#and(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` using a short-circuiting logical AND.

The resulting matcher evaluates to `true` only if both this and the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#and(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` matcher succeed on a given node.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Parameters |
|---|---|
| `other: https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | The second `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` to satisfy. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A combined `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher`. |

### matches

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

```
fun matches(node: SubspaceSemanticsInfo): Boolean
```

Returns whether the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matches(androidx.xr.compose.subspace.node.SubspaceSemanticsInfo)` is matched by this matcher.

| Parameters |
|---|---|
| `node: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo` | The target `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo` to evaluate. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matches(androidx.xr.compose.subspace.node.SubspaceSemanticsInfo)` satisfies the predicate; `false` otherwise. |

### matchesAny

```
fun matchesAny(nodes: Iterable<SubspaceSemanticsInfo>): Boolean
```

Returns whether at least one of the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matchesAny(kotlin.collections.Iterable)` is matched by this matcher.

**Edge Cases:** If the provided `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#matchesAny(kotlin.collections.Iterable)` iterable is empty, this evaluation returns `false`.

| Parameters |
|---|---|
| `nodes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo>` | An iterable collection of `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceSemanticsInfo` instances to evaluate. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if at least one node satisfies the predicate; `false` otherwise. |

### not

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

```
operator fun not(): SubspaceSemanticsMatcher
```

Inverts the evaluation logic of this matcher using a logical NOT.

Evaluates to `true` if the underlying matcher evaluates to `false`.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A negated `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher`. |

### or

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

```
infix fun or(other: SubspaceSemanticsMatcher): SubspaceSemanticsMatcher
```

Combines this matcher with `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#or(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` using a short-circuiting logical OR.

The resulting matcher evaluates to `true` if either this or the `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher#or(androidx.xr.compose.testing.SubspaceSemanticsMatcher)` matcher succeeds on a given node.

```kotlin
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.xr.compose.spatial.Subspace
import androidx.xr.compose.testing.SubspaceSemanticsMatcher
import androidx.xr.compose.testing.onSubspaceNode

// Construct custom semantics matchers using factory methods
val hasTestTag =
    SubspaceSemanticsMatcher.expectValue(SemanticsProperties.TestTag, "customPanel")
val hasContentDescription =
    SubspaceSemanticsMatcher.keyIsDefined(SemanticsProperties.ContentDescription)

// Combine matchers using infix functions and logical operators
val complexMatcher = hasTestTag and hasContentDescription

// Use the combined matcher to locate and assert existence of the spatial node
composeTestRule.onSubspaceNode(complexMatcher).assertExists()
```

| Parameters |
|---|---|
| `other: https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | The alternative `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` to satisfy. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher` | A combined `https://developer.android.com/reference/kotlin/androidx/xr/compose/testing/SubspaceSemanticsMatcher`. |

## Public properties

### description

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

```
val description: String
```

A human-readable explanation of the condition being tested, used in test failure messages.