Documentation
¶
Overview ¶
Package goldens compares rendered images with the golden PNGs of a package's tests.
A golden lives in the testdata/goldens directory of the package under test. On a mismatch Check writes the image it got and a picture of the differences beside the golden, as <name>.actual.png and <name>.diff.png. Running the tests with -update-goldens rewrites the goldens; every changed one must be looked at before it is committed.
Flutter: flutter_test/lib/src/goldens.dart
Index ¶
Constants ¶
const DefaultTolerance = 2
DefaultTolerance is the largest difference in one channel of one pixel, out of 255, that Check accepts. It absorbs the float rounding of different processors.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check compares img with testdata/goldens/<name>.png, with DefaultTolerance.
Flutter: flutter_test/lib/src/matchers.dart matchesGoldenFile
func CheckTolerance ¶
CheckTolerance is Check with an explicit tolerance for each channel of each pixel.
Flutter: flutter_test/lib/src/matchers.dart matchesGoldenFile
Types ¶
type Result ¶
type Result struct {
// SizeMismatch says that the images have different sizes; nothing else is
// set then.
SizeMismatch bool
// Pixels is the number of pixels with a channel that differs by more than
// the tolerance.
Pixels int
// MaxDiff is the largest difference of any channel of any pixel.
MaxDiff int
// Diff shows the pixels that differ more than the tolerance in red over a
// faded copy of the golden; nil if the images match.
Diff *image.RGBA
}
Result is the outcome of comparing two images.
Flutter: flutter_test/lib/src/goldens.dart ComparisonResult