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.
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>
17 <div id=
"description"></div>
18 <div id=
"console"></div>
19 <canvas id=
"canvas" width=
"2" height=
"2"> </canvas>
22 description("This test checks getParameter returns strings in the correct format");
25 debug("Canvas.getContext");
27 var wtu
= WebGLTestUtils
;
28 var gl
= wtu
.create3DContext("canvas", null, 2);
30 testFailed("context does not exist");
32 testPassed("context exists");
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
]);
45 s
.length
>= expected
.length
&&
46 s
.substring(0, expected
.length
) == expected
) {
47 testPassed("getParameter(gl." + enum_val
+ ") correctly started with " + expected
);
49 testFailed("getParameter(gl." + enum_val
+ ") did not start with " + expected
);
54 var successfullyParsed
= true;
57 <script src=
"../../js/js-test-post.js"></script>