Index: conformance/misc/functions-returning-strings.html |
=================================================================== |
--- conformance/misc/functions-returning-strings.html (revision 0) |
+++ conformance/misc/functions-returning-strings.html (working copy) |
@@ -0,0 +1,127 @@ |
+<!-- |
+ |
+/* |
+** Copyright (c) 2012 The Khronos Group Inc. |
+** |
+** Permission is hereby granted, free of charge, to any person obtaining a |
+** copy of this software and/or associated documentation files (the |
+** "Materials"), to deal in the Materials without restriction, including |
+** without limitation the rights to use, copy, modify, merge, publish, |
+** distribute, sublicense, and/or sell copies of the Materials, and to |
+** permit persons to whom the Materials are furnished to do so, subject to |
+** the following conditions: |
+** |
+** The above copyright notice and this permission notice shall be included |
+** in all copies or substantial portions of the Materials. |
+** |
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
+*/ |
+ |
+--> |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<meta charset="utf-8"> |
+<title>WebGL Conformance Tests</title> |
+<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> |
+<script src="../resources/webgl-test-utils.js"></script> |
+<script src="../../resources/test-eval.js"></script> |
+</head> |
+<body> |
+<div id="description"></div> |
+<div id="console"></div> |
+<canvas id="canvas" width="2" height="2"> </canvas> |
+<script> |
+"use strict"; |
+description("Test that functions returning strings really do return strings (and not e.g. null)"); |
+debug(""); |
+ |
+var validVertexShaderString = |
+ "attribute vec4 aVertex; attribute vec4 aColor; varying vec4 vColor; void main() { vColor = aColor; gl_Position = aVertex; }"; |
+var validFragmentShaderString = |
+ "precision mediump float; varying vec4 vColor; void main() { gl_FragColor = vColor; }"; |
+ |
+function shouldReturnString(_a) |
+{ |
+ var exception; |
+ var _av; |
+ try { |
+ _av = TestEval(_a); |
+ } catch (e) { |
+ exception = e; |
+ } |
+ |
+ if (exception) |
+ testFailed(_a + ' should return a string. Threw exception ' + exception); |
+ else if (typeof _av == "string") |
+ testPassed(_a + ' returns a string'); |
+ else |
+ testFailed(_a + ' should return a string. Returns: "' + _av + '"'); |
+} |
+ |
+var wtu = WebGLTestUtils; |
+var gl = wtu.create3DContext("canvas"); |
+if (!gl) { |
+ testFailed("context does not exist"); |
+} else { |
+ var vs = gl.createShader(gl.VERTEX_SHADER); |
+ shouldReturnString("gl.getShaderSource(vs)"); |
+ shouldReturnString("gl.getShaderInfoLog(vs)"); |
+ gl.shaderSource(vs, validVertexShaderString); |
+ gl.compileShader(vs); |
+ shouldReturnString("gl.getShaderSource(vs)"); |
+ shouldReturnString("gl.getShaderInfoLog(vs)"); |
+ |
+ var fs = gl.createShader(gl.FRAGMENT_SHADER); |
+ shouldReturnString("gl.getShaderSource(fs)"); |
+ shouldReturnString("gl.getShaderInfoLog(fs)"); |
+ gl.shaderSource(fs, validFragmentShaderString); |
+ gl.compileShader(fs); |
+ shouldReturnString("gl.getShaderSource(fs)"); |
+ shouldReturnString("gl.getShaderInfoLog(fs)"); |
+ |
+ var prog = gl.createProgram(); |
+ shouldReturnString("gl.getProgramInfoLog(prog)"); |
+ gl.attachShader(prog, vs); |
+ gl.attachShader(prog, fs); |
+ gl.linkProgram(prog); |
+ shouldReturnString("gl.getProgramInfoLog(prog)"); |
+ |
+ // Make sure different numbers of extensions doesn't result in |
+ // different test output. |
+ var exts = gl.getSupportedExtensions(); |
+ var allPassed = true; |
+ for (var ii = 0; ii < exts.length; ++ii) { |
+ var s = exts[ii]; |
+ if (typeof s != "string") { |
+ shouldReturnString("gl.getSupportedExtensions()[" + s + "]"); |
+ allPassed = false; |
+ } |
+ } |
+ if (allPassed) { |
+ testPassed('getSupportedExtensions() returns an array of strings'); |
+ } |
+ |
+ shouldReturnString("gl.getParameter(gl.VENDOR)"); |
+ shouldReturnString("gl.getParameter(gl.RENDERER)"); |
+ shouldReturnString("gl.getParameter(gl.VERSION)"); |
+ shouldReturnString("gl.getParameter(gl.SHADING_LANGUAGE_VERSION)"); |
+} |
+ |
+debug(""); |
+var successfullyParsed = true; |
+ |
+</script> |
+<script src="../../resources/js-test-post.js"></script> |
+ |
+</body> |
+</html> |
Property changes on: conformance/misc/functions-returning-strings.html |
___________________________________________________________________ |
Added: svn:eol-style |
## -0,0 +1 ## |
+LF |
\ No newline at end of property |