Factor out use of "print" in flutter_goldens (#144846)
This is part 5 of a broken down version of the #140101 refactor. This PR removes direct use of `print` and replaces it with a callback.
This commit is contained in:
@@ -1,7 +1 @@
|
||||
[0-9]+:[0-9]+ [+]0: Local passes non-existent baseline for new test, null expectation *
|
||||
*No expectations provided by Skia Gold for test: library.flutter.new_golden_test.1.png. This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.
|
||||
*Validate image output found at flutter/test/library/
|
||||
[0-9]+:[0-9]+ [+]1: Local passes non-existent baseline for new test, empty expectation *
|
||||
*No expectations provided by Skia Gold for test: library.flutter.new_golden_test.2.png. This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.
|
||||
*Validate image output found at flutter/test/library/
|
||||
[0-9]+:[0-9]+ [+]2: All tests passed! *
|
||||
|
||||
@@ -21,6 +21,7 @@ const List<int> _kFailPngBytes = <int>[
|
||||
];
|
||||
|
||||
void main() {
|
||||
final List<String> log = <String>[];
|
||||
final MemoryFileSystem fs = MemoryFileSystem();
|
||||
final Directory basedir = fs.directory('flutter/test/library/')
|
||||
..createSync(recursive: true);
|
||||
@@ -34,9 +35,11 @@ void main() {
|
||||
environment: <String, String>{'FLUTTER_ROOT': '/flutter'},
|
||||
operatingSystem: 'macos'
|
||||
),
|
||||
log: log.add,
|
||||
);
|
||||
|
||||
test('Local passes non-existent baseline for new test, null expectation', () async {
|
||||
log.clear();
|
||||
expect(
|
||||
await comparator.compare(
|
||||
Uint8List.fromList(_kFailPngBytes),
|
||||
@@ -44,9 +47,15 @@ void main() {
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
const String expectation =
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.1.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
expect(log, const <String>[expectation]);
|
||||
});
|
||||
|
||||
test('Local passes non-existent baseline for new test, empty expectation', () async {
|
||||
log.clear();
|
||||
expect(
|
||||
await comparator.compare(
|
||||
Uint8List.fromList(_kFailPngBytes),
|
||||
@@ -54,6 +63,11 @@ void main() {
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
const String expectation =
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.2.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
expect(log, const <String>[expectation]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user