Skip to content

Commit

Permalink
Fix blend test diffrate on mac (flutter#17198)
Browse files Browse the repository at this point in the history
* Fix error message for golden failure. Fix blend test diffrate when running on MacOS

* Revert MacOS adjustment
  • Loading branch information
ferhatb authored Mar 18, 2020
1 parent 216c420 commit 6d30043
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void main() async {

// Commit a recording canvas to a bitmap, and compare with the expected
Future<void> _checkScreenshot(RecordingCanvas rc, String fileName,
{Rect region = const Rect.fromLTWH(0, 0, 500, 500)}) async {
{Rect region = const Rect.fromLTWH(0, 0, 500, 500),
double maxDiffRatePercent = 0.0}) async {
final EngineCanvas engineCanvas = BitmapCanvas(screenRect);

rc.apply(engineCanvas);
Expand All @@ -29,7 +30,7 @@ void main() async {
try {
sceneElement.append(engineCanvas.rootElement);
html.document.body.append(sceneElement);
await matchGoldenFile('$fileName.png', region: region, maxDiffRatePercent: 0.0);
await matchGoldenFile('$fileName.png', region: region, maxDiffRatePercent: maxDiffRatePercent);
} finally {
// The page is reused across tests, so remove the element after taking the
// Scuba screenshot.
Expand Down Expand Up @@ -76,7 +77,8 @@ void main() async {
..style = PaintingStyle.fill
..color = const Color.fromARGB(128, 255, 0, 0));
rc.restore();
await _checkScreenshot(rc, 'canvas_blend_circle_diff_color');
await _checkScreenshot(rc, 'canvas_blend_circle_diff_color',
maxDiffRatePercent: operatingSystem == OperatingSystem.macOs ? 2.95 : 0);
});

test('Blend circle and text with multiply', () async {
Expand Down Expand Up @@ -112,7 +114,8 @@ void main() async {
rc.drawImage(createTestImage(), Offset(135.0, 130.0),
Paint()..blendMode = BlendMode.multiply);
rc.restore();
await _checkScreenshot(rc, 'canvas_blend_image_multiply');
await _checkScreenshot(rc, 'canvas_blend_image_multiply',
maxDiffRatePercent: operatingSystem == OperatingSystem.macOs ? 2.95 : 0);
});
}

Expand Down

0 comments on commit 6d30043

Please sign in to comment.