takahirom / roborazzi

Make JVM Android integration test visible 🤖📸
https://takahirom.github.io/roborazzi/
Apache License 2.0
706 stars 32 forks source link

Snapshot diff tolerance #324

Closed mattinger closed 5 months ago

mattinger commented 5 months ago

I'm looking at replacing paparazzi with roborazzi in some of my projects. I'm not sure if i'm missing something or not, but is there no way to set a diff tolerance for the verify tasks? This is something that paparazzi allowed, that seems to be not available in this project.

takahirom commented 5 months ago

Thanks for tring Roborazzi! In RoborazziOptions, you can configure CompareOptions to set thresholds for change percentage and color distance. Additionally, because it supports the interface from dropbox/differ, you can also write your own diff logic. This flexibility allows you to tailor the snapshot comparison to your specific needs.

.captureRoboImage(
        roborazziOptions = RoborazziOptions(
          compareOptions = RoborazziOptions.CompareOptions(
            imageComparator = SimpleImageComparator(
              maxDistance = 0.5F
            ),
            changeThreshold = 0.5F
          )
)
takahirom commented 5 months ago

I'll close this issue now. If you encounter any issues with comparison or verification, please let me know.