Skip to content

Commit

Permalink
Merge pull request #507 from darekbx/darekbx/add-info-about-differ-op…
Browse files Browse the repository at this point in the history
…tions

Add description how to configure Differ
  • Loading branch information
takahirom authored Oct 18, 2024
2 parents 2f78447 + 1912c65 commit 0f51a41
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,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.
Expand Down
20 changes: 20 additions & 0 deletions docs/topics/how_to_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0f51a41

Please sign in to comment.