content/canvas/test/webgl-conformance/conformance/context/methods.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial