Comparing pixels instead of bytes with GoldenFileComparator#38473
Merged
Piinks merged 21 commits intoflutter:masterfrom Aug 19, 2019
Merged
Comparing pixels instead of bytes with GoldenFileComparator#38473Piinks merged 21 commits intoflutter:masterfrom
Piinks merged 21 commits intoflutter:masterfrom
Conversation
Contributor
Author
|
Thanks @gspencergoog ! I will fix the formatting. |
Contributor
|
Yes, I think it's probably OK too. I suspect that something that was bit-identical before is also pixel-identical now. |
This was referenced Aug 22, 2019
Merged
goderbauer
reviewed
Aug 26, 2019
| import 'dart:io'; | ||
| import 'dart:math' as math; | ||
| import 'dart:typed_data'; | ||
| import 'dart:ui'; |
Member
There was a problem hiding this comment.
Per style guide, this should have been imported with "show" or "as ui": https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#import-conventions
Member
There was a problem hiding this comment.
(It is not clear to me how dart currently decides if you want the Image class from dart:ui or from package:image. I am surprised that this works as is...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This PR changes the implementation of the
GoldenFileComparators method of comparison. While in the past, comparisons have been done bit-by-bit, this replaces that construct with pixel-by-pixel comparison.See follow-up section below for further implications of this change in
package:flutter/flutter.This also adds the features of more feedback in describing why a comparison fails as well as providing output of images to illustrate the difference. When a pixel comparison fails due to a detected difference, the following files will be output in a failure directory located where the master golden image was specified for the given test.
Output files will follow the format:
testname_ImageType.png
Other Options to Consider for this Change
An allowable pixel difference for each channel that is being compared
A % of pixel difference overall that can be dismissed as trivial
Follow-up
Following this PR, the improved comparator will be implemented further in the
package:flutter/fluttergolden file tests to incorporate Skia Gold baselines established with #36103. The follow-up to this change will enable local, pre-submit and post-submit testing forpackage:flutter/flutteracross all platforms. 🎉Related Issues
Fixes #17260
Fixes #17258
also maybe #17259, #30036
Tests
Updated/Added:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?