Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2009 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
michael@0 | 7 | "http://www.w3.org/TR/html4/loose.dtd"> |
michael@0 | 8 | <html> |
michael@0 | 9 | <head> |
michael@0 | 10 | <title>WebGL get error conformance test.</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 12 | <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> |
michael@0 | 13 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 14 | <script src="../resources/webgl-test.js"> </script> |
michael@0 | 15 | <script src="../resources/webgl-test-utils.js"> </script> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></canvas> |
michael@0 | 19 | <div id="description"></div><div id="console"></div> |
michael@0 | 20 | <script> |
michael@0 | 21 | description("Test getError."); |
michael@0 | 22 | var wtu = WebGLTestUtils; |
michael@0 | 23 | var gl = wtu.create3DContext("example"); |
michael@0 | 24 | var tex = gl.createTexture(); |
michael@0 | 25 | gl.bindTexture(gl.TEXTURE_2D, tex); |
michael@0 | 26 | |
michael@0 | 27 | gl.enable(desktopGL.ALPHA_TEST); |
michael@0 | 28 | glErrorShouldBe(gl, gl.INVALID_ENUM, "should generate INVALID_ENUM"); |
michael@0 | 29 | gl.viewport(-1, -1, -1, -1); |
michael@0 | 30 | glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE"); |
michael@0 | 31 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
michael@0 | 32 | glErrorShouldBe(gl, gl.INVALID_OPERATION, "should generate INVALID_OPERATION"); |
michael@0 | 33 | |
michael@0 | 34 | // Generate 2 errors of each type for 6 total possible errors. |
michael@0 | 35 | // The OpenGL ES 2.0 spec section 2.5 says the implementation is allowed to |
michael@0 | 36 | // either return the first error or many errors in an unspecied order. |
michael@0 | 37 | gl.viewport(-1, -1, -1, -1); |
michael@0 | 38 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
michael@0 | 39 | gl.enable(desktopGL.ALPHA_TEST); |
michael@0 | 40 | gl.viewport(-1, -1, -1, -1); |
michael@0 | 41 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
michael@0 | 42 | // Note: This error is specifically last because we know it will be synthasized |
michael@0 | 43 | // by WebGL at least when implemented on top of Desktop OpenGL |
michael@0 | 44 | gl.enable(desktopGL.ALPHA_TEST); |
michael@0 | 45 | |
michael@0 | 46 | var err1 = gl.getError(); |
michael@0 | 47 | var err2 = gl.getError(); |
michael@0 | 48 | var err3 = gl.getError(); |
michael@0 | 49 | var err4 = gl.getError(); |
michael@0 | 50 | var err5 = gl.getError(); |
michael@0 | 51 | var err6 = gl.getError(); |
michael@0 | 52 | |
michael@0 | 53 | debug(""); |
michael@0 | 54 | if (err2 == gl.NO_ERROR) { |
michael@0 | 55 | debug("This WebGL implementation looks like it uses the 'first error' method"); |
michael@0 | 56 | debug("There should be 1 error, the first one generated"); |
michael@0 | 57 | shouldBeTrue('err1 == gl.INVALID_VALUE && err2 == gl.NO_ERROR && err3 == gl.NO_ERROR'); |
michael@0 | 58 | } else { |
michael@0 | 59 | debug("This WebGL implementation looks like it uses the many error method"); |
michael@0 | 60 | debug("Check is that at least one of the errors is the first error"); |
michael@0 | 61 | shouldBeTrue('err1 == gl.INVALID_VALUE || ' + |
michael@0 | 62 | 'err2 == gl.INVALID_VALUE || ' + |
michael@0 | 63 | 'err3 == gl.INVALID_VALUE || ' + |
michael@0 | 64 | 'err4 == gl.INVALID_VALUE || ' + |
michael@0 | 65 | 'err5 == gl.INVALID_VALUE || ' + |
michael@0 | 66 | 'err6 == gl.INVALID_VALUE'); |
michael@0 | 67 | shouldBeTrue('gl.getError() == gl.NO_ERROR'); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | debug(""); |
michael@0 | 71 | successfullyParsed = true; |
michael@0 | 72 | </script> |
michael@0 | 73 | <script>finishTest();</script> |
michael@0 | 74 | </body> |
michael@0 | 75 | </html> |
michael@0 | 76 |