Skip to content

Commit

Permalink
Improve tolerance message
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrovgs committed Oct 14, 2020
1 parent 35b0e2c commit 2a80ae6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class ScreenshotsComparator {
val newScreenshotPixels = newScreenshot.pixels
val differentPixels = oldScreenshotPixels.diff(newScreenshotPixels).length
val percentageOfDifferentPixels = differentPixels.toFloat / oldScreenshotPixels.length.toFloat
val imagesAreDifferent = percentageOfDifferentPixels * 100 > tolerance
val imagesAreDifferent = (percentageOfDifferentPixels * 100).toInt > tolerance
if (tolerance != 100 && imagesAreDifferent) {
val screenshotName = screenshot.name
println(
Console.YELLOW + s"Shot warning: There are some pixels changed in the screenshot named $screenshotName, but we consider the comparison correct because tolerance is configured to $tolerance and the percentage of different pixels is $percentageOfDifferentPixels" + Console.RESET)
Console.YELLOW + s"⚠️ Shot warning: There are some pixels changed in the screenshot named $screenshotName, but we consider the comparison correct because tolerance is configured to $tolerance and the percentage of different pixels is $percentageOfDifferentPixels" + Console.RESET)
}
imagesAreDifferent
}
Expand Down

0 comments on commit 2a80ae6

Please sign in to comment.