Backed out changeset 713114c0331a (bug 1938707) by developer request CLOSED TREE
[gecko.git] / dom / canvas / test / reftest / webgl-hanging-scissor-test.html
blobfb035153f1c5b23fce5ca7596562d5843e2f74e7
1 <!DOCTYPE html>
2 <html class="reftest-wait">
3 <head>
4 <meta charset="UTF-8">
6 <script type="text/javascript" src="webgl-utils.js"></script>
7 <script type="text/javascript">
8 /* Hanging Scissor Test
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.
14 * Failure should look like only the top-left quadrant is rendered.
17 "use strict";
19 function renderGL(gl) {
20 gl.clearColor(0.0, 1.0, 0.0, 1.0);
21 gl.clear(gl.COLOR_BUFFER_BIT);
23 gl.enable(gl.SCISSOR_TEST);
24 gl.scissor(0, 128, 128, 128);
26 gl.finish();
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);
35 function runTest() {
36 var canvas = document.getElementById("canvas");
37 var gl = initGL(canvas);
39 if (gl)
40 renderGL(gl);
41 else
42 renderFailure(canvas);
44 waitForComposite(testComplete);
47 function testComplete() {
48 document.documentElement.removeAttribute("class");
50 </script>
51 </head>
53 <body onload="rAF(runTest);">
54 <canvas id="canvas" width="256" height="256"></canvas>
55 </body>
57 </html>