2010-06-04 12:03:40 -07:00
|
|
|
<!--
|
2011-08-19 08:39:00 -07:00
|
|
|
Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
2010-06-04 12:03:40 -07:00
|
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
|
|
found in the LICENSE file.
|
|
|
|
-->
|
2011-08-19 08:39:00 -07:00
|
|
|
<!DOCTYPE html>
|
2010-06-04 12:03:40 -07:00
|
|
|
<html>
|
|
|
|
<head>
|
2011-08-19 08:39:00 -07:00
|
|
|
<meta charset="utf-8">
|
2010-06-15 10:30:13 -07:00
|
|
|
<title>WebGL gl.getParameter Strings Conformance Tests</title>
|
2010-06-04 12:03:40 -07:00
|
|
|
<link rel="stylesheet" href="../resources/js-test-style.css"/>
|
|
|
|
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
|
|
|
|
<script src="../resources/js-test-pre.js"></script>
|
|
|
|
<script src="resources/webgl-test.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="description"></div>
|
|
|
|
<div id="console"></div>
|
|
|
|
<canvas id="canvas" width="2" height="2"> </canvas>
|
|
|
|
<script>
|
2010-06-15 10:30:13 -07:00
|
|
|
description("This test checks getParameter returns strings in the correct format");
|
2010-06-04 12:03:40 -07:00
|
|
|
|
|
|
|
debug("");
|
|
|
|
debug("Canvas.getContext");
|
|
|
|
|
|
|
|
var gl = create3DContext(document.getElementById("canvas"));
|
|
|
|
if (!gl) {
|
|
|
|
testFailed("context does not exist");
|
|
|
|
} else {
|
|
|
|
testPassed("context exists");
|
|
|
|
|
|
|
|
debug("");
|
2010-06-15 10:30:13 -07:00
|
|
|
checkPrefix("WebGL 1.0", "VERSION");
|
|
|
|
checkPrefix("WebGL GLSL ES 1.0", "SHADING_LANGUAGE_VERSION");
|
2010-10-09 12:44:24 -07:00
|
|
|
shouldBeNonNull("gl.getParameter(gl.VENDOR)");
|
|
|
|
shouldBeNonNull("gl.getParameter(gl.RENDERER)");
|
|
|
|
shouldBe("gl.getError()", "gl.NO_ERROR");
|
2010-06-04 12:03:40 -07:00
|
|
|
}
|
|
|
|
|
2010-08-25 16:09:26 -07:00
|
|
|
function checkPrefix(expected, enum_val) {
|
|
|
|
var s = gl.getParameter(gl[enum_val]);
|
2010-07-16 07:30:32 -07:00
|
|
|
if (s != null &&
|
|
|
|
s.length >= expected.length &&
|
2010-06-04 12:03:40 -07:00
|
|
|
s.substring(0, expected.length) == expected) {
|
2010-08-25 16:09:26 -07:00
|
|
|
testPassed("getParameter(gl." + enum_val + ") correctly started with " + expected);
|
2010-06-04 12:03:40 -07:00
|
|
|
} else {
|
2010-08-25 16:09:26 -07:00
|
|
|
testFailed("getParameter(gl." + enum_val + ") did not start with " + expected);
|
2010-06-04 12:03:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
debug("");
|
|
|
|
successfullyParsed = true;
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<script src="../resources/js-test-post.js"></script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|