3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
11 description("Tests generation of synthetic and real GL errors");
14 window
.internals
.settings
.setWebGLErrorsToConsoleEnabled(false);
16 var context
= create3DContext();
17 var program
= loadStandardProgram(context
);
19 // Other tests in this directory like getActiveTest and
20 // incorrect-context-object-behaviour already test the raising of many
21 // synthetic GL errors. This test verifies the raising of certain
22 // known real GL errors, and contains a few regression tests for bugs
23 // discovered in the synthetic error generation and in the WebGL
24 // implementation itself.
26 glErrorShouldBe(context
, context
.NO_ERROR
);
28 debug("Testing getActiveAttrib");
29 // Synthetic OpenGL error
30 shouldBeNull("context.getActiveAttrib(null, 2)");
31 glErrorShouldBe(context
, context
.INVALID_VALUE
);
32 // Error state should be clear by this point
33 glErrorShouldBe(context
, context
.NO_ERROR
);
35 shouldBeNull("context.getActiveAttrib(program, 2)");
36 glErrorShouldBe(context
, context
.INVALID_VALUE
);
37 // Error state should be clear by this point
38 glErrorShouldBe(context
, context
.NO_ERROR
);
40 debug("Testing getActiveUniform");
41 // Synthetic OpenGL error
42 shouldBeNull("context.getActiveUniform(null, 0)");
43 glErrorShouldBe(context
, context
.INVALID_VALUE
);
44 // Error state should be clear by this point
45 glErrorShouldBe(context
, context
.NO_ERROR
);
47 shouldBeNull("context.getActiveUniform(program, 50)");
48 glErrorShouldBe(context
, context
.INVALID_VALUE
);
49 // Error state should be clear by this point
50 glErrorShouldBe(context
, context
.NO_ERROR
);
52 debug("Testing attempts to manipulate the default framebuffer");
53 shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, null)");
54 glErrorShouldBe(context
, context
.NO_ERROR
);
55 shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null)");
56 // Synthetic OpenGL error
57 glErrorShouldBe(context
, context
.INVALID_OPERATION
);
58 // Error state should be clear by this point
59 glErrorShouldBe(context
, context
.NO_ERROR
);
60 shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0)");
61 // Synthetic OpenGL error
62 glErrorShouldBe(context
, context
.INVALID_OPERATION
);
63 // Error state should be clear by this point
64 glErrorShouldBe(context
, context
.NO_ERROR
);