diff options
-rw-r--r-- | tools/skdiff_main.cpp | 47 | ||||
-rw-r--r-- | tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout | 14 | ||||
-rw-r--r-- | tools/tests/skdiff/identical-bits/output-expected/stdout | 13 | ||||
-rw-r--r-- | tools/tests/skdiff/test1/output-expected/stdout | 19 | ||||
-rw-r--r-- | tools/tests/skdiff/test2/output-expected/stdout | 19 |
5 files changed, 75 insertions, 37 deletions
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp index eea0e0d043..9017f64757 100644 --- a/tools/skdiff_main.cpp +++ b/tools/skdiff_main.cpp @@ -193,28 +193,32 @@ struct DiffSummary { FileArray fResultsOfType[kNumResultTypes]; - // Print a line about the contents of this FileArray to stdout; if the FileArray is empty, - // print nothing. + // Print a line about the contents of this FileArray to stdout. void printContents(const FileArray& fileArray, const char* headerText, bool listFilenames) { int n = fileArray.count(); - if (n > 0) { - printf(" %d file pairs %s", n, headerText); - if (listFilenames) { - printf(": "); - for (int i = 0; i < n; ++i) { - printf("%s ", fileArray[i]->c_str()); - } + printf("%d file pairs %s", n, headerText); + if (listFilenames) { + printf(": "); + for (int i = 0; i < n; ++i) { + printf("%s ", fileArray[i]->c_str()); } - printf("\n"); } + printf("\n"); } - void print(bool listFilenames) { - printf("compared %d file pairs:\n", fNumMatches + fNumMismatches); + void print(bool listFilenames, bool failOnResultType[kNumResultTypes]) { + printf("\ncompared %d file pairs:\n", fNumMatches + fNumMismatches); for (int resultInt = 0; resultInt < kNumResultTypes; resultInt++) { Result result = static_cast<Result>(resultInt); + if (failOnResultType[result]) { + printf("[*] "); + } else { + printf("[_] "); + } printContents(fResultsOfType[result], getResultDescription(result), listFilenames); } + printf("(results marked with [*] will cause nonzero return value)\n"); + printf("\nnumber of mismatching file pairs: %d\n", fNumMismatches); if (fNumMismatches > 0) { printf("Maximum pixel intensity mismatch %d\n", fMaxMismatchV); printf("Largest area mismatch was %.2f%% of pixels\n",fMaxMismatchPercent); @@ -1158,7 +1162,6 @@ int main (int argc, char ** argv) { StringArray matchSubstrings; StringArray nomatchSubstrings; - SkTDArray<Result> failOnTheseResultTypes; bool generateDiffs = true; bool listFilenames = false; @@ -1167,14 +1170,17 @@ int main (int argc, char ** argv) { RecordArray differences; DiffSummary summary; + bool failOnResultType[kNumResultTypes]; + for (int i = 0; i < kNumResultTypes; i++) { + failOnResultType[i] = false; + } + int i; int numUnflaggedArguments = 0; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--failonresult")) { Result type = getResultByName(argv[++i]); - if (!failOnTheseResultTypes.contains(type)) { - failOnTheseResultTypes.push(type); - } + failOnResultType[type] = true; continue; } if (!strcmp(argv[i], "--help")) { @@ -1284,7 +1290,7 @@ int main (int argc, char ** argv) { create_diff_images(diffProc, colorThreshold, &differences, baseDir, comparisonDir, outputDir, matchSubstrings, nomatchSubstrings, &summary); - summary.print(listFilenames); + summary.print(listFilenames, failOnResultType); if (differences.count()) { qsort(differences.begin(), differences.count(), @@ -1303,9 +1309,10 @@ int main (int argc, char ** argv) { nomatchSubstrings.deleteAll(); int num_failing_results = 0; - for (int i = 0; i < failOnTheseResultTypes.count(); i++) { - Result type = failOnTheseResultTypes[i]; - num_failing_results += summary.fResultsOfType[type].count(); + for (int i = 0; i < kNumResultTypes; i++) { + if (failOnResultType[i]) { + num_failing_results += summary.fResultsOfType[i].count(); + } } // On Linux (and maybe other platforms too), any results outside of the diff --git a/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout index c5d12ec3da..38575a5769 100644 --- a/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout +++ b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout @@ -1,6 +1,16 @@ baseDir is [tools/tests/skdiff/baseDir/] comparisonDir is [tools/tests/skdiff/comparisonDir/] not writing any diffs to outputDir [tools/tests/skdiff/identical-bits-or-pixels/output-actual/] + compared 3 file pairs: - 2 file pairs contain exactly the same bits - 1 file pairs contain the same pixel values, but not the same bits +[_] 2 file pairs contain exactly the same bits +[_] 1 file pairs contain the same pixel values, but not the same bits +[_] 0 file pairs have identical dimensions but some differing pixels +[_] 0 file pairs have differing dimensions +[_] 0 file pairs contain different bits and are not parsable images +[_] 0 file pairs missing from comparisonDir +[_] 0 file pairs missing from baseDir +[_] 0 file pairs not compared yet +(results marked with [*] will cause nonzero return value) + +number of mismatching file pairs: 0 diff --git a/tools/tests/skdiff/identical-bits/output-expected/stdout b/tools/tests/skdiff/identical-bits/output-expected/stdout index c40ae334c9..8e27568b33 100644 --- a/tools/tests/skdiff/identical-bits/output-expected/stdout +++ b/tools/tests/skdiff/identical-bits/output-expected/stdout @@ -1,5 +1,16 @@ baseDir is [tools/tests/skdiff/baseDir/] comparisonDir is [tools/tests/skdiff/comparisonDir/] not writing any diffs to outputDir [tools/tests/skdiff/identical-bits/output-actual/] + compared 2 file pairs: - 2 file pairs contain exactly the same bits +[_] 2 file pairs contain exactly the same bits +[_] 0 file pairs contain the same pixel values, but not the same bits +[_] 0 file pairs have identical dimensions but some differing pixels +[_] 0 file pairs have differing dimensions +[_] 0 file pairs contain different bits and are not parsable images +[_] 0 file pairs missing from comparisonDir +[_] 0 file pairs missing from baseDir +[_] 0 file pairs not compared yet +(results marked with [*] will cause nonzero return value) + +number of mismatching file pairs: 0 diff --git a/tools/tests/skdiff/test1/output-expected/stdout b/tools/tests/skdiff/test1/output-expected/stdout index 142093f1dd..3cc7f6fc84 100644 --- a/tools/tests/skdiff/test1/output-expected/stdout +++ b/tools/tests/skdiff/test1/output-expected/stdout @@ -6,13 +6,18 @@ ERROR: no codec found for <tools/tests/skdiff/comparisonDir/different-bits-unkno baseDir is [tools/tests/skdiff/baseDir/] comparisonDir is [tools/tests/skdiff/comparisonDir/] writing diffs to outputDir is [tools/tests/skdiff/test1/output-actual/] + compared 12 file pairs: - 2 file pairs contain exactly the same bits - 1 file pairs contain the same pixel values, but not the same bits - 2 file pairs have identical dimensions but some differing pixels - 2 file pairs have differing dimensions - 1 file pairs contain different bits and are not parsable images - 2 file pairs missing from comparisonDir - 2 file pairs missing from baseDir +[_] 2 file pairs contain exactly the same bits +[_] 1 file pairs contain the same pixel values, but not the same bits +[_] 2 file pairs have identical dimensions but some differing pixels +[_] 2 file pairs have differing dimensions +[_] 1 file pairs contain different bits and are not parsable images +[_] 2 file pairs missing from comparisonDir +[_] 2 file pairs missing from baseDir +[_] 0 file pairs not compared yet +(results marked with [*] will cause nonzero return value) + +number of mismatching file pairs: 9 Maximum pixel intensity mismatch 239 Largest area mismatch was 97.99% of pixels diff --git a/tools/tests/skdiff/test2/output-expected/stdout b/tools/tests/skdiff/test2/output-expected/stdout index 855deaee6e..09c4ea1ae0 100644 --- a/tools/tests/skdiff/test2/output-expected/stdout +++ b/tools/tests/skdiff/test2/output-expected/stdout @@ -2,13 +2,18 @@ ERROR: no codec found for basePath <tools/tests/skdiff/baseDir/different-bits-un baseDir is [tools/tests/skdiff/baseDir/] comparisonDir is [tools/tests/skdiff/comparisonDir/] not writing any diffs to outputDir [tools/tests/skdiff/test2/output-actual/] + compared 12 file pairs: - 2 file pairs contain exactly the same bits: identical-bits-unknown-format.xyz identical-bits.png - 1 file pairs contain the same pixel values, but not the same bits: different-bits-identical-pixels.png - 2 file pairs have identical dimensions but some differing pixels: slightly-different-pixels-same-size.png very-different-pixels-same-size.png - 2 file pairs have differing dimensions: slightly-different-sizes.png very-different-sizes.png - 1 file pairs contain different bits and are not parsable images: different-bits-unknown-format.xyz - 2 file pairs missing from comparisonDir: missing-from-comparisonDir.png missing-from-comparisonDir.xyz - 2 file pairs missing from baseDir: missing-from-baseDir.png missing-from-baseDir.xyz +[_] 2 file pairs contain exactly the same bits: identical-bits-unknown-format.xyz identical-bits.png +[_] 1 file pairs contain the same pixel values, but not the same bits: different-bits-identical-pixels.png +[*] 2 file pairs have identical dimensions but some differing pixels: slightly-different-pixels-same-size.png very-different-pixels-same-size.png +[*] 2 file pairs have differing dimensions: slightly-different-sizes.png very-different-sizes.png +[*] 1 file pairs contain different bits and are not parsable images: different-bits-unknown-format.xyz +[_] 2 file pairs missing from comparisonDir: missing-from-comparisonDir.png missing-from-comparisonDir.xyz +[_] 2 file pairs missing from baseDir: missing-from-baseDir.png missing-from-baseDir.xyz +[*] 0 file pairs not compared yet: +(results marked with [*] will cause nonzero return value) + +number of mismatching file pairs: 9 Maximum pixel intensity mismatch 239 Largest area mismatch was 97.99% of pixels |