Skip to content

Commit 1da1175

Browse files
authored
[rfw, ci] Regenerate goldens, manually roll flutter#4835 (flutter#4862)
This PR updates the goldens for `package:rfw`. This PR also: * Modifies `run_tests.sh` so it forwards all its command-line parameters to the inner `test_coverage.dart` bin. (This enables passing `--update-goldens` without much fuss.) * Updates the documentation on how to update goldens in the package.
1 parent 8e36deb commit 1da1175

10 files changed

+80
-30
lines changed

.ci/flutter_master.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c175cf87a6a3d797fdc3f81cbd54419f639cd3d9
1+
685ce14b2d0f4046bd596842208d0c17f9a21e57

packages/rfw/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Ignore golden test failure files
2+
test/failures/*.png
3+
14
# Miscellaneous
25
*.class
36
*.log

packages/rfw/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.15
2+
3+
* Updates README.md to point to the CONTRIBUTING.md file.
4+
* Introduces CONTRIBUTING.md, and adds more information about golden testing.
5+
16
## 1.0.14
27

38
* Adds pub topics to package metadata.

packages/rfw/CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributing
2+
3+
If you run into any problems, please file a [new
4+
bug](https://github.com/flutter/flutter/issues/new?labels=p:%20rfw,package,P2).
5+
Rather than waiting for a fix, we encourage you to consider submitting
6+
a PR yourself. See our [contributing
7+
guide](https://github.com/flutter/packages/blob/master/CONTRIBUTING.md)
8+
for details.
9+
10+
Adding more widgets to `lib/flutter/core_widgets.dart` and
11+
`lib/flutter/material_widgets.dart` is welcome.
12+
13+
When contributing code, ensure that `flutter test --coverage; lcov
14+
--list coverage/lcov.info` continues to show 100% test coverage, and
15+
update `test_coverage/bin/test_coverage.dart` with the appropriate
16+
expectations to prevent future coverage regressions. (That program is
17+
run by `run_tests.sh`.)
18+
19+
## Tests
20+
21+
To run the tests, use `flutter test`.
22+
23+
To run the web tests, use `flutter test --platform=chrome`. If there
24+
is code that only runs on the web target, mark each such line by
25+
ending it with the string `// dead code on VM target`. This will
26+
exclude that line from the coverage calculation.
27+
28+
Golden tests are only run against the Flutter master channel and only
29+
run on Linux, since minor rendering differences are expected on
30+
different platforms and on different versions of Flutter.
31+
32+
## Golden test failures
33+
34+
When golden tests fail, several files will be created in a `test/failures`
35+
directory.
36+
37+
The suffix of each file briefly describes its contents:
38+
39+
* `_masterImage`: The current golden against which comparisons are being made.
40+
* `_testImage`: The image generated by this run of the test.
41+
* `_isolatedDiff`: An image where only the pixels that differ between the
42+
master and test images are rendered.
43+
* `_maskedDiff`: An image where the pixels that differ between the master and
44+
test images are rendered in black (isolatedDiff + maskedDiff = testImage).
45+
46+
Check the `_testImage` and the `Diff`s and see if the changes are valid. From
47+
time to time, a new dithering or anti-aliasing algorithm will land in Flutter
48+
that will invalidate a bunch of goldens, but not really break the rendering.
49+
50+
In this case, you may update the golden files.
51+
52+
### Updating golden files
53+
54+
Once you've validated that the new goldens are correct, you may update them by
55+
calling `run_tests.sh --update-goldens`.
56+
57+
That command updates the reference golden images in the `test/goldens` directory.
58+
59+
Read more about Golden matching [in `package:flutter_test` API docs][package-test].
60+
61+
[package-test]: https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html

packages/rfw/README.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -965,29 +965,4 @@ concerns on iOS, anyway).
965965

966966
## Contributing
967967

968-
If you run into any problems, please file a [new
969-
bug](https://github.com/flutter/flutter/issues/new?labels=p:%20rfw,package,P2).
970-
Rather than waiting for a fix, we encourage you to consider submitting
971-
a PR yourself. See our [contributing
972-
guide](https://github.com/flutter/packages/blob/master/CONTRIBUTING.md)
973-
for details.
974-
975-
Adding more widgets to `lib/flutter/core_widgets.dart` and
976-
`lib/flutter/material_widgets.dart` is welcome.
977-
978-
When contributing code, ensure that `flutter test --coverage; lcov
979-
--list coverage/lcov.info` continues to show 100% test coverage, and
980-
update `test_coverage/bin/test_coverage.dart` with the appropriate
981-
expectations to prevent future coverage regressions. (That program is
982-
run by `run_tests.sh`.)
983-
984-
To run the tests, use `flutter test`.
985-
986-
To run the web tests, use `flutter test --platform=chrome`. If there
987-
is code that only runs on the web target, mark each such line by
988-
ending it with the string `// dead code on VM target`. This will
989-
exclude that line from the coverage calculation.
990-
991-
Golden tests are only run against the Flutter master channel and only
992-
run on Linux, since minor rendering differences are expected on
993-
different platforms and on different versions of Flutter.
968+
See [CONTRIBUTING.md](https://github.com/flutter/packages/blob/main/packages/rfw/CONTRIBUTING.md)

packages/rfw/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: rfw
22
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
33
repository: https://github.com/flutter/packages/tree/main/packages/rfw
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
5-
version: 1.0.14
5+
version: 1.0.15
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"

packages/rfw/run_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99

1010
set -e
1111
pushd test_coverage; dart pub get; popd
12-
dart --enable-asserts test_coverage/bin/test_coverage.dart
12+
set -x
13+
dart --enable-asserts test_coverage/bin/test_coverage.dart "$@"
Loading
Loading

packages/rfw/test_coverage/bin/test_coverage.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ Future<void> main(List<String> arguments) async {
5757

5858
final ProcessResult result = Process.runSync(
5959
'flutter',
60-
<String>['test', '--coverage'],
60+
<String>[
61+
'test',
62+
'--coverage',
63+
if (arguments.isNotEmpty) ...arguments,
64+
],
6165
);
66+
6267
if (result.exitCode != 0) {
6368
print(result.stdout);
6469
print(result.stderr);

0 commit comments

Comments
 (0)