Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.imageData.get.clamp.html
blobed62ed5d7c25e9b67ab3edb3b1dd6d0e7d4b0135
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.imageData.get.clamp</title>
3 <!-- Testing: getImageData() clamps colours to the range [0, 255] -->
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 ctx.fillStyle = 'rgb(-100, -200, -300)';
18 ctx.fillRect(0, 0, 100, 50);
19 ctx.fillStyle = 'rgb(256, 300, 400)';
20 ctx.fillRect(20, 10, 60, 10);
21 var imgdata1 = ctx.getImageData(10, 5, 1, 1);
22 ok(imgdata1.data[0] === 0, "imgdata1.data[\""+(0)+"\"] === 0");
23 ok(imgdata1.data[1] === 0, "imgdata1.data[\""+(1)+"\"] === 0");
24 ok(imgdata1.data[2] === 0, "imgdata1.data[\""+(2)+"\"] === 0");
25 var imgdata2 = ctx.getImageData(30, 15, 1, 1);
26 ok(imgdata2.data[0] === 255, "imgdata2.data[\""+(0)+"\"] === 255");
27 ok(imgdata2.data[1] === 255, "imgdata2.data[\""+(1)+"\"] === 255");
28 ok(imgdata2.data[2] === 255, "imgdata2.data[\""+(2)+"\"] === 255");
30 SimpleTest.finish();
32 });
33 </script>