Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.imageData.put.unchanged.html
blob8e4e827d18b730a036e8e27ccbb10f3be3525a60
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.imageData.put.unchanged</title>
3 <!-- Testing: putImageData(getImageData(...), ...) has no effect -->
4 <script src="/MochiKit/MochiKit.js"></script>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
7 <body>
8 <canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
9 <script>
11 SimpleTest.waitForExplicitFinish();
12 MochiKit.DOM.addLoadEvent(function () {
14 var canvas = document.getElementById('c');
15 var ctx = canvas.getContext('2d');
17 var i = 0;
18 for (var y = 0; y < 16; ++y) {
19 for (var x = 0; x < 16; ++x, ++i) {
20 ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')';
21 ctx.fillRect(x, y, 1, 1);
24 var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
25 var olddata = [];
26 for (var i = 0; i < imgdata1.data.length; ++i)
27 olddata[i] = imgdata1.data[i];
29 ctx.putImageData(imgdata1, 0.1, 0.2);
31 var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
32 for (var i = 0; i < imgdata2.data.length; ++i) {
33 ok(olddata[i] === imgdata2.data[i], "olddata[\""+(i)+"\"] === imgdata2.data[\""+(i)+"\"]");
36 SimpleTest.finish();
38 });
39 </script>