Package 

Class ViewBuilder

    • Constructor Detail

      • ViewBuilder

        ViewBuilder()
    • Method Detail

      • isNotEnabled

         final Unit isNotEnabled()

        Returns whether the node is not enabled.

      • isOn

         final Unit isOn()

        Returns whether the node is toggled.

      • isOff

         final Unit isOff()

        Returns whether the node is not toggled.

      • isSelected

         final Unit isSelected()

        Returns whether the node is selected.

      • isFocusable

         final Unit isFocusable()

        Return whether the node is able to receive focus

      • isNotFocusable

         final Unit isNotFocusable()

        Return whether the node is not able to receive focus.

      • isFocused

         final Unit isFocused()

        Returns whether the node is focused.

      • isNotFocused

         final Unit isNotFocused()

        Returns whether the node is not focused.

      • hasClickAction

         final Unit hasClickAction()

        Return whether the node has a semantics click action defined.

      • hasNoClickAction

         final Unit hasNoClickAction()

        Return whether the node has no semantics click action defined.

      • hasScrollAction

         final Unit hasScrollAction()

        Return whether the node has a semantics scrollable action defined.

      • hasNoScrollAction

         final Unit hasNoScrollAction()

        Return whether the node has no semantics scrollable action defined.

      • hasContentDescription

         final Unit hasContentDescription(String value, Boolean substring, Boolean ignoreCase)

        Returns whether the node's content description contains the given value.

        Note that in merged semantics tree there can be a list of content descriptions that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to announce.

        Parameters:
        value - Value to match as one of the items in the list of content descriptions.
        substring - Whether to use substring matching.
        ignoreCase - Whether case should be ignored.
      • hasContentDescriptionExactly

         final Unit hasContentDescriptionExactly(String values)

        Returns whether the node's content description contains exactly the given values and nothing else.

        Note that in merged semantics tree there can be a list of content descriptions that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to announce.

        Parameters:
        values - List of values to match (the order does not matter)
      • hasText

         final Unit hasText(String text, Boolean substring, Boolean ignoreCase)

        Returns whether the node's text contains the given text.

        This will also search in SemanticsProperties.EditableText.

        Note that in merged semantics tree there can be a list of text items that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to use.

        Parameters:
        text - Value to match as one of the items in the list of text values.
        substring - Whether to use substring matching.
        ignoreCase - Whether case should be ignored.
      • hasTextExactly

         final Unit hasTextExactly(String textValues, Boolean includeEditableText)

        Returns whether the node's text contains exactly the given values and nothing else.

        This will also search in SemanticsProperties.EditableText by default.

        Note that in merged semantics tree there can be a list of text items that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to use.

        Parameters:
        textValues - List of values to match (the order does not matter)
        includeEditableText - Whether to also assert against the editable text.
      • hasStateDescription

         final Unit hasStateDescription(String value)

        Returns whether the node's value matches exactly to the given accessibility value.

        Parameters:
        value - Value to match.
      • isHeading

         final Unit isHeading()

        Returns whether the node is marked as an accessibility header.

      • hasProgressBarRangeInfo

         final Unit hasProgressBarRangeInfo(ProgressBarRangeInfo rangeInfo)

        Returns whether the node's range info matches exactly to the given accessibility range info.

        Parameters:
        rangeInfo - range info to match.
      • hasTestTag

         final Unit hasTestTag(String testTag)

        Returns whether the node is annotated by the given test tag.

        Parameters:
        testTag - Value to match.
      • isDialog

         final Unit isDialog()

        Returns whether the node is a dialog.

        This only checks if the node itself is a dialog, not if it is part of a dialog. Use hasAnyAncestorThat(isDialog()) for that.

      • isPopup

         final Unit isPopup()

        Returns whether the node is a popup.

        This only checks if the node itself is a popup, not if it is part of a popup. Use hasAnyAncestorThat(isPopup()) for that.

      • hasImeAction

         final Unit hasImeAction(ImeAction actionType)

        Returns whether the node defines the given IME action.

        Parameters:
        actionType - the action to match.
      • hasSetTextAction

         final Unit hasSetTextAction()

        Returns whether the node defines semantics action to set text to it.

        This can be used to for instance filter out text fields.

      • hasScrollToIndexAction

         final Unit hasScrollToIndexAction()

        Returns whether the node defines the ability to scroll to an item index.

        Note that not all scrollable containers have item indices. For example, a androidx.compose.foundation.gestures.scrollable doesn't have items with an index, while androidx.compose.foundation.lazy.LazyColumn does.

      • hasScrollToKeyAction

         final Unit hasScrollToKeyAction()

        Returns whether the node defines the ability to scroll to an item identified by a key, such as androidx.compose.foundation.lazy.LazyColumn or androidx.compose.foundation.lazy.LazyRow.

      • isRoot

         final Unit isRoot()

        Return whether the node is the root semantics node.

        There is always one root in every node tree, added implicitly by Compose.

      • hasParent

         final Unit hasParent(SemanticsMatcher matcher)

        Returns whether the node's parent satisfies the given matcher.

        Returns false if no parent exists.

      • hasAnyChild

         final Unit hasAnyChild(SemanticsMatcher matcher)

        Returns whether the node has at least one child that satisfies the given matcher.

      • hasAnySibling

         final Unit hasAnySibling(SemanticsMatcher matcher)

        Returns whether the node has at least one sibling that satisfies the given matcher.

        Sibling is defined as a any other node that shares the same parent.

      • hasAnyAncestor

         final Unit hasAnyAncestor(SemanticsMatcher matcher)

        Returns whether the node has at least one ancestor that satisfies the given matcher.

        Example: For the following tree |-X |-A |-B |-C1 |-C2 In case of C1, we would check the matcher against A and B

      • hasAnyDescendant

         final Unit hasAnyDescendant(SemanticsMatcher matcher)

        Returns whether the node has at least one descendant that satisfies the given matcher.

        Example: For the following tree |-X |-A |-B |-C1 |-C2 In case of A, we would check the matcher against B,C1 and C2

      • addSemanticsMatcher

         final Unit addSemanticsMatcher(SemanticsMatcher matcher)

        Returns whether the node matches exactly to the given custom matcher.