Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / canvas-zero-size.html
blobeeb356a056b642bd758d815c5c5fb3f32e3d1cb8
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Zero Size Canvas Test</title>
6 <script src="../../../resources/js-test.js"></script>
7 <script src="resources/webgl-test.js"> </script>
8 <script src="resources/webgl-test-utils.js"> </script>
9 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
13 <script>
14 description("Tests that a zero size canvas does not fail.");
15 var wtu = WebGLTestUtils;
16 var canvas = document.createElement('canvas');
17 var gl = wtu.create3DContext(canvas);
18 canvas.width = 0;
19 canvas.height = 0;
20 gl.viewport(0, 0, 0, 0);
21 var program = wtu.setupTexturedQuad(gl);
22 shouldBeTrue("program != null");
23 var tex = gl.createTexture();
24 gl.bindTexture(gl.TEXTURE_2D, tex);
25 var pixel = new Uint8Array([0, 255, 0, 255]);
26 gl.texImage2D(
27 gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
28 wtu.drawQuad(gl);
30 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
31 </script>
33 </body>
34 </html>