Skip to main content
Version: 3.2.0

Excluding a region from the comparison

For some Views, it may be impossible to guarantee a stable, consistent rendering. For instance, if the content is dynamic or randomized. For this reason, Testify provides the option to specify a series of rectangles to exclude from the comparison. All pixels in these rectangles are ignored and only pixels not contained will be compared.

caution

This comparison mechanism is slower than the default.

@ScreenshotInstrumentation
@Test
fun default() {
rule
.configure {
defineExclusionRects { rootView, exclusionRects ->
val card = rootView.findViewById<View>(R.id.info_card)
exclusionRects.add(card.boundingBox)
}
}
.assertSame()
}