@@ -12,7 +12,7 @@ class GoldenSceneReportPrinter {
12
12
final buffer = StringBuffer ();
13
13
14
14
// 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 (" );
16
16
buffer.write ("✅ ${report .totalPassed }/${report .items .length }, " );
17
17
buffer.write ("❌ ${report .totalFailed }/${report .items .length }" );
18
18
if (report.missingCandidates.isNotEmpty || report.extraCandidates.isNotEmpty) {
@@ -29,10 +29,9 @@ class GoldenSceneReportPrinter {
29
29
buffer.write (" +${report .extraCandidates .length }" );
30
30
}
31
31
}
32
- buffer.writeln (")" );
32
+ buffer.writeln ("): " );
33
33
34
34
if (report.totalFailed > 0 ) {
35
- buffer.writeln ("" );
36
35
for (final item in report.items) {
37
36
if (item.status == GoldenTestStatus .success) {
38
37
buffer.writeln ("✅ ${item .metadata .id }" );
@@ -43,12 +42,37 @@ class GoldenSceneReportPrinter {
43
42
final mismatch = item.mismatch;
44
43
switch (mismatch) {
45
44
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 ()})' );
46
48
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 ("" );
48
72
break ;
49
73
case PixelGoldenMismatch ():
50
74
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 )}%) ' );
52
76
break ;
53
77
case MissingGoldenMismatch ():
54
78
case MissingCandidateMismatch ():
0 commit comments