Skip to content

Instantly share code, notes, and snippets.

@plnice
Last active February 18, 2018 08:53
Show Gist options
  • Save plnice/8f0140236a327d5eb6689b42ac6a8ee7 to your computer and use it in GitHub Desktop.
Save plnice/8f0140236a327d5eb6689b42ac6a8ee7 to your computer and use it in GitHub Desktop.
fun withDrawable(@DrawableRes id: Int) = object : TypeSafeMatcher<View>() {
override fun describeTo(description: Description) {
description.appendText("ImageView with drawable same as drawable with id $id")
}
override fun matchesSafely(view: View): Boolean {
val context = view.context
val expectedDrawable = context.getDrawable(id)
return view is ImageView && ??? // what now?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment