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 draft
authorMilan Sreckovic <milan@mozilla.com>
Thu, 19 Apr 2018 17:17:01 -0400
changeset 785315 d87034297cc39f6f028cfe5ac461ea921b7d8ba3
parent 785144 3cc613bf13443acc2fea4804872fb3ca56757181
push id107186
push userbmo:milan@mozilla.com
push dateThu, 19 Apr 2018 21:26:39 +0000
reviewersjwatt
bugs1318947
milestone61.0a1
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
testing/mochitest/tests/SimpleTest/WindowSnapshot.js
--- 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);