Fix blend test diffrate on mac (flutter/engine#17198)
* Fix error message for golden failure. Fix blend test diffrate when running on MacOS * Revert MacOS adjustment
This commit is contained in:
@@ -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);
|
||||
@@ -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.
|
||||
@@ -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 {
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user