Skip to content

Commit

Permalink
[web] Increase tolerance for golden diffs on Safari (#50655)
Browse files Browse the repository at this point in the history
1. Re-institute the 10% pixel count tolerance number that was accidentally lost in [this commit](a0f389e#diff-356abf8d8d08b3ba08c35d6399e2a21d3107aa16c55f4303bb3b8f96195bbcc0) (this applies to all web environments).
2. Allow each individual pixel on Safari to differ by a value of 16 per RGB channel.
  • Loading branch information
mdebbar authored Feb 14, 2024
1 parent edb2745 commit f89bde0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions web_sdk/web_test_utils/lib/image_compare.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,26 @@ Future<String> compareImage(
// comparison.
final int screenshotSize = screenshot.width * screenshot.height;

late int pixelColorDelta;
final int pixelColorDeltaPerChannel;
final double differentPixelsRate;

if (isCanvaskitTest) {
pixelColorDelta = 21;
differentPixelsRate = 0.1;
pixelColorDeltaPerChannel = 7;
} else if (skiaClient.dimensions != null && skiaClient.dimensions!['Browser'] == 'ios-safari') {
pixelColorDelta = 15;
differentPixelsRate = 0.15;
pixelColorDeltaPerChannel = 16;
} else {
pixelColorDelta = 3;
differentPixelsRate = 0.1;
pixelColorDeltaPerChannel = 1;
}

skiaClient.addImg(
filename,
screenshotFile,
screenshotSize: screenshotSize,
pixelColorDelta: pixelColorDelta,
differentPixelsRate: differentPixelsRate,
pixelColorDelta: pixelColorDeltaPerChannel * 3,
);
return 'OK';
}
Expand Down

0 comments on commit f89bde0

Please sign in to comment.