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. |
TestContext |
Context data for performing assertation on a layout, including: |
Top-level functions summary
LayoutElementMatcher |
containsTag(value: String)Returns a |
LayoutElementMatcher |
hasAllCorners(radiusDp: Float)Returns a |
LayoutElementMatcher |
hasBottomLeftCorner(xRadiusDp: Float, yRadiusDp: Float)Returns a |
LayoutElementMatcher |
hasBottomRightCorner(xRadiusDp: Float, yRadiusDp: Float)Returns a |
LayoutElementMatcher |
hasChild(matcher: LayoutElementMatcher)Returns a |
LayoutElementMatcher |
hasClickable(Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
hasContentDescription(pattern: Regex)Returns a |
LayoutElementMatcher |
hasContentDescription(value: String)Returns a |
LayoutElementMatcher |
hasDescendant(matcher: LayoutElementMatcher)Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
|
LayoutElementMatcher |
hasTopLeftCorner(xRadiusDp: Float, yRadiusDp: Float)Returns a |
LayoutElementMatcher |
hasTopRightCorner(xRadiusDp: Float, yRadiusDp: Float)Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
LayoutElementMatcher |
Returns a |
Top-level functions
containsTag
fun containsTag(value: String): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element's metadata tag contains the given value.
hasAllCorners
fun hasAllCorners(radiusDp: Float): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has all its four corners with the given radius.
hasBottomLeftCorner
fun hasBottomLeftCorner(xRadiusDp: Float, yRadiusDp: Float): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has its bottom left corner with the given radii.
hasBottomRightCorner
fun hasBottomRightCorner(xRadiusDp: Float, yRadiusDp: Float): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has its bottom right corners with the given radii.
hasChild
fun hasChild(matcher: LayoutElementMatcher): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has a child matching the given matcher.
hasClickable
fun hasClickable(
action: ActionBuilders.Action = loadAction(),
id: String? = null,
minClickableWidth: @Dimension(unit = 0) Float = Float.NaN,
minClickableHeight: @Dimension(unit = 0) Float = Float.NaN
): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has the specific Clickable attached.
hasColor
fun hasColor(argb: @ColorInt Int): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element is drawn with the given color.
hasContentDescription
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. |
hasContentDescription
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. |
hasDescendant
fun hasDescendant(matcher: LayoutElementMatcher): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has a descendant matches the given matcher.
hasHeight
fun hasHeight(height: DimensionBuilders.ContainerDimension): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has the given height value.
hasHeight
fun hasHeight(height: DimensionBuilders.ProportionalDimensionProp): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has the given height value.
hasImage
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. |
hasTag
fun hasTag(value: String): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element's metadata tag equals to the given value.
hasText
fun hasText(value: String, subString: Boolean = false, ignoreCase: Boolean = false): LayoutElementMatcher
hasTopLeftCorner
fun hasTopLeftCorner(xRadiusDp: Float, yRadiusDp: Float): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has its top left corner with the given radii.
hasTopRightCorner
fun hasTopRightCorner(xRadiusDp: Float, yRadiusDp: Float): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has its top right corner with the given radii.
hasWidth
fun hasWidth(width: DimensionBuilders.ContainerDimension): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has the given width value.
hasWidth
fun hasWidth(width: DimensionBuilders.ProportionalDimensionProp): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element has the given width value.
isClickable
fun isClickable(): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element is clickable.
isSemanticsHeading
fun isSemanticsHeading(): LayoutElementMatcher
Returns a LayoutElementMatcher which checks whether the element is marked as heading for accessibility purpose.