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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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
     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  */
    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();
    27 }
    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 }
    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);
    45 }
    47 function testComplete() {
    48   document.documentElement.removeAttribute("class");
    49 }
    50 </script>
    51 </head>
    53 <body onload="rAF(runTest);">
    54   <canvas id="canvas" width="256" height="256"></canvas>
    55 </body>
    57 </html>

mercurial