# SemanticsMatcher

Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/SemanticsMatcher.kt+class:androidx.compose.ui.test.SemanticsMatcher) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  class SemanticsMatcher
  ```

*** ** * ** ***

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

## Summary

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#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/compose/ui/test/SemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)` is equal to `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher.Companion#expectValue(androidx.compose.ui.semantics.SemanticsPropertyKey,kotlin.Any)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#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/compose/ui/test/SemanticsMatcher.Companion#keyIsDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is defined in semantics. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#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/compose/ui/test/SemanticsMatcher.Companion#keyNotDefined(androidx.compose.ui.semantics.SemanticsPropertyKey)` is NOT defined in semantics. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#SemanticsMatcher(kotlin.String,kotlin.Function1)(description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, matcher: (https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsNode) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `infix https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#and(androidx.compose.ui.test.SemanticsMatcher)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher)` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#matches(androidx.compose.ui.semantics.SemanticsNode)(node: https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsNode)` Returns whether the given node is matched by this matcher. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#matchesAny(kotlin.collections.Iterable)(nodes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsNode>)` Returns whether at least one of the given nodes is matched by this matcher. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#not()()` | Cmn |
| `infix https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#or(androidx.compose.ui.test.SemanticsMatcher)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher#description()` | Cmn |

## Public companion functions

### expectValue

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

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

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

### keyIsDefined

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

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

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

### keyNotDefined

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

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

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

## Public constructors

### SemanticsMatcher

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

```
SemanticsMatcher(description: String, matcher: (SemanticsNode) -> Boolean)
```

## Public functions

### and

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

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

### matches

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

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

Returns whether the given node is matched by this matcher.

### matchesAny

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

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

Returns whether at least one of the given nodes is matched by this matcher.

### not

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

```
operator fun not(): SemanticsMatcher
```

### or

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

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

## Public properties

### description

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

```
val description: String
```