content/canvas/test/reftest/webgl-orientation-test.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:82de25ef6a94
1 <!DOCTYPE html>
2 <html class="reftest-wait">
3 <head>
4 <meta charset="UTF-8">
5
6 <script type="text/javascript" src="webgl-utils.js"></script>
7 <script type="text/javascript">
8 /* Orientation Test
9 *
10 * Clear the canvas to black, and clear the upper-left quadrant
11 * to white. If this doesn't pass, but the Clear test does, then
12 * likely y-flip is wrong.
13 */
14
15 "use strict";
16
17 function renderGL(gl) {
18 gl.clearColor(0.0, 0.0, 0.0, 1.0);
19 gl.clear(gl.COLOR_BUFFER_BIT);
20
21 gl.enable(gl.SCISSOR_TEST);
22 gl.scissor(0, 128, 128, 128);
23 gl.clearColor(1.0, 1.0, 1.0, 1.0);
24 gl.clear(gl.COLOR_BUFFER_BIT);
25
26 gl.finish();
27 }
28
29 function renderFailure(canvas) {
30 // This will also trigger RAF for us.
31 var context = canvas.getContext("2d");
32 context.fillText('WebGL failed.', 64, 64);
33 }
34
35 function runTest() {
36 var canvas = document.getElementById("canvas");
37 var gl = initGL(canvas);
38
39 if (gl)
40 renderGL(gl);
41 else
42 renderFailure(canvas);
43
44 waitForComposite(testComplete);
45 }
46
47 function testComplete() {
48 document.documentElement.removeAttribute("class");
49 }
50 </script>
51 </head>
52
53 <body onload="rAF(runTest);">
54 <canvas id="canvas" width="256" height="256"></canvas>
55 </body>
56
57 </html>

mercurial