LocalFileComparatorWithThreshold class
Works just like LocalFileComparator but includes a threshold that, when exceeded, marks the test as a failure. Source: https://rows.com/blog/post/writing-a-localfilecomparator-with-threshold-for-flutter-golden-tests
- Inheritance
-
- Object
- GoldenFileComparator
- LocalFileComparator
- LocalFileComparatorWithThreshold
Constructors
- LocalFileComparatorWithThreshold(Uri testFile, double threshold)
Properties
- basedir → Uri
-
The directory in which the test was loaded.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger → BetterLogInstance
-
The logger that will be used to log messages
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- threshold → double
-
Threshold above which tests will be marked as failing.
Ranges from 0 to 1, both inclusive.
final
Methods
-
compare(
Uint8List imageBytes, Uri golden) → Future< bool> -
Copy of LocalFileComparator's compare method, except for the fact that
it checks if the ComparisonResult.diffPercent is not greater than
threshold to decide whether this test is successful or a failure.
override
-
d(
String message) → void -
Logs a debug message
inherited
-
e(
String message, [Object? error, StackTrace? stackTrace]) → void -
Logs an error message
inherited
-
generateFailureOutput(
ComparisonResult result, Uri golden, Uri basedir, {String key = ''}) → Future< String> -
Writes out diffs from the ComparisonResult of a golden file test.
inherited
-
getFailureFile(
String failure, Uri golden, Uri basedir) → File -
Returns the appropriate file for a given diff from a ComparisonResult.
inherited
-
getGoldenBytes(
Uri golden) → Future< List< int> > -
Returns the bytes of the given
goldenfile.inherited -
getTestUri(
Uri key, int? version) → Uri -
Returns a new golden file Uri to incorporate any
versionnumber with thekey.inherited -
i(
String message) → void -
Logs an info message
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Uri golden, Uint8List imageBytes) → Future< void> -
Updates the golden file identified by
goldenwithimageBytes.inherited -
w(
String message) → void -
Logs a warning message
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited