blob: 056364b1656fd5bcf82bfeb1af5dce1321ba230f [file] [log] [blame]
chang.shu@nokia.comd5cb9102010-05-21 20:47:13 +00001<!DOCTYPE html>
2<title>Canvas test: 2d.composite.canvas.destination-atop</title>
3<script src="../tests.js"></script>
4<link rel="stylesheet" href="../tests.css">
andreas.kling@nokia.com7817c162010-11-07 13:49:39 +00005<body>
6<p id="passtext">Pass</p>
7<p id="failtext">Fail</p>
8<p class="output">These images should be identical:</p>
chang.shu@nokia.comd5cb9102010-05-21 20:47:13 +00009<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
10<p class="output expectedtext">Expected output:<p><img src="2d.composite.canvas.destination-atop.png" class="output expected" id="expected" alt="">
11<ul id="d"></ul>
12<script>
13_addTest(function(canvas, ctx) {
14
15
16var canvas2 = document.createElement('canvas');
17canvas2.width = canvas.width;
18canvas2.height = canvas.height;
19var ctx2 = canvas2.getContext('2d');
20ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
21ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
22ctx.fillRect(0, 0, 100, 50);
23ctx.globalCompositeOperation = 'destination-atop';
24ctx.drawImage(canvas2, 0, 0);
25_assertPixelApprox(canvas, 50,25, 127,255,127,191, "50,25", "127,255,127,191", 5);
26
27
28});
29</script>
30<img src="../images/yellow75.png" id="yellow75.png" class="resource">
31