content/canvas/test/reftest/webgl-hanging-scissor-test.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e25dda183309
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 /* Hanging Scissor Test
9 *
10 * Clear the canvas to green, but create and enable and set scissor values
11 * before returning. This can fail if we blindly blit or read from the screen
12 * without disabling scissor-test.
13 *
14 * Failure should look like only the top-left quadrant is rendered.
15 */
16
17 "use strict";
18
19 function renderGL(gl) {
20 gl.clearColor(0.0, 1.0, 0.0, 1.0);
21 gl.clear(gl.COLOR_BUFFER_BIT);
22
23 gl.enable(gl.SCISSOR_TEST);
24 gl.scissor(0, 128, 128, 128);
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