Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / gl-getstring.html
blob1b9fc0294404cd2941b662e79e25749100c8c384
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>WebGL gl.getParameter Strings Conformance Tests</title>
7 <script src="resources/desktop-gl-constants.js" type="text/javascript"></script>
8 <script src="../../../resources/js-test.js"></script>
9 <script src="resources/webgl-test.js"></script>
10 </head>
11 <body>
12 <div id="description"></div>
13 <div id="console"></div>
14 <canvas id="canvas" width="2" height="2"> </canvas>
15 <script>
16 description("This test checks getParameter returns strings in the correct format");
18 debug("");
19 debug("Canvas.getContext");
21 var gl = create3DContext(document.getElementById("canvas"));
22 if (!gl) {
23 testFailed("context does not exist");
24 } else {
25 testPassed("context exists");
27 debug("");
28 checkPrefix("WebGL 1.0", "VERSION");
29 checkPrefix("WebGL GLSL ES 1.0", "SHADING_LANGUAGE_VERSION");
30 shouldBeNonNull("gl.getParameter(gl.VENDOR)");
31 shouldBeNonNull("gl.getParameter(gl.RENDERER)");
32 shouldBe("gl.getError()", "gl.NO_ERROR");
35 function checkPrefix(expected, enum_val) {
36 var s = gl.getParameter(gl[enum_val]);
37 if (s != null &&
38 s.length >= expected.length &&
39 s.substring(0, expected.length) == expected) {
40 testPassed("getParameter(gl." + enum_val + ") correctly started with " + expected);
41 } else {
42 testFailed("getParameter(gl." + enum_val + ") did not start with " + expected);
46 debug("");
48 </script>
50 <script>
51 </script>
53 </body>
54 </html>