androidx.wear.protolayout.testing


Classes

LayoutElementAssertion

Represents a layout element that can be asserted on.

LayoutElementAssertionsProvider

Provides the main entry point into testing by exposing methods to find a layout element.

LayoutElementMatcher

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

Top-level functions summary

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's metadata tag contains the given value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has a child matching the given matcher.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the specific Clickable attached.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element is drawn with the given color.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's content description matches the given pattern.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's content description contains the given value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has a descendant matches the given matcher.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given height value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given height value.

LayoutElementMatcher
hasImage(protolayoutResId: String)

Returns a LayoutElementMatcher which checks whether the element displays an image with the given protolayout resource id.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's text equals the given value.

LayoutElementMatcher
hasText(value: String, subString: Boolean, ignoreCase: Boolean)

Returns a LayoutElementMatcher which checks whether the element's text contains the given value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given width value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given width value.

LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element is clickable.

Top-level functions

fun containsTag(value: String): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's metadata tag contains the given value.

fun hasChild(matcher: LayoutElementMatcher): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has a child matching the given matcher.

fun hasClickable(clickable: ModifiersBuilders.Clickable): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the specific Clickable attached.

fun hasColor(argb: @ColorInt Int): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element is drawn with the given color.

fun hasContentDescription(pattern: Regex): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's content description matches the given pattern.

Parameters
pattern: Regex

String pattern to match with content description.

fun hasContentDescription(value: String): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's content description contains the given value.

Parameters
value: String

Value to match with content description.

fun hasDescendant(matcher: LayoutElementMatcher): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has a descendant matches the given matcher.

fun hasHeight(height: DimensionBuilders.ContainerDimension): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given height value.

fun hasHeight(height: DimensionBuilders.ProportionalDimensionProp): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given height value.

fun hasImage(protolayoutResId: String): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element displays an image with the given protolayout resource id.

Parameters
protolayoutResId: String

The resource id of the image, which should be a protolayout resource id instead of android resource id.

fun hasText(value: TypeBuilders.StringProp): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's text equals the given value.

fun hasText(value: String, subString: Boolean = false, ignoreCase: Boolean = false): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element's text contains the given value.

Note that this only checks the static content of the element's text.

fun hasWidth(width: DimensionBuilders.ContainerDimension): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given width value.

fun hasWidth(width: DimensionBuilders.ProportionalDimensionProp): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element has the given width value.

fun isClickable(): LayoutElementMatcher

Returns a LayoutElementMatcher which checks whether the element is clickable.