tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gl-getstring.html (1631B)


      1 <!--
      2 Copyright (c) 2019 The Khronos Group Inc.
      3 Use of this source code is governed by an MIT-style license that can be
      4 found in the LICENSE.txt file.
      5 -->
      6 
      7 <!DOCTYPE html>
      8 <html>
      9 <head>
     10 <meta charset="utf-8">
     11 <title>WebGL gl.getParameter Strings Conformance Tests</title>
     12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
     13 <script src="../../js/js-test-pre.js"></script>
     14 <script src="../../js/webgl-test-utils.js"></script>
     15 </head>
     16 <body>
     17 <div id="description"></div>
     18 <div id="console"></div>
     19 <canvas id="canvas" width="2" height="2"> </canvas>
     20 <script>
     21 "use strict";
     22 description("This test checks getParameter returns strings in the correct format");
     23 
     24 debug("");
     25 debug("Canvas.getContext");
     26 
     27 var wtu = WebGLTestUtils;
     28 var gl = wtu.create3DContext("canvas");
     29 if (!gl) {
     30  testFailed("context does not exist");
     31 } else {
     32  testPassed("context exists");
     33 
     34  debug("");
     35  checkPrefix("WebGL 1.0", "VERSION");
     36  checkPrefix("WebGL GLSL ES 1.0", "SHADING_LANGUAGE_VERSION");
     37  shouldBeNonNull("gl.getParameter(gl.VENDOR)");
     38  shouldBeNonNull("gl.getParameter(gl.RENDERER)");
     39  shouldBe("gl.getError()", "gl.NO_ERROR");
     40 }
     41 
     42 function checkPrefix(expected, enum_val) {
     43  var s = gl.getParameter(gl[enum_val]);
     44  if (s != null &&
     45      s.length >= expected.length &&
     46      s.substring(0, expected.length) == expected) {
     47    testPassed("getParameter(gl." + enum_val + ") correctly started with " + expected);
     48  } else {
     49    testFailed("getParameter(gl." + enum_val + ") did not start with " + expected);
     50  }
     51 }
     52 
     53 debug("");
     54 var successfullyParsed = true;
     55 
     56 </script>
     57 <script src="../../js/js-test-post.js"></script>
     58 
     59 </body>
     60 </html>