Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: conformance/state/gl-geterror.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « conformance/state/gl-get-calls.html ('k') | conformance/state/gl-getstring.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7 "http://www.w3.org/TR/html4/loose.dtd">
8 <html>
9 <head>
10 <title>WebGL get error conformance test.</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
13 <script src="../../resources/js-test-pre.js"></script>
14 <script src="../resources/webgl-test.js"> </script>
15 <script src="../resources/webgl-test-utils.js"> </script>
16 </head>
17 <body>
18 <canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></ canvas>
19 <div id="description"></div><div id="console"></div>
20 <script>
21 description("Test getError.");
22 var wtu = WebGLTestUtils;
23 var canvas = document.getElementById("example");
24 var gl = wtu.create3DContext(canvas);
25 var tex = gl.createTexture();
26 gl.bindTexture(gl.TEXTURE_2D, tex);
27
28 gl.enable(desktopGL.ALPHA_TEST);
29 glErrorShouldBe(gl, gl.INVALID_ENUM, "should generate INVALID_ENUM");
30 gl.viewport(-1, -1, -1, -1);
31 glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE");
32 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
33 glErrorShouldBe(gl, gl.INVALID_OPERATION, "should generate INVALID_OPERATION");
34
35 // Generate 2 errors of each type for 6 total possible errors.
36 // The OpenGL ES 2.0 spec section 2.5 says the implementation is allowed to
37 // either return the first error or many errors in an unspecied order.
38 gl.viewport(-1, -1, -1, -1);
39 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
40 gl.enable(desktopGL.ALPHA_TEST);
41 gl.viewport(-1, -1, -1, -1);
42 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
43 // Note: This error is specifically last because we know it will be synthasized
44 // by WebGL at least when implemented on top of Desktop OpenGL
45 gl.enable(desktopGL.ALPHA_TEST);
46
47 var err1 = gl.getError();
48 var err2 = gl.getError();
49 var err3 = gl.getError();
50 var err4 = gl.getError();
51 var err5 = gl.getError();
52 var err6 = gl.getError();
53
54 debug("");
55 if (err2 == gl.NO_ERROR) {
56 debug("This WebGL implementation looks like it uses the 'first error' method") ;
57 debug("There should be 1 error, the first one generated");
58 shouldBeTrue('err1 == gl.INVALID_VALUE && err2 == gl.NO_ERROR && err3 == gl.NO _ERROR');
59 } else {
60 debug("This WebGL implementation looks like it uses the many error method");
61 debug("Check is that at least one of the errors is the first error");
62 shouldBeTrue('err1 == gl.INVALID_VALUE || ' +
63 'err2 == gl.INVALID_VALUE || ' +
64 'err3 == gl.INVALID_VALUE || ' +
65 'err4 == gl.INVALID_VALUE || ' +
66 'err5 == gl.INVALID_VALUE || ' +
67 'err6 == gl.INVALID_VALUE');
68 shouldBeTrue('gl.getError() == gl.NO_ERROR');
69 }
70
71 debug("");
72 successfullyParsed = true;
73 </script>
74 <script src="../../resources/js-test-post.js"></script>
75 </body>
76 </html>
77
OLDNEW
« no previous file with comments | « conformance/state/gl-get-calls.html ('k') | conformance/state/gl-getstring.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698