content/canvas/test/webgl-conformance/conformance/rendering/gl-clear.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 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4   found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10 <title>WebGL clear conformance test.</title>
    11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    12 <script src="../../resources/js-test-pre.js"></script>
    13 <script src="../resources/webgl-test.js"> </script>
    14 <script src="../resources/webgl-test-utils.js"> </script>
    15 </head>
    16 <body>
    17 <canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></canvas>
    18 <div id="description"></div><div id="console"></div>
    19 <script>
    20 description("Test clear.");
    21 var wtu = WebGLTestUtils;
    22 var gl = wtu.create3DContext("example");
    23 var program = wtu.setupTexturedQuad(gl);
    25 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
    26 wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0");
    28 gl.clearColor(1,1,1,1);
    29 gl.clear(gl.COLOR_BUFFER_BIT);
    30 wtu.checkCanvas(gl, [255,255,255,255], "should be 255,255,255,255");
    32 gl.clearColor(0,0,0,0);
    33 gl.clear(gl.COLOR_BUFFER_BIT);
    34 wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0");
    36 gl.colorMask(false, false, false, true);
    37 gl.clearColor(1,1,1,1);
    38 gl.clear(gl.COLOR_BUFFER_BIT);
    39 wtu.checkCanvas(gl, [0,0,0,255], "should be 0,0,0,255");
    41 var tex = gl.createTexture();
    42   gl.bindTexture(gl.TEXTURE_2D, tex);
    43   gl.texImage2D(
    44       gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
    45       new Uint8Array([128, 128, 128, 192]));
    47 gl.disable(gl.DEPTH_TEST);
    48 gl.disable(gl.BLEND);
    49 gl.colorMask(true, true, true, true);
    50 gl.drawArrays(gl.TRIANGLES, 0, 6);
    51 wtu.checkCanvas(gl, [128,128,128,192], "should be 128,128,128,192");
    53 gl.colorMask(false, false, false, true);
    54 gl.clearColor(1,1,1,1);
    55 gl.clear(gl.COLOR_BUFFER_BIT);
    56 wtu.checkCanvas(gl, [128,128,128,255], "should be 128,128,128,255");
    58 // TODO: Test depth and stencil clearing.
    60 debug("");
    61 successfullyParsed = true;
    62 </script>
    63 <script>finishTest();</script>
    64 </body>
    65 </html>

mercurial