fun childAtPosition( parentMatcher: Matcher<View>, position: Int): Matcher<View> { return object : TypeSafeMatcher<View>() { override fun describeTo(description: Description) { description.appendText("Child at position $position in parent ") parentMatcher.describeTo(description) } public override fun matchesSafely(view: View): Boolean { val parent = view.parent
return parent is ViewGroup && parentMatcher.matches(parent) && view == parent.getChildAt(position) } } }
No hay comentarios:
Publicar un comentario