Skip to content

Add basic support for golden image file testing - #17094

Merged
tvolkert merged 1 commit into
flutter:masterfrom
tvolkert:goldens
Apr 30, 2018
Merged

tvolkert merged 1 commit into
flutter:masterfrom
tvolkert:goldens

Conversation

@tvolkert

Copy link
Copy Markdown
Contributor
  • Add a matchesGoldenFile() async matcher that will match
    a finder's widget's rasterized image against a golden file.
  • Add support for pluggable image comparison backends
  • Add a default backend that does simplistic PNG byte
    comparison on locally stored golden files.
  • Add support for flutter test --update-goldens, which will
    treat the rasterized image bytes produced during the test
    as the new golden bytes and update the golden file accordingly

Still TODO:

  • Add support for the flutter_test_config.dart test config hook
  • Utilize flutter_test_config.dart in packages/flutter/test
    to install a backend that retrieves golden files from a dedicated
    flutter/goldens repo

#16859

@tvolkert

Copy link
Copy Markdown
Contributor Author

This includes #17085, which should be reviewed first.

* Add a `matchesGoldenFile()` async matcher that will match
  a finder's widget's rasterized image against a golden file.
* Add support for pluggable image comparison backends
* Add a default backend that does simplistic PNG byte
  comparison on locally stored golden files.
* Add support for `flutter test --update-goldens`, which will
  treat the rasterized image bytes produced during the test
  as the new golden bytes and update the golden file accordingly

Still TODO:

* Add support for the `flutter_test_config.dart` test config hook
* Utilize `flutter_test_config.dart` in `packages/flutter/test`
  to install a backend that retrieves golden files from a dedicated
  `flutter/goldens` repo

#16859
import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test/test.dart' hide TypeMatcher;
import 'package:test/src/frontend/async_matcher.dart'; // ignore: implementation_imports

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only way to define an AsyncMatcher subclass? Too bad we have to ignore lint for it to be possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alas, yes.

@gspencergoog

Copy link
Copy Markdown
Contributor

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@tvolkert
tvolkert merged commit e19db89 into flutter:master Apr 30, 2018
@tvolkert
tvolkert deleted the goldens branch April 30, 2018 17:36
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
* Add a `matchesGoldenFile()` async matcher that will match
  a finder's widget's rasterized image against a golden file.
* Add support for pluggable image comparison backends
* Add a default backend that does simplistic PNG byte
  comparison on locally stored golden files.
* Add support for `flutter test --update-goldens`, which will
  treat the rasterized image bytes produced during the test
  as the new golden bytes and update the golden file accordingly

Still TODO:

* Add support for the `flutter_test_config.dart` test config hook
* Utilize `flutter_test_config.dart` in `packages/flutter/test`
  to install a backend that retrieves golden files from a dedicated
  `flutter/goldens` repo

flutter#16859
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants