| Index: tools/image_expectations.cpp
|
| diff --git a/tools/image_expectations.cpp b/tools/image_expectations.cpp
|
| index 9b180da5feded20795c7e900a8cd2ff7cf9159c5..24c91755415d62e4e292cbd72d0af0b76f4045cc 100644
|
| --- a/tools/image_expectations.cpp
|
| +++ b/tools/image_expectations.cpp
|
| @@ -104,7 +104,7 @@ namespace sk_tools {
|
| }
|
|
|
| void ImageResultsAndExpectations::add(const char *sourceName, const char *fileName,
|
| - const ImageDigest &digest, const int *tileNumber) {
|
| + const ImageDigest &digest, const int *tileNumber) {
|
| // Get expectation, if any.
|
| Json::Value expectedImage;
|
| if (!fExpectedResults.isNull()) {
|
| @@ -146,6 +146,29 @@ namespace sk_tools {
|
| }
|
| }
|
|
|
| + bool ImageResultsAndExpectations::matchesExpectation(const char *sourceName,
|
| + const ImageDigest &digest,
|
| + const int *tileNumber) {
|
| + if (fExpectedResults.isNull()) {
|
| + return false;
|
| + }
|
| +
|
| + Json::Value expectedImage;
|
| + if (NULL == tileNumber) {
|
| + expectedImage = fExpectedResults[sourceName][kJsonKey_Source_WholeImage];
|
| + } else {
|
| + expectedImage = fExpectedResults[sourceName][kJsonKey_Source_TiledImages][*tileNumber];
|
| + }
|
| + if (expectedImage.isNull()) {
|
| + return false;
|
| + }
|
| +
|
| + Json::Value actualChecksumAlgorithm = digest.getHashType().c_str();
|
| + Json::Value actualChecksumValue = Json::UInt64(digest.getHashValue());
|
| + return ((actualChecksumAlgorithm == expectedImage[kJsonKey_Image_ChecksumAlgorithm]) &&
|
| + (actualChecksumValue == expectedImage[kJsonKey_Image_ChecksumValue]));
|
| + }
|
| +
|
| void ImageResultsAndExpectations::writeToFile(const char *filename) const {
|
| Json::Value header;
|
| header[kJsonKey_Header_Type] = kJsonValue_Header_Type;
|
|
|