Bug 674003. Add reftest for transparent radial gradients. r=joe
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Fri, 05 Aug 2011 17:10:09 -0400
changeset 73929 bae3e43a51730b52db124a810f117e1e24f7fb9f
parent 73928 39d0aea0cbcd316decfecf9a60020295ffe771f7
child 73930 672300c1bf65aede27bb2bc18479bcb4363ca7b2
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjoe
bugs674003
milestone8.0a1
Bug 674003. Add reftest for transparent radial gradients. r=joe This draws a unchanging part of the gradient on to another canvas.
layout/reftests/canvas/674003-alpha-radial-gradient-superlum-ref.html
layout/reftests/canvas/674003-alpha-radial-gradient-superlum.html
layout/reftests/canvas/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/canvas/674003-alpha-radial-gradient-superlum-ref.html
@@ -0,0 +1,11 @@
+<body bgcolor="orange">
+    <canvas width="300" height="300" id="testcase-canvas-dest"></canvas>
+  <script>
+    const kTransparent = "rgba(0%, 100%, 100%, 0.5)";
+
+    cx2 = document.getElementById('testcase-canvas-dest').getContext('2d');
+    cx2.fillStyle = kTransparent;
+    cx2.fillRect(0,0,100,20);
+  </script>
+
+</window>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/canvas/674003-alpha-radial-gradient-superlum.html
@@ -0,0 +1,36 @@
+<body bgcolor="orange">
+    <canvas width="300" height="300" id="testcase-canvas" style="display:none"></canvas>
+    <canvas width="300" height="300" id="testcase-canvas-dest"></canvas>
+  <script>
+    const kShadow = "rgba(00%, 0%, 0%, 1)";
+    const kTransparent = "rgba(0%, 100%, 100%, 0.5)";
+
+    var cx, g;
+
+    cx = document.getElementById('testcase-canvas').getContext('2d');
+    
+    cx.fillStyle = kShadow;
+    cx.fillRect(100, 50, 150, 50);
+
+    g = cx.createLinearGradient(0, 50, 0, 0);
+    g.addColorStop(0, kShadow);
+    g.addColorStop(0.2, kTransparent);
+    g.addColorStop(1, kTransparent);
+    cx.fillStyle = g;
+    cx.fillRect(100, 0, 150, 50);
+
+    g = cx.createRadialGradient(100, 100, 50, 100, 100, 100);
+    g.addColorStop(0, kShadow);
+    g.addColorStop(0.2, kTransparent);
+    g.addColorStop(1, kTransparent);
+    cx.fillStyle = g;
+    cx.beginPath();
+    cx.arc(100, 100, 100, Math.PI * 0.5, Math.PI * 1.5);
+    cx.fill();
+    
+    cx2 = document.getElementById('testcase-canvas-dest').getContext('2d');
+    // draw a chunk of the gradients from above onto testcase-canvas-dest
+    cx2.drawImage(document.getElementById('testcase-canvas'),45,20, 100,20 ,0,0, 100,20);
+  </script>
+
+</window>
--- a/layout/reftests/canvas/reftest.list
+++ b/layout/reftests/canvas/reftest.list
@@ -61,8 +61,9 @@ fails-if(cocoaWidget) == linear-gradient
 == dash-sanity.html data:text/html,<body>Pass
 random-if(Android) == dash-1.html dash-1-ref.svg  # Bug 668412 (really is android-specific, not IPC-specific)
 
 == ctm-sanity.html data:text/html,<body>Pass
 fails == ctm-singular-sanity.html data:text/html,<body>Pass  # Bug 612033
 == ctm-1.html ctm-1-ref.html
 
 fails-if(cocoaWidget) == 672646-alpha-radial-gradient.html 672646-alpha-radial-gradient-ref.html # Bug 673333
+== 674003-alpha-radial-gradient-superlum.html 674003-alpha-radial-gradient-superlum-ref.html