OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <!-- |
| 6 Copyright (c) 2011 Ilmari Heikkinen. All rights reserved. |
| 7 Use of this source code is governed by a BSD-style license that can be |
| 8 found in the LICENSE file. |
| 9 --> |
| 10 <title>WebGL Methods Test</title> |
| 11 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s
cript> |
| 13 <script src="../../resources/js-test-pre.js"></script> |
| 14 <script src="../resources/webgl-test.js"></script> |
| 15 </head> |
| 16 <body> |
| 17 <div id="description"></div> |
| 18 <div id="console"></div> |
| 19 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> |
| 20 <script> |
| 21 description("This test ensures that the WebGL context has all the methods in the
specification."); |
| 22 |
| 23 var methods = [ |
| 24 "canvas", |
| 25 "getContextAttributes", |
| 26 "activeTexture", |
| 27 "attachShader", |
| 28 "bindAttribLocation", |
| 29 "bindBuffer", |
| 30 "bindFramebuffer", |
| 31 "bindRenderbuffer", |
| 32 "bindTexture", |
| 33 "blendColor", |
| 34 "blendEquation", |
| 35 "blendEquationSeparate", |
| 36 "blendFunc", |
| 37 "blendFuncSeparate", |
| 38 "bufferData", |
| 39 "bufferSubData", |
| 40 "checkFramebufferStatus", |
| 41 "clear", |
| 42 "clearColor", |
| 43 "clearDepth", |
| 44 "clearStencil", |
| 45 "colorMask", |
| 46 "compileShader", |
| 47 "copyTexImage2D", |
| 48 "copyTexSubImage2D", |
| 49 "createBuffer", |
| 50 "createFramebuffer", |
| 51 "createProgram", |
| 52 "createRenderbuffer", |
| 53 "createShader", |
| 54 "createTexture", |
| 55 "cullFace", |
| 56 "deleteBuffer", |
| 57 "deleteFramebuffer", |
| 58 "deleteProgram", |
| 59 "deleteRenderbuffer", |
| 60 "deleteShader", |
| 61 "deleteTexture", |
| 62 "depthFunc", |
| 63 "depthMask", |
| 64 "depthRange", |
| 65 "detachShader", |
| 66 "disable", |
| 67 "disableVertexAttribArray", |
| 68 "drawArrays", |
| 69 "drawElements", |
| 70 "enable", |
| 71 "enableVertexAttribArray", |
| 72 "finish", |
| 73 "flush", |
| 74 "framebufferRenderbuffer", |
| 75 "framebufferTexture2D", |
| 76 "frontFace", |
| 77 "generateMipmap", |
| 78 "getActiveAttrib", |
| 79 "getActiveUniform", |
| 80 "getAttachedShaders", |
| 81 "getAttribLocation", |
| 82 "getParameter", |
| 83 "getBufferParameter", |
| 84 "getError", |
| 85 "getFramebufferAttachmentParameter", |
| 86 "getProgramParameter", |
| 87 "getProgramInfoLog", |
| 88 "getRenderbufferParameter", |
| 89 "getShaderParameter", |
| 90 "getShaderInfoLog", |
| 91 "getShaderSource", |
| 92 "getTexParameter", |
| 93 "getUniform", |
| 94 "getUniformLocation", |
| 95 "getVertexAttrib", |
| 96 "getVertexAttribOffset", |
| 97 "hint", |
| 98 "isBuffer", |
| 99 "isEnabled", |
| 100 "isFramebuffer", |
| 101 "isProgram", |
| 102 "isRenderbuffer", |
| 103 "isShader", |
| 104 "isTexture", |
| 105 "lineWidth", |
| 106 "linkProgram", |
| 107 "pixelStorei", |
| 108 "polygonOffset", |
| 109 "readPixels", |
| 110 "renderbufferStorage", |
| 111 "sampleCoverage", |
| 112 "scissor", |
| 113 "shaderSource", |
| 114 "stencilFunc", |
| 115 "stencilFuncSeparate", |
| 116 "stencilMask", |
| 117 "stencilMaskSeparate", |
| 118 "stencilOp", |
| 119 "stencilOpSeparate", |
| 120 "texImage2D", |
| 121 "texParameterf", |
| 122 "texParameteri", |
| 123 "texSubImage2D", |
| 124 "uniform1f", |
| 125 "uniform1fv", |
| 126 "uniform1i", |
| 127 "uniform1iv", |
| 128 "uniform2f", |
| 129 "uniform2fv", |
| 130 "uniform2i", |
| 131 "uniform2iv", |
| 132 "uniform3f", |
| 133 "uniform3fv", |
| 134 "uniform3i", |
| 135 "uniform3iv", |
| 136 "uniform4f", |
| 137 "uniform4fv", |
| 138 "uniform4i", |
| 139 "uniform4iv", |
| 140 "uniformMatrix2fv", |
| 141 "uniformMatrix3fv", |
| 142 "uniformMatrix4fv", |
| 143 "useProgram", |
| 144 "validateProgram", |
| 145 "vertexAttrib1f", |
| 146 "vertexAttrib1fv", |
| 147 "vertexAttrib2f", |
| 148 "vertexAttrib2fv", |
| 149 "vertexAttrib3f", |
| 150 "vertexAttrib3fv", |
| 151 "vertexAttrib4f", |
| 152 "vertexAttrib4fv", |
| 153 "vertexAttribPointer", |
| 154 "viewport" |
| 155 ] |
| 156 |
| 157 function assertProperty(v, p) { |
| 158 try { |
| 159 if (v[p] == null) { |
| 160 testFailed("Property does not exist: " + p) |
| 161 return false; |
| 162 } else { |
| 163 return true; |
| 164 } |
| 165 } catch(e) { |
| 166 testFailed("Trying to access the property '"+p+"' threw an error: "+e.toStri
ng()); |
| 167 } |
| 168 } |
| 169 |
| 170 debug(""); |
| 171 debug("Canvas.getContext"); |
| 172 |
| 173 var canvas = document.getElementById("canvas"); |
| 174 var gl = create3DContext(canvas); |
| 175 var passed = true; |
| 176 for (var i=0; i<methods.length; i++) { |
| 177 var r = assertProperty(gl, methods[i]); |
| 178 passed = passed && r; |
| 179 } |
| 180 if (passed) { |
| 181 testPassed("All WebGL methods found."); |
| 182 } |
| 183 var extended = false; |
| 184 for (var i in gl) { |
| 185 if (i.match(/^[a-z]/) && methods.indexOf(i) == -1) { |
| 186 if (!extended) { |
| 187 extended = true; |
| 188 debug("Also found the following extra methods:"); |
| 189 } |
| 190 debug(i); |
| 191 } |
| 192 } |
| 193 |
| 194 debug(""); |
| 195 successfullyParsed = true; |
| 196 </script> |
| 197 <script src="../../resources/js-test-post.js"></script> |
| 198 |
| 199 </body> |
| 200 </html> |
OLD | NEW |