const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored";
const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison";
const static char kJsonKey_ActualResults_Succeeded[] = "succeeded";
-const static char kJsonKey_ActualResults_AnyStatus_BitmapCityhash[] = "bitmap-cityhash";
+#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
+const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-64bitMD5";
+#else
+const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-cityhash";
+#endif
const static char kJsonKey_ExpectedResults[] = "expected-results";
-const static char kJsonKey_ExpectedResults_AllowedBitmapCityhashes[] = "allowed-bitmap-cityhashes";
+#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
+const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-64bitMD5s";
+#else
+const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-cityhashes";
+#endif
const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-failure";
namespace skiagm {
// TODO(epoger): This currently assumes that the result SkHashDigest was
- // generated as a CityHash of an SkBitmap. We'll need to allow for other
- // hash types to cover non-bitmaps, MD5 instead of CityHash, etc.
+ // generated as an SkHashDigest of an SkBitmap. We'll need to allow for other
+ // hash types to cover non-bitmaps.
Json::Value ActualResultAsJsonValue(const SkHashDigest& result) {
Json::Value jsonValue;
- jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapCityhash] = asJsonValue(result);
+ jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(result);
return jsonValue;
}
if (!SkBitmapHasher::ComputeDigest(bitmap, &digest)) {
digest = 0;
}
- fAllowedBitmapCityhashes.push_back() = digest;
+ fAllowedBitmapChecksums.push_back() = digest;
}
Expectations::Expectations(Json::Value jsonElement) {
}
Json::Value allowedChecksums =
- jsonElement[kJsonKey_ExpectedResults_AllowedBitmapCityhashes];
+ jsonElement[kJsonKey_ExpectedResults_AllowedBitmapHashes];
if (allowedChecksums.isNull()) {
// ok, we'll just assume there aren't any expected checksums to compare against
} else if (!allowedChecksums.isArray()) {
gm_fprintf(stderr, "found non-array json value"
" for key '%s' in element '%s'\n",
- kJsonKey_ExpectedResults_AllowedBitmapCityhashes,
+ kJsonKey_ExpectedResults_AllowedBitmapHashes,
jsonElement.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else {
jsonElement.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else {
- fAllowedBitmapCityhashes.push_back() = asChecksum(checksumElement);
+ fAllowedBitmapChecksums.push_back() = asChecksum(checksumElement);
}
}
}
}
bool Expectations::match(Checksum actualChecksum) const {
- for (int i=0; i < this->fAllowedBitmapCityhashes.count(); i++) {
- Checksum allowedChecksum = this->fAllowedBitmapCityhashes[i];
+ for (int i=0; i < this->fAllowedBitmapChecksums.count(); i++) {
+ Checksum allowedChecksum = this->fAllowedBitmapChecksums[i];
if (allowedChecksum == actualChecksum) {
return true;
}
Json::Value Expectations::asJsonValue() const {
Json::Value allowedChecksumArray;
- if (!this->fAllowedBitmapCityhashes.empty()) {
- for (int i=0; i < this->fAllowedBitmapCityhashes.count(); i++) {
- Checksum allowedChecksum = this->fAllowedBitmapCityhashes[i];
+ if (!this->fAllowedBitmapChecksums.empty()) {
+ for (int i=0; i < this->fAllowedBitmapChecksums.count(); i++) {
+ Checksum allowedChecksum = this->fAllowedBitmapChecksums[i];
allowedChecksumArray.append(Json::UInt64(allowedChecksum));
}
}
Json::Value jsonValue;
- jsonValue[kJsonKey_ExpectedResults_AllowedBitmapCityhashes] = allowedChecksumArray;
+ jsonValue[kJsonKey_ExpectedResults_AllowedBitmapHashes] = allowedChecksumArray;
jsonValue[kJsonKey_ExpectedResults_IgnoreFailure] = this->ignoreFailure();
return jsonValue;
}
/**
* Returns true iff there are no allowed checksums.
*/
- bool empty() const { return this->fAllowedBitmapCityhashes.empty(); }
+ bool empty() const { return this->fAllowedBitmapChecksums.empty(); }
/**
* Returns true iff actualChecksum matches any allowedChecksum,
private:
const static bool kDefaultIgnoreFailure = false;
- SkTArray<Checksum> fAllowedBitmapCityhashes;
+ SkTArray<Checksum> fAllowedBitmapChecksums;
bool fIgnoreFailure;
SkBitmap fBitmap;
};
"actual-results" : {
"failed" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"failure-ignored" : null,
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+ "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+ "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
"ignore-failure" : false
}
}
"actual-results" : {
"failed" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"failure-ignored" : null,
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+ "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+ "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
"ignore-failure" : false
}
}
"failure-ignored" : null,
"no-comparison" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"succeeded" : null
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : null,
+ "allowed-bitmap-64bitMD5s" : null,
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : null,
+ "allowed-bitmap-64bitMD5s" : null,
"ignore-failure" : false
}
}
"no-comparison" : null,
"succeeded" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
}
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+ "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
}
}
"no-comparison" : null,
"succeeded" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
}
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+ "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
}
}
"no-comparison" : null,
"succeeded" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
}
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+ "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
}
}
"no-comparison" : null,
"succeeded" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
}
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+ "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
}
}
"actual-results" : {
"failed" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"failure-ignored" : null,
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+ "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+ "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
"ignore-failure" : false
}
}
"failure-ignored" : null,
"no-comparison" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"565/selftest2" : {
- "bitmap-cityhash" : 8863920166200910451
+ "bitmap-64bitMD5" : 8863920166200910451
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
},
"8888/selftest2" : {
- "bitmap-cityhash" : 13451349865803053525
+ "bitmap-64bitMD5" : 13451349865803053525
}
},
"succeeded" : null
"failure-ignored" : null,
"no-comparison" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"succeeded" : null
"failure-ignored" : null,
"no-comparison" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
},
"succeeded" : null
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : null,
+ "allowed-bitmap-64bitMD5s" : null,
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : null,
+ "allowed-bitmap-64bitMD5s" : null,
"ignore-failure" : false
}
}
"actual-results" : {
"failed" : {
"comparison/selftest1-pipe" : {
- "bitmap-cityhash" : 6140979239232854774
+ "bitmap-64bitMD5" : 6140979239232854774
}
},
"failure-ignored" : null,
"no-comparison" : null,
"succeeded" : {
"565/selftest1" : {
- "bitmap-cityhash" : 12927999507540085554
+ "bitmap-64bitMD5" : 12927999507540085554
},
"8888/selftest1" : {
- "bitmap-cityhash" : 1209453360120438698
+ "bitmap-64bitMD5" : 1209453360120438698
}
}
},
"expected-results" : {
"565/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+ "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
"ignore-failure" : false
},
"8888/selftest1" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
},
"comparison/selftest1-pipe" : {
- "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+ "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
"ignore-failure" : false
}
}