Google is committed to advancing racial equity for Black communities. See how.

SemanticsMatcher

class SemanticsMatcher
kotlin.Any
   ↳ androidx.ui.test.SemanticsMatcher

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

Summary

Public constructors
<init>(description: String, matcher: (SemanticsNode) -> Boolean)

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

Public methods
infix SemanticsMatcher

Boolean

Returns whether the given node is matched by this matcher.

Boolean

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

operator SemanticsMatcher
not()

infix SemanticsMatcher

Companion functions
SemanticsMatcher
expectValue(key: SemanticsPropertyKey<T>, expectedValue: T)

Builds a predicate that tests whether the value of the given key is equal to expectedValue.

SemanticsMatcher

Builds a predicate that tests whether the given key is defined in semantics.

SemanticsMatcher

Builds a predicate that tests whether the given key is NOT defined in semantics.

Properties
String

Public constructors

<init>

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

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

Public methods

and

infix fun and(other: SemanticsMatcher): SemanticsMatcher

matches

fun matches(node: SemanticsNode): Boolean

Returns whether the given node is matched by this matcher.

matchesAny

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

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

not

operator fun not(): SemanticsMatcher

or

infix fun or(other: SemanticsMatcher): SemanticsMatcher

Properties

description

val description: String

Companion functions

expectValue

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

Builds a predicate that tests whether the value of the given key is equal to expectedValue.

keyIsDefined

fun <T> keyIsDefined(key: SemanticsPropertyKey<T>): SemanticsMatcher

Builds a predicate that tests whether the given key is defined in semantics.

keyNotDefined

fun <T> keyNotDefined(key: SemanticsPropertyKey<T>): SemanticsMatcher

Builds a predicate that tests whether the given key is NOT defined in semantics.