Feature Request P3
Status Update
Comments
ju...@google.com <ju...@google.com>
ro...@gmail.com <ro...@gmail.com> #2
Currently the image diff algorithm has many false positives and negatives when run on different hardware like a CI. For example a screenshot with a large amount of antialiased pixels will fail because the edges of the text vary slightly. The threshold is then increased to not get a false positive. Then it will get a false negative on a screenshot with a small amount that disappeared. Thanks.
Description
Compose Preview Screenshots produce slightly different images depending on the hardware it is run on. There is support for limiting the threshold for an image diff with `imageDifferenceThreshold`. This threshold varies greatly because antialiased pixels can vary depending on the type of content captured. For example a image with a lot of text will have many more antialiased pixels. Roborazzi, another screenshot testing framework, has a more robust set of options for handling the image difference thresholds. Please add a more robust set of options for image differnce thresholds to mitigate false positives of antialiased pixels. Thanks.
Here is a snippet of the options Roborazzi has for detecting an image diff:
compareOptions = RoborazziOptions.CompareOptions(
changeThreshold = 0.01, // For 1% accepted difference
imageComparator = SimpleImageComparator(
maxDistance = 0.007F, // 0.001F is default value from Differ
vShift = 2, // Increasing the shift can help resolve antialiasing issues
hShift = 2 // Increasing the shift can help resolve antialiasing issues
)
)
com.android.compose.screenshot:0.0.1-alpha08