Skip to content

Commit

Permalink
Ensure all golden filenames end in .png. (flutter#40604)
Browse files Browse the repository at this point in the history
Ensure all golden filenames end in .png.
  • Loading branch information
eyebrowsoffire authored Mar 24, 2023
1 parent 2b97577 commit 78c7f95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/web_ui/test/canvaskit/font_variation_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void testMain() {
canvas.drawParagraph(paragraph, const ui.Offset(10, 10));
final CkPicture picture = recorder.endRecording();
await matchPictureGolden(
'font_variation.jpg',
'font_variation.png',
picture,
region: ui.Rect.fromLTRB(0, 0, testWidth, paragraph.height + 20),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/canvaskit/image_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ void _testForImageCodecs({required bool useBrowserImageDecoder}) {
}
CanvasKitRenderer.instance.rasterizer.draw(sb.build().layerTree);
await matchGoldenFile(
'canvaskit_picture_texture_toimage',
'canvaskit_picture_texture_toimage.png',
region: const ui.Rect.fromLTRB(0, 0, 128, 128),
);
mandrill.dispose();
Expand Down
3 changes: 3 additions & 0 deletions web_sdk/web_engine_tester/lib/golden_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ enum PixelComparison {
/// [pixelComparison] determines the algorithm used to compare pixels. Uses
/// fuzzy comparison by default.
Future<void> matchGoldenFile(String filename, {Rect? region}) async {
if (!filename.endsWith('.png')) {
throw ArgumentError('Filename must end in .png or SkiaGold will ignore it.');
}
final Map<String, dynamic> serverParams = <String, dynamic>{
'filename': filename,
'region': region == null
Expand Down

0 comments on commit 78c7f95

Please sign in to comment.