1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
6 <title>WebGL gl enums Conformance Tests
</title>
7 <script src=
"resources/desktop-gl-constants.js" type=
"text/javascript"></script>
8 <script src=
"../../../resources/js-test.js"></script>
9 <script src=
"resources/webgl-test.js"></script>
12 <div id=
"description"></div>
13 <div id=
"console"></div>
14 <canvas id=
"canvas" width=
"2" height=
"2"> </canvas>
16 description("This test ensures various WebGL functions fail when passed non OpenGL ES 2.0 enums.");
19 debug("Canvas.getContext");
22 window
.internals
.settings
.setWebGLErrorsToConsoleEnabled(false);
24 var gl
= create3DContext(document
.getElementById("canvas"));
26 testFailed("context does not exist");
28 testPassed("context exists");
31 debug("Checking gl enums.");
33 var buffer
= new ArrayBuffer(2);
34 var buf
= new Uint16Array(buffer
);
35 var tex
= gl
.createTexture();
36 gl
.bindBuffer(gl
.ARRAY_BUFFER
, gl
.createBuffer());
37 glErrorShouldBe(gl
, gl
.NO_ERROR
);
40 "gl.bindTexture(desktopGL['TEXTURE_3D'], tex)",
41 "gl.blendEquation(desktopGL['MIN'])",
42 "gl.blendEquation(desktopGL['MAX'])",
43 "gl.blendEquationSeparate(desktopGL['MIN'], gl.FUNC_ADD)",
44 "gl.blendEquationSeparate(desktopGL['MAX'], gl.FUNC_ADD)",
45 "gl.blendEquationSeparate(gl.FUNC_ADD, desktopGL['MIN'])",
46 "gl.blendEquationSeparate(gl.FUNC_ADD, desktopGL['MAX'])",
47 "gl.bufferData(gl.ARRAY_BUFFER, 3, desktopGL['STATIC_READ'])",
48 "gl.disable(desktopGL['CLIP_PLANE0'])",
49 "gl.disable(desktopGL['POINT_SPRITE'])",
50 "gl.getBufferParameter(gl.ARRAY_BUFFER, desktopGL['PIXEL_PACK_BUFFER'])",
51 "gl.hint(desktopGL['PERSPECTIVE_CORRECTION_HINT'], gl.FASTEST)",
52 "gl.isEnabled(desktopGL['CLIP_PLANE0'])",
53 "gl.isEnabled(desktopGL['POINT_SPRITE'])",
54 "gl.pixelStorei(desktopGL['PACK_SWAP_BYTES'], 1)",
55 "gl.readPixels(0, 0, 1, 1, gl.ALPHA, gl.SHORT, buf)",
57 for (var ii
= 0; ii
< tests
.length
; ++ii
) {
59 glErrorShouldBe(gl
, gl
.INVALID_ENUM
,
60 tests
[ii
] + " should return INVALID_ENUM.");
63 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
64 glErrorShouldBe(gl
, gl
.NO_ERROR
);
67 "gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'])",
68 "gl.texParameteri(desktopGL['TEXTURE_3D'], gl.TEXTURE_MAG_FILTER, gl.NEAREST)",
69 "gl.texParameteri(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'], 1)"
71 for (var ii
= 0; ii
< tests
.length
; ++ii
) {
73 glErrorShouldBe(gl
, gl
.INVALID_ENUM
,
74 tests
[ii
] + " should return INVALID_ENUM.");