From 1912c65a8b6fe6b7d31de520a424afe5b5c2716d Mon Sep 17 00:00:00 2001 From: Darek <34578369+darekbx@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:09:40 +0200 Subject: [PATCH] Updated how_to_use.md file --- docs/topics/how_to_use.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/topics/how_to_use.md b/docs/topics/how_to_use.md index cb360f3b..a0a6c1c4 100644 --- a/docs/topics/how_to_use.md +++ b/docs/topics/how_to_use.md @@ -634,6 +634,26 @@ data class RoborazziOptions( } ``` +#### Image comparator custom settings +When comparing images, you may encounter differences due to minor changes related to antialiasing. You can use the options below to avoid this. +```kotlin +@get:Rule +val roborazziRule = RoborazziRule( + options = RoborazziRule.Options( + roborazziOptions = RoborazziOptions( + 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 + ) + ) + ) + ) +) +``` + ### Dump mode If you are having trouble debugging your test, try Dump mode as follows.