Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / gl-enable-enum-test.html
blobf5474b458592c57eef77a4932232d9f0da190478
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.ENABLE 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 WebGL implementations allow OpenGL ES 2.0 features to be turned on but not non OpenGL ES 2.0 features.");
18 debug("");
19 debug("Canvas.getContext");
21 if (window.internals)
22 window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
24 var gl = create3DContext(document.getElementById("canvas"));
25 if (!gl) {
26 testFailed("context does not exist");
27 } else {
28 testPassed("context exists");
30 debug("");
31 debug("Checking gl.ENABLE enums.");
33 var invalidEnums = [
34 'ALPHA_TEST',
35 'AUTO_NORMAL',
36 'CLIP_PLANE0',
37 'CLIP_PLANE1',
38 'COLOR_LOGIC_OP',
39 'COLOR_MATERIAL',
40 'COLOR_SUM',
41 'COLOR_TABLE',
42 // 'CONVOLUTION_1D',
43 // 'CONVOLUTION_2D',
44 'FOG',
45 'HISTOGRAM',
46 'INDEX_LOGIC_OP',
47 'LIGHT0',
48 'LIGHT1',
49 'LIGHTING',
50 'LINE_SMOOTH',
51 'LINE_STIPPLE',
52 'MAP1_COLOR_4',
53 'MAP1_INDEX',
54 'MAP1_NORMAL',
55 'MAP1_TEXTURE_COORD_1',
56 'MAP1_TEXTURE_COORD_2',
57 'MAP1_TEXTURE_COORD_3',
58 'MAP1_TEXTURE_COORD_4',
59 'MAP1_VERTEX_3',
60 'MAP1_VERTEX_4',
61 'MAP2_COLOR_4',
62 'MAP2_INDEX',
63 'MAP2_NORMAL',
64 'MAP2_TEXTURE_COORD_1',
65 'MAP2_TEXTURE_COORD_2',
66 'MAP2_TEXTURE_COORD_3',
67 'MAP2_TEXTURE_COORD_4',
68 'MAP2_VERTEX_3',
69 'MAP2_VERTEX_4',
70 'MINMAX',
71 'MULTISAMPLE',
72 'NORMALIZE',
73 'POINT_SMOOTH',
74 'POINT_SPRITE',
75 'POLYGON_OFFSET_LINE',
76 'POLYGON_OFFSET_POINT',
77 'POLYGON_SMOOTH',
78 'POLYGON_STIPPLE',
79 'POST_COLOR_MATRIX_COLOR_TABLE',
80 'POST_CONVOLUTION_COLOR_TABLE',
81 'RESCALE_NORMAL',
82 'SAMPLE_ALPHA_TO_ONE',
83 // 'SEPARABLE_2D',
84 'TEXTURE_1D',
85 'TEXTURE_2D',
86 'TEXTURE_3D',
87 'TEXTURE_CUBE_MAP',
88 'TEXTURE_GEN_Q',
89 'TEXTURE_GEN_R',
90 'TEXTURE_GEN_S',
91 'TEXTURE_GEN_T',
92 'VERTEX_PROGRAM_POINT_SIZE',
93 'VERTEX_PROGRAM_TWO_SIDE'
96 for (var ii = 0; ii < invalidEnums.length; ++ii) {
97 var name = invalidEnums[ii];
98 gl.enable(desktopGL[name]);
99 assertMsg(gl.getError() == gl.INVALID_ENUM,
100 "gl.enable must set INVALID_ENUM when passed GL_" + name );
103 var validEnums = [
104 'BLEND',
105 'CULL_FACE',
106 'DEPTH_TEST',
107 'DITHER',
108 'POLYGON_OFFSET_FILL',
109 'SAMPLE_ALPHA_TO_COVERAGE',
110 'SAMPLE_COVERAGE',
111 'SCISSOR_TEST',
112 'STENCIL_TEST'
115 for (var ii = 0; ii < validEnums.length; ++ii) {
116 var name = validEnums[ii];
117 gl.enable(gl[name]);
118 assertMsg(gl.getError() == gl.NO_ERROR,
119 "gl.enable must succeed when passed gl." + name );
124 debug("");
126 </script>
128 <script>
129 </script>
131 </body>
132 </html>