Index: conformance/state/gl-geterror.html |
=================================================================== |
--- conformance/state/gl-geterror.html (revision 0) |
+++ conformance/state/gl-geterror.html (revision 0) |
@@ -0,0 +1,77 @@ |
+<!-- |
+Copyright (c) 2009 The Chromium Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style license that can be |
+ found in the LICENSE file. |
+ --> |
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
+ "http://www.w3.org/TR/html4/loose.dtd"> |
+<html> |
+<head> |
+<title>WebGL get error conformance test.</title> |
+<link rel="stylesheet" href="../../resources/js-test-style.css"/> |
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> |
+<script src="../../resources/js-test-pre.js"></script> |
+<script src="../resources/webgl-test.js"> </script> |
+<script src="../resources/webgl-test-utils.js"> </script> |
+</head> |
+<body> |
+<canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></canvas> |
+<div id="description"></div><div id="console"></div> |
+<script> |
+description("Test getError."); |
+var wtu = WebGLTestUtils; |
+var canvas = document.getElementById("example"); |
+var gl = wtu.create3DContext(canvas); |
+var tex = gl.createTexture(); |
+gl.bindTexture(gl.TEXTURE_2D, tex); |
+ |
+gl.enable(desktopGL.ALPHA_TEST); |
+glErrorShouldBe(gl, gl.INVALID_ENUM, "should generate INVALID_ENUM"); |
+gl.viewport(-1, -1, -1, -1); |
+glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE"); |
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "should generate INVALID_OPERATION"); |
+ |
+// Generate 2 errors of each type for 6 total possible errors. |
+// The OpenGL ES 2.0 spec section 2.5 says the implementation is allowed to |
+// either return the first error or many errors in an unspecied order. |
+gl.viewport(-1, -1, -1, -1); |
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
+gl.enable(desktopGL.ALPHA_TEST); |
+gl.viewport(-1, -1, -1, -1); |
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); |
+// Note: This error is specifically last because we know it will be synthasized |
+// by WebGL at least when implemented on top of Desktop OpenGL |
+gl.enable(desktopGL.ALPHA_TEST); |
+ |
+var err1 = gl.getError(); |
+var err2 = gl.getError(); |
+var err3 = gl.getError(); |
+var err4 = gl.getError(); |
+var err5 = gl.getError(); |
+var err6 = gl.getError(); |
+ |
+debug(""); |
+if (err2 == gl.NO_ERROR) { |
+ debug("This WebGL implementation looks like it uses the 'first error' method"); |
+ debug("There should be 1 error, the first one generated"); |
+ shouldBeTrue('err1 == gl.INVALID_VALUE && err2 == gl.NO_ERROR && err3 == gl.NO_ERROR'); |
+} else { |
+ debug("This WebGL implementation looks like it uses the many error method"); |
+ debug("Check is that at least one of the errors is the first error"); |
+ shouldBeTrue('err1 == gl.INVALID_VALUE || ' + |
+ 'err2 == gl.INVALID_VALUE || ' + |
+ 'err3 == gl.INVALID_VALUE || ' + |
+ 'err4 == gl.INVALID_VALUE || ' + |
+ 'err5 == gl.INVALID_VALUE || ' + |
+ 'err6 == gl.INVALID_VALUE'); |
+ shouldBeTrue('gl.getError() == gl.NO_ERROR'); |
+} |
+ |
+debug(""); |
+successfullyParsed = true; |
+</script> |
+<script src="../../resources/js-test-post.js"></script> |
+</body> |
+</html> |
+ |
Property changes on: conformance/state/gl-geterror.html |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |