SemanticsMatcher

Class

Common
class SemanticsMatcher(val description: String, private val matcher: (SemanticsNode) -> Boolean)

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

Functions

fun matches(node: SemanticsNode): Boolean

Returns whether the given node is matched by this matcher.

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

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

infix fun and(other: SemanticsMatcher): SemanticsMatcher
infix fun or(other: SemanticsMatcher): SemanticsMatcher
operator fun not(): SemanticsMatcher

Companion Object

Methods

Common
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.

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

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

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

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