You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement better logic in golden file comparators #17258
The current golden file comparator (both LocalFileComparator and FlutterGoldenFileComparator ) are very simplistic. They compare encoded PNG bytes and report failure if the byte-for-byte comparison turned up any differences.
What would be more useful would to be for the comparator to decode the PNG to raw pixels and reporting which pixels differ - optionally being configurable to allow for a tolerance of N number of pixel differences allowed before it reports as a failure (or even N RGB allowable differences per pixel, and M allowable pixels different outside of the N tolerance).
We probably also want to allow the augment the GoldenFileComparator API to allow it to declare the preferred format in which it receives image bytes during the call to compare(). Then the matcher would consult the comparator and request the appropriate format up-front, thus saving the comparator from having to convert the recorded image.
matchesReferenceImage already compares pixels and it can report things like does not match as width or height do not match and does not match on N pixels. Maybe that code can be reused here. I think it would make sense that matchesReferenceImage and matchesGoldenFile worked in a similar fashion.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
tomnewton commentedon Jun 6, 2018
The package:image stores pixels in aabbggrr format... which is a huge pain when working in Flutter.
https://github.com/brendan-duncan/image/blob/master/lib/src/image.dart#L14
apaatsio commentedon Mar 6, 2019
matchesReferenceImagealready compares pixels and it can report things likedoes not match as width or height do not matchanddoes not match on N pixels. Maybe that code can be reused here. I think it would make sense thatmatchesReferenceImageandmatchesGoldenFileworked in a similar fashion.flutter-team-archive/engine@2d42c74...d7ad50c
flutter-team-archive/engine@2d42c74...d7ad50c
github-actions commentedon Aug 28, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.