The bug as originally logged speculated that the problem was the PixelCopyCapture and the ExclusionRects being incompatible. The issue was actually with the setExactness method. Since PixelCopyCapture is hardware accelerated, it's susceptible to minor variations in rendering due to differences in GPU capabilities. As such, it's recommended to lower the matching tolerance using setExactness when using PixelCopyCapture. As originally designed, the exactness and exclusion rect comparison methods were separate paths and you could not combine them together.
This PR unifies the two concepts and allows you to mix & match the comparison methods.
Library
Bug fixes
https://github.com/Shopify/android-testify/issues/216
You can now use ScreenshotRule.setExactness() in conjunction with ScreenshotRule.defineExclusionRects(). You can now define both an exclusion area and an exactness threshold.
Method ScreenshotRule.setExactness(exactness: Float?): ScreenshotRule<T> now accepts a nullable value.
TestifyFeatures.GenerateDiffs now visualizes exclusion regions and the exactness tolerance.
When enabled, GenerateDiffs will write a companion image for your screenshot test which can help you more easily
identify which areas of your test have triggered the screenshot failure.
Diff files are only generated for failing tests.
The generated file will be created in the same directory as your baseline images. Diff files can be pulled from
the device using :screenshotPull.
Black pixels are identical between the baseline and test image
Grey pixels have been excluded from the comparison
Yellow pixels are different, but within the Exactness threshold
Red pixels are different
Method DeviceIdentifier.getDeviceDimensions(context: Context): Pair<Int, Int> is now public.
What does this change accomplish?
Resolves #216
The bug as originally logged speculated that the problem was the PixelCopyCapture and the ExclusionRects being incompatible. The issue was actually with the
setExactness
method. Since PixelCopyCapture is hardware accelerated, it's susceptible to minor variations in rendering due to differences in GPU capabilities. As such, it's recommended to lower the matching tolerance usingsetExactness
when using PixelCopyCapture. As originally designed, the exactness and exclusion rect comparison methods were separate paths and you could not combine them together.This PR unifies the two concepts and allows you to mix & match the comparison methods.
Library
Bug fixes
ScreenshotRule.setExactness()
in conjunction withScreenshotRule.defineExclusionRects()
. You can now define both an exclusion area and an exactness threshold.Added
ScreenshotRule.getExactness():Float?
added.Changes
ScreenshotRule.setExactness(exactness: Float?): ScreenshotRule<T>
now accepts a nullable value.TestifyFeatures.GenerateDiffs
now visualizes exclusion regions and the exactness tolerance. When enabled, GenerateDiffs will write a companion image for your screenshot test which can help you more easily identify which areas of your test have triggered the screenshot failure. Diff files are only generated for failing tests. The generated file will be created in the same directory as your baseline images. Diff files can be pulled from the device using:screenshotPull
.DeviceIdentifier.getDeviceDimensions(context: Context): Pair<Int, Int>
is now public.