diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 81b6a8cb4266c..734aeae5d35e1 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -c175cf87a6a3d797fdc3f81cbd54419f639cd3d9 +685ce14b2d0f4046bd596842208d0c17f9a21e57 diff --git a/packages/rfw/.gitignore b/packages/rfw/.gitignore index a247422ef7c3f..01f61108a475f 100644 --- a/packages/rfw/.gitignore +++ b/packages/rfw/.gitignore @@ -1,3 +1,6 @@ +# Ignore golden test failure files +test/failures/*.png + # Miscellaneous *.class *.log diff --git a/packages/rfw/CHANGELOG.md b/packages/rfw/CHANGELOG.md index f12358ce3b6ba..3ea805ee8b8cb 100644 --- a/packages/rfw/CHANGELOG.md +++ b/packages/rfw/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.15 + +* Updates README.md to point to the CONTRIBUTING.md file. +* Introduces CONTRIBUTING.md, and adds more information about golden testing. + ## 1.0.14 * Adds pub topics to package metadata. diff --git a/packages/rfw/CONTRIBUTING.md b/packages/rfw/CONTRIBUTING.md new file mode 100644 index 0000000000000..81b6d7f1406fe --- /dev/null +++ b/packages/rfw/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing + +If you run into any problems, please file a [new +bug](https://github.com/flutter/flutter/issues/new?labels=p:%20rfw,package,P2). +Rather than waiting for a fix, we encourage you to consider submitting +a PR yourself. See our [contributing +guide](https://github.com/flutter/packages/blob/master/CONTRIBUTING.md) +for details. + +Adding more widgets to `lib/flutter/core_widgets.dart` and +`lib/flutter/material_widgets.dart` is welcome. + +When contributing code, ensure that `flutter test --coverage; lcov +--list coverage/lcov.info` continues to show 100% test coverage, and +update `test_coverage/bin/test_coverage.dart` with the appropriate +expectations to prevent future coverage regressions. (That program is +run by `run_tests.sh`.) + +## Tests + +To run the tests, use `flutter test`. + +To run the web tests, use `flutter test --platform=chrome`. If there +is code that only runs on the web target, mark each such line by +ending it with the string `// dead code on VM target`. This will +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. + +## Golden test failures + +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 golden files + +Once you've validated that the new goldens are correct, you may update them by +calling `run_tests.sh --update-goldens`. + +That command updates 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 diff --git a/packages/rfw/README.md b/packages/rfw/README.md index 93bfdeb2c22bc..4f967a57a7185 100644 --- a/packages/rfw/README.md +++ b/packages/rfw/README.md @@ -965,29 +965,4 @@ concerns on iOS, anyway). ## Contributing -If you run into any problems, please file a [new -bug](https://github.com/flutter/flutter/issues/new?labels=p:%20rfw,package,P2). -Rather than waiting for a fix, we encourage you to consider submitting -a PR yourself. See our [contributing -guide](https://github.com/flutter/packages/blob/master/CONTRIBUTING.md) -for details. - -Adding more widgets to `lib/flutter/core_widgets.dart` and -`lib/flutter/material_widgets.dart` is welcome. - -When contributing code, ensure that `flutter test --coverage; lcov ---list coverage/lcov.info` continues to show 100% test coverage, and -update `test_coverage/bin/test_coverage.dart` with the appropriate -expectations to prevent future coverage regressions. (That program is -run by `run_tests.sh`.) - -To run the tests, use `flutter test`. - -To run the web tests, use `flutter test --platform=chrome`. If there -is code that only runs on the web target, mark each such line by -ending it with the string `// dead code on VM target`. This will -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. +See [CONTRIBUTING.md](https://github.com/flutter/packages/blob/main/packages/rfw/CONTRIBUTING.md) diff --git a/packages/rfw/pubspec.yaml b/packages/rfw/pubspec.yaml index de09e069db441..c437ea2413c9c 100644 --- a/packages/rfw/pubspec.yaml +++ b/packages/rfw/pubspec.yaml @@ -2,7 +2,7 @@ name: rfw description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime." repository: https://github.com/flutter/packages/tree/main/packages/rfw issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22 -version: 1.0.14 +version: 1.0.15 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/packages/rfw/run_tests.sh b/packages/rfw/run_tests.sh index 178b5d596f974..f15f0f9292392 100755 --- a/packages/rfw/run_tests.sh +++ b/packages/rfw/run_tests.sh @@ -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 "$@" diff --git a/packages/rfw/test/goldens/argument_decoders_test.containers.png b/packages/rfw/test/goldens/argument_decoders_test.containers.png index 12695d219f16a..e8dc0c15a3210 100644 Binary files a/packages/rfw/test/goldens/argument_decoders_test.containers.png and b/packages/rfw/test/goldens/argument_decoders_test.containers.png differ diff --git a/packages/rfw/test/goldens/argument_decoders_test.text.png b/packages/rfw/test/goldens/argument_decoders_test.text.png index 6dd313c3a249f..8bd73041bf6ee 100644 Binary files a/packages/rfw/test/goldens/argument_decoders_test.text.png and b/packages/rfw/test/goldens/argument_decoders_test.text.png differ diff --git a/packages/rfw/test_coverage/bin/test_coverage.dart b/packages/rfw/test_coverage/bin/test_coverage.dart index 7c753557a3038..425bd2c27cca4 100644 --- a/packages/rfw/test_coverage/bin/test_coverage.dart +++ b/packages/rfw/test_coverage/bin/test_coverage.dart @@ -57,8 +57,13 @@ Future main(List arguments) async { final ProcessResult result = Process.runSync( 'flutter', - ['test', '--coverage'], + [ + 'test', + '--coverage', + if (arguments.isNotEmpty) ...arguments, + ], ); + if (result.exitCode != 0) { print(result.stdout); print(result.stderr);