Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-large-dimensions.html
blob08f38a5b4af7f7ec09b74544b9efba6827398978
1 <!DOCTYPE html>
2 <title>Canvas test: test large width/height values</title>
3 <script src="../../resources/js-test.js"></script>
4 <body>
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>
8 <script>
9 var canvas = document.getElementById("c");
10 var x, y, w=1, h=1;
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) {
21 canvas.width = 50;
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)
27 testPassed(msg);
28 else
29 testFailed(msg);
30 x = canvas.width-2;
31 y = canvas.height-2;
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)
37 testPassed(msg);
38 else
39 testFailed(msg);
43 function testWidth(canvas, width) {
44 canvas.height = 50;
45 canvas.width = 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)
50 testPassed(msg);
51 else
52 testFailed(msg);
53 x = canvas.width-2;
54 y = canvas.height-2;
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)
60 testPassed(msg);
61 else
62 testFailed(msg);
65 </script>