OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/html4/loose.dtd"> | |
3 <html> | |
4 <head> | |
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> | |
10 </head> | |
11 <body> | |
12 <div id="description"></div> | |
13 <div id="console"></div> | |
14 <canvas id="canvas" width="2" height="2"> </canvas> | |
15 <script> | |
16 description("This test ensures various WebGL functions fail when passed non Open
GL ES 2.0 enums."); | |
17 | |
18 debug(""); | |
19 debug("Canvas.getContext"); | |
20 | |
21 if (window.internals) | |
22 window.internals.settings.setWebGLErrorsToConsoleEnabled(false); | |
23 | |
24 var gl = create3DContext(document.getElementById("canvas")); | |
25 if (!gl) { | |
26 testFailed("context does not exist"); | |
27 } else { | |
28 testPassed("context exists"); | |
29 | |
30 debug(""); | |
31 debug("Checking gl enums."); | |
32 | |
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); | |
38 | |
39 var tests = [ | |
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)", | |
56 ]; | |
57 for (var ii = 0; ii < tests.length; ++ii) { | |
58 eval(tests[ii]); | |
59 glErrorShouldBe(gl, gl.INVALID_ENUM, | |
60 tests[ii] + " should return INVALID_ENUM."); | |
61 } | |
62 | |
63 gl.bindTexture(gl.TEXTURE_2D, tex); | |
64 glErrorShouldBe(gl, gl.NO_ERROR); | |
65 | |
66 tests = [ | |
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)" | |
70 ]; | |
71 for (var ii = 0; ii < tests.length; ++ii) { | |
72 eval(tests[ii]); | |
73 glErrorShouldBe(gl, gl.INVALID_ENUM, | |
74 tests[ii] + " should return INVALID_ENUM."); | |
75 } | |
76 } | |
77 | |
78 debug(""); | |
79 | |
80 </script> | |
81 | |
82 <script> | |
83 </script> | |
84 | |
85 </body> | |
86 </html> | |
87 | |
OLD | NEW |