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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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