Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <meta charset="utf-8"> |
michael@0 | 5 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 6 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 7 | <script src="../resources/webgl-test.js"></script> |
michael@0 | 8 | <script src="../resources/webgl-test-utils.js"></script> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
michael@0 | 11 | <canvas id="testbed" width="16" height="16"></canvas> |
michael@0 | 12 | <canvas id="c" width="16" height="16"></canvas> |
michael@0 | 13 | <div id="description"></div> |
michael@0 | 14 | <div id="console"></div> |
michael@0 | 15 | <script> |
michael@0 | 16 | description('Tests texSubImage2D with bad arguments'); |
michael@0 | 17 | |
michael@0 | 18 | var wtu = WebGLTestUtils; |
michael@0 | 19 | var c = document.getElementById("c"); |
michael@0 | 20 | |
michael@0 | 21 | var gl = wtu.create3DContext("testbed"); |
michael@0 | 22 | var tex = gl.createTexture(); |
michael@0 | 23 | gl.bindTexture(gl.TEXTURE_2D, tex); |
michael@0 | 24 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 25 | glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); |
michael@0 | 26 | |
michael@0 | 27 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 28 | glErrorShouldBe(gl, gl.INVALID_VALUE, "y + height > texture height"); |
michael@0 | 29 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 30 | glErrorShouldBe(gl, gl.INVALID_VALUE, "x + width > texture width"); |
michael@0 | 31 | gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 32 | glErrorShouldBe(gl, gl.INVALID_VALUE, "negative x"); |
michael@0 | 33 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 34 | glErrorShouldBe(gl, gl.INVALID_VALUE, "negative y"); |
michael@0 | 35 | gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 36 | glErrorShouldBe(gl, gl.INVALID_VALUE, "negative level"); |
michael@0 | 37 | gl.texSubImage2D(gl.FLOAT, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 38 | glErrorShouldBe(gl, gl.INVALID_ENUM, "bad target"); |
michael@0 | 39 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 40 | glErrorShouldBe(gl, gl.NO_ERROR, "good args"); |
michael@0 | 41 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); |
michael@0 | 42 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original"); |
michael@0 | 43 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); |
michael@0 | 44 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original"); |
michael@0 | 45 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, c); |
michael@0 | 46 | glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGB"); |
michael@0 | 47 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); |
michael@0 | 48 | glErrorShouldBe(gl, gl.NO_ERROR, "format same as original RGB"); |
michael@0 | 49 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 50 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original RGB"); |
michael@0 | 51 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_SHORT_5_6_5, c); |
michael@0 | 52 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original RGB"); |
michael@0 | 53 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); |
michael@0 | 54 | glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGBA 4_4_4_4"); |
michael@0 | 55 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); |
michael@0 | 56 | glErrorShouldBe(gl, gl.NO_ERROR, "format same as original RGBA 4_4_4_4"); |
michael@0 | 57 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); |
michael@0 | 58 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original RGBA 4_4_4_4"); |
michael@0 | 59 | gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); |
michael@0 | 60 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original RGBA 4_4_4_4"); |
michael@0 | 61 | |
michael@0 | 62 | successfullyParsed = true; |
michael@0 | 63 | </script> |
michael@0 | 64 | <script>finishTest();</script> |
michael@0 | 65 | </body> |
michael@0 | 66 | </html> |