Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c175cf87a6a3d797fdc3f81cbd54419f639cd3d9
685ce14b2d0f4046bd596842208d0c17f9a21e57
3 changes: 3 additions & 0 deletions packages/rfw/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ignore golden test failure files
test/failures/*.png

# Miscellaneous
*.class
*.log
Expand Down
31 changes: 31 additions & 0 deletions packages/rfw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -991,3 +991,34 @@ exclude that line from the coverage calculation.
Golden tests are only run against the Flutter master channel and only
run on Linux, since minor rendering differences are expected on
different platforms and on different versions of Flutter.

### When goldens fail

When golden tests fail, several files will be created in a `test/failures`
directory.

The suffix of each file briefly describes its contents:

* `_masterImage`: The current golden against which comparisons are being made.
* `_testImage`: The image generated by this run of the test.
* `_isolatedDiff`: An image where only the pixels that differ between the
master and test images are rendered.
* `_maskedDiff`: An image where the pixels that differ between the master and
test images are rendered in black (isolatedDiff + maskedDiff = testImage).

Check the `_testImage` and the `Diff`s and see if the changes are valid. From
time to time, a new dithering or anti-aliasing algorithm will land in Flutter
that will invalidate a bunch of goldens, but not really break the rendering.

In this case, you may update the golden files.

### Updating goldens

Once you've validated that the new goldens make sense, you may update the
goldens by calling `run_tests.sh --update-goldens`.

That should update the reference golden images in the `test/goldens` directory.

Read more about Golden matching [in `package:flutter_test` API docs][package-test].

[package-test]: https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html
3 changes: 2 additions & 1 deletion packages/rfw/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@

set -e
pushd test_coverage; dart pub get; popd
dart --enable-asserts test_coverage/bin/test_coverage.dart
set -x
dart --enable-asserts test_coverage/bin/test_coverage.dart "$@"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/rfw/test/goldens/argument_decoders_test.text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion packages/rfw/test_coverage/bin/test_coverage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ Future<void> main(List<String> arguments) async {

final ProcessResult result = Process.runSync(
'flutter',
<String>['test', '--coverage'],
<String>[
'test', '--coverage',
if (arguments.isNotEmpty)
...arguments,
],
);

if (result.exitCode != 0) {
print(result.stdout);
print(result.stderr);
Expand Down