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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/state/gl-geterror.html

Issue 10399113: Roll webgl conformance tests to r17874: part 2, adding r17874 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 7 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27
28 <!DOCTYPE html>
29 <html>
30 <head>
31 <meta charset="utf-8">
32 <title>WebGL get error conformance test.</title>
33 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
34 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
35 <script src="../../resources/js-test-pre.js"></script>
36 <script src="../resources/webgl-test.js"> </script>
37 <script src="../resources/webgl-test-utils.js"> </script>
38 </head>
39 <body>
40 <canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></ canvas>
41 <div id="description"></div><div id="console"></div>
42 <script>
43 description("Test getError.");
44 var wtu = WebGLTestUtils;
45 var gl = wtu.create3DContext("example");
46 var tex = gl.createTexture();
47 gl.bindTexture(gl.TEXTURE_2D, tex);
48
49 gl.enable(desktopGL.ALPHA_TEST);
50 glErrorShouldBe(gl, gl.INVALID_ENUM, "should generate INVALID_ENUM");
51 gl.viewport(-1, -1, -1, -1);
52 glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE");
53 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
54 glErrorShouldBe(gl, gl.INVALID_OPERATION, "should generate INVALID_OPERATION");
55
56 // Generate 2 errors of each type for 6 total possible errors.
57 // The OpenGL ES 2.0 spec section 2.5 says the implementation is allowed to
58 // either return the first error or many errors in an unspecied order.
59 gl.viewport(-1, -1, -1, -1);
60 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
61 gl.enable(desktopGL.ALPHA_TEST);
62 gl.viewport(-1, -1, -1, -1);
63 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
64 // Note: This error is specifically last because we know it will be synthasized
65 // by WebGL at least when implemented on top of Desktop OpenGL
66 gl.enable(desktopGL.ALPHA_TEST);
67
68 var err1 = gl.getError();
69 var err2 = gl.getError();
70 var err3 = gl.getError();
71 var err4 = gl.getError();
72 var err5 = gl.getError();
73 var err6 = gl.getError();
74
75 debug("");
76 if (err2 == gl.NO_ERROR) {
77 debug("This WebGL implementation looks like it uses the 'first error' method") ;
78 debug("There should be 1 error, the first one generated");
79 shouldBeTrue('err1 == gl.INVALID_VALUE && err2 == gl.NO_ERROR && err3 == gl.NO _ERROR');
80 } else {
81 debug("This WebGL implementation looks like it uses the many error method");
82 debug("Check is that at least one of the errors is the first error");
83 shouldBeTrue('err1 == gl.INVALID_VALUE || ' +
84 'err2 == gl.INVALID_VALUE || ' +
85 'err3 == gl.INVALID_VALUE || ' +
86 'err4 == gl.INVALID_VALUE || ' +
87 'err5 == gl.INVALID_VALUE || ' +
88 'err6 == gl.INVALID_VALUE');
89 shouldBeTrue('gl.getError() == gl.NO_ERROR');
90 }
91
92 debug("");
93 successfullyParsed = true;
94 </script>
95 <script src="../../resources/js-test-post.js"></script>
96 </body>
97 </html>
98
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698