Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / webgl / src / sdk / tests / conformance2 / context / methods-2.html
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>WebGL2 Methods Test</title>
32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/js-test-pre.js"></script>
34 <script src="../../conformance/resources/webgl-test-utils.js"></script>
35 </head>
36 <body>
37 <div id="description"></div>
38 <div id="console"></div>
39 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
40 <script>
41 "use strict";
42 description("This test ensures that the WebGL context has all the methods in the specification.");
43
44 var methods = [
45 "getContextAttributes",
46 "activeTexture",
47 "attachShader",
48 "bindAttribLocation",
49 "bindBuffer",
50 "bindFramebuffer",
51 "bindRenderbuffer",
52 "bindTexture",
53 "blendColor",
54 "blendEquation",
55 "blendEquationSeparate",
56 "blendFunc",
57 "blendFuncSeparate",
58 "bufferData",
59 "bufferSubData",
60 "checkFramebufferStatus",
61 "clear",
62 "clearColor",
63 "clearDepth",
64 "clearStencil",
65 "colorMask",
66 "compileShader",
67 "compressedTexImage2D",
68 "compressedTexSubImage2D",
69 "copyTexImage2D",
70 "copyTexSubImage2D",
71 "createBuffer",
72 "createFramebuffer",
73 "createProgram",
74 "createRenderbuffer",
75 "createShader",
76 "createTexture",
77 "cullFace",
78 "deleteBuffer",
79 "deleteFramebuffer",
80 "deleteProgram",
81 "deleteRenderbuffer",
82 "deleteShader",
83 "deleteTexture",
84 "depthFunc",
85 "depthMask",
86 "depthRange",
87 "detachShader",
88 "disable",
89 "disableVertexAttribArray",
90 "drawArrays",
91 "drawElements",
92 "enable",
93 "enableVertexAttribArray",
94 "finish",
95 "flush",
96 "framebufferRenderbuffer",
97 "framebufferTexture2D",
98 "frontFace",
99 "generateMipmap",
100 "getActiveAttrib",
101 "getActiveUniform",
102 "getAttachedShaders",
103 "getAttribLocation",
104 "getParameter",
105 "getBufferParameter",
106 "getError",
107 "getExtension",
108 "getFramebufferAttachmentParameter",
109 "getProgramParameter",
110 "getProgramInfoLog",
111 "getRenderbufferParameter",
112 "getShaderParameter",
113 "getShaderInfoLog",
114 "getShaderPrecisionFormat",
115 "getShaderSource",
116 "getSupportedExtensions",
117 "getTexParameter",
118 "getUniform",
119 "getUniformLocation",
120 "getVertexAttrib",
121 "getVertexAttribOffset",
122 "hint",
123 "isBuffer",
124 "isContextLost",
125 "isEnabled",
126 "isFramebuffer",
127 "isProgram",
128 "isRenderbuffer",
129 "isShader",
130 "isTexture",
131 "lineWidth",
132 "linkProgram",
133 "pixelStorei",
134 "polygonOffset",
135 "readPixels",
136 "renderbufferStorage",
137 "sampleCoverage",
138 "scissor",
139 "shaderSource",
140 "stencilFunc",
141 "stencilFuncSeparate",
142 "stencilMask",
143 "stencilMaskSeparate",
144 "stencilOp",
145 "stencilOpSeparate",
146 "texImage2D",
147 "texParameterf",
148 "texParameteri",
149 "texSubImage2D",
150 "uniform1f",
151 "uniform1fv",
152 "uniform1i",
153 "uniform1iv",
154 "uniform2f",
155 "uniform2fv",
156 "uniform2i",
157 "uniform2iv",
158 "uniform3f",
159 "uniform3fv",
160 "uniform3i",
161 "uniform3iv",
162 "uniform4f",
163 "uniform4fv",
164 "uniform4i",
165 "uniform4iv",
166 "uniformMatrix2fv",
167 "uniformMatrix3fv",
168 "uniformMatrix4fv",
169 "useProgram",
170 "validateProgram",
171 "vertexAttrib1f",
172 "vertexAttrib1fv",
173 "vertexAttrib2f",
174 "vertexAttrib2fv",
175 "vertexAttrib3f",
176 "vertexAttrib3fv",
177 "vertexAttrib4f",
178 "vertexAttrib4fv",
179 "vertexAttribPointer",
180 "viewport",
181
182 // WebGL2 methods
183 "copyBufferSubData",
184 "blitFramebuffer",
185 "framebufferTextureLayer",
186 "getInternalformatParameter",
187 "invalidateFramebuffer",
188 "invalidateSubFramebuffer",
189 "readBuffer",
190 "renderbufferStorageMultisample",
191 "texStorage2D",
192 "texStorage3D",
193 "texSubImage3D",
194 "texSubImage3D",
195 "texSubImage3D",
196 "texSubImage3D",
197 "texSubImage3D",
198 "copyTexSubImage3D",
199 "compressedTexImage3D",
200 "compressedTexSubImage3D",
201 "getFragDataLocation",
202 "uniform1ui",
203 "uniform2ui",
204 "uniform3ui",
205 "uniform4ui",
206 "uniform1uiv",
207 "uniform2uiv",
208 "uniform3uiv",
209 "uniform4uiv",
210 "uniformMatrix2x3fv",
211 "uniformMatrix2x3fv",
212 "uniformMatrix3x2fv",
213 "uniformMatrix3x2fv",
214 "uniformMatrix2x4fv",
215 "uniformMatrix2x4fv",
216 "uniformMatrix4x2fv",
217 "uniformMatrix4x2fv",
218 "uniformMatrix3x4fv",
219 "uniformMatrix3x4fv",
220 "uniformMatrix4x3fv",
221 "uniformMatrix4x3fv",
222 "vertexAttribI4i",
223 "vertexAttribI4iv",
224 "vertexAttribI4ui",
225 "vertexAttribI4uiv",
226 "vertexAttribIPointer",
227 "vertexAttribDivisor",
228 "drawArraysInstanced",
229 "drawElementsInstanced",
230 "drawBuffers",
231 "clearBufferiv",
232 "clearBufferiv",
233 "clearBufferuiv",
234 "clearBufferuiv",
235 "clearBufferfv",
236 "clearBufferfv",
237 "clearBufferfi",
238 "createQuery",
239 "deleteQuery",
240 "isQuery",
241 "beginQuery",
242 "endQuery",
243 "getQuery",
244 "getQueryParameter",
245 "createSampler",
246 "deleteSampler",
247 "isSampler",
248 "bindSampler",
249 "samplerParameteri",
250 "samplerParameteriv",
251 "samplerParameteriv",
252 "samplerParameterf",
253 "samplerParameterfv",
254 "samplerParameterfv",
255 "getSamplerParameter",
256 "fenceSync",
257 "isSync",
258 "deleteSync",
259 "clientWaitSync",
260 "waitSync",
261 "getSyncParameter",
262 "createTransformFeedback",
263 "deleteTransformFeedback",
264 "isTransformFeedback",
265 "bindTransformFeedback",
266 "beginTransformFeedback",
267 "endTransformFeedback",
268 "transformFeedbackVaryings",
269 "getTransformFeedbackVarying",
270 "pauseTransformFeedback",
271 "resumeTransformFeedback",
272 "bindBufferBase",
273 "bindBufferRange",
274 "getIndexedParameter",
275 "getUniformIndices",
276 "getActiveUniforms",
277 "getUniformBlockIndex",
278 "getActiveUniformBlockParameter",
279 "getActiveUniformBlockName",
280 "uniformBlockBinding",
281 "createVertexArray",
282 "deleteVertexArray",
283 "isVertexArray",
284 "bindVertexArray",
285 ];
286
287 // Properties to be ignored because they were added in versions of the
288 // spec that are backward-compatible with this version
289 var ignoredMethods = [
290 ];
291
292 function assertFunction(v, f) {
293   try {
294     if (typeof v[f] != "function") {
295       testFailed("Property either does not exist or is not a function: " + f);
296       return false;
297     } else {
298       return true;
299     }
300   } catch(e) {
301     testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
302   }
303 }
304
305 debug("");
306 debug("Canvas.getContext");
307
308 var wtu = WebGLTestUtils;
309 var canvas = document.getElementById("canvas");
310 var gl = wtu.create3DContext(canvas, null, 2);
311 var passed = true;
312 for (var i=0; i<methods.length; i++) {
313   var r = assertFunction(gl, methods[i]);
314   passed = passed && r;
315 }
316 if (passed) {
317   testPassed("All WebGL methods found.");
318 }
319 var extended = false;
320 for (var i in gl) {
321   if (typeof gl[i] == "function" && methods.indexOf(i) == -1 && ignoredMethods.indexOf(i) == -1) {
322     if (!extended) {
323       extended = true;
324       testFailed("Also found the following extra methods:");
325     }
326     testFailed(i);
327   }
328 }
329
330 if (!extended) {
331   testPassed("No extra methods found on WebGL context.");
332 }
333
334 debug("");
335 var successfullyParsed = true;
336 </script>
337 <script src="../../resources/js-test-post.js"></script>
338
339 </body>
340 </html>