OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
3 Use of this source code is governed by a BSD-style license that can be | |
4 found in the LICENSE file. | |
5 --> | |
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
7 "http://www.w3.org/TR/html4/loose.dtd"> | |
8 <html> | |
9 <head> | |
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
11 <title>WebGL gl enums Conformance Tests</title> | |
12 <link rel="stylesheet" href="../resources/js-test-style.css"/> | |
13 <script src="../resources/desktop-gl-constants.js" type="text/javascript"></scri
pt> | |
14 <script src="../resources/js-test-pre.js"></script> | |
15 <script src="resources/webgl-test.js"></script> | |
16 </head> | |
17 <body> | |
18 <div id="description"></div> | |
19 <div id="console"></div> | |
20 <canvas id="canvas" width="2" height="2"> </canvas> | |
21 <script> | |
22 description("This test ensures various WebGL functions fail when passed non Open
GL ES 2.0 enums."); | |
23 | |
24 debug(""); | |
25 debug("Canvas.getContext"); | |
26 | |
27 var gl = create3DContext(document.getElementById("canvas")); | |
28 if (!gl) { | |
29 testFailed("context does not exist"); | |
30 } else { | |
31 testPassed("context exists"); | |
32 | |
33 debug(""); | |
34 debug("Checking gl enums."); | |
35 | |
36 var buffer = new ArrayBuffer(2); | |
37 var buf = new Uint16Array(buffer); | |
38 var tex = gl.createTexture(); | |
39 gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer()); | |
40 glErrorShouldBe(gl, gl.NO_ERROR); | |
41 | |
42 var tests = [ | |
43 "gl.bindTexture(desktopGL['TEXTURE_3D'], tex)", | |
44 "gl.blendEquation(desktopGL['MIN'])", | |
45 "gl.blendEquation(desktopGL['MAX'])", | |
46 "gl.blendEquationSeparate(desktopGL['MIN'], gl.FUNC_ADD)", | |
47 "gl.blendEquationSeparate(desktopGL['MAX'], gl.FUNC_ADD)", | |
48 "gl.blendEquationSeparate(gl.FUNC_ADD, desktopGL['MIN'])", | |
49 "gl.blendEquationSeparate(gl.FUNC_ADD, desktopGL['MAX'])", | |
50 "gl.bufferData(gl.ARRAY_BUFFER, 3, desktopGL['STATIC_READ'])", | |
51 "gl.disable(desktopGL['CLIP_PLANE0'])", | |
52 "gl.disable(desktopGL['POINT_SPRITE'])", | |
53 "gl.getBufferParameter(gl.ARRAY_BUFFER, desktopGL['PIXEL_PACK_BUFFER'])", | |
54 "gl.hint(desktopGL['PERSPECTIVE_CORRECTION_HINT'], gl.FASTEST)", | |
55 "gl.isEnabled(desktopGL['CLIP_PLANE0'])", | |
56 "gl.isEnabled(desktopGL['POINT_SPRITE'])", | |
57 "gl.pixelStorei(desktopGL['PACK_SWAP_BYTES'], 1)", | |
58 ]; | |
59 for (var ii = 0; ii < tests.length; ++ii) { | |
60 eval(tests[ii]); | |
61 glErrorShouldBe(gl, gl.INVALID_ENUM, | |
62 tests[ii] + " should return INVALID_ENUM."); | |
63 } | |
64 | |
65 gl.bindTexture(gl.TEXTURE_2D, tex); | |
66 glErrorShouldBe(gl, gl.NO_ERROR); | |
67 | |
68 tests = [ | |
69 "gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'])", | |
70 "gl.texParameteri(desktopGL['TEXTURE_3D'], gl.TEXTURE_MAG_FILTER, gl.NEAREST
)", | |
71 "gl.texParameteri(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'], 1)" | |
72 ]; | |
73 for (var ii = 0; ii < tests.length; ++ii) { | |
74 eval(tests[ii]); | |
75 glErrorShouldBe(gl, gl.INVALID_ENUM, | |
76 tests[ii] + " should return INVALID_ENUM."); | |
77 } | |
78 } | |
79 | |
80 debug(""); | |
81 successfullyParsed = true; | |
82 | |
83 </script> | |
84 <script src="../resources/js-test-post.js"></script> | |
85 | |
86 <script> | |
87 </script> | |
88 | |
89 </body> | |
90 </html> | |
91 | |
OLD | NEW |