Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / state / gl-getstring.html
blob2e494589ebc55f228890a4788477cc6f894d6603
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 -->
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");
24 debug("");
25 debug("Canvas.getContext");
27 var wtu = WebGLTestUtils;
28 var gl = wtu.create3DContext("canvas", null, 2);
29 if (!gl) {
30 testFailed("context does not exist");
31 } else {
32 testPassed("context exists");
34 debug("");
35 checkPrefix("WebGL 2.0", "VERSION");
36 checkPrefix("WebGL GLSL ES 3.00", "SHADING_LANGUAGE_VERSION");
37 shouldBeNonNull("gl.getParameter(gl.VENDOR)");
38 shouldBeNonNull("gl.getParameter(gl.RENDERER)");
39 shouldBe("gl.getError()", "gl.NO_ERROR");
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);
53 debug("");
54 var successfullyParsed = true;
56 </script>
57 <script src="../../js/js-test-post.js"></script>
59 </body>
60 </html>