Bug 1028288: Add two reftests for globalAlpha. One just tests globalAlpha, and one tests scaling and globalAlpha. r=roc
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 29 Aug 2014 23:04:35 +0900
changeset 223995 32ea974e14922e1104aed8595636530325dfd557
parent 223994 d02d3b4f448f28642278685c00ebeb3e28b67b62
child 223996 aaa4cf41cade8e24576cb7224c33fd3699fecd52
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1028288
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1028288: Add two reftests for globalAlpha. One just tests globalAlpha, and one tests scaling and globalAlpha. r=roc
layout/reftests/svg/as-image/canvas-drawImage-alpha-1-ref.html
layout/reftests/svg/as-image/canvas-drawImage-alpha-1.html
layout/reftests/svg/as-image/canvas-drawImage-alpha-2-ref.html
layout/reftests/svg/as-image/canvas-drawImage-alpha-2.html
layout/reftests/svg/as-image/reftest.list
layout/reftests/svg/as-image/squaredCircle-transparent.svg
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/canvas-drawImage-alpha-1-ref.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+  <div style="width: 100px; height: 100px; background: orange; position:absolute"></div>
+  <div style="width: 100px; height: 100px; background: lime; opacity: .25; position:absolute"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/canvas-drawImage-alpha-1.html
@@ -0,0 +1,22 @@
+<html>
+  <head>
+    <script type="text/javascript">
+      function go() {
+        var canvas = document.getElementById("canvas");
+        var ctx = canvas.getContext("2d");
+        var image = document.getElementById("image");
+
+        // Draw some orange
+        ctx.fillStyle = "orange";
+        ctx.fillRect(0, 0, 100, 100);
+
+        ctx.globalAlpha = 0.25;
+        ctx.drawImage(image, 0, 0);
+      }
+    </script>
+  </head>
+  <body onload="go()">
+    <canvas id="canvas" width="200" height="200"></canvas>
+    <img id="image" src="lime100x100.svg" style="display: none">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/canvas-drawImage-alpha-2-ref.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+  <embed style="width: 200px; height: 200px;"
+         src="squaredCircle-transparent.svg"/>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/canvas-drawImage-alpha-2.html
@@ -0,0 +1,22 @@
+<html>
+  <head>
+    <script type="text/javascript">
+      function go() {
+        var canvas = document.getElementById("canvas");
+        var ctx = canvas.getContext("2d");
+        var image = document.getElementById("image");
+
+        // Draw some orange
+        ctx.fillStyle = "orange";
+        ctx.fillRect(0, 0, 200, 200);
+
+        ctx.globalAlpha = 0.75;
+        ctx.drawImage(image, 0, 0, 200, 200);
+      }
+    </script>
+  </head>
+  <body onload="go()">
+    <canvas id="canvas" width="200" height="200"></canvas>
+    <img id="image" src="squaredCircle-viewBox-100x100.svg" style="display: none">
+  </body>
+</html>
--- a/layout/reftests/svg/as-image/reftest.list
+++ b/layout/reftests/svg/as-image/reftest.list
@@ -41,16 +41,20 @@ skip-if(B2G) == canvas-drawImage-scale-1
 skip-if(B2G) == canvas-drawImage-scale-1b.html lime100x100-ref.html
 skip-if(B2G) == canvas-drawImage-scale-1c.html lime100x100-ref.html
 
 # Fails on Android versions where we apply a zoom by default, because the
 # resolution of a canvas element is fixed regardless of zoom level.
 fuzzy(1,2) fails-if(Android&&AndroidVersion<15&&AndroidVersion!=10) == canvas-drawImage-scale-2a.html canvas-drawImage-scale-2-ref.html
 fuzzy(1,2) fails-if(Android&&AndroidVersion<15&&AndroidVersion!=10) == canvas-drawImage-scale-2b.html canvas-drawImage-scale-2-ref.html
 
+fuzzy-if(winWidget&&!d2d,1,10000) fuzzy-if(Android||B2G,1,10000) == canvas-drawImage-alpha-1.html canvas-drawImage-alpha-1-ref.html
+#Same as scale-2a but with globalAlpha:
+fuzzy(1,2) fuzzy-if(winWidget&&!d2d,1,40000) fuzzy-if(Android||B2G,1,40000) fails-if(Android&&AndroidVersion<15&&AndroidVersion!=10) == canvas-drawImage-alpha-2.html canvas-drawImage-alpha-2-ref.html
+
 skip-if(B2G) == canvas-drawImage-slice-1a.html lime100x100-ref.html
 == canvas-drawImage-slice-1b.html lime100x100-ref.html
 
 == canvas-drawImage-origin-clean-1.html lime100x100-ref.html
 
 # Simple <img> tests
 == img-simple-1.html  lime100x100-ref.html
 == img-simple-2.html  lime100x100-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/squaredCircle-transparent.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" >
+  <rect x="0" y="0" height="100" width="100" fill="orange"/>
+  <g style="opacity:.75">
+      <rect x="2" y="2" height="96" width="96"
+            stroke-width="4" stroke="black" fill="yellow"/>
+      <circle cx="50" cy="50" r="46" style="fill: blue"/>
+  </g>
+</svg>