WebGoldenComparator class Null safety
Compares image pixels against a golden image file.
Instances of this comparator will be used as the backend for matchesGoldenFile when tests are running on Flutter Web, and will usually implemented by deferring the screenshot taking and image comparison to a test server.
Instances of this comparator will be invoked by the test framework in the TestWidgetsFlutterBinding.runAsync zone and are thus not subject to the fake async constraints that are normally imposed on widget tests (i.e. the need or the ability to call WidgetTester.pump to advance the microtask queue). Prior to the invocation, the test framework will render only the widgets.Element to be compared on the screen.
See also:
- GoldenFileComparator for the comparator to be used when the test is not running in a web browser.
- DefaultWebGoldenComparator for the default WebGoldenComparator
implementation for
flutter test
. - matchesGoldenFile, the function from flutter_test that invokes the comparator.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
compare(
double width, double height, Uri golden) → Future< bool> -
Compares the rendered pixels of size
width
xheight
that is being rendered on the top left of the screen against the golden file identified bygolden
. -
getTestUri(
Uri key, int? version) → Uri -
Returns a new golden file Uri to incorporate any
version
number with thekey
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double width, double height, Uri golden) → Future< void> -
Updates the golden file identified by
golden
with rendered pixels ofwidth
xheight
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited