2 <title>Canvas test: test large width/height values
</title>
3 <script src=
"../../resources/js-test.js"></script>
5 <p>Tests that using reasonably large values for canvas.height and canvas.height don't cause a crash
"</p>
6 <pre id="console
"></pre>
7 <canvas id="c
" class="output
" width="100" height="50"><p class="fallback
">FAIL (fallback content)</p></canvas>
9 var canvas = document.getElementById("c
");
12 testHeight(canvas, 1000);
13 testHeight(canvas, 10000);
14 testHeight(canvas, 32000);
16 testWidth(canvas, 1000);
17 testWidth(canvas, 10000);
18 testWidth(canvas, 32000);
20 function testHeight(canvas, height) {
22 canvas.height = height;
23 var ctx = canvas.getContext("2d
");
24 ctx.fillStyle = "rgba(255, 255, 255, 1)";
25 var msg = "height
== "+height;
26 if (canvas.height == height)
32 ctx.fillRect(x,y,w,h);
33 var data = ctx.getImageData(x,y,w,h);
34 for (var x = 0; x < 4; x++) {
35 var msg = "Actual
: " + data.data[x] + " Expected
: 255";
36 if (data.data[x] == 255)
43 function testWidth(canvas, width) {
46 var ctx = canvas.getContext("2d
");
47 ctx.fillStyle = "rgba(255, 255, 255, 1)";
48 var msg = "width
== "+width;
49 if (canvas.width == width)
55 ctx.fillRect(x,y,w,h);
56 var data = ctx.getImageData(x,y,w,h);
57 for (var x = 0; x < 4; x++) {
58 var msg = "Actual
: " + data.data[x] + " Expected
: 255";
59 if (data.data[x] == 255)