1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/state/gl-getstring.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<!-- 1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.6 +Use of this source code is governed by a BSD-style license that can be 1.7 +found in the LICENSE file. 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 +<head> 1.12 +<meta charset="utf-8"> 1.13 +<title>WebGL gl.getParameter Strings Conformance Tests</title> 1.14 +<link rel="stylesheet" href="../../resources/js-test-style.css"/> 1.15 +<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> 1.16 +<script src="../../resources/js-test-pre.js"></script> 1.17 +<script src="../resources/webgl-test.js"></script> 1.18 +</head> 1.19 +<body> 1.20 +<div id="description"></div> 1.21 +<div id="console"></div> 1.22 +<canvas id="canvas" width="2" height="2"> </canvas> 1.23 +<script> 1.24 +description("This test checks getParameter returns strings in the correct format"); 1.25 + 1.26 +debug(""); 1.27 +debug("Canvas.getContext"); 1.28 + 1.29 +var gl = create3DContext(document.getElementById("canvas")); 1.30 +if (!gl) { 1.31 + testFailed("context does not exist"); 1.32 +} else { 1.33 + testPassed("context exists"); 1.34 + 1.35 + debug(""); 1.36 + checkPrefix("WebGL 1.0", "VERSION"); 1.37 + checkPrefix("WebGL GLSL ES 1.0", "SHADING_LANGUAGE_VERSION"); 1.38 + shouldBeNonNull("gl.getParameter(gl.VENDOR)"); 1.39 + shouldBeNonNull("gl.getParameter(gl.RENDERER)"); 1.40 + shouldBe("gl.getError()", "gl.NO_ERROR"); 1.41 +} 1.42 + 1.43 +function checkPrefix(expected, enum_val) { 1.44 + var s = gl.getParameter(gl[enum_val]); 1.45 + if (s != null && 1.46 + s.length >= expected.length && 1.47 + s.substring(0, expected.length) == expected) { 1.48 + testPassed("getParameter(gl." + enum_val + ") correctly started with " + expected); 1.49 + } else { 1.50 + testFailed("getParameter(gl." + enum_val + ") did not start with " + expected); 1.51 + } 1.52 +} 1.53 + 1.54 +debug(""); 1.55 +successfullyParsed = true; 1.56 + 1.57 +</script> 1.58 +<script>finishTest();</script> 1.59 + 1.60 +</body> 1.61 +</html>