Index: LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html |
diff --git a/LayoutTests/fast/canvas/canvas-toDataURL-webp.html b/LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html |
similarity index 56% |
copy from LayoutTests/fast/canvas/canvas-toDataURL-webp.html |
copy to LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html |
index 24f7f92a231cc13eb21dd8fe027ba9ac7bbb61f5..46e417c0527b6f9fadbbd017f4a6c8fe03954daf 100644 |
--- a/LayoutTests/fast/canvas/canvas-toDataURL-webp.html |
+++ b/LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html |
@@ -1,29 +1,30 @@ |
<canvas id="canvas" width="64px" height="64px" style="display: none"></canvas> |
+<!-- The <img> background color should be visible behind the html5.png test image (the test |
+ image has an alpha channel, which should be preserved by the webp toDataURL encoder). --> |
+<img id="result" style="background-color: green"> |
<pre id="log"></pre> |
-<img id="result"> |
+ |
<script> |
if (window.testRunner) { |
window.testRunner.dumpAsTextWithPixelResults(); |
window.testRunner.waitUntilDone(); |
} |
-function webpDataURLTest() |
-{ |
+var image = new Image(); |
+image.onload = function() { |
var canvas = document.getElementById('canvas'); |
- var context = canvas.getContext('2d'); |
- context.drawImage(window.image, 0, 0, canvas.width, canvas.height); |
+ canvas.getContext('2d').drawImage(this, 0, 0, canvas.width, canvas.height); |
var dataURL = canvas.toDataURL('image/webp', 0.8); |
+ |
if (!dataURL.match(/^data:image\/webp[;,]/)) |
- document.getElementById('log').textContent += "FAIL: canvas.toDataURL('image/webp') not supported"; |
+ document.getElementById('log').textContent += "FAIL: the dataURL should have 'image/webp' type."; |
else |
document.getElementById('result').src = dataURL; |
if (window.testRunner) |
window.testRunner.notifyDone(); |
-} |
+}; |
-var image = new Image(); |
-image.onload = webpDataURLTest; |
image.src = 'resources/html5.png'; |
</script> |