OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
3 | |
4 Redistribution and use in source and binary forms, with or without | |
5 modification, are permitted provided that the following conditions are | |
6 met: | |
7 | |
8 * Redistributions of source code must retain the above copyright | |
9 notice, this list of conditions and the following disclaimer. | |
10 * Redistributions in binary form must reproduce the above | |
11 copyright notice, this list of conditions and the following disclaimer | |
12 in the documentation and/or other materials provided with the | |
13 distribution. | |
14 * Neither the name of Google Inc. nor the names of its | |
15 contributors may be used to endorse or promote products derived from | |
16 this software without specific prior written permission. | |
17 | |
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 --> | |
30 <!DOCTYPE html> | |
31 <html> | |
32 <head> | |
33 <meta charset="utf-8"> | |
34 <link rel="stylesheet" href="../../resources/js-test-style.css"/> | |
35 <script src="../../resources/js-test-pre.js"></script> | |
36 <script src="../resources/webgl-test.js"></script> | |
37 </head> | |
38 <body> | |
39 <div id="description"></div> | |
40 <div id="console"></div> | |
41 | |
42 <script> | |
43 description("Tests generation of synthetic and real GL errors"); | |
44 | |
45 var context = create3DContext(); | |
46 var program = loadStandardProgram(context); | |
47 | |
48 // Other tests in this directory like getActiveTest and | |
49 // incorrect-context-object-behaviour already test the raising of many | |
50 // synthetic GL errors. This test verifies the raising of certain | |
51 // known real GL errors, and contains a few regression tests for bugs | |
52 // discovered in the synthetic error generation and in the WebGL | |
53 // implementation itself. | |
54 | |
55 glErrorShouldBe(context, context.NO_ERROR); | |
56 | |
57 debug("Testing getActiveAttrib"); | |
58 // Synthetic OpenGL error | |
59 shouldBeNull("context.getActiveAttrib(null, 2)"); | |
60 glErrorShouldBe(context, context.INVALID_VALUE); | |
61 // Error state should be clear by this point | |
62 glErrorShouldBe(context, context.NO_ERROR); | |
63 // Real OpenGL error | |
64 shouldBeNull("context.getActiveAttrib(program, 2)"); | |
65 glErrorShouldBe(context, context.INVALID_VALUE); | |
66 // Error state should be clear by this point | |
67 glErrorShouldBe(context, context.NO_ERROR); | |
68 | |
69 debug("Testing getActiveUniform"); | |
70 // Synthetic OpenGL error | |
71 shouldBeNull("context.getActiveUniform(null, 0)"); | |
72 glErrorShouldBe(context, context.INVALID_VALUE); | |
73 // Error state should be clear by this point | |
74 glErrorShouldBe(context, context.NO_ERROR); | |
75 // Real OpenGL error | |
76 shouldBeNull("context.getActiveUniform(program, 50)"); | |
77 glErrorShouldBe(context, context.INVALID_VALUE); | |
78 // Error state should be clear by this point | |
79 glErrorShouldBe(context, context.NO_ERROR); | |
80 | |
81 debug("Testing attempts to manipulate the default framebuffer"); | |
82 shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, null)"); | |
83 glErrorShouldBe(context, context.NO_ERROR); | |
84 shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.
DEPTH_ATTACHMENT, context.RENDERBUFFER, null)"); | |
85 // Synthetic OpenGL error | |
86 glErrorShouldBe(context, context.INVALID_OPERATION); | |
87 // Error state should be clear by this point | |
88 glErrorShouldBe(context, context.NO_ERROR); | |
89 shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COL
OR_ATTACHMENT0, context.TEXTURE_2D, null, 0)"); | |
90 // Synthetic OpenGL error | |
91 glErrorShouldBe(context, context.INVALID_OPERATION); | |
92 // Error state should be clear by this point | |
93 glErrorShouldBe(context, context.NO_ERROR); | |
94 | |
95 successfullyParsed = true; | |
96 </script> | |
97 | |
98 <script src="../../resources/js-test-post.js"></script> | |
99 </body> | |
100 </html> | |
OLD | NEW |