@@ -12,7 +12,7 @@ class GoldenSceneReportPrinter {
1212 final buffer = StringBuffer ();
1313
1414 // Report the summary of passed/failed tests and missing/extra candidates.
15- buffer.write ("Golden scene has failures: ${ report . metadata . description } (" );
15+ buffer.write ("Golden scene failed (" );
1616 buffer.write ("✅ ${report .totalPassed }/${report .items .length }, " );
1717 buffer.write ("❌ ${report .totalFailed }/${report .items .length }" );
1818 if (report.missingCandidates.isNotEmpty || report.extraCandidates.isNotEmpty) {
@@ -29,10 +29,9 @@ class GoldenSceneReportPrinter {
2929 buffer.write (" +${report .extraCandidates .length }" );
3030 }
3131 }
32- buffer.writeln (")" );
32+ buffer.writeln ("): " );
3333
3434 if (report.totalFailed > 0 ) {
35- buffer.writeln ("" );
3635 for (final item in report.items) {
3736 if (item.status == GoldenTestStatus .success) {
3837 buffer.writeln ("✅ ${item .metadata .id }" );
@@ -43,12 +42,37 @@ class GoldenSceneReportPrinter {
4342 final mismatch = item.mismatch;
4443 switch (mismatch) {
4544 case WrongSizeGoldenMismatch ():
45+ buffer.writeln ('❌ ${item .metadata .id } (wrong size)' );
46+ buffer.writeln (
47+ ' - Golden size: (${mismatch .golden .size .width .toInt ()}, ${mismatch .golden .size .height .toInt ()})' );
4648 buffer.writeln (
47- '"❌ ${item .metadata .id }" has an unexpected size (expected: ${mismatch .golden .size }, actual: ${mismatch .screenshot .size })' );
49+ ' - Candidate size: (${mismatch .screenshot .size .width .toInt ()}, ${mismatch .screenshot .size .height .toInt ()})' );
50+ buffer.write (' - ' );
51+ // Print the width comparison.
52+ if (mismatch.golden.size.width > mismatch.screenshot.size.width) {
53+ buffer.write (
54+ "Candidate is ${(mismatch .golden .size .width - mismatch .screenshot .size .width ).toInt ()}px too narrow." );
55+ } else if (mismatch.golden.size.width < mismatch.screenshot.size.width) {
56+ buffer.write (
57+ "Candidate is ${(mismatch .screenshot .size .width - mismatch .golden .size .width ).toInt ()}px too wide." );
58+ } else {
59+ buffer.write ("Candidate has correct width." );
60+ }
61+ // Print the height comparison.
62+ if (mismatch.golden.size.height > mismatch.screenshot.size.height) {
63+ buffer.write (
64+ " Candidate is ${(mismatch .golden .size .height - mismatch .screenshot .size .height ).toInt ()}px too short." );
65+ } else if (mismatch.golden.size.height < mismatch.screenshot.size.height) {
66+ buffer.write (
67+ " Candidate is ${(mismatch .screenshot .size .height - mismatch .golden .size .height .toInt ())}px too tall." );
68+ } else {
69+ buffer.write (" Candidate has correct height." );
70+ }
71+ buffer.writeln ("" );
4872 break ;
4973 case PixelGoldenMismatch ():
5074 buffer.writeln (
51- '" ❌ ${item .metadata .id }" has a ${(mismatch .percent * 100 ).toStringAsFixed (2 )}% (${ mismatch . mismatchPixelCount }px) mismatch ' );
75+ '❌ ${item .metadata .id } (${ mismatch . mismatchPixelCount }px, ${(mismatch .percent * 100 ).toStringAsFixed (2 )}%) ' );
5276 break ;
5377 case MissingGoldenMismatch ():
5478 case MissingCandidateMismatch ():
0 commit comments