skimage: report failure if expectation not found.
If the expectation file exists, but the particular file being
decoded has no expectation, report a failure.
This is more appropriate since the intended use is that an
expectation will be created for each file. Without an expectation,
we cannot know whether the decoder has changed.
R=epoger@google.com
Review URL: https://codereview.chromium.org/15094011
git-svn-id: http://skia.googlecode.com/svn/trunk@9122 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 2041f7b..e434ff0 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -202,9 +202,13 @@
* Compare against an expectation for this filename, if there is one.
* @param bitmap SkBitmap to compare to the expected value.
* @param filename String used to find the expected value.
- * @return bool True if the bitmap matched the expectation, or if there was no expectation. False
- * if there was an expecation that the bitmap did not match, or if an expectation could not be
- * computed from an expectation.
+ * @return bool True in any of these cases:
+ * - the bitmap matches the expectation.
+ * - there is no expectations file.
+ * False in any of these cases:
+ * - there is an expectations file, but no expectation for this bitmap.
+ * - there is an expectation for this bitmap, but it did not match.
+ * - expectation could not be computed from the bitmap.
*/
static bool compare_to_expectations_if_necessary(const SkBitmap& bitmap, const char* filename,
SkTArray<SkString, false>* failureArray) {
@@ -214,7 +218,11 @@
skiagm::Expectations jsExpectation = gJsonExpectations->get(filename);
if (jsExpectation.empty()) {
- return true;
+ if (failureArray != NULL) {
+ failureArray->push_back().printf("decoded %s, but could not find expectation.",
+ filename);
+ }
+ return false;
}
SkHashDigest checksum;