Unverified Commit e62c68c2 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Fix for broken LocalFileComparator output (#40399)

* Fixing LocalFileComparator output

* Fixing path separators for windows failures

* Windows path issues

* Testing

* ++

* ++

* Fixing base directory - windows

* Clean up
parent af9f424d
......@@ -129,7 +129,10 @@ class LocalFileComparator extends GoldenFileComparator {
+ '_'
+ failure
+ '.png';
return File(_path.join('failures', testName));
return File(_path.join(
_path.fromUri(basedir),
_path.fromUri(Uri.parse('failures/$testName')),
));
}
}
......
......@@ -148,6 +148,34 @@ void main() {
});
group('fails', () {
test('and generates correct output in the correct location', () async {
comparator = LocalFileComparator(Uri.parse('local_test.dart'), pathStyle: fs.path.style);
await fs.file(fix('/golden.png')).writeAsBytes(_kColorFailurePngBytes);
try {
await doComparison();
fail('TestFailure expected but not thrown.');
} on TestFailure catch (error) {
expect(error.message, contains('% diff detected'));
final io.File master = fs.file(
fix('/failures/golden_masterImage.png')
);
final io.File test = fs.file(
fix('/failures/golden_testImage.png')
);
final io.File isolated = fs.file(
fix('/failures/golden_isolatedDiff.png')
);
final io.File masked = fs.file(
fix('/failures/golden_maskedDiff.png')
);
expect(master.existsSync(), isTrue);
expect(test.existsSync(), isTrue);
expect(isolated.existsSync(), isTrue);
expect(masked.existsSync(), isTrue);
}
});
test('when golden file does not exist', () async {
try {
await doComparison();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment