Bug 1318947: If expecting snapshots to be different, having them be different size should be considered a succuess. Add more diagnostic information when snapshot comparison fails. r?jwatt
MozReview-Commit-ID: 3lKiulcu7Gz
--- a/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
+++ b/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
@@ -16,18 +16,18 @@ function snapshotRect(win, rect) {
return SpecialPowers.snapshotRect(win, rect);
}
// If the two snapshots don't compare as expected (true for equal, false for
// unequal), returns their serializations as data URIs. In all cases, returns
// whether the comparison was as expected.
function compareSnapshots(s1, s2, expectEqual, fuzz) {
if (s1.width != s2.width || s1.height != s2.height) {
- ok(false, "Snapshot canvases are not the same size - comparing them makes no sense");
- return [false];
+ ok(!expectEqual, "Snapshot canvases are not the same size: " + s1.width + "x" + s1.height + " vs. " + s2.width + "x" + s2.height);
+ return [!expectEqual];
}
var passed = false;
var numDifferentPixels;
var maxDifference = { value: undefined };
if (gWindowUtils) {
var equal;
try {
numDifferentPixels = gWindowUtils.compareCanvases(s1, s2, maxDifference);