GM: stop recording all *_pdf.png results as "INVALID" on non-Mac platforms
BUG=https://code.google.com/p/skia/issues/detail?id=1352 R=edisonn@google.com Review URL: https://codereview.chromium.org/17366003 git-svn-id: http://skia.googlecode.com/svn/trunk@9912 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
056dab300d
commit
e33e137623
@ -664,7 +664,7 @@ public:
|
||||
ErrorCombination write_reference_image(const ConfigData& gRec, const char writePath [],
|
||||
const char renderModeDescriptor [],
|
||||
const char *shortName,
|
||||
const BitmapAndDigest& bitmapAndDigest,
|
||||
const BitmapAndDigest* bitmapAndDigest,
|
||||
SkDynamicMemoryWStream* document) {
|
||||
SkString path;
|
||||
bool success = false;
|
||||
@ -673,8 +673,8 @@ public:
|
||||
(gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) {
|
||||
|
||||
path = make_bitmap_filename(writePath, shortName, gRec.fName, renderModeDescriptor,
|
||||
bitmapAndDigest.fDigest);
|
||||
success = write_bitmap(path, bitmapAndDigest.fBitmap);
|
||||
bitmapAndDigest->fDigest);
|
||||
success = write_bitmap(path, bitmapAndDigest->fBitmap);
|
||||
}
|
||||
if (kPDF_Backend == gRec.fBackend) {
|
||||
path = make_filename(writePath, shortName, gRec.fName, renderModeDescriptor,
|
||||
@ -905,47 +905,56 @@ public:
|
||||
* @param gRec
|
||||
* @param writePath unless this is NULL, write out actual images into this
|
||||
* directory
|
||||
* @param actualBitmap bitmap generated by this run
|
||||
* @param pdf
|
||||
* @param actualBitmapAndDigest ptr to bitmap generated by this run, or NULL
|
||||
* if we don't have a usable bitmap representation
|
||||
* @param document pdf or xps representation, if appropriate
|
||||
*/
|
||||
ErrorCombination compare_test_results_to_stored_expectations(
|
||||
GM* gm, const ConfigData& gRec, const char writePath[],
|
||||
SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) {
|
||||
const BitmapAndDigest* actualBitmapAndDigest, SkDynamicMemoryWStream* document) {
|
||||
|
||||
BitmapAndDigest actualBitmapAndDigest(actualBitmap);
|
||||
SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(), gRec.fName);
|
||||
SkString nameWithExtension(shortNamePlusConfig);
|
||||
nameWithExtension.append(".");
|
||||
nameWithExtension.append(kPNG_FileExtension);
|
||||
|
||||
ErrorCombination errors;
|
||||
ExpectationsSource *expectationsSource = this->fExpectationsSource.get();
|
||||
if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) {
|
||||
/*
|
||||
* Get the expected results for this test, as one or more allowed
|
||||
* hash digests. The current implementation of expectationsSource
|
||||
* get this by computing the hash digest of a single PNG file on disk.
|
||||
*
|
||||
* TODO(epoger): This relies on the fact that
|
||||
* force_all_opaque() was called on the bitmap before it
|
||||
* was written to disk as a PNG in the first place. If
|
||||
* not, the hash digest returned here may not match the
|
||||
* hash digest of actualBitmap, which *has* been run through
|
||||
* force_all_opaque().
|
||||
* See comments above complete_bitmap() for more detail.
|
||||
*/
|
||||
Expectations expectations = expectationsSource->get(nameWithExtension.c_str());
|
||||
errors.add(compare_to_expectations(expectations, actualBitmapAndDigest,
|
||||
gm->shortName(), gRec.fName, "", true));
|
||||
} else {
|
||||
// If we are running without expectations, we still want to
|
||||
// record the actual results.
|
||||
add_actual_results_to_json_summary(nameWithExtension.c_str(),
|
||||
actualBitmapAndDigest.fDigest,
|
||||
ErrorCombination(kMissingExpectations_ErrorType),
|
||||
false);
|
||||
RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType),
|
||||
|
||||
if (NULL == actualBitmapAndDigest) {
|
||||
// Note that we intentionally skipped validating the results for
|
||||
// this test, because we don't know how to generate an SkBitmap
|
||||
// version of the output.
|
||||
RecordTestResults(ErrorCombination(kIntentionallySkipped_ErrorType),
|
||||
shortNamePlusConfig, "");
|
||||
} else {
|
||||
ExpectationsSource *expectationsSource = this->fExpectationsSource.get();
|
||||
if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) {
|
||||
/*
|
||||
* Get the expected results for this test, as one or more allowed
|
||||
* hash digests. The current implementation of expectationsSource
|
||||
* get this by computing the hash digest of a single PNG file on disk.
|
||||
*
|
||||
* TODO(epoger): This relies on the fact that
|
||||
* force_all_opaque() was called on the bitmap before it
|
||||
* was written to disk as a PNG in the first place. If
|
||||
* not, the hash digest returned here may not match the
|
||||
* hash digest of actualBitmap, which *has* been run through
|
||||
* force_all_opaque().
|
||||
* See comments above complete_bitmap() for more detail.
|
||||
*/
|
||||
Expectations expectations = expectationsSource->get(nameWithExtension.c_str());
|
||||
errors.add(compare_to_expectations(expectations, *actualBitmapAndDigest,
|
||||
gm->shortName(), gRec.fName, "", true));
|
||||
} else {
|
||||
// If we are running without expectations, we still want to
|
||||
// record the actual results.
|
||||
add_actual_results_to_json_summary(nameWithExtension.c_str(),
|
||||
actualBitmapAndDigest->fDigest,
|
||||
ErrorCombination(kMissingExpectations_ErrorType),
|
||||
false);
|
||||
RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType),
|
||||
shortNamePlusConfig, "");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Consider moving this into compare_to_expectations(),
|
||||
@ -954,7 +963,7 @@ public:
|
||||
// renderModes of all tests! That would be a lot of files.
|
||||
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
|
||||
errors.add(write_reference_image(gRec, writePath, "", gm->shortName(),
|
||||
actualBitmapAndDigest, pdf));
|
||||
actualBitmapAndDigest, document));
|
||||
}
|
||||
|
||||
return errors;
|
||||
@ -1054,12 +1063,22 @@ public:
|
||||
SkAutoDataUnref data(document.copyToData());
|
||||
SkMemoryStream stream(data->data(), data->size());
|
||||
SkPDFDocumentToBitmap(&stream, bitmap);
|
||||
#else
|
||||
bitmap = NULL; // we don't generate a bitmap rendering of the PDF file
|
||||
#endif
|
||||
} else if (gRec.fBackend == kXPS_Backend) {
|
||||
generate_xps(gm, document);
|
||||
bitmap = NULL; // we don't generate a bitmap rendering of the XPS file
|
||||
}
|
||||
|
||||
if (NULL == bitmap) {
|
||||
return compare_test_results_to_stored_expectations(
|
||||
gm, gRec, writePath, NULL, &document);
|
||||
} else {
|
||||
BitmapAndDigest bitmapAndDigest(*bitmap);
|
||||
return compare_test_results_to_stored_expectations(
|
||||
gm, gRec, writePath, &bitmapAndDigest, &document);
|
||||
}
|
||||
return compare_test_results_to_stored_expectations(
|
||||
gm, gRec, writePath, *bitmap, &document);
|
||||
}
|
||||
|
||||
ErrorCombination test_deferred_drawing(GM* gm,
|
||||
|
@ -0,0 +1 @@
|
||||
out/Debug/gm --verbose --hierarchy --match selftest1 --config 8888 565 pdf -r gm/tests/inputs/json/identical-bytes.json --writeJsonSummaryPath gm/tests/outputs/add-config-pdf/output-actual/json-summary.txt --writePath gm/tests/outputs/add-config-pdf/output-actual/writePath --mismatchPath gm/tests/outputs/add-config-pdf/output-actual/mismatchPath --missingExpectationsPath gm/tests/outputs/add-config-pdf/output-actual/missingExpectationsPath
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"actual-results" : {
|
||||
"failed" : null,
|
||||
"failure-ignored" : null,
|
||||
"no-comparison" : null,
|
||||
"succeeded" : {
|
||||
"565/selftest1.png" : [ "bitmap-64bitMD5", 12927999507540085554 ],
|
||||
"8888/selftest1.png" : [ "bitmap-64bitMD5", 1209453360120438698 ]
|
||||
}
|
||||
},
|
||||
"expected-results" : {
|
||||
"565/selftest1.png" : {
|
||||
"allowed-digests" : [
|
||||
[ "bitmap-64bitMD5", 12927999507540085554 ]
|
||||
],
|
||||
"ignore-failure" : false
|
||||
},
|
||||
"8888/selftest1.png" : {
|
||||
"allowed-digests" : [
|
||||
[ "bitmap-64bitMD5", 1209453360120438698 ]
|
||||
],
|
||||
"ignore-failure" : false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
0
|
18
gm/tests/outputs/add-config-pdf/output-expected/stdout
Normal file
18
gm/tests/outputs/add-config-pdf/output-expected/stdout
Normal file
@ -0,0 +1,18 @@
|
||||
GM: These configs will be run: 8888 565 pdf
|
||||
GM: reading expectations from JSON summary file gm/tests/inputs/json/identical-bytes.json
|
||||
GM: writing to gm/tests/outputs/add-config-pdf/output-actual/writePath
|
||||
GM: writing mismatches to gm/tests/outputs/add-config-pdf/output-actual/mismatchPath
|
||||
GM: writing images without expectations to gm/tests/outputs/add-config-pdf/output-actual/missingExpectationsPath
|
||||
GM: drawing... selftest1 [300 200]
|
||||
GM: Ran 1 GMs
|
||||
GM: ... over 3 configs ["8888", "565", "pdf"]
|
||||
GM: ... and 7 modes ["pipe", "pipe cross-process", "pipe cross-process, shared address", "replay", "rtree", "serialize", "tilegrid"]
|
||||
GM: ... so there should be a total of 10 tests.
|
||||
GM: Ran 10 tests: NoGpuContext=0 IntentionallySkipped=1 RenderModeMismatch=0 ExpectationsMismatch=0 MissingExpectations=0 WritingReferenceImage=0
|
||||
GM: [*] 0 NoGpuContext:
|
||||
GM: [ ] 1 IntentionallySkipped: pdf/selftest1
|
||||
GM: [*] 0 RenderModeMismatch:
|
||||
GM: [*] 0 ExpectationsMismatch:
|
||||
GM: [ ] 0 MissingExpectations:
|
||||
GM: [*] 0 WritingReferenceImage:
|
||||
GM: (results marked with [*] will cause nonzero return value)
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
[contents of gm/tests/outputs/add-config-pdf/output-actual/writePath/565/selftest1.png]
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
[contents of gm/tests/outputs/add-config-pdf/output-actual/writePath/8888/selftest1.png]
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories.
|
@ -0,0 +1 @@
|
||||
[contents of gm/tests/outputs/add-config-pdf/output-actual/writePath/pdf/selftest1.pdf]
|
@ -108,6 +108,9 @@ function gm_test {
|
||||
for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do
|
||||
echo "[contents of $IMAGEFILE]" >$IMAGEFILE
|
||||
done
|
||||
for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.pdf); do
|
||||
echo "[contents of $IMAGEFILE]" >$IMAGEFILE
|
||||
done
|
||||
|
||||
# Add a file to any empty subdirectories.
|
||||
for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do
|
||||
@ -199,6 +202,9 @@ gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere"
|
||||
# Compare generated image against an empty "expected image" dir, but NOT in verbose mode.
|
||||
gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose"
|
||||
|
||||
# Add pdf to the list of configs.
|
||||
gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json/identical-bytes.json" "$GM_OUTPUTS/add-config-pdf"
|
||||
|
||||
# If run without "-r", the JSON's "actual-results" section should contain
|
||||
# actual checksums marked as "failure-ignored", but the "expected-results"
|
||||
# section should be empty.
|
||||
|
Loading…
Reference in New Issue
Block a user