LocalFileComparator class

The default GoldenFileComparator implementation for flutter test.

This comparator loads golden files from the local file system, treating the golden key as a relative path from the test file's directory.

This comparator performs a very simplistic comparison, doing a byte-for-byte comparison of the encoded PNGs, returning true only if there's an exact match. This means it will fail the test if two PNGs represent the same pixels but are encoded differently.

When using flutter test --update-goldens, LocalFileComparator updates the files on disk to match the rendering.

Inheritance

Constructors

LocalFileComparator(Uri testFile, { Style pathStyle })
Creates a new LocalFileComparator for the specified testFile. [...]

Properties

basedir Uri
The directory in which the test was loaded. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

compare(Uint8List imageBytes, Uri golden) Future<bool>
Compares imageBytes against the golden file identified by golden. [...]
override
update(Uri golden, Uint8List imageBytes) Future<void>
Updates the golden file identified by golden with imageBytes. [...]
override
getTestUri(Uri key, int version) Uri
Returns a new golden file Uri to incorporate any version number with the key. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited