content/canvas/test/reftest/webgl-clear-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 /* Clear Test
     9  *
    10  * Clear the canvas to green to test that we get pixels to the screen.
    11  */
    13 "use strict";
    15 function renderGL(gl) {
    16   gl.clearColor(0.0, 1.0, 0.0, 1.0);
    17   gl.clear(gl.COLOR_BUFFER_BIT);
    18   gl.finish();
    19 }
    21 function renderFailure(canvas) {
    22   // This will also trigger RAF for us.
    23   var context = canvas.getContext("2d");
    24   context.fillText('WebGL failed.', 64, 64);
    25 }
    27 function runTest() {
    28   var canvas = document.getElementById("canvas");
    29   var gl = initGL(canvas);
    31   if (gl)
    32     renderGL(gl);
    33   else
    34     renderFailure(canvas);
    36   waitForComposite(testComplete);
    37 }
    39 function testComplete() {
    40   document.documentElement.removeAttribute("class");
    41 }
    43 </script>
    44 </head>
    46 <body onload="rAF(runTest);">
    47   <canvas id="canvas" width="256" height="256"></canvas>
    48 </body>
    50 </html>

mercurial