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

Fixing local golden output flake (#44307)

parent 3dd67410
......@@ -506,10 +506,11 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
}
failureDiffs[expectation] = result;
}
failureDiffs.forEach((String expectation, ComparisonResult result) async {
if (await skiaClient.isValidDigestForExpectation(expectation, golden.path))
generateFailureOutput(result, golden, basedir, key: expectation);
});
for (MapEntry<String, ComparisonResult> entry in failureDiffs.entries) {
if (await skiaClient.isValidDigestForExpectation(entry.key, golden.path))
generateFailureOutput(entry.value, golden, basedir, key: entry.key);
}
return false;
}
}
......@@ -741,6 +741,27 @@ void main() {
isTrue,
);
});
test('compare properly awaits validation & output before failing.', () async {
final Completer<bool> completer = Completer<bool>();
when(mockSkiaClient.isValidDigestForExpectation(
'55109a4bed52acc780530f7a9aeff6c0',
'library.flutter.golden_test.1.png',
))
.thenAnswer((_) => completer.future);
final Future<bool> result = comparator.compare(
Uint8List.fromList(_kFailPngBytes),
Uri.parse('flutter.golden_test.1.png'),
);
bool shouldThrow = true;
result.then((_) {
if (shouldThrow)
fail('Compare completed before validation completed!');
});
await Future<void>.value();
shouldThrow = false;
completer.complete(Future<bool>.value(false));
});
});
});
}
......
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