Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: conformance/misc/functions-returning-strings.html

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « conformance/misc/error-reporting.html ('k') | conformance/misc/instanceof-test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27 <!DOCTYPE html>
28 <html>
29 <head>
30 <meta charset="utf-8">
31 <title>WebGL Conformance Tests</title>
32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
34 <script src="../../resources/js-test-pre.js"></script>
35 <script src="../resources/webgl-test.js"></script>
36 <script src="../resources/webgl-test-utils.js"></script>
37 <script src="../../resources/test-eval.js"></script>
38 </head>
39 <body>
40 <div id="description"></div>
41 <div id="console"></div>
42 <canvas id="canvas" width="2" height="2"> </canvas>
43 <script>
44 "use strict";
45 description("Test that functions returning strings really do return strings (and not e.g. null)");
46 debug("");
47
48 var validVertexShaderString =
49 "attribute vec4 aVertex; attribute vec4 aColor; varying vec4 vColor; void main () { vColor = aColor; gl_Position = aVertex; }";
50 var validFragmentShaderString =
51 "precision mediump float; varying vec4 vColor; void main() { gl_FragColor = vC olor; }";
52
53 function shouldReturnString(_a)
54 {
55 var exception;
56 var _av;
57 try {
58 _av = TestEval(_a);
59 } catch (e) {
60 exception = e;
61 }
62
63 if (exception)
64 testFailed(_a + ' should return a string. Threw exception ' + exception);
65 else if (typeof _av == "string")
66 testPassed(_a + ' returns a string');
67 else
68 testFailed(_a + ' should return a string. Returns: "' + _av + '"');
69 }
70
71 var wtu = WebGLTestUtils;
72 var gl = wtu.create3DContext("canvas");
73 if (!gl) {
74 testFailed("context does not exist");
75 } else {
76 var vs = gl.createShader(gl.VERTEX_SHADER);
77 shouldReturnString("gl.getShaderSource(vs)");
78 shouldReturnString("gl.getShaderInfoLog(vs)");
79 gl.shaderSource(vs, validVertexShaderString);
80 gl.compileShader(vs);
81 shouldReturnString("gl.getShaderSource(vs)");
82 shouldReturnString("gl.getShaderInfoLog(vs)");
83
84 var fs = gl.createShader(gl.FRAGMENT_SHADER);
85 shouldReturnString("gl.getShaderSource(fs)");
86 shouldReturnString("gl.getShaderInfoLog(fs)");
87 gl.shaderSource(fs, validFragmentShaderString);
88 gl.compileShader(fs);
89 shouldReturnString("gl.getShaderSource(fs)");
90 shouldReturnString("gl.getShaderInfoLog(fs)");
91
92 var prog = gl.createProgram();
93 shouldReturnString("gl.getProgramInfoLog(prog)");
94 gl.attachShader(prog, vs);
95 gl.attachShader(prog, fs);
96 gl.linkProgram(prog);
97 shouldReturnString("gl.getProgramInfoLog(prog)");
98
99 // Make sure different numbers of extensions doesn't result in
100 // different test output.
101 var exts = gl.getSupportedExtensions();
102 var allPassed = true;
103 for (var ii = 0; ii < exts.length; ++ii) {
104 var s = exts[ii];
105 if (typeof s != "string") {
106 shouldReturnString("gl.getSupportedExtensions()[" + s + "]");
107 allPassed = false;
108 }
109 }
110 if (allPassed) {
111 testPassed('getSupportedExtensions() returns an array of strings');
112 }
113
114 shouldReturnString("gl.getParameter(gl.VENDOR)");
115 shouldReturnString("gl.getParameter(gl.RENDERER)");
116 shouldReturnString("gl.getParameter(gl.VERSION)");
117 shouldReturnString("gl.getParameter(gl.SHADING_LANGUAGE_VERSION)");
118 }
119
120 debug("");
121 var successfullyParsed = true;
122
123 </script>
124 <script src="../../resources/js-test-post.js"></script>
125
126 </body>
127 </html>
OLDNEW
« no previous file with comments | « conformance/misc/error-reporting.html ('k') | conformance/misc/instanceof-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698