ViewTree

class ViewTree

This is a helper class to allow asserting on view trees and recursively verify predicates on its nodes within the narrow abilities that Robolectric affords us.

Functions

Link copied to clipboard
open fun findChild(predicate: Predicate<View>): ImmutableList<View>
Find a view in the hierarchy for which the given predicate is true
open fun findChild(predicate: Predicate<View>, shouldCheckChildren: Predicate<in ViewGroup>): ImmutableList<View>
Find a view in the hierarchy for which the given predicate is true, while only check children of nodes as directed by the additional shouldCheckChildren predicate
Link copied to clipboard
open fun getRoot(): View
Link copied to clipboard
open fun makeString(extraTextFunction: Function<View, String>): String
Generates a string describing the views tree using the views' toString methods and an extra information function.
open fun makeString(startingDepth: Int, extraTextFunction: Function<View, String>): String
Generates a string describing the views tree using the views' toString methods and an extra information function with formatting starting at the given depth.
Link copied to clipboard
open fun of(view: View): ViewTree