Bug 1272878 - Fuzz test_bitmaprenderer.html because of differences in our two codepaths with antialiasing r=Morris
authorGeorge Wright <george@mozilla.com>
Mon, 08 Aug 2016 14:06:40 -0400
changeset 334589 e2d1e50ec9f58e404a2ee224f0600392353023db
parent 334588 9999b6b8022bfe815d79a4f309986d2859285e16
child 334590 eac5c4bf002d95bc536d17f876650d77ae38ba1a
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMorris
bugs1272878
milestone51.0a1
Bug 1272878 - Fuzz test_bitmaprenderer.html because of differences in our two codepaths with antialiasing r=Morris
dom/canvas/test/test_bitmaprenderer.html
--- a/dom/canvas/test/test_bitmaprenderer.html
+++ b/dom/canvas/test/test_bitmaprenderer.html
@@ -65,17 +65,26 @@ function runTest(canvasWidth, canvasHeig
     canvasRef.style.display = "none";
     canvas2.style.display = "block";
     var snapshot = snapshotWindow(window);
 
     canvasRef.style.display = "block";
     canvas2.style.display = "none";
     var snapshotRef = snapshotWindow(window);
 
-    var results = compareSnapshots(snapshot, snapshotRef, true);
+    // bitmaprenderers use an ImageLayer whereas a normal 2d canvas uses a canvas layer. This
+    // can result in some anti-aliasing differences on the edge. We consider slight AA differences
+    // to be reasonable when using different codepaths so fuzz a little bit.
+    var fuzz = { numDifferentPixels:  0,
+                 maxDifference: 0 };
+    if (SpecialPowers.Services.appinfo.widgetToolkit == "android") {
+      fuzz.maxDifference = 14;
+      fuzz.numDifferentPixels = 130;
+    }
+    var results = compareSnapshots(snapshot, snapshotRef, true, fuzz);
     ok(results[0], "Screenshots should be the same");
 
     document.body.removeChild(canvasRef);
     document.body.removeChild(canvas2);
 
     nextTest();
   });
 }