create sk_tools::Expectation class, similar to skiagm::Expectations class
The overarching goal here is for our "gm" and "render_pictures" tools to handle
image expectations/actuals in the same way, sharing the same code, so their
results can be processed through a single pipeline.
By adding an Expectation class within tools/image_expectations.h, similar to
the Expectations class in gm/gm_expectations.h, we get one step closer to
that goal.
R=stephana@google.com
TBR=stephana
Author: epoger@google.com
Review URL: https://codereview.chromium.org/493363002
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 7325c20..ac639e5 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -297,7 +297,7 @@
SkString outputFilename;
const char *outputSubdirPtr = NULL;
if (useChecksumBasedFilenames) {
- const ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
+ ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
outputSubdirPtr = escapedInputFilename.c_str();
outputFilename.set(imageDigestPtr->getHashType());
outputFilename.append("_");
@@ -312,7 +312,7 @@
outputFilename.append(".png");
if (NULL != jsonSummaryPtr) {
- const ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
+ ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
SkString outputRelativePath;
if (outputSubdirPtr) {
outputRelativePath.set(outputSubdirPtr);
@@ -325,8 +325,8 @@
jsonSummaryPtr->add(inputFilename.c_str(), outputRelativePath.c_str(),
*imageDigestPtr, tileNumberPtr);
if (!mismatchPath.isEmpty() &&
- !jsonSummaryPtr->matchesExpectation(inputFilename.c_str(), *imageDigestPtr,
- tileNumberPtr)) {
+ !jsonSummaryPtr->getExpectation(inputFilename.c_str(),
+ tileNumberPtr).matches(*imageDigestPtr)) {
if (!write_bitmap_to_disk(bitmap, mismatchPath, outputSubdirPtr, outputFilename)) {
return false;
}