How to use expectError method in Playwright Internal

Best JavaScript code snippet using playwright-internal

es3fNegativeTextureApiTests.js

Source:es3fNegativeTextureApiTests.js Github

copy

Full Screen

...72 testGroup.addChild(new es3fApiCase.ApiCaseCallback('activetexture', 'Invalid gl.ActiveTexture() usage', gl,73 function() {74 bufferedLogToConsole('gl.INVALID_ENUM is generated if texture is not one of gl.TEXTUREi, where i ranges from 0 to (gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1).');75 gl.activeTexture(-1);76 this.expectError(gl.INVALID_ENUM);77 var numMaxTextureUnits = /** @type {number} */(gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS));78 gl.activeTexture(gl.TEXTURE0 + numMaxTextureUnits);79 this.expectError(gl.INVALID_ENUM);80 }));81 // gl.bindTexture82 testGroup.addChild(new es3fApiCase.ApiCaseCallback('bindTexture', 'Invalid gl.bindTexture() usage', gl,83 function() {84 /** @type {Array<WebGLTexture>} */ var texture = [];85 texture[0] = gl.createTexture();86 texture[1] = gl.createTexture();87 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not one of the allowable values.');88 gl.bindTexture(0, texture[0]);89 this.expectError(gl.INVALID_ENUM);90 gl.bindTexture(gl.FRAMEBUFFER, texture[0]);91 this.expectError(gl.INVALID_ENUM);92 bufferedLogToConsole('gl.INVALID_OPERATION is generated if texture was previously created with a target that doesn\'t match that of target.');93 gl.bindTexture(gl.TEXTURE_2D, texture[0]);94 this.expectError(gl.NO_ERROR);95 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);96 this.expectError(gl.INVALID_OPERATION);97 gl.bindTexture(gl.TEXTURE_3D, texture[0]);98 this.expectError(gl.INVALID_OPERATION);99 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[0]);100 this.expectError(gl.INVALID_OPERATION);101 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);102 this.expectError(gl.NO_ERROR);103 gl.bindTexture(gl.TEXTURE_2D, texture[1]);104 this.expectError(gl.INVALID_OPERATION);105 gl.bindTexture(gl.TEXTURE_3D, texture[1]);106 this.expectError(gl.INVALID_OPERATION);107 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[1]);108 this.expectError(gl.INVALID_OPERATION);109 gl.deleteTexture(texture[0]);110 gl.deleteTexture(texture[1]);111 }));112 // gl.compressedTexImage2D113 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_target', 'Invalid gl.compressedTexImage2D() usage', gl,114 function() {115 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }116 /** @type {Array<WebGLTexture>} */ var texture = [];117 texture[0] = gl.createTexture();118 texture[1] = gl.createTexture();119 gl.bindTexture(gl.TEXTURE_2D, texture[0]);120 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);121 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');122 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);123 gl.compressedTexImage2D(0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);124 this.expectError(gl.INVALID_ENUM);125 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);126 this.expectError(gl.INVALID_ENUM);127 gl.deleteTexture(texture[0]);128 gl.deleteTexture(texture[1]);129 }));130 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_format', 'Invalid gl.compressedTexImage2D() usage', gl,131 function() {132 /** @type {Array<WebGLTexture>} */ var texture = [];133 texture[0] = gl.createTexture();134 texture[1] = gl.createTexture();135 gl.bindTexture(gl.TEXTURE_2D, texture[0]);136 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);137 bufferedLogToConsole('gl.INVALID_ENUM is generated if internalformat is not a supported format returned in gl.COMPRESSED_TEXTURE_FORMATS.');138 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);139 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, uint8);140 this.expectError(gl.INVALID_ENUM);141 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 0, uint8);142 this.expectError(gl.INVALID_ENUM);143 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, 0, 0, 0, uint8);144 this.expectError(gl.INVALID_ENUM);145 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, uint8);146 this.expectError(gl.INVALID_ENUM);147 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, uint8);148 this.expectError(gl.INVALID_ENUM);149 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, uint8);150 this.expectError(gl.INVALID_ENUM);151 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, uint8);152 this.expectError(gl.INVALID_ENUM);153 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, uint8);154 this.expectError(gl.INVALID_ENUM);155 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, uint8);156 this.expectError(gl.INVALID_ENUM);157 gl.deleteTexture(texture[0]);158 gl.deleteTexture(texture[1]);159 }));160 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_neg_level', 'Invalid gl.compressedTexImage2D() usage', gl,161 function() {162 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }163 /** @type {Array<WebGLTexture>} */ var texture = [];164 texture[0] = gl.createTexture();165 texture[1] = gl.createTexture();166 gl.bindTexture(gl.TEXTURE_2D, texture[0]);167 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);168 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');169 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);170 gl.compressedTexImage2D(gl.TEXTURE_2D, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);171 this.expectError(gl.INVALID_VALUE);172 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);173 this.expectError(gl.INVALID_VALUE);174 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);175 this.expectError(gl.INVALID_VALUE);176 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);177 this.expectError(gl.INVALID_VALUE);178 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);179 this.expectError(gl.INVALID_VALUE);180 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);181 this.expectError(gl.INVALID_VALUE);182 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);183 this.expectError(gl.INVALID_VALUE);184 gl.deleteTexture(texture[0]);185 gl.deleteTexture(texture[1]);186 }));187 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_max_level', 'Invalid gl.compressedTexImage2D() usage', gl,188 function() {189 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }190 /** @type {Array<WebGLTexture>} */ var texture = [];191 texture[0] = gl.createTexture();192 texture[1] = gl.createTexture();193 gl.bindTexture(gl.TEXTURE_2D, texture[0]);194 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);195 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE) for a 2d texture target.');196 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16));197 /** @type {number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;198 gl.compressedTexImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.COMPRESSED_RGB8_ETC2, 16, 16, 0, uint8);199 this.expectError(gl.INVALID_VALUE);200 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE) for a cubemap target.');201 /** @type {number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;202 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);203 this.expectError(gl.INVALID_VALUE);204 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);205 this.expectError(gl.INVALID_VALUE);206 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);207 this.expectError(gl.INVALID_VALUE);208 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);209 this.expectError(gl.INVALID_VALUE);210 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);211 this.expectError(gl.INVALID_VALUE);212 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);213 this.expectError(gl.INVALID_VALUE);214 gl.deleteTexture(texture[0]);215 gl.deleteTexture(texture[1]);216 }));217 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_neg_width_height', 'Invalid gl.compressedTexImage2D() usage', gl,218 function() {219 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }220 /** @type {Array<WebGLTexture>} */ var texture = [];221 texture[0] = gl.createTexture();222 texture[1] = gl.createTexture();223 gl.bindTexture(gl.TEXTURE_2D, texture[0]);224 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);225 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');226 bufferedLogToConsole('gl.TEXTURE_2D target');227 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);228 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);229 this.expectError(gl.INVALID_VALUE);230 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);231 this.expectError(gl.INVALID_VALUE);232 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);233 this.expectError(gl.INVALID_VALUE);234 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');235 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);236 this.expectError(gl.INVALID_VALUE);237 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);238 this.expectError(gl.INVALID_VALUE);239 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);240 this.expectError(gl.INVALID_VALUE);241 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');242 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);243 this.expectError(gl.INVALID_VALUE);244 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);245 this.expectError(gl.INVALID_VALUE);246 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);247 this.expectError(gl.INVALID_VALUE);248 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');249 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);250 this.expectError(gl.INVALID_VALUE);251 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);252 this.expectError(gl.INVALID_VALUE);253 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);254 this.expectError(gl.INVALID_VALUE);255 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');256 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);257 this.expectError(gl.INVALID_VALUE);258 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);259 this.expectError(gl.INVALID_VALUE);260 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);261 this.expectError(gl.INVALID_VALUE);262 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');263 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);264 this.expectError(gl.INVALID_VALUE);265 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);266 this.expectError(gl.INVALID_VALUE);267 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);268 this.expectError(gl.INVALID_VALUE);269 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');270 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);271 this.expectError(gl.INVALID_VALUE);272 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);273 this.expectError(gl.INVALID_VALUE);274 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);275 this.expectError(gl.INVALID_VALUE);276 gl.deleteTexture(texture[0]);277 gl.deleteTexture(texture[1]);278 }));279 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_max_width_height', 'Invalid gl.compressedTexImage2D() usage', gl,280 function() {281 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }282 /** @type {Array<WebGLTexture>} */ var texture = [];283 texture[0] = gl.createTexture();284 texture[1] = gl.createTexture();285 gl.bindTexture(gl.TEXTURE_2D, texture[0]);286 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);287 var maxTextureSize = /** @type {number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;288 var maxCubemapSize = /** @type {number} */ (gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;289 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');290 bufferedLogToConsole('gl.TEXTURE_2D target');291 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxTextureSize, 1)));292 this.expectError(gl.INVALID_VALUE);293 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxTextureSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxTextureSize)));294 this.expectError(gl.INVALID_VALUE);295 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxTextureSize, maxTextureSize)));296 this.expectError(gl.INVALID_VALUE);297 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');298 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));299 this.expectError(gl.INVALID_VALUE);300 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));301 this.expectError(gl.INVALID_VALUE);302 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));303 this.expectError(gl.INVALID_VALUE);304 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');305 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));306 this.expectError(gl.INVALID_VALUE);307 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));308 this.expectError(gl.INVALID_VALUE);309 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));310 this.expectError(gl.INVALID_VALUE);311 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');312 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));313 this.expectError(gl.INVALID_VALUE);314 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));315 this.expectError(gl.INVALID_VALUE);316 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));317 this.expectError(gl.INVALID_VALUE);318 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');319 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));320 this.expectError(gl.INVALID_VALUE);321 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));322 this.expectError(gl.INVALID_VALUE);323 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));324 this.expectError(gl.INVALID_VALUE);325 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');326 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));327 this.expectError(gl.INVALID_VALUE);328 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));329 this.expectError(gl.INVALID_VALUE);330 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));331 this.expectError(gl.INVALID_VALUE);332 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');333 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, 1)));334 this.expectError(gl.INVALID_VALUE);335 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(1, maxCubemapSize)));336 this.expectError(gl.INVALID_VALUE);337 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(maxCubemapSize, maxCubemapSize)));338 this.expectError(gl.INVALID_VALUE);339 gl.deleteTexture(texture[0]);340 gl.deleteTexture(texture[1]);341 }));342 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_border', 'Invalid gl.compressedTexImage2D() usage', gl,343 function() {344 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }345 /** @type {Array<WebGLTexture>} */ var texture = [];346 texture[0] = gl.createTexture();347 texture[1] = gl.createTexture();348 gl.bindTexture(gl.TEXTURE_2D, texture[0]);349 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);350 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);351 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');352 bufferedLogToConsole('gl.TEXTURE_2D target');353 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);354 this.expectError(gl.INVALID_VALUE);355 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);356 this.expectError(gl.INVALID_VALUE);357 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');358 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);359 this.expectError(gl.INVALID_VALUE);360 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);361 this.expectError(gl.INVALID_VALUE);362 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');363 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);364 this.expectError(gl.INVALID_VALUE);365 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);366 this.expectError(gl.INVALID_VALUE);367 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');368 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);369 this.expectError(gl.INVALID_VALUE);370 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);371 this.expectError(gl.INVALID_VALUE);372 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');373 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);374 this.expectError(gl.INVALID_VALUE);375 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);376 this.expectError(gl.INVALID_VALUE);377 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');378 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);379 this.expectError(gl.INVALID_VALUE);380 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);381 this.expectError(gl.INVALID_VALUE);382 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');383 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);384 this.expectError(gl.INVALID_VALUE);385 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);386 this.expectError(gl.INVALID_VALUE);387 gl.deleteTexture(texture[0]);388 gl.deleteTexture(texture[1]);389 }));390 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_size', 'Invalid gl.compressedTexImage2D() usage', gl,391 function() {392 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }393 /** @type {WebGLTexture} */ var texture;394 texture = gl.createTexture();395 gl.bindTexture(gl.TEXTURE_2D, texture);396 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');397 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, new Uint8Array(1));398 this.expectError(gl.INVALID_VALUE);399 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(4 * 4 * 8));400 this.expectError(gl.INVALID_VALUE);401 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGB8_ETC2, 16, 16, 0, new Uint8Array(4 * 4 * 16));402 this.expectError(gl.INVALID_VALUE);403 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_SIGNED_R11_EAC, 16, 16, 0, new Uint8Array(4 * 4 * 16));404 this.expectError(gl.INVALID_VALUE);405 gl.deleteTexture(texture);406 }));407 // gl.copyTexImage2D408 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_target', 'Invalid gl.copyTexImage2D() usage', gl,409 function() {410 /** @type {WebGLTexture} */ var texture;411 texture = gl.createTexture();412 gl.bindTexture(gl.TEXTURE_2D, texture);413 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');414 gl.copyTexImage2D(0, 0, gl.RGB, 0, 0, 64, 64, 0);415 this.expectError(gl.INVALID_ENUM);416 gl.deleteTexture(texture);417 }));418 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_format', 'Invalid gl.copyTexImage2D() usage', gl,419 function() {420 /** @type {Array<WebGLTexture>} */ var texture = [];421 texture[0] = gl.createTexture();422 texture[1] = gl.createTexture();423 gl.bindTexture(gl.TEXTURE_2D, texture[0]);424 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);425 bufferedLogToConsole('gl.INVALID_ENUM or gl.INVALID_VALUE is generated if internalformat is not an accepted format.');426 gl.copyTexImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0);427 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);428 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0);429 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);430 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0);431 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);432 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0);433 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);434 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0);435 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);436 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0);437 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);438 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0);439 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);440 gl.deleteTexture(texture[0]);441 gl.deleteTexture(texture[1]);442 }));443 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_inequal_width_height_cube', 'Invalid gl.copyTexImage2D() usage', gl,444 function() {445 /** @type {WebGLTexture} */ var texture;446 texture = gl.createTexture();447 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);448 bufferedLogToConsole('gl.INVALID_VALUE is generated if target is one of the six cube map 2D image targets and the width and height parameters are not equal.');449 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 16, 17, 0);450 this.expectError(gl.INVALID_VALUE);451 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 16, 17, 0);452 this.expectError(gl.INVALID_VALUE);453 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 16, 17, 0);454 this.expectError(gl.INVALID_VALUE);455 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 16, 17, 0);456 this.expectError(gl.INVALID_VALUE);457 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 16, 17, 0);458 this.expectError(gl.INVALID_VALUE);459 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 16, 17, 0);460 this.expectError(gl.INVALID_VALUE);461 gl.deleteTexture(texture);462 }));463 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_neg_level', 'Invalid gl.copyTexImage2D() usage', gl,464 function() {465 /** @type {Array<WebGLTexture>} */ var texture = [];466 texture[0] = gl.createTexture();467 texture[1] = gl.createTexture();468 gl.bindTexture(gl.TEXTURE_2D, texture[0]);469 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);470 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');471 gl.copyTexImage2D(gl.TEXTURE_2D, -1, gl.RGB, 0, 0, 64, 64, 0);472 this.expectError(gl.INVALID_VALUE);473 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.RGB, 0, 0, 16, 16, 0);474 this.expectError(gl.INVALID_VALUE);475 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.RGB, 0, 0, 16, 16, 0);476 this.expectError(gl.INVALID_VALUE);477 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.RGB, 0, 0, 16, 16, 0);478 this.expectError(gl.INVALID_VALUE);479 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.RGB, 0, 0, 16, 16, 0);480 this.expectError(gl.INVALID_VALUE);481 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.RGB, 0, 0, 16, 16, 0);482 this.expectError(gl.INVALID_VALUE);483 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.RGB, 0, 0, 16, 16, 0);484 this.expectError(gl.INVALID_VALUE);485 gl.deleteTexture(texture[0]);486 gl.deleteTexture(texture[1]);487 }));488 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_max_level', 'Invalid gl.copyTexImage2D() usage', gl,489 function() {490 /** @type {Array<WebGLTexture>} */ var texture = [];491 texture[0] = gl.createTexture();492 texture[1] = gl.createTexture();493 gl.bindTexture(gl.TEXTURE_2D, texture[0]);494 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);495 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');496 /** @type {number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;497 gl.copyTexImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.RGB, 0, 0, 64, 64, 0);498 this.expectError(gl.INVALID_VALUE);499 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');500 /** @type {number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;501 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);502 this.expectError(gl.INVALID_VALUE);503 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);504 this.expectError(gl.INVALID_VALUE);505 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);506 this.expectError(gl.INVALID_VALUE);507 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);508 this.expectError(gl.INVALID_VALUE);509 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);510 this.expectError(gl.INVALID_VALUE);511 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);512 this.expectError(gl.INVALID_VALUE);513 gl.deleteTexture(texture[0]);514 gl.deleteTexture(texture[1]);515 }));516 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_neg_width_height', 'Invalid gl.copyTexImage2D() usage', gl,517 function() {518 /** @type {Array<WebGLTexture>} */ var texture = [];519 texture[0] = gl.createTexture();520 texture[1] = gl.createTexture();521 gl.bindTexture(gl.TEXTURE_2D, texture[0]);522 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);523 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');524 bufferedLogToConsole('gl.TEXTURE_2D target');525 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, -1, 1, 0);526 this.expectError(gl.INVALID_VALUE);527 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 1, -1, 0);528 this.expectError(gl.INVALID_VALUE);529 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, -1, -1, 0);530 this.expectError(gl.INVALID_VALUE);531 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');532 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, -1, 1, 0);533 this.expectError(gl.INVALID_VALUE);534 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 1, -1, 0);535 this.expectError(gl.INVALID_VALUE);536 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, -1, -1, 0);537 this.expectError(gl.INVALID_VALUE);538 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');539 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, -1, 1, 0);540 this.expectError(gl.INVALID_VALUE);541 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 1, -1, 0);542 this.expectError(gl.INVALID_VALUE);543 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, -1, -1, 0);544 this.expectError(gl.INVALID_VALUE);545 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');546 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, -1, 1, 0);547 this.expectError(gl.INVALID_VALUE);548 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 1, -1, 0);549 this.expectError(gl.INVALID_VALUE);550 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, -1, -1, 0);551 this.expectError(gl.INVALID_VALUE);552 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');553 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, -1, 1, 0);554 this.expectError(gl.INVALID_VALUE);555 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 1, -1, 0);556 this.expectError(gl.INVALID_VALUE);557 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, -1, -1, 0);558 this.expectError(gl.INVALID_VALUE);559 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');560 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, -1, 1, 0);561 this.expectError(gl.INVALID_VALUE);562 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 1, -1, 0);563 this.expectError(gl.INVALID_VALUE);564 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, -1, -1, 0);565 this.expectError(gl.INVALID_VALUE);566 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');567 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, -1, 1, 0);568 this.expectError(gl.INVALID_VALUE);569 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 1, -1, 0);570 this.expectError(gl.INVALID_VALUE);571 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, -1, -1, 0);572 this.expectError(gl.INVALID_VALUE);573 gl.deleteTexture(texture[0]);574 gl.deleteTexture(texture[1]);575 }));576 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_max_width_height', 'Invalid gl.copyTexImage2D() usage', gl,577 function() {578 /** @type {Array<WebGLTexture>} */ var texture = [];579 texture[0] = gl.createTexture();580 texture[1] = gl.createTexture();581 gl.bindTexture(gl.TEXTURE_2D, texture[0]);582 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);583 var maxTextureSize = /** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;584 var maxCubemapSize = /** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;585 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');586 bufferedLogToConsole('gl.TEXTURE_2D target');587 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, maxTextureSize, 1, 0);588 this.expectError(gl.INVALID_VALUE);589 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 1, maxTextureSize, 0);590 this.expectError(gl.INVALID_VALUE);591 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, maxTextureSize, maxTextureSize, 0);592 this.expectError(gl.INVALID_VALUE);593 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');594 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);595 this.expectError(gl.INVALID_VALUE);596 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);597 this.expectError(gl.INVALID_VALUE);598 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);599 this.expectError(gl.INVALID_VALUE);600 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');601 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);602 this.expectError(gl.INVALID_VALUE);603 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);604 this.expectError(gl.INVALID_VALUE);605 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);606 this.expectError(gl.INVALID_VALUE);607 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');608 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);609 this.expectError(gl.INVALID_VALUE);610 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);611 this.expectError(gl.INVALID_VALUE);612 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);613 this.expectError(gl.INVALID_VALUE);614 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');615 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);616 this.expectError(gl.INVALID_VALUE);617 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);618 this.expectError(gl.INVALID_VALUE);619 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);620 this.expectError(gl.INVALID_VALUE);621 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');622 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);623 this.expectError(gl.INVALID_VALUE);624 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);625 this.expectError(gl.INVALID_VALUE);626 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);627 this.expectError(gl.INVALID_VALUE);628 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');629 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);630 this.expectError(gl.INVALID_VALUE);631 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);632 this.expectError(gl.INVALID_VALUE);633 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);634 this.expectError(gl.INVALID_VALUE);635 gl.deleteTexture(texture[0]);636 gl.deleteTexture(texture[1]);637 }));638 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_border', 'Invalid gl.copyTexImage2D() usage', gl,639 function() {640 /** @type {Array<WebGLTexture>} */ var texture = [];641 texture[0] = gl.createTexture();642 texture[1] = gl.createTexture();643 gl.bindTexture(gl.TEXTURE_2D, texture[0]);644 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);645 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');646 bufferedLogToConsole('gl.TEXTURE_2D target');647 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 0, 0, -1);648 this.expectError(gl.INVALID_VALUE);649 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 0, 0, 1);650 this.expectError(gl.INVALID_VALUE);651 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');652 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, 0, -1);653 this.expectError(gl.INVALID_VALUE);654 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, 0, 1);655 this.expectError(gl.INVALID_VALUE);656 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');657 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 0, 0, -1);658 this.expectError(gl.INVALID_VALUE);659 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 0, 0, 1);660 this.expectError(gl.INVALID_VALUE);661 bufferedLogToConsole('gl.TEXTURE_2D target');662 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 0, 0, -1);663 this.expectError(gl.INVALID_VALUE);664 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 0, 0, 1);665 this.expectError(gl.INVALID_VALUE);666 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');667 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 0, 0, -1);668 this.expectError(gl.INVALID_VALUE);669 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 0, 0, 1);670 this.expectError(gl.INVALID_VALUE);671 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');672 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 0, 0, -1);673 this.expectError(gl.INVALID_VALUE);674 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 0, 0, 1);675 this.expectError(gl.INVALID_VALUE);676 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');677 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 0, 0, -1);678 this.expectError(gl.INVALID_VALUE);679 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 0, 0, 1);680 this.expectError(gl.INVALID_VALUE);681 gl.deleteTexture(texture[0]);682 gl.deleteTexture(texture[1]);683 }));684 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_incomplete_framebuffer', 'Invalid gl.copyTexImage2D() usage', gl,685 function() {686 /** @type {Array<WebGLTexture>} */ var texture = [];687 texture[0] = gl.createTexture();688 texture[1] = gl.createTexture();689 gl.bindTexture(gl.TEXTURE_2D, texture[0]);690 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);691 /** @type {WebGLFramebuffer} */ var fbo;692 fbo = gl.createFramebuffer();693 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);694 gl.checkFramebufferStatus(gl.FRAMEBUFFER);695 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');696 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, 0, 0, 0, 0, 0);697 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);698 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA8, 0, 0, 0, 0, 0);699 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);700 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA8, 0, 0, 0, 0, 0);701 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);702 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA8, 0, 0, 0, 0, 0);703 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);704 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA8, 0, 0, 0, 0, 0);705 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);706 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA8, 0, 0, 0, 0, 0);707 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);708 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA8, 0, 0, 0, 0, 0);709 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);710 gl.bindFramebuffer(gl.FRAMEBUFFER, null);711 gl.deleteFramebuffer(fbo);712 gl.deleteTexture(texture[0]);713 gl.deleteTexture(texture[1]);714 }));715 // gl.copyTexSubImage2D716 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_invalid_target', 'Invalid gl.copyTexSubImage2D() usage', gl,717 function() {718 /** @type {WebGLTexture} */ var texture;719 texture = gl.createTexture();720 gl.bindTexture(gl.TEXTURE_2D, texture);721 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);722 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');723 gl.copyTexSubImage2D(0, 0, 0, 0, 0, 0, 4, 4);724 this.expectError(gl.INVALID_ENUM);725 gl.deleteTexture(texture);726 }));727 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_level', 'Invalid gl.copyTexSubImage2D() usage', gl,728 function() {729 /** @type {Array<WebGLTexture>} */ var texture = [];730 texture[0] = gl.createTexture();731 texture[1] = gl.createTexture();732 gl.bindTexture(gl.TEXTURE_2D, texture[0]);733 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);734 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);735 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {736 gl.texImage2D(faceGL, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);737 });738 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');739 gl.copyTexSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, 4, 4);740 this.expectError(gl.INVALID_VALUE);741 var local = this;742 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {743 gl.copyTexSubImage2D(faceGL, -1, 0, 0, 0, 0, 4, 4);744 local.expectError(gl.INVALID_VALUE);745 });746 gl.deleteTexture(texture[0]);747 gl.deleteTexture(texture[1]);748 }));749 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_max_level', 'Invalid gl.copyTexSubImage2D() usage', gl,750 function() {751 /** @type{Array<WebGLTexture>} */ var texture = [];752 texture[0] = gl.createTexture();753 texture[1] = gl.createTexture();754 gl.bindTexture(gl.TEXTURE_2D, texture[0]);755 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);756 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);757 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {758 gl.texImage2D(faceGL, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);759 });760 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE) for 2D texture targets.');761 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;762 gl.copyTexSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 4, 4);763 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);764 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_SIZE) for cubemap targets.');765 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;766 var local = this;767 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {768 gl.copyTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, 4, 4);769 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);770 });771 gl.deleteTexture(texture[0]);772 gl.deleteTexture(texture[1]);773 }));774 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_offset', 'Invalid gl.copyTexSubImage2D() usage', gl,775 function() {776 /** @type{WebGLTexture} */ var texture;777 texture = gl.createTexture();778 gl.bindTexture(gl.TEXTURE_2D, texture);779 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);780 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset < 0 or yoffset < 0.');781 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, -1, 0, 0, 0, 4, 4);782 this.expectError(gl.INVALID_VALUE);783 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, -1, 0, 0, 4, 4);784 this.expectError(gl.INVALID_VALUE);785 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, -1, -1, 0, 0, 4, 4);786 this.expectError(gl.INVALID_VALUE);787 gl.deleteTexture(texture);788 }));789 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_invalid_offset', 'Invalid gl.copyTexSubImage2D() usage', gl,790 function() {791 /** @type{WebGLTexture} */ var texture;792 texture = gl.createTexture();793 gl.bindTexture(gl.TEXTURE_2D, texture);794 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);795 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.');796 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 14, 0, 0, 0, 4, 4);797 this.expectError(gl.INVALID_VALUE);798 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 14, 0, 0, 4, 4);799 this.expectError(gl.INVALID_VALUE);800 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 14, 14, 0, 0, 4, 4);801 this.expectError(gl.INVALID_VALUE);802 gl.deleteTexture(texture);803 }));804 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_width_height', 'Invalid gl.copyTexSubImage2D() usage', gl,805 function() {806 /** @type{WebGLTexture} */ var texture;807 texture = gl.createTexture();808 gl.bindTexture(gl.TEXTURE_2D, texture);809 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);810 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');811 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0);812 this.expectError(gl.INVALID_VALUE);813 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1);814 this.expectError(gl.INVALID_VALUE);815 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1);816 this.expectError(gl.INVALID_VALUE);817 gl.deleteTexture(texture);818 }));819 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_incomplete_framebuffer', 'Invalid gl.copyTexSubImage2D() usage', gl,820 function() {821 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');822 /** @type{Array<WebGLTexture>} */ var texture = [];823 /** @type{WebGLFramebuffer} */ var fbo;824 texture[0] = gl.createTexture();825 texture[1] = gl.createTexture();826 gl.bindTexture(gl.TEXTURE_2D, texture[0]);827 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);828 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);829 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);830 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);831 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);832 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);833 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);834 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);835 this.expectError(gl.NO_ERROR);836 fbo = gl.createFramebuffer();837 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);838 gl.checkFramebufferStatus(gl.FRAMEBUFFER);839 this.expectError(gl.NO_ERROR);840 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);841 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);842 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);843 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);844 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);845 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);846 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);847 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);848 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);849 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);850 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);851 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);852 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);853 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);854 gl.bindFramebuffer(gl.FRAMEBUFFER, null);855 gl.deleteFramebuffer(fbo);856 gl.deleteTexture(texture[0]);857 gl.deleteTexture(texture[1]);858 }));859 // glDeleteTextures860 testGroup.addChild(new es3fApiCase.ApiCaseCallback('deletetextures', 'glDeleteTextures() usage', gl,861 function() {862 /** @type{WebGLTexture} */ var texture;863 texture = gl.createTexture();864 bufferedLogToConsole('gl.NO_ERROR is generated if texture is null.');865 gl.deleteTexture(null);866 this.expectError(gl.NO_ERROR);867 gl.bindTexture(gl.TEXTURE_2D, texture);868 gl.deleteTexture(null);869 this.expectError(gl.NO_ERROR);870 gl.deleteTexture(texture);871 }));872 // gl.generateMipmap873 testGroup.addChild(new es3fApiCase.ApiCaseCallback('generatemipmap', 'Invalid gl.generateMipmap() usage', gl,874 function() {875 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }876 /** @type{Array<WebGLTexture>} */ var texture = [];877 /** @type{WebGLFramebuffer} */ var fbo;878 texture[0] = gl.createTexture();879 texture[1] = gl.createTexture();880 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not gl.TEXTURE_2D or gl.TEXTURE_CUBE_MAP.');881 gl.generateMipmap(0);882 this.expectError(gl.INVALID_ENUM);883 bufferedLogToConsole('INVALID_OPERATION is generated if the texture bound to target is not cube complete.');884 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);885 gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT);886 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, null);887 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);888 this.expectError(gl.INVALID_OPERATION);889 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);890 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);891 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);892 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);893 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);894 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);895 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);896 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);897 this.expectError(gl.INVALID_OPERATION);898 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format.');899 gl.bindTexture(gl.TEXTURE_2D, texture[1]);900 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, new Uint8Array(0));901 gl.generateMipmap(gl.TEXTURE_2D);902 this.expectError(gl.INVALID_OPERATION);903 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the level base array was not specified with an unsized internal format or a sized internal format that is both color-renderable and texture-filterable.');904 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB8_SNORM, 0, 0, 0, gl.RGB, gl.BYTE, null);905 gl.generateMipmap(gl.TEXTURE_2D);906 this.expectError(gl.INVALID_OPERATION);907 gl.texImage2D(gl.TEXTURE_2D, 0, gl.R8I, 0, 0, 0, gl.RED_INTEGER, gl.BYTE, null);908 gl.generateMipmap(gl.TEXTURE_2D);909 this.expectError(gl.INVALID_OPERATION);910 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, 0, 0, 0, gl.RGBA, gl.FLOAT, null);911 gl.generateMipmap(gl.TEXTURE_2D);912 this.expectError(gl.INVALID_OPERATION);913 gl.deleteTexture(texture[0]);914 gl.deleteTexture(texture[1]);915 }));916 // gl.pixelStorei917 testGroup.addChild(new es3fApiCase.ApiCaseCallback('pixelstorei', 'Invalid gl.pixelStorei() usage', gl,918 function() {919 bufferedLogToConsole('gl.INVALID_ENUM is generated if pname is not an accepted value.');920 gl.pixelStorei(0,1);921 this.expectError(gl.INVALID_ENUM);922 bufferedLogToConsole('gl.INVALID_VALUE is generated if a negative row length, pixel skip, or row skip value is specified, or if alignment is specified as other than 1, 2, 4, or 8.');923 gl.pixelStorei(gl.PACK_ROW_LENGTH, -1);924 this.expectError(gl.INVALID_VALUE);925 gl.pixelStorei(gl.PACK_SKIP_ROWS, -1);926 this.expectError(gl.INVALID_VALUE);927 gl.pixelStorei(gl.PACK_SKIP_PIXELS, -1);928 this.expectError(gl.INVALID_VALUE);929 gl.pixelStorei(gl.UNPACK_ROW_LENGTH, -1);930 this.expectError(gl.INVALID_VALUE);931 gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, -1);932 this.expectError(gl.INVALID_VALUE);933 gl.pixelStorei(gl.UNPACK_SKIP_ROWS, -1);934 this.expectError(gl.INVALID_VALUE);935 gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, -1);936 this.expectError(gl.INVALID_VALUE);937 gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, -1);938 this.expectError(gl.INVALID_VALUE);939 gl.pixelStorei(gl.PACK_ALIGNMENT, 0);940 this.expectError(gl.INVALID_VALUE);941 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 0);942 this.expectError(gl.INVALID_VALUE);943 gl.pixelStorei(gl.PACK_ALIGNMENT, 16);944 this.expectError(gl.INVALID_VALUE);945 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 16);946 this.expectError(gl.INVALID_VALUE);947 }));948 // gl.texImage2D949 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d', 'Invalid gl.texImage2D() usage', gl,950 function() {951 /** @type {WebGLTexture} */ var texture;952 texture = gl.createTexture();953 gl.bindTexture(gl.TEXTURE_2D, texture);954 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');955 gl.texImage2D(0, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);956 this.expectError(gl.INVALID_ENUM);957 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');958 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, 0, null);959 this.expectError(gl.INVALID_ENUM);960 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');961 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, 0, gl.UNSIGNED_BYTE, null);962 this.expectError(gl.INVALID_ENUM);963 bufferedLogToConsole('gl.INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants.');964 gl.texImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);965 this.expectError(gl.INVALID_VALUE);966 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.');967 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);968 this.expectError(gl.INVALID_OPERATION);969 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, null);970 this.expectError(gl.INVALID_OPERATION);971 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB5_A1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, null);972 this.expectError(gl.INVALID_OPERATION);973 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB10_A2, 1, 1, 0, gl.RGB, gl.UNSIGNED_INT_2_10_10_10_REV, null);974 this.expectError(gl.INVALID_OPERATION);975 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32UI, 1, 1, 0, gl.RGBA_INTEGER, gl.INT, null);976 this.expectError(gl.INVALID_OPERATION);977 gl.deleteTexture(texture);978 }));979 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_inequal_width_height_cube', 'Invalid gl.texImage2D() usage', gl,980 function() {981 /** @type {WebGLTexture} */ var texture;982 texture = gl.createTexture();983 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);984 bufferedLogToConsole('gl.INVALID_VALUE is generated if target is one of the six cube map 2D image targets and the width and height parameters are not equal.');985 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);986 this.expectError(gl.INVALID_VALUE);987 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);988 this.expectError(gl.INVALID_VALUE);989 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);990 this.expectError(gl.INVALID_VALUE);991 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);992 this.expectError(gl.INVALID_VALUE);993 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);994 this.expectError(gl.INVALID_VALUE);995 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);996 this.expectError(gl.INVALID_VALUE);997 gl.deleteTexture(texture);998 }));999 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_neg_level', 'Invalid gl.texImage2D() usage', gl,1000 function() {1001 /** @type {Array<WebGLTexture>} */ var texture = [];1002 texture[0] = gl.createTexture();1003 texture[1] = gl.createTexture();1004 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1005 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1006 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1007 gl.texImage2D(gl.TEXTURE_2D, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1008 this.expectError(gl.INVALID_VALUE);1009 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1010 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1011 this.expectError(gl.INVALID_VALUE);1012 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1013 this.expectError(gl.INVALID_VALUE);1014 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1015 this.expectError(gl.INVALID_VALUE);1016 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1017 this.expectError(gl.INVALID_VALUE);1018 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1019 this.expectError(gl.INVALID_VALUE);1020 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1021 this.expectError(gl.INVALID_VALUE);1022 gl.deleteTexture(texture[0]);1023 gl.deleteTexture(texture[1]);1024 }));1025 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_max_level', 'Invalid gl.texImage2D() usage', gl,1026 function() {1027 /** @type {Array<WebGLTexture>} */ var texture = [];1028 texture[0] = gl.createTexture();1029 texture[1] = gl.createTexture();1030 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1031 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1032 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1033 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1034 gl.texImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1035 this.expectError(gl.INVALID_VALUE);1036 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');1037 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;1038 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1039 this.expectError(gl.INVALID_VALUE);1040 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1041 this.expectError(gl.INVALID_VALUE);1042 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1043 this.expectError(gl.INVALID_VALUE);1044 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1045 this.expectError(gl.INVALID_VALUE);1046 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1047 this.expectError(gl.INVALID_VALUE);1048 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1049 this.expectError(gl.INVALID_VALUE);1050 gl.deleteTexture(texture[0]);1051 gl.deleteTexture(texture[1]);1052 }));1053 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_neg_width_height', 'Invalid gl.texImage2D() usage', gl,1054 function() {1055 /** @type {Array<WebGLTexture>} */ var texture = [];1056 texture[0] = gl.createTexture();1057 texture[1] = gl.createTexture();1058 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1059 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1060 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');1061 bufferedLogToConsole('gl.TEXTURE_2D target');1062 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1063 this.expectError(gl.INVALID_VALUE);1064 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1065 this.expectError(gl.INVALID_VALUE);1066 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1067 this.expectError(gl.INVALID_VALUE);1068 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');1069 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1070 this.expectError(gl.INVALID_VALUE);1071 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1072 this.expectError(gl.INVALID_VALUE);1073 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1074 this.expectError(gl.INVALID_VALUE);1075 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');1076 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1077 this.expectError(gl.INVALID_VALUE);1078 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1079 this.expectError(gl.INVALID_VALUE);1080 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1081 this.expectError(gl.INVALID_VALUE);1082 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');1083 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1084 this.expectError(gl.INVALID_VALUE);1085 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1086 this.expectError(gl.INVALID_VALUE);1087 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1088 this.expectError(gl.INVALID_VALUE);1089 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');1090 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1091 this.expectError(gl.INVALID_VALUE);1092 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1093 this.expectError(gl.INVALID_VALUE);1094 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1095 this.expectError(gl.INVALID_VALUE);1096 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');1097 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1098 this.expectError(gl.INVALID_VALUE);1099 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1100 this.expectError(gl.INVALID_VALUE);1101 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1102 this.expectError(gl.INVALID_VALUE);1103 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');1104 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1105 this.expectError(gl.INVALID_VALUE);1106 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1107 this.expectError(gl.INVALID_VALUE);1108 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1109 this.expectError(gl.INVALID_VALUE);1110 gl.deleteTexture(texture[0]);1111 gl.deleteTexture(texture[1]);1112 }));1113 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_max_width_height', 'Invalid gl.texImage2D() usage', gl,1114 function() {1115 /** @type {Array<WebGLTexture>} */ var texture = [];1116 texture[0] = gl.createTexture();1117 texture[1] = gl.createTexture();1118 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1119 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1120 var maxTextureSize = /** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;1121 var maxCubemapSize = /** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;1122 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');1123 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, maxTextureSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1124 this.expectError(gl.INVALID_VALUE);1125 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, maxTextureSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1126 this.expectError(gl.INVALID_VALUE);1127 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, maxTextureSize, maxTextureSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1128 this.expectError(gl.INVALID_VALUE);1129 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_CUBE_MAP_TEXTURE_SIZE.');1130 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');1131 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1132 this.expectError(gl.INVALID_VALUE);1133 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1134 this.expectError(gl.INVALID_VALUE);1135 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1136 this.expectError(gl.INVALID_VALUE);1137 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');1138 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1139 this.expectError(gl.INVALID_VALUE);1140 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1141 this.expectError(gl.INVALID_VALUE);1142 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1143 this.expectError(gl.INVALID_VALUE);1144 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');1145 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1146 this.expectError(gl.INVALID_VALUE);1147 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1148 this.expectError(gl.INVALID_VALUE);1149 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1150 this.expectError(gl.INVALID_VALUE);1151 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');1152 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1153 this.expectError(gl.INVALID_VALUE);1154 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1155 this.expectError(gl.INVALID_VALUE);1156 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1157 this.expectError(gl.INVALID_VALUE);1158 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');1159 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1160 this.expectError(gl.INVALID_VALUE);1161 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1162 this.expectError(gl.INVALID_VALUE);1163 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1164 this.expectError(gl.INVALID_VALUE);1165 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');1166 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1167 this.expectError(gl.INVALID_VALUE);1168 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1169 this.expectError(gl.INVALID_VALUE);1170 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1171 this.expectError(gl.INVALID_VALUE);1172 gl.deleteTexture(texture[0]);1173 gl.deleteTexture(texture[1]);1174 }));1175 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_invalid_border', 'Invalid gl.texImage2D() usage', gl,1176 function() {1177 /** @type {Array<WebGLTexture>} */ var texture = [];1178 texture[0] = gl.createTexture();1179 texture[1] = gl.createTexture();1180 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1181 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1182 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');1183 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1184 this.expectError(gl.INVALID_VALUE);1185 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);1186 this.expectError(gl.INVALID_VALUE);1187 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1188 this.expectError(gl.INVALID_VALUE);1189 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1190 this.expectError(gl.INVALID_VALUE);1191 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1192 this.expectError(gl.INVALID_VALUE);1193 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1194 this.expectError(gl.INVALID_VALUE);1195 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1196 this.expectError(gl.INVALID_VALUE);1197 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);1198 this.expectError(gl.INVALID_VALUE);1199 gl.deleteTexture(texture[0]);1200 gl.deleteTexture(texture[1]);1201 }));1202 // gl.texSubImage2D1203 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d', 'Invalid gl.texSubImage2D() usage', gl,1204 function() {1205 /** @type{WebGLTexture} */ var texture;1206 texture = gl.createTexture();1207 gl.bindTexture(gl.TEXTURE_2D, texture);1208 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1209 this.expectError(gl.NO_ERROR);1210 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(64);1211 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1212 gl.texSubImage2D(0, 0, 0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1213 this.expectError(gl.INVALID_ENUM);1214 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');1215 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 4, 4, gl.UNSIGNED_BYTE, uint8);1216 this.expectError(gl.INVALID_ENUM);1217 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');1218 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, 0, uint8);1219 this.expectError(gl.INVALID_ENUM);1220 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.');1221 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_SHORT_5_6_5, uint8);1222 this.expectError(gl.INVALID_OPERATION);1223 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, uint8);1224 this.expectError(gl.INVALID_OPERATION);1225 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);1226 this.expectError(gl.INVALID_OPERATION);1227 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);1228 this.expectError(gl.INVALID_OPERATION);1229 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGBA_INTEGER, gl.UNSIGNED_INT, uint8);1230 this.expectError(gl.INVALID_OPERATION);1231 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.FLOAT, uint8);1232 this.expectError(gl.INVALID_OPERATION);1233 gl.deleteTexture(texture);1234 }));1235 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_level', 'Invalid gl.texSubImage2D() usage', gl,1236 function() {1237 /** @type{Array<WebGLTexture>} */ var texture = [];1238 texture[0] = gl.createTexture();1239 texture[1] = gl.createTexture();1240 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1241 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1242 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1243 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1244 gl.texImage2D(faceGL, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1245 });1246 this.expectError(gl.NO_ERROR);1247 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1248 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1249 gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1250 this.expectError(gl.INVALID_VALUE);1251 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1252 var local = this;1253 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1254 gl.texSubImage2D(faceGL, -1, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1255 local.expectError(gl.INVALID_VALUE);1256 });1257 gl.deleteTexture(texture[0]);1258 gl.deleteTexture(texture[1]);1259 }));1260 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_max_level', 'Invalid gl.texSubImage2D() usage', gl,1261 function() {1262 /** @type{Array<WebGLTexture>} */ var texture = [];1263 texture[0] = gl.createTexture();1264 texture[1] = gl.createTexture();1265 gl.bindTexture (gl.TEXTURE_2D, texture[0]);1266 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1267 gl.bindTexture (gl.TEXTURE_CUBE_MAP, texture[1]);1268 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1269 gl.texImage2D(faceGL, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1270 });1271 this.expectError (gl.NO_ERROR);1272 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1273 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1274 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1275 gl.texSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1276 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1277 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');1278 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;1279 var local = this;1280 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1281 gl.texSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1282 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1283 });1284 gl.deleteTexture(texture[0]);1285 gl.deleteTexture(texture[1]);1286 }));1287 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_offset', 'Invalid gl.texSubImage2D() usage', gl,1288 function() {1289 /** @type{WebGLTexture} */ var texture;1290 texture = gl.createTexture();1291 gl.bindTexture(gl.TEXTURE_2D, texture);1292 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1293 this.expectError(gl.NO_ERROR);1294 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1295 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset or yoffset are negative.');1296 gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1297 this.expectError(gl.INVALID_VALUE);1298 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1299 this.expectError(gl.INVALID_VALUE);1300 gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, -1, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);1301 this.expectError(gl.INVALID_VALUE);1302 gl.deleteTexture(texture);1303 }));1304 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_invalid_offset', 'Invalid gl.texSubImage2D() usage', gl,1305 function() {1306 /** @type{WebGLTexture} */ var texture;1307 texture = gl.createTexture();1308 gl.bindTexture(gl.TEXTURE_2D, texture);1309 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1310 this.expectError(gl.NO_ERROR);1311 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(64);1312 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.');1313 gl.texSubImage2D(gl.TEXTURE_2D, 0, 30, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1314 this.expectError(gl.INVALID_VALUE);1315 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 30, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1316 this.expectError(gl.INVALID_VALUE);1317 gl.texSubImage2D(gl.TEXTURE_2D, 0, 30, 30, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1318 this.expectError(gl.INVALID_VALUE);1319 gl.deleteTexture(texture);1320 }));1321 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_width_height', 'Invalid gl.texSubImage2D() usage', gl,1322 function() {1323 /** @type{WebGLTexture} */ var texture;1324 texture = gl.createTexture();1325 gl.bindTexture(gl.TEXTURE_2D, texture);1326 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1327 this.expectError(gl.NO_ERROR);1328 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1329 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');1330 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1331 this.expectError(gl.INVALID_VALUE);1332 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1333 this.expectError(gl.INVALID_VALUE);1334 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -1, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1335 this.expectError(gl.INVALID_VALUE);1336 gl.deleteTexture(texture);1337 }));1338 // gl.texParameteri1339 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texparameteri', 'Invalid gl.texParameteri() usage', gl,1340 function() {1341 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');1342 gl.texParameteri(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);1343 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1344 gl.texParameteri(gl.TEXTURE_2D, 0, gl.LINEAR);1345 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1346 gl.texParameteri(0, 0, gl.LINEAR);1347 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1348 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');1349 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);1350 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1351 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);1352 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1353 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);1354 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1355 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);1356 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1357 /** @type{WebGLTexture} */ var texture;1358 texture = gl.createTexture();1359 gl.bindTexture(gl.TEXTURE_2D, texture);1360 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');1361 gl.texParameteri(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);1362 this.expectError(gl.INVALID_ENUM);1363 gl.texParameteri(gl.TEXTURE_2D, 0, gl.LINEAR);1364 this.expectError(gl.INVALID_ENUM);1365 gl.texParameteri(0, 0, gl.LINEAR);1366 this.expectError(gl.INVALID_ENUM);1367 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');1368 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);1369 this.expectError(gl.INVALID_ENUM);1370 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);1371 this.expectError(gl.INVALID_ENUM);1372 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);1373 this.expectError(gl.INVALID_ENUM);1374 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);1375 this.expectError(gl.INVALID_ENUM);1376 gl.deleteTexture(texture);1377 }));1378 // gl.texParameterf1379 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texparameterf', 'Invalid gl.texParameterf() usage', gl,1380 function() {1381 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');1382 gl.texParameterf(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);1383 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1384 gl.texParameterf(gl.TEXTURE_2D, 0, gl.LINEAR);1385 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1386 gl.texParameterf(0, 0, gl.LINEAR);1387 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1388 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');1389 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);1390 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1391 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);1392 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1393 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);1394 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1395 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);1396 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);1397 /** @type{ WebGLTexture} */ var texture;1398 texture = gl.createTexture();1399 gl.bindTexture(gl.TEXTURE_2D, texture);1400 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');1401 gl.texParameterf(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);1402 this.expectError(gl.INVALID_ENUM);1403 gl.texParameterf(gl.TEXTURE_2D, 0, gl.LINEAR);1404 this.expectError(gl.INVALID_ENUM);1405 gl.texParameterf(0, 0, gl.LINEAR);1406 this.expectError(gl.INVALID_ENUM);1407 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');1408 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);1409 this.expectError(gl.INVALID_ENUM);1410 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);1411 this.expectError(gl.INVALID_ENUM);1412 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);1413 this.expectError(gl.INVALID_ENUM);1414 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);1415 this.expectError(gl.INVALID_ENUM);1416 gl.deleteTexture(texture);1417 }));1418 // gl.compressedTexSubImage2D1419 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d', 'Invalid gl.compressedTexSubImage2D() usage', gl,1420 function() {1421 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1422 /** @type{WebGLTexture} */ var texture;1423 texture = gl.createTexture();1424 gl.bindTexture (gl.TEXTURE_2D, texture);1425 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1426 gl.compressedTexSubImage2D(0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));1427 this.expectError(gl.INVALID_ENUM);1428 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));1429 this.expectError (gl.NO_ERROR);1430 bufferedLogToConsole('gl.INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.');1431 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));1432 this.expectError(gl.INVALID_OPERATION);1433 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level.');1434 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 4, 0, 10, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(10, 4)));1435 this.expectError(gl.INVALID_OPERATION);1436 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level.');1437 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 4, 4, 10, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 10)));1438 this.expectError(gl.INVALID_OPERATION);1439 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.');1440 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 1, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));1441 this.expectError(gl.INVALID_OPERATION);1442 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 1, 0, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));1443 this.expectError(gl.INVALID_OPERATION);1444 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 1, 1, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));1445 this.expectError(gl.INVALID_OPERATION);1446 gl.deleteTexture(texture);1447 }));1448 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_level', 'Invalid gl.compressedTexSubImage2D() usage', gl,1449 function() {1450 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1451 /** @type{Array<WebGLTexture>} */ var texture = [];1452 texture[0] = gl.createTexture();1453 texture[1] = gl.createTexture();1454 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1455 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));1456 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1457 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1458 gl.compressedTexImage2D(faceGL, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));1459 });1460 this.expectError(gl.NO_ERROR);1461 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1462 gl.compressedTexSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1463 this.expectError(gl.INVALID_VALUE);1464 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1465 var local = this;1466 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1467 gl.compressedTexSubImage2D(faceGL, -1, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1468 local.expectError(gl.INVALID_VALUE);1469 });1470 gl.deleteTexture(texture[0]);1471 gl.deleteTexture(texture[1]);1472 }));1473 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_max_level', 'Invalid gl.compressedTexSubImage2D() usage', gl,1474 function() {1475 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1476 /** @type{Array<WebGLTexture>} */ var texture = [];1477 texture[0] = gl.createTexture();1478 texture[1] = gl.createTexture();1479 gl.bindTexture(gl.TEXTURE_2D, texture[0]);1480 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));1481 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);1482 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1483 gl.compressedTexImage2D(faceGL, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));1484 });1485 this.expectError(gl.NO_ERROR);1486 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1487 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1488 gl.compressedTexSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1489 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1490 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');1491 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;1492 var local = this;1493 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {1494 gl.compressedTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1495 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1496 });1497 gl.deleteTexture(texture[0]);1498 gl.deleteTexture(texture[1]);1499 }));1500 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_offset', 'Invalid gl.compressedTexSubImage2D() usage', gl,1501 function() {1502 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1503 /** @type{ WebGLTexture} */ var texture;1504 texture = gl.createTexture();1505 gl.bindTexture(gl.TEXTURE_2D, texture);1506 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 8, 8, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));1507 // \note Both gl.INVALID_VALUE and gl.INVALID_OPERATION are valid here since implementation may1508 // first check if offsets are valid for certain format and only after that check that they1509 // are not negative.1510 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset or yoffset are negative.');1511 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1512 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1513 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1514 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1515 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, -4, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1516 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1517 gl.deleteTexture(texture);1518 }));1519 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_invalid_offset', 'Invalid gl.compressedTexSubImage2D() usage', gl,1520 function() {1521 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1522 /** @type{WebGLTexture} */ var texture;1523 texture = gl.createTexture();1524 gl.bindTexture (gl.TEXTURE_2D, texture);1525 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));1526 this.expectError (gl.NO_ERROR);1527 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.');1528 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 12, 0, 8, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 4)));1529 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1530 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 12, 4, 8, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 8)));1531 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1532 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 12, 12, 8, 8, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));1533 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1534 gl.deleteTexture(texture);1535 }));1536 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_width_height', 'Invalid gl.compressedTexSubImage2D() usage', gl,1537 function() {1538 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1539 /** @type{WebGLTexture} */ var texture;1540 texture = gl.createTexture();1541 gl.bindTexture (gl.TEXTURE_2D, texture);1542 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));1543 this.expectError (gl.NO_ERROR);1544 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if width or height is less than 0.');1545 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -4, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1546 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1547 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1548 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1549 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -4, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));1550 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1551 gl.deleteTexture(texture);1552 }));1553 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_invalid_size', 'Invalid gl.compressedTexImage2D() usage', gl,1554 function() {1555 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1556 /** @type{WebGLTexture} */ var texture;1557 texture = gl.createTexture();1558 gl.bindTexture (gl.TEXTURE_2D, texture);1559 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));1560 this.expectError (gl.NO_ERROR);1561 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');1562 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(1));1563 this.expectError(gl.INVALID_VALUE);1564 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 16, 16, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(4*4*16-1));1565 this.expectError(gl.INVALID_VALUE);1566 gl.deleteTexture(texture);1567 }));1568 // gl.texImage3D1569 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d', 'Invalid gl.texImage3D() usage', gl,1570 function() {1571 /** @type{Array<WebGLTexture>} */ var texture = [];1572 texture[0] = gl.createTexture();1573 texture[1] = gl.createTexture();1574 gl.bindTexture (gl.TEXTURE_2D, texture[0]);1575 gl.bindTexture (gl.TEXTURE_3D, texture[1]);1576 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1577 gl.texImage3D(0, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1578 this.expectError(gl.INVALID_ENUM);1579 gl.texImage3D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1580 this.expectError(gl.INVALID_ENUM);1581 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');1582 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, 0, null);1583 this.expectError(gl.INVALID_ENUM);1584 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');1585 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, 0, gl.UNSIGNED_BYTE, null);1586 this.expectError(gl.INVALID_ENUM);1587 bufferedLogToConsole('gl.INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants.');1588 gl.texImage3D(gl.TEXTURE_3D, 0, 0, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1589 this.expectError(gl.INVALID_VALUE);1590 bufferedLogToConsole('gl.INVALID_OPERATION is generated if target is gl.TEXTURE_3D and format is gl.DEPTH_COMPONENT, or gl.DEPTH_STENCIL.');1591 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_BYTE, null);1592 this.expectError(gl.INVALID_OPERATION);1593 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_BYTE, null);1594 this.expectError(gl.INVALID_OPERATION);1595 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.');1596 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1597 this.expectError(gl.INVALID_OPERATION);1598 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, null);1599 this.expectError(gl.INVALID_OPERATION);1600 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB5_A1, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, null);1601 this.expectError(gl.INVALID_OPERATION);1602 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB10_A2, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_INT_2_10_10_10_REV, null);1603 this.expectError(gl.INVALID_OPERATION);1604 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA32UI, 1, 1, 1, 0, gl.RGBA_INTEGER, gl.INT, null);1605 this.expectError(gl.INVALID_OPERATION);1606 gl.deleteTexture(texture[0]);1607 gl.deleteTexture(texture[1]);1608 }));1609 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_neg_level', 'Invalid gl.texImage3D() usage', gl,1610 function() {1611 // NOTE: this method hangs the browser if the textures are binded.1612 /** @type{Array<WebGLTexture>} */ var texture = [];1613 texture[0] = gl.createTexture();1614 texture[1] = gl.createTexture();1615 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1616 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1617 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1618 gl.texImage3D(gl.TEXTURE_3D, -1, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1619 this.expectError(gl.INVALID_VALUE);1620 gl.texImage3D(gl.TEXTURE_2D_ARRAY, -1, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1621 this.expectError(gl.INVALID_VALUE);1622 gl.deleteTexture(texture[0]);1623 gl.deleteTexture(texture[1]);1624 }));1625 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_max_level', 'Invalid gl.texImage3D() usage', gl,1626 function() {1627 /** @type{Array<WebGLTexture>} */ var texture = [];1628 texture[0] = gl.createTexture();1629 texture[1] = gl.createTexture();1630 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1631 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1632 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');1633 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */ (gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;1634 gl.texImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1635 this.expectError(gl.INVALID_VALUE);1636 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1637 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1638 gl.texImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);1639 this.expectError(gl.INVALID_VALUE);1640 gl.deleteTexture(texture[0]);1641 gl.deleteTexture(texture[1]);1642 }));1643 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_neg_width_height_depth', 'Invalid gl.texImage3D() usage', gl,1644 function() {1645 /** @type{Array<WebGLTexture>} */ var texture = [];1646 texture[0] = gl.createTexture();1647 texture[1] = gl.createTexture();1648 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1649 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1650 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');1651 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, -1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1652 this.expectError(gl.INVALID_VALUE);1653 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, -1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1654 this.expectError(gl.INVALID_VALUE);1655 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1656 this.expectError(gl.INVALID_VALUE);1657 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, -1, -1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1658 this.expectError(gl.INVALID_VALUE);1659 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, -1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1660 this.expectError(gl.INVALID_VALUE);1661 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, -1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1662 this.expectError(gl.INVALID_VALUE);1663 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, 1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1664 this.expectError(gl.INVALID_VALUE);1665 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, -1, -1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1666 this.expectError(gl.INVALID_VALUE);1667 gl.deleteTexture(texture[0]);1668 gl.deleteTexture(texture[1]);1669 }));1670 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_max_width_height_depth', 'Invalid gl.texImage3D() usage', gl,1671 function() {1672 /** @type{Array<WebGLTexture>} */ var texture = [];1673 texture[0] = gl.createTexture();1674 texture[1] = gl.createTexture();1675 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1676 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1677 var max3DTextureSize = /** @type{number} */ (gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)) + 1;1678 var maxTextureSize = /** @type{number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;1679 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_3D_TEXTURE_SIZE.');1680 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, max3DTextureSize, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1681 this.expectError(gl.INVALID_VALUE);1682 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, max3DTextureSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1683 this.expectError(gl.INVALID_VALUE);1684 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, max3DTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1685 this.expectError(gl.INVALID_VALUE);1686 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, max3DTextureSize, max3DTextureSize, max3DTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1687 this.expectError(gl.INVALID_VALUE);1688 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_TEXTURE_SIZE.');1689 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, maxTextureSize, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1690 this.expectError(gl.INVALID_VALUE);1691 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, maxTextureSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1692 this.expectError(gl.INVALID_VALUE);1693 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, 1, maxTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1694 this.expectError(gl.INVALID_VALUE);1695 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, maxTextureSize, maxTextureSize, maxTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1696 this.expectError(gl.INVALID_VALUE);1697 gl.deleteTexture(texture[0]);1698 gl.deleteTexture(texture[1]);1699 }));1700 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_invalid_border', 'Invalid gl.texImage3D() usage', gl,1701 function() {1702 /** @type{Array<WebGLTexture>} */ var texture = [];1703 texture[0] = gl.createTexture();1704 texture[1] = gl.createTexture();1705 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1706 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1707 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0 or 1.');1708 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);1709 this.expectError(gl.INVALID_VALUE);1710 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, 2, gl.RGB, gl.UNSIGNED_BYTE, null);1711 this.expectError(gl.INVALID_VALUE);1712 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGB, 1, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);1713 this.expectError(gl.INVALID_VALUE);1714 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGB, 1, 1, 1, 2, gl.RGB, gl.UNSIGNED_BYTE, null);1715 this.expectError(gl.INVALID_VALUE);1716 gl.deleteTexture(texture[0]);1717 gl.deleteTexture(texture[1]);1718 }));1719 // gl.texSubImage3D1720 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d', 'Invalid gl.texSubImage3D() usage', gl,1721 function() {1722 /** @type{WebGLTexture} */ var texture;1723 texture = gl.createTexture();1724 gl.bindTexture (gl.TEXTURE_3D, texture);1725 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1726 this.expectError (gl.NO_ERROR);1727 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(256);1728 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1729 gl.texSubImage3D(0, 0, 0, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1730 this.expectError(gl.INVALID_ENUM);1731 gl.texSubImage3D(gl.TEXTURE_2D, 0, 0, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1732 this.expectError(gl.INVALID_ENUM);1733 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');1734 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 4, 4, 4, gl.UNSIGNED_BYTE, uint8);1735 this.expectError(gl.INVALID_ENUM);1736 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');1737 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, 0, uint8);1738 this.expectError(gl.INVALID_ENUM);1739 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.');1740 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, uint8);1741 this.expectError(gl.INVALID_OPERATION);1742 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);1743 this.expectError(gl.INVALID_OPERATION);1744 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);1745 this.expectError(gl.INVALID_OPERATION);1746 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGBA_INTEGER, gl.UNSIGNED_INT, uint8);1747 this.expectError(gl.INVALID_OPERATION);1748 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.FLOAT, uint8);1749 this.expectError(gl.INVALID_OPERATION);1750 gl.deleteTexture(texture);1751 }));1752 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_level', 'Invalid gl.texSubImage3D() usage', gl,1753 function() {1754 /** @type{Array<WebGLTexture>} */ var texture = [];1755 texture[0] = gl.createTexture();1756 texture[1] = gl.createTexture();1757 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1758 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1759 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1760 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1761 this.expectError (gl.NO_ERROR);1762 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1763 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1764 gl.texSubImage3D(gl.TEXTURE_3D, -1, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1765 this.expectError(gl.INVALID_VALUE);1766 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1767 this.expectError(gl.INVALID_VALUE);1768 gl.deleteTexture(texture[0]);1769 gl.deleteTexture(texture[1]);1770 }));1771 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_max_level', 'Invalid gl.texSubImage3D() usage', gl,1772 function() {1773 /** @type{Array<WebGLTexture>} */ var texture = [];1774 texture[0] = gl.createTexture();1775 texture[1] = gl.createTexture();1776 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1777 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1778 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1779 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1780 this.expectError (gl.NO_ERROR);1781 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;1782 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1783 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1784 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');1785 gl.texSubImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1786 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1787 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1788 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1789 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1790 gl.deleteTexture(texture[0]);1791 gl.deleteTexture(texture[1]);1792 }));1793 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_offset', 'Invalid gl.texSubImage3D() usage', gl,1794 function() {1795 /** @type{Array<WebGLTexture>} */ var texture = [];1796 texture[0] = gl.createTexture();1797 texture[1] = gl.createTexture();1798 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1799 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1800 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1801 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1802 this.expectError (gl.NO_ERROR);1803 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1804 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative.');1805 gl.texSubImage3D(gl.TEXTURE_3D, 0, -1, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1806 this.expectError(gl.INVALID_VALUE);1807 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, -1, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1808 this.expectError(gl.INVALID_VALUE);1809 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1810 this.expectError(gl.INVALID_VALUE);1811 gl.texSubImage3D(gl.TEXTURE_3D, 0, -1, -1, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1812 this.expectError(gl.INVALID_VALUE);1813 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -1, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1814 this.expectError(gl.INVALID_VALUE);1815 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, -1, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1816 this.expectError(gl.INVALID_VALUE);1817 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1818 this.expectError(gl.INVALID_VALUE);1819 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1820 this.expectError(gl.INVALID_VALUE);1821 gl.deleteTexture(texture[0]);1822 gl.deleteTexture(texture[1]);1823 }));1824 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_invalid_offset', 'Invalid gl.texSubImage3D() usage', gl,1825 function() {1826 /** @type{WebGLTexture} */ var texture;1827 texture = gl.createTexture();1828 gl.bindTexture (gl.TEXTURE_3D, texture);1829 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1830 this.expectError (gl.NO_ERROR);1831 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(256);1832 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width.');1833 gl.texSubImage3D(gl.TEXTURE_3D, 0, 2, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1834 this.expectError(gl.INVALID_VALUE);1835 bufferedLogToConsole('gl.INVALID_VALUE is generated if yoffset + height > texture_height.');1836 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 2, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1837 this.expectError(gl.INVALID_VALUE);1838 bufferedLogToConsole('gl.INVALID_VALUE is generated if zoffset + depth > texture_depth.');1839 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 2, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1840 this.expectError(gl.INVALID_VALUE);1841 gl.deleteTexture(texture);1842 }));1843 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_width_height', 'Invalid gl.texSubImage3D() usage', gl,1844 function() {1845 /** @type{WebGLTexture} */ var texture;1846 texture = gl.createTexture();1847 gl.bindTexture (gl.TEXTURE_3D, texture);1848 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1849 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);1850 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is less than 0.');1851 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, -1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1852 this.expectError(gl.INVALID_VALUE);1853 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1854 this.expectError(gl.INVALID_VALUE);1855 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1856 this.expectError(gl.INVALID_VALUE);1857 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);1858 this.expectError(gl.INVALID_VALUE);1859 gl.deleteTexture(texture);1860 }));1861 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d', 'Invalid gl.copyTexSubImage3D() usage', gl,1862 function() {1863 /** @type{WebGLTexture} */ var texture;1864 texture = gl.createTexture();1865 gl.bindTexture (gl.TEXTURE_3D, texture);1866 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1867 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1868 gl.copyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 4, 0);1869 this.expectError(gl.INVALID_ENUM);1870 gl.deleteTexture(texture);1871 }));1872 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_level', 'Invalid gl.copyTexSubImage3D() usage', gl,1873 function() {1874 /** @type{Array<WebGLTexture>} */ var texture = [];1875 texture[0] = gl.createTexture();1876 texture[1] = gl.createTexture();1877 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1878 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1879 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1880 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1881 this.expectError (gl.NO_ERROR);1882 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');1883 gl.copyTexSubImage3D(gl.TEXTURE_3D, -1, 0, 0, 0, 0, 0, 4, 0);1884 this.expectError(gl.INVALID_VALUE);1885 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 0);1886 this.expectError(gl.INVALID_VALUE);1887 gl.deleteTexture(texture[0]);1888 gl.deleteTexture(texture[1]);1889 }));1890 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_max_level', 'Invalid gl.copyTexSubImage3D() usage', gl,1891 function() {1892 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;1893 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;1894 /** @type{Array<WebGLTexture>} */ var texture = [];1895 texture[0] = gl.createTexture();1896 texture[1] = gl.createTexture();1897 gl.bindTexture (gl.TEXTURE_3D, texture[0]);1898 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1899 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1900 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1901 this.expectError (gl.NO_ERROR);1902 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');1903 gl.copyTexSubImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 4, 0);1904 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1905 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');1906 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 4, 0);1907 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);1908 gl.deleteTexture(texture[0]);1909 gl.deleteTexture(texture[1]);1910 }));1911 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_offset', 'Invalid gl.copyTexSubImage3D() usage', gl,1912 function() {1913 /** @type{ WebGLTexture} */ var texture;1914 texture = gl.createTexture();1915 gl.bindTexture (gl.TEXTURE_3D, texture);1916 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1917 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset, yoffset or zoffset is negative.');1918 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, -1, 0, 0, 0, 0, 4, 4);1919 this.expectError(gl.INVALID_VALUE);1920 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, -1, 0, 0, 0, 4, 4);1921 this.expectError(gl.INVALID_VALUE);1922 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, -1, 0, 0, 4, 4);1923 this.expectError(gl.INVALID_VALUE);1924 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, -1, -1, -1, 0, 0, 4, 4);1925 this.expectError(gl.INVALID_VALUE);1926 gl.deleteTexture(texture);1927 }));1928 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_invalid_offset', 'Invalid gl.copyTexSubImage3D() usage', gl,1929 function() {1930 /** @type{WebGLTexture} */ var texture;1931 texture = gl.createTexture();1932 gl.bindTexture (gl.TEXTURE_3D, texture);1933 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1934 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width.');1935 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 1, 0, 0, 0, 0, 4, 4);1936 this.expectError(gl.INVALID_VALUE);1937 bufferedLogToConsole('gl.INVALID_VALUE is generated if yoffset + height > texture_height.');1938 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 1, 0, 0, 0, 4, 4);1939 this.expectError(gl.INVALID_VALUE);1940 bufferedLogToConsole('gl.INVALID_VALUE is generated if zoffset + 1 > texture_depth.');1941 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 4, 0, 0, 4, 4);1942 this.expectError(gl.INVALID_VALUE);1943 gl.deleteTexture(texture);1944 }));1945 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_width_height', 'Invalid gl.copyTexSubImage3D() usage', gl,1946 function() {1947 /** @type{ WebGLTexture} */ var texture;1948 texture = gl.createTexture();1949 gl.bindTexture (gl.TEXTURE_3D, texture);1950 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1951 bufferedLogToConsole('gl.INVALID_VALUE is generated if width < 0.');1952 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, -4, 4);1953 this.expectError(gl.INVALID_VALUE);1954 bufferedLogToConsole('gl.INVALID_VALUE is generated if height < 0.');1955 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, -4);1956 this.expectError(gl.INVALID_VALUE);1957 gl.deleteTexture(texture);1958 }));1959 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_incomplete_framebuffer', 'Invalid gl.copyTexSubImage3D() usage', gl,1960 function() {1961 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');1962 /** @type{Array<WebGLTexture>} */ var texture = [];1963 /** @type{WebGLFramebuffer} */ var fbo;1964 texture[0] = gl.createTexture();1965 texture[1] = gl.createTexture();1966 gl.bindTexture(gl.TEXTURE_3D, texture[0]);1967 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1968 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[1]);1969 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);1970 this.expectError(gl.NO_ERROR);1971 fbo = gl.createFramebuffer();1972 gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo);1973 gl.checkFramebufferStatus(gl.READ_FRAMEBUFFER);1974 this.expectError(gl.NO_ERROR);1975 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, 4);1976 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);1977 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 4, 4);1978 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);1979 gl.bindFramebuffer(gl.FRAMEBUFFER, null);1980 gl.deleteFramebuffer(fbo);1981 gl.deleteTexture(texture[0]);1982 gl.deleteTexture(texture[1]);1983 }));1984 // gl.compressedTexImage3D1985 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d', 'Invalid gl.compressedTexImage3D() usage', gl,1986 function() {1987 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }1988 /** @type{Array<WebGLTexture>} */ var texture = [];1989 // We have to create and bind textures to each target for the test because default textures are not supported by WebGL.1990 texture[0] = gl.createTexture();1991 texture[1] = gl.createTexture();1992 gl.bindTexture (gl.TEXTURE_CUBE_MAP, texture[0]);1993 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);1994 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');1995 gl.compressedTexImage3D(0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));1996 this.expectError(gl.INVALID_ENUM);1997 gl.compressedTexImage3D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));1998 this.expectError(gl.INVALID_ENUM);1999 bufferedLogToConsole('gl.INVALID_ENUM is generated if internalformat is not one of the specific compressed internal formats.');2000 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, new Uint8Array(0));2001 this.expectError(gl.INVALID_ENUM);2002 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA8, 0, 0, 0, 0, new Uint8Array(0));2003 this.expectError(gl.INVALID_ENUM);2004 gl.deleteTexture(texture[0]);2005 gl.deleteTexture(texture[1]);2006 }));2007 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_neg_level', 'Invalid gl.compressedTexImage3D() usage', gl,2008 function() {2009 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2010 /** @type{ WebGLTexture} */ var texture;2011 texture = gl.createTexture();2012 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2013 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');2014 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));2015 this.expectError(gl.INVALID_VALUE);2016 gl.deleteTexture(texture);2017 }));2018 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_max_level', 'Invalid gl.compressedTexImage3D() usage', gl,2019 function() {2020 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2021 /** @type{ WebGLTexture} */ var texture;2022 texture = gl.createTexture();2023 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2024 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');2025 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;2026 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));2027 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2028 gl.deleteTexture(texture);2029 }));2030 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_neg_width_height_depth', 'Invalid gl.compressedTexImage3D() usage', gl,2031 function() {2032 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2033 /** @type{ WebGLTexture} */ var texture;2034 texture = gl.createTexture();2035 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2036 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is less than 0.');2037 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, new Uint8Array(0));2038 this.expectError(gl.INVALID_VALUE);2039 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, new Uint8Array(0));2040 this.expectError(gl.INVALID_VALUE);2041 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, new Uint8Array(0));2042 this.expectError(gl.INVALID_VALUE);2043 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, -1, 0, new Uint8Array(0));2044 this.expectError(gl.INVALID_VALUE);2045 gl.deleteTexture(texture);2046 }));2047 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_max_width_height_depth', 'Invalid gl.compressedTexImage3D() usage', gl,2048 function() {2049 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2050 /** @type{ WebGLTexture} */ var texture;2051 texture = gl.createTexture();2052 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2053 var maxTextureSize = /** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;2054 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_TEXTURE_SIZE.');2055 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 0, 0, 0, new Uint8Array(0));2056 this.expectError(gl.INVALID_VALUE);2057 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, new Uint8Array(0));2058 this.expectError(gl.INVALID_VALUE);2059 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureSize, 0, new Uint8Array(0));2060 this.expectError(gl.INVALID_VALUE);2061 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureSize, 0, new Uint8Array(0));2062 this.expectError(gl.INVALID_VALUE);2063 gl.deleteTexture(texture);2064 }));2065 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_invalid_border', 'Invalid gl.compressedTexImage3D() usage', gl,2066 function() {2067 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2068 /** @type{ WebGLTexture} */ var texture;2069 texture = gl.createTexture();2070 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2071 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');2072 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, new Uint8Array(0));2073 this.expectError(gl.INVALID_VALUE);2074 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, new Uint8Array(0));2075 this.expectError(gl.INVALID_VALUE);2076 gl.deleteTexture(texture);2077 }));2078 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_invalid_size', 'Invalid gl.compressedTexImage3D() usage', gl,2079 function() {2080 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2081 /** @type{ WebGLTexture} */ var texture;2082 texture = gl.createTexture();2083 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2084 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');2085 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(1));2086 this.expectError(gl.INVALID_VALUE);2087 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(4*4*8));2088 this.expectError(gl.INVALID_VALUE);2089 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, new Uint8Array(4*4*16));2090 this.expectError(gl.INVALID_VALUE);2091 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_SIGNED_R11_EAC, 16, 16, 1, 0, new Uint8Array(4*4*16));2092 this.expectError(gl.INVALID_VALUE);2093 gl.deleteTexture(texture);2094 }));2095 // gl.compressedTexSubImage3D2096 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d', 'Invalid gl.compressedTexSubImage3D() usage', gl,2097 function() {2098 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2099 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');2100 /** @type{WebGLTexture} */ var texture;2101 texture = gl.createTexture();2102 gl.compressedTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2103 this.expectError(gl.INVALID_ENUM);2104 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2105 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));2106 this.expectError (gl.NO_ERROR);2107 bufferedLogToConsole('gl.INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.');2108 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));2109 this.expectError(gl.INVALID_OPERATION);2110 bufferedLogToConsole('gl.INVALID_OPERATION is generated if internalformat is an ETC2/EAC format and target is not gl.TEXTURE_2D_ARRAY.');2111 gl.compressedTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 18, 18, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));2112 this.expectError(gl.INVALID_OPERATION);2113 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level.');2114 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 4, 0, 0, 10, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(10, 4)));2115 this.expectError(gl.INVALID_OPERATION);2116 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level.');2117 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 4, 0, 4, 10, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 10)));2118 this.expectError(gl.INVALID_OPERATION);2119 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.');2120 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 1, 0, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));2121 this.expectError(gl.INVALID_OPERATION);2122 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 1, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));2123 this.expectError(gl.INVALID_OPERATION);2124 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 1, 1, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));2125 this.expectError(gl.INVALID_OPERATION);2126 gl.deleteTexture(texture);2127 }));2128 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_level', 'Invalid gl.compressedTexSubImage3D() usage', gl,2129 function() {2130 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2131 /** @type{WebGLTexture} */ var texture;2132 texture = gl.createTexture();2133 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2134 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));2135 this.expectError (gl.NO_ERROR);2136 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');2137 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2138 this.expectError(gl.INVALID_VALUE);2139 gl.deleteTexture(texture);2140 }));2141 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_max_level', 'Invalid gl.compressedTexSubImage3D() usage', gl,2142 function() {2143 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2144 /** @type{WebGLTexture} */ var texture;2145 texture = gl.createTexture();2146 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2147 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));2148 this.expectError (gl.NO_ERROR);2149 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');2150 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;2151 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2152 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2153 gl.deleteTexture(texture);2154 }));2155 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_offset', 'Invalid gl.compressedTexSubImage3D() usage', gl,2156 function() {2157 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2158 /** @type{WebGLTexture} */ var texture;2159 texture = gl.createTexture();2160 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2161 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));2162 this.expectError (gl.NO_ERROR);2163 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset, yoffset or zoffset are negative.');2164 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -4, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2165 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2166 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, -4, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2167 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2168 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2169 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2170 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -4, -4, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2171 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2172 gl.deleteTexture(texture);2173 }));2174 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_invalid_offset', 'Invalid gl.compressedTexSubImage3D() usage', gl,2175 function() {2176 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2177 /** @type{WebGLTexture} */ var texture;2178 texture = gl.createTexture();2179 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2180 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));2181 this.expectError (gl.NO_ERROR);2182 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.');2183 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 12, 0, 0, 8, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 4)));2184 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2185 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 12, 0, 4, 8, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 8)));2186 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2187 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 12, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));2188 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2189 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 12, 12, 12, 8, 8, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));2190 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2191 gl.deleteTexture(texture);2192 }));2193 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_width_height_depth', 'Invalid gl.compressedTexSubImage3D() usage', gl,2194 function() {2195 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2196 /** @type{WebGLTexture} */ var texture;2197 texture = gl.createTexture();2198 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2199 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));2200 this.expectError (gl.NO_ERROR);2201 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if width, height or depth are negative.');2202 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2203 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2204 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, -4, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2205 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2206 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2207 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2208 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, -4, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2209 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);2210 gl.deleteTexture(texture);2211 }));2212 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_invalid_size', 'Invalid gl.compressedTexSubImage3D() usage', gl,2213 function() {2214 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2215 /** @type{WebGLTexture} */ var texture;2216 texture = gl.createTexture();2217 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);2218 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(4*4*16));2219 this.expectError (gl.NO_ERROR);2220 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');2221 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));2222 this.expectError(gl.INVALID_VALUE);2223 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(4*4*16-1));2224 this.expectError(gl.INVALID_VALUE);2225 gl.deleteTexture(texture);2226 }));2227 // gl.texStorage2D2228 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage2d', 'Invalid gl.texStorage2D() usage', gl,2229 function() {2230 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }2231 /** @type{WebGLTexture} */ var texture;2232 texture = gl.createTexture();2233 gl.bindTexture (gl.TEXTURE_2D, texture);2234 bufferedLogToConsole('gl.INVALID_ENUM or gl.INVALID_VALUE is generated if internalformat is not a valid sized internal format.');2235 gl.texStorage2D (gl.TEXTURE_2D, 1, 0, 16, 16);2236 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);2237 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA_INTEGER, 16, 16);2238 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);...

Full Screen

Full Screen

withTheme.js

Source:withTheme.js Github

copy

Full Screen

1// @flow2import React, { Component } from 'react';3import type { WithThemeProps } from '../../types';4import withTheme, { withContentTheme, withGlobalTheme } from '../../withTheme';5type FooProps = {6 ...$Exact<WithThemeProps>,7 alwaysRequired: string,8 optional?: string,9 requiredButHasDefault: string,10};11class Foo extends Component<FooProps> {12 static defaultProps = {13 requiredButHasDefault: 'default Yo',14 };15 render() {16 return null;17 }18}19const mockTheme = {20 mode: {21 globalItem: () => ({ itemBase: {}, itemWrapper: {}, badgeWrapper: {} }),22 globalNav: () => ({}),23 heading: () => ({ product: {}, container: {} }),24 item: () => ({ product: {}, container: {} }),25 contentNav: () => ({ product: {}, container: {} }),26 scrollHint: () => ({ product: {}, container: {} }),27 section: () => ({ product: {}, container: {} }),28 separator: () => ({ product: {}, container: {} }),29 skeletonItem: () => ({ product: {}, container: {} }),30 },31};32/**33 * Foo34 */35<Foo alwaysRequired="always" theme={mockTheme} />;36// $ExpectError - missing alwaysRequired37<Foo theme={mockTheme} />;38// $ExpectError - missing theme39<Foo alwaysRequired="always" />;40// $ExpectError - requiredButHasDefault wrong type41<Foo alwaysRequired="always" requiredButHasDefault={5} />;42// $ExpectError - optional wrong type43<Foo alwaysRequired="always" optional={5} />;44/**45 * FooWithTheme46 */47const FooWithTheme = withTheme()(Foo);48<FooWithTheme alwaysRequired="always" />;49// $ExpectError - missing alwaysRequired50<FooWithTheme />;51// $ExpectError - requiredButHasDefault wrong type52<FooWithTheme alwaysRequired="always" requiredButHasDefault={5} />;53// $ExpectError - optional wrong type54<FooWithTheme alwaysRequired="always" optional={5} />;55/**56 * FooWithContentTheme57 */58const FooWithContentTheme = withContentTheme(Foo);59<FooWithContentTheme alwaysRequired="always" />;60// $ExpectError - missing alwaysRequired61<FooWithContentTheme />;62// $ExpectError - requiredButHasDefault wrong type63<FooWithContentTheme alwaysRequired="always" requiredButHasDefault={5} />;64// $ExpectError - optional wrong type65<FooWithContentTheme alwaysRequired="always" optional={5} />;66/**67 * FooWithGlobalTheme68 */69const FooWithGlobalTheme = withGlobalTheme(Foo);70<FooWithGlobalTheme alwaysRequired="always" />;71// $ExpectError - missing alwaysRequired72<FooWithGlobalTheme />;73// $ExpectError - requiredButHasDefault wrong type74<FooWithGlobalTheme alwaysRequired="always" requiredButHasDefault={5} />;75// $ExpectError - optional wrong type76<FooWithGlobalTheme alwaysRequired="always" optional={5} />;77/**78 * FooWithDoubleTheme - will it work with multiple HOCs79 */80const FooWithDoubleTheme = withTheme()(withTheme()(Foo));81<FooWithDoubleTheme alwaysRequired="always" />;82// $ExpectError - missing alwaysRequired83<FooWithDoubleTheme />;84// $ExpectError - requiredButHasDefault wrong type85<FooWithDoubleTheme alwaysRequired="always" requiredButHasDefault={5} />;86// $ExpectError - optional wrong type87<FooWithDoubleTheme alwaysRequired="always" optional={5} />;88/**89 * FooWithDoubleContentTheme - will it work with multiple HOCs90 */91const FooWithDoubleContentTheme = withContentTheme(withContentTheme(Foo));92<FooWithDoubleContentTheme alwaysRequired="always" />;93// $ExpectError - missing alwaysRequired94<FooWithDoubleContentTheme />;95// $ExpectError - requiredButHasDefault wrong type96<FooWithDoubleContentTheme alwaysRequired="always" requiredButHasDefault={5} />;97// $ExpectError - optional wrong type98<FooWithDoubleContentTheme alwaysRequired="always" optional={5} />;99/**100 * FooWithDoubleGlobalTheme - will it work with multiple HOCs101 */102const FooWithDoubleGlobalTheme = withGlobalTheme(withGlobalTheme(Foo));103<FooWithDoubleGlobalTheme alwaysRequired="always" />;104// $ExpectError - missing alwaysRequired105<FooWithDoubleGlobalTheme />;106// $ExpectError - requiredButHasDefault wrong type107<FooWithDoubleGlobalTheme alwaysRequired="always" requiredButHasDefault={5} />;108// $ExpectError - optional wrong type109<FooWithDoubleGlobalTheme alwaysRequired="always" optional={5} />;110/**111 * Bar112 */113type BarProps = {114 theme: string,115};116class Bar extends Component<BarProps> {117 render() {118 return null;119 }120}121<Bar theme="test" />;122/**123 * BarWithTheme124 */125// $ExpectError - Bar props are incompatible with HOC injected prop126const BarWithTheme = withTheme()(Bar);...

Full Screen

Full Screen

letContextualKeyword.js

Source:letContextualKeyword.js Github

copy

Full Screen

1function expectError(str) {2 var log = "";3 try {4 eval(str);5 } catch (e) {6 log += "e";7 assertEq(e instanceof SyntaxError, true);8 }9 assertEq(log, "e");10}11eval(`let x = 42; assertEq(x, 42);`);12eval(`var let = 42; assertEq(let, 42);`);13eval(`let;`);14eval(`[...let] = [];`);15eval(`function let() { return 42; } assertEq(let(), 42);`)16eval(`let {x:x} = {x:42}; assertEq(x, 42);`);17eval(`let [x] = [42]; assertEq(x, 42);`);18eval(`for (let x in [1]) { assertEq(x, "0"); }`);19expectError(`for (const x in [1]) { assertEq(x, "0"); }`); // XXX bug 44981120eval(`for (let x of [1]) { assertEq(x, 1); }`);21expectError(`for (const x of [1]) { assertEq(x, 1); }`); // XXX bug 44981122eval(`for (let i = 0; i < 1; i++) { assertEq(i, 0); }`);23eval(`var done = false; for (const i = 0; !done; done = true) { assertEq(i, 0); }`);24eval(`for (let of of [1]) { assertEq(of, 1); }`);25expectError(`for (const of of [1]) { assertEq(of, 1); }`); // XXX bug 44981126eval(`try { throw 17; } catch (let) { assertEq(let, 17); }`);27eval(`try { throw [17]; } catch ([let]) { assertEq(let, 17); }`);28eval(`try { throw { x: 17 }; } catch ({ x: let }) { assertEq(let, 17); }`);29eval(`try { throw {}; } catch ({ x: let = 17 }) { assertEq(let, 17); }`);30expectError(`try { throw [17, 42]; } catch ([let, let]) {}`);31eval(`for (let in [1]) { assertEq(let, "0"); }`);32eval(`for (let / 1; ; ) { break; }`);33expectError(`let = {}; for (let.x of;;);`);34expectError(`for (let of [1]) { }`);35expectError(`for (let let in [1]) { }`);36expectError(`for (const let in [1]) { }`);37expectError(`for (let let of [1]) { }`);38expectError(`for (const let of [1]) { }`);39expectError(`for (let let = 17; false; ) { }`);40expectError(`for (const let = 17; false; ) { }`);41expectError(`for (let [let] = 17; false; ) { }`);42expectError(`for (const [let] = 17; false; ) { }`);43expectError(`for (let [let = 42] = 17; false; ) { }`);44expectError(`for (const [let = 42] = 17; false; ) { }`);45expectError(`for (let { x: let } = 17; false; ) { }`);46expectError(`for (const { x: let } = 17; false; ) { }`);47expectError(`for (let { x: let = 42 } = 17; false; ) { }`);48expectError(`for (const { x: let = 42 } = 17; false; ) { }`);49expectError("let\nlet;");50expectError("const\nlet;");51expectError(`let let = 17;`);52expectError(`const let = 17;`);53expectError(`let [let] = 17;`);54expectError(`const [let] = 17;`);55expectError(`let [let = 42] = 17;`);56expectError(`const [let = 42] = 17;`);57expectError(`let {let} = 17;`);58expectError(`const {let} = 17;`);59expectError(`let { let = 42 } = 17;`);60expectError(`const { let = 42 } = 17;`);61expectError(`let { x: let } = 17;`);62expectError(`const { x: let } = 17;`);63expectError(`let { x: let = 42 } = 17;`);64expectError(`const { x: let = 42 } = 17;`);65expectError(`let { ['y']: let } = 17;`);66expectError(`const { ['y']: let } = 17;`);67expectError(`let { ['y']: let = 42 } = 17;`);68expectError(`const { ['y']: let = 42 } = 17;`);69expectError(`let { x: [let] } = { x: 17 };`);70expectError(`const { x: [let] } = { x: 17 };`);71expectError(`let { x: [let = 42] } = { x: 17 };`);72expectError(`const { x: [let = 42] } = { x: 17 };`);73expectError(`let [foo, let] = 42;`);74expectError(`const [foo, let] = 42;`);75expectError(`let [foo, { let }] = [17, {}];`);76expectError(`const [foo, { let }] = [17, {}];`);77expectError(`"use strict"; var let = 42;`);78expectError(`"use strict"; function let() {}`);79expectError(`"use strict"; for (let of [1]) {}`);...

Full Screen

Full Screen

518f91d40a2fa1611abd13aafb71ba63.js

Source:518f91d40a2fa1611abd13aafb71ba63.js Github

copy

Full Screen

1load("201224b0d1c296b45befd2285e95dd42.js");2function expectError(str) {3 var log = "";4 try {5 eval(str);6 } catch (e) {7 log += "e";8 assertEq(e instanceof SyntaxError, true);9 }10 assertEq(log, "e");11}12eval(`let x = 42; assertEq(x, 42);`);13eval(`var let = 42; assertEq(let, 42);`);14eval(`let;`);15eval(`[...let] = [];`);16eval(`function let() { return 42; } assertEq(let(), 42);`)17eval(`let {x:x} = {x:42}; assertEq(x, 42);`);18eval(`let [x] = [42]; assertEq(x, 42);`);19eval(`for (let x in [1]) { assertEq(x, "0"); }`);20eval(`for (const x in [1]) { assertEq(x, "0"); }`);21eval(`for (let x of [1]) { assertEq(x, 1); }`);22eval(`for (const x of [1]) { assertEq(x, 1); }`);23eval(`for (let i = 0; i < 1; i++) { assertEq(i, 0); }`);24eval(`var done = false; for (const i = 0; !done; done = true) { assertEq(i, 0); }`);25eval(`for (let of of [1]) { assertEq(of, 1); }`);26eval(`for (const of of [1]) { assertEq(of, 1); }`);27eval(`try { throw 17; } catch (let) { assertEq(let, 17); }`);28eval(`try { throw [17]; } catch ([let]) { assertEq(let, 17); }`);29eval(`try { throw { x: 17 }; } catch ({ x: let }) { assertEq(let, 17); }`);30eval(`try { throw {}; } catch ({ x: let = 17 }) { assertEq(let, 17); }`);31expectError(`try { throw [17, 42]; } catch ([let, let]) {}`);32eval(`for (let in [1]) { assertEq(let, "0"); }`);33eval(`for (let / 1; ; ) { break; }`);34expectError(`let = {}; for (let.x of;;);`);35expectError(`for (let of [1]) { }`);36expectError(`for (let let in [1]) { }`);37expectError(`for (const let in [1]) { }`);38expectError(`for (let let of [1]) { }`);39expectError(`for (const let of [1]) { }`);40expectError(`for (let let = 17; false; ) { }`);41expectError(`for (const let = 17; false; ) { }`);42expectError(`for (let [let] = 17; false; ) { }`);43expectError(`for (const [let] = 17; false; ) { }`);44expectError(`for (let [let = 42] = 17; false; ) { }`);45expectError(`for (const [let = 42] = 17; false; ) { }`);46expectError(`for (let { x: let } = 17; false; ) { }`);47expectError(`for (const { x: let } = 17; false; ) { }`);48expectError(`for (let { x: let = 42 } = 17; false; ) { }`);49expectError(`for (const { x: let = 42 } = 17; false; ) { }`);50expectError("let\nlet;");51expectError("const\nlet;");52expectError(`let let = 17;`);53expectError(`const let = 17;`);54expectError(`let [let] = 17;`);55expectError(`const [let] = 17;`);56expectError(`let [let = 42] = 17;`);57expectError(`const [let = 42] = 17;`);58expectError(`let {let} = 17;`);59expectError(`const {let} = 17;`);60expectError(`let { let = 42 } = 17;`);61expectError(`const { let = 42 } = 17;`);62expectError(`let { x: let } = 17;`);63expectError(`const { x: let } = 17;`);64expectError(`let { x: let = 42 } = 17;`);65expectError(`const { x: let = 42 } = 17;`);66expectError(`let { ['y']: let } = 17;`);67expectError(`const { ['y']: let } = 17;`);68expectError(`let { ['y']: let = 42 } = 17;`);69expectError(`const { ['y']: let = 42 } = 17;`);70expectError(`let { x: [let] } = { x: 17 };`);71expectError(`const { x: [let] } = { x: 17 };`);72expectError(`let { x: [let = 42] } = { x: 17 };`);73expectError(`const { x: [let = 42] } = { x: 17 };`);74expectError(`let [foo, let] = 42;`);75expectError(`const [foo, let] = 42;`);76expectError(`let [foo, { let }] = [17, {}];`);77expectError(`const [foo, { let }] = [17, {}];`);78expectError(`"use strict"; var let = 42;`);79expectError(`"use strict"; function let() {}`);80expectError(`"use strict"; for (let of [1]) {}`);...

Full Screen

Full Screen

test_ext_manifest_omnibox.js

Source:test_ext_manifest_omnibox.js Github

copy

Full Screen

1/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */2/* vim: set sts=2 sw=2 et tw=80: */3"use strict";4async function testKeyword(params) {5 let normalized = await ExtensionTestUtils.normalizeManifest({6 "omnibox": {7 "keyword": params.keyword,8 },9 });10 if (params.expectError) {11 let expectedError = (12 String.raw`omnibox.keyword: String "${params.keyword}" ` +13 String.raw`must match /^[^?\s:]([^\s:]*[^/\s:])?$/`14 );15 ok(normalized.error.includes(expectedError),16 `The manifest error ${JSON.stringify(normalized.error)} ` +17 `must contain ${JSON.stringify(expectedError)}`);18 } else {19 equal(normalized.error, undefined, "Should not have an error");20 equal(normalized.errors.length, 0, "Should not have warnings");21 }22}23add_task(async function test_manifest_commands() {24 // accepted single character keywords25 await testKeyword({keyword: "a", expectError: false});26 await testKeyword({keyword: "-", expectError: false});27 await testKeyword({keyword: "嗨", expectError: false});28 await testKeyword({keyword: "*", expectError: false});29 await testKeyword({keyword: "/", expectError: false});30 // rejected single character keywords31 await testKeyword({keyword: "?", expectError: true});32 await testKeyword({keyword: " ", expectError: true});33 await testKeyword({keyword: ":", expectError: true});34 // accepted multi-character keywords35 await testKeyword({keyword: "aa", expectError: false});36 await testKeyword({keyword: "http", expectError: false});37 await testKeyword({keyword: "f?a", expectError: false});38 await testKeyword({keyword: "fa?", expectError: false});39 await testKeyword({keyword: "f/x", expectError: false});40 await testKeyword({keyword: "/fx", expectError: false});41 // rejected multi-character keywords42 await testKeyword({keyword: " a", expectError: true});43 await testKeyword({keyword: "a ", expectError: true});44 await testKeyword({keyword: " ", expectError: true});45 await testKeyword({keyword: " a ", expectError: true});46 await testKeyword({keyword: "?fx", expectError: true});47 await testKeyword({keyword: "fx/", expectError: true});48 await testKeyword({keyword: "f:x", expectError: true});49 await testKeyword({keyword: "fx:", expectError: true});50 await testKeyword({keyword: "f x", expectError: true});51 // miscellaneous tests52 await testKeyword({keyword: "こんにちは", expectError: false});53 await testKeyword({keyword: "http://", expectError: true});...

Full Screen

Full Screen

withNavigationUIController.js

Source:withNavigationUIController.js Github

copy

Full Screen

1// @flow2import React, { Component } from 'react';3import UIController from '../../UIController';4import withNavigationUIController from '../../withNavigationUIController';5import type { WithNavigationUIControllerProps } from '../../types';6type FooProps = {7 ...$Exact<WithNavigationUIControllerProps>,8 alwaysRequired: string,9 optional?: string,10 requiredButHasDefault: string,11};12class Foo extends Component<FooProps> {13 static defaultProps = {14 requiredButHasDefault: 'default Yo',15 };16 render() {17 return null;18 }19}20/**21 * Foo22 */23<Foo24 alwaysRequired="always"25 navigationUIController={new UIController({}, false)}26/>;27// $ExpectError - missing alwaysRequired28<Foo navigationUIController={new UIController({}, false)} />;29// $ExpectError - missing navigationUIController30<Foo alwaysRequired="always" />;31// $ExpectError - requiredButHasDefault wrong type32<Foo alwaysRequired="always" requiredButHasDefault={5} />;33// $ExpectError - optional wrong type34<Foo alwaysRequired="always" optional={5} />;35/**36 * FoowithNavigationUIController37 */38const FoowithNavigationUIController = withNavigationUIController(Foo);39<FoowithNavigationUIController alwaysRequired="always" />;40// $ExpectError - missing alwaysRequired41<FoowithNavigationUIController />;42// $ExpectError - requiredButHasDefault wrong type43<FoowithNavigationUIController44 alwaysRequired="always"45 requiredButHasDefault={5}46/>;47// $ExpectError - optional wrong type48<FoowithNavigationUIController alwaysRequired="always" optional={5} />;49/**50 * Double Trouble51 */52const FooDoubleTrouble = withNavigationUIController(53 withNavigationUIController(Foo),54);55<FooDoubleTrouble alwaysRequired="always" />;56// $ExpectError - missing alwaysRequired57<FooDoubleTrouble />;58// $ExpectError - requiredButHasDefault wrong type59<FooDoubleTrouble alwaysRequired="always" requiredButHasDefault={5} />;60// $ExpectError - optional wrong type61<FooDoubleTrouble alwaysRequired="always" optional={5} />;62/**63 * Bar64 */65type BarProps = {66 navigationUIController: string,67};68class Bar extends Component<BarProps> {69 render() {70 return null;71 }72}73<Bar navigationUIController="test" />;74/**75 * BarWithNavigationUIController76 */77// $ExpectError - Bar props are incompatible with HOC injected prop78const BarWithNavigationUIController = withNavigationUIController(Bar);...

Full Screen

Full Screen

_flow.js

Source:_flow.js Github

copy

Full Screen

1// @flow2import chalk from '..';3// $ExpectError (Can't have typo in option name)4new chalk.Instance({levl: 1});5new chalk.Instance({level: 1});6// $ExpectError (Option must have proper type)7new chalk.Instance({enabled: 'true'});8new chalk.Instance({enabled: true});9// $ExpectError (Can't have typo in chalk method)10chalk.rd('foo');11chalk.red('foo');12// $ExpectError (Can't have typo in chalk method)13chalk.gren`foo`;14chalk.green`foo`;15// $ExpectError (Can't have typo in chalk method)16chalk.red.bgBlu.underline('foo');17chalk.red.bgBlue.underline('foo');18// $ExpectError (Level must be 0, 1, 2, or 3)19const badCtx = chalk.Instance({level: 4});20const ctx = chalk.Instance({level: 3});21// $ExpectError (Can't have typo in method name)22ctx.gry('foo');23ctx.grey('foo');24// $ExpectError (Can't have typo in method name)25ctx`foo`.value();26ctx`foo`.valueOf();27// $ExpectError (Can't have typo in property name)28chalk.abled = true;29chalk.enabled = true;30// $ExpectError (Can't use invalid Level for property setter)31chalk.level = 10;32chalk.level = 1;33const chalkInstance = new chalk.Instance();34// $ExpectError (Can't have typo in method name)35chalkInstance.blu('foo');36chalkInstance.blue('foo');37chalkInstance`foo`;38// $ExpectError (Can't have typo in method name)39chalk.keywrd('orange').bgBlue('foo');40chalk.keyword('orange').bgBlue('foo');41// $ExpectError (rgb should take in 3 numbers)42chalk.rgb(1, 14).bgBlue('foo');43chalk.rgb(1, 14, 9).bgBlue('foo');44// $ExpectError (hsl should take in 3 numbers)45chalk.hsl(1, 14, '9').bgBlue('foo');46chalk.hsl(1, 14, 9).bgBlue('foo');47// $ExpectError (hsv should take in 3 numbers)48chalk.hsv(1, 14).bgBlue('foo');49chalk.hsv(1, 14, 9).bgBlue('foo');50// $ExpectError (hwb should take in 3 numbers)51chalk.hwb(1, 14).bgBlue('foo');52chalk.hwb(1, 14, 9).bgBlue('foo');53// $ExpectError (Can't have typo in method name)54chalk.visibl('foo');55chalk.visible('foo');56// $ExpectError (Can't have typo in method name)57chalk.red.visibl('foo');58chalk.red.visible('foo');59chalk.visible.red('foo');60// $ExpectError (Can't write to readonly property)61chalk.black = 'foo';62chalk.black;63// $ExpectError (Can't write to readonly property)64chalk.reset = 'foo';...

Full Screen

Full Screen

hocs.js

Source:hocs.js Github

copy

Full Screen

1// @flow2import React, { Component } from 'react';3import { withAnalyticsEvents, withAnalyticsContext } from '../../index';4type FooProps = {5 alwaysRequired: string,6 optional?: string,7 requiredButHasDefault: string,8};9class Foo extends Component<FooProps> {10 static defaultProps = {11 requiredButHasDefault: 'default Yo',12 };13 render() {14 return null;15 }16}17/**18 * Foo19 */20<Foo alwaysRequired="always" />;21// $ExpectError - missing alwaysRequired22<Foo />;23// $ExpectError - requiredButHasDefault wrong type24<Foo alwaysRequired="always" requiredButHasDefault={5} />;25// $ExpectError - optional wrong type26<Foo alwaysRequired="always" optional={5} />;27/**28 * FooWithAnalyticsEvents29 */30const FooWithAnalyticsEvents = withAnalyticsEvents()(Foo);31<FooWithAnalyticsEvents alwaysRequired="always" />;32// $ExpectError - missing alwaysRequired33<FooWithAnalyticsEvents />;34// $ExpectError - requiredButHasDefault wrong type35<FooWithAnalyticsEvents alwaysRequired="always" requiredButHasDefault={5} />;36// $ExpectError - optional wrong type37<FooWithAnalyticsEvents alwaysRequired="always" optional={5} />;38/**39 * FooWithAnalyticsContext40 */41const FooWithAnalyticsContext = withAnalyticsContext()(Foo);42<FooWithAnalyticsContext alwaysRequired="always" />;43// $ExpectError - missing alwaysRequired44<FooWithAnalyticsContext />;45// $ExpectError - requiredButHasDefault wrong type46<FooWithAnalyticsContext alwaysRequired="always" requiredButHasDefault={5} />;47// $ExpectError - optional wrong type48<FooWithAnalyticsContext alwaysRequired="always" optional={5} />;49/**50 * FooWithAnalyticsEventsAndContext51 */52const FooWithAnalyticsEventsAndContext = withAnalyticsContext()(53 withAnalyticsEvents()(Foo),54);55<FooWithAnalyticsEventsAndContext alwaysRequired="always" />;56// $ExpectError - missing alwaysRequired57<FooWithAnalyticsEventsAndContext />;58// $ExpectError - requiredButHasDefault wrong type59<FooWithAnalyticsEventsAndContext60 alwaysRequired="always"61 requiredButHasDefault={5}62/>;63// $ExpectError - optional wrong type...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('@playwright/test');2const { expectError } = require('@playwright/test');3const { expectError } = require('@playwright/test');4const { test, expect } = require('@playwright/test');5test('should display error message when username is empty', async ({ page }) => {6 await page.click('text=Log in');7 await expect(page).toHaveText('Please enter both username and password');8});9test('should display error message when password is empty', async ({ page }) => {10 await page.fill('input[name="username"]', 'username');11 await page.click('text=Log in');12 await expect(page).toHaveText('Please enter both username and password');13});14test('should display error message when username and password are empty', async ({ page }) => {15 await page.click('text=Log in');16 await expect(page).toHaveText('Please enter both username and password');17});18test('should display error message when username and password are incorrect', async ({ page }) => {19 await page.fill('input[name="username"]', 'username');20 await page.fill('input[name="password"]', 'password');21 await page.click('text=Log in');22 await expect(page).toHaveText('Username and password do not match any user in this service');23});24test('should display error message when password is incorrect', async ({ page }) => {25 await page.fill('input[name="username"]', 'username');26 await page.fill('input[name="password"]', 'password');27 await page.click('text=Log in');28 await expect(page).toHaveText('Username and password do not match any user in this service');29});30test('should display error message when username is incorrect', async ({ page }) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('@playwright/test');2const { expect } = require('@playwright/test');3const { test } = require('@playwright/test');4test('should display error message', async ({ page }) => {5 await page.click('text=Sign in');6 await page.waitForSelector('input[type="email"]');7 await page.click('input[type="email"]');8 await page.fill('input[type="email"]', '

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('playwright');2const { test, expect } = require('@playwright/test');3test('test', async ({ page }) => {4 const title = await page.$('title');5 const text = await title.innerText();6 expectError(text === 'Playwright', 'Title does not match');7});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('@playwright/test');2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 await expectError('Error', page, () => page.click('non-existing'));5});6const { expect } = require('@playwright/test');7const { test } = require('@playwright/test');8test('test', async ({ page }) => {9 await expect(page).toHaveSelector('non-existing');10});11const { test } = require('@playwright/test');12test('test', async ({ page }) => {13 await page.click('non-existing');14});15const { test } = require('@playwright/test');16test('test', async ({ page }) => {17 await page.click('non-existing');18});19const { test } = require('@playwright/test');20test('test', async ({ page }) => {21 await page.click('non-existing');22});23const { test } = require('@playwright/test');24test('test', async ({ page }) => {25 await page.click('non-existing');26});27const { test } = require('@playwright/test');28test('test', async ({ page }) => {29 await page.click('non-existing');30});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('@playwright/test');2test('should fail', async ({ page }) => {3 await expectError('error', async () => {4 await page.waitForSelector('text=non-existing');5 });6});7const { expect } = require('@playwright/test');8test('should fail', async ({ page }) => {9 await expect(page).toHaveSelector('text=non-existing');10});11const { expect } = require('@playwright/test');12test('should fail', async ({ page }) => {13 await expect(page).toHaveSelector('text=non-existing');14});15const { expect } = require('@playwright/test');16test('should fail', async ({ page }) => {17 await expect(page).toHaveSelector('text=non-existing');18});19const { expect } = require('@playwright/test');20test('should fail', async ({ page }) => {21 await expect(page).toHaveSelector('text=non-existing');22});23const { expect } = require('@playwright/test');24test('should fail', async ({ page }) => {25 await expect(page).toHaveSelector('text=non-existing');26});27const { expect } = require('@playwright/test');28test('should fail', async ({ page }) => {29 await expect(page).toHaveSelector('text=non-existing');30});31const { expect } = require('@playwright/test');32test('should fail', async ({ page }) => {33 await expect(page).toHaveSelector('text=non-existing');34});35const { expect } = require('@playwright/test');36test('

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('playwright/lib/internal/utils/utils');2const { test } = require('@playwright/test');3test('should fail', async ({ page }) => {4 expectError(new Error('test error'));5});6 at Object.<anonymous> (/Users/username/playwright-test/test.js:6:13)7 at runMicrotasks (<anonymous>)8 at processTicksAndRejections (internal/process/task_queues.js:93:5)9 at async Object.<anonymous> (/Users/username/playwright-test/test.js:9:1)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('playwright');2const { expect } = require('chai');3const { test } = require('playwright');4test('Test to verify error message', async ({ page }) => {5 await expectError(async () => {6 await page.click('no-such-element');7 }, 'No node found for selector: no-such-element');8});9test('Test to verify error message', async ({ page }) => {10 await expectError(async () => {11 await page.click('no-such-element');12 }, /No node found for selector/);13});14test('Test to verify error message', async ({ page }) => {15 await expectError(async () => {16 await page.click('no-such-element');17 }, error => error.message.includes('No node found for selector'));18});19test('Test to verify error message', async ({ page }) => {20 await expectError(async () => {21 await page.click('no-such-element');22 }, error => error.message.includes('No node found for selector') && error.message.includes('no-such-element'));23});24test('Test to verify error message', async ({ page }) => {25 await expectError(async () => {26 await page.click('no-such-element');27 }, error => error.message.includes('No node found for selector') && error.message.includes('no-such-element') && error.message.includes('page.click'));28});29test('Test to verify error message', async ({ page }) => {30 await expectError(async () => {31 await page.click('no-such-element');32 }, error => error.message.includes('No node found for selector') && error.message.includes('no-such-element') && error.message.includes('page.click') && error.message.includes('test.js'));33});34test('Test to verify error message', async ({ page }) => {35 await expectError(async () => {36 await page.click('no-such-element');37 }, error => error

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectError } = require('playwright/lib/internal/stackTrace');2const { expect } = require('chai');3it('should throw error', async function () {4 await expectError('foo', async () => {5 });6});7const { expect } = require('playwright/lib/internal/stackTrace');8const { expect } = require('chai');9it('should throw error', async function () {10});11const { expect } = require('playwright/lib/internal/stackTrace');12const { expect } = require('chai');13it('should throw error', async function () {14});15const { expect } = require('playwright/lib/internal/stackTrace');16const { expect } = require('chai');17it('should throw error', async function () {18});19const { expect } = require('playwright/lib/internal/stackTrace');20const { expect } = require('chai');21it('should throw error', async function () {22});23const { expect } = require('playwright/lib/internal/stackTrace');24const { expect } = require('chai');25it('should throw error', async function () {26});27const { expect } = require('playwright/lib/internal/stackTrace');28const { expect } = require('chai');29it('should throw error', async function () {30});31const { expect } = require('playwright/lib/internal/stackTrace');32const { expect } = require('chai');33it('should throw error', async function () {34 await expect(page.goto('http

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful