| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <title>WebGL gl.ENABLE enums Conformance Tests</title> |
| <script src="resources/desktop-gl-constants.js" type="text/javascript"></script> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="resources/webgl-test.js"></script> |
| </head> |
| <body> |
| <div id="description"></div> |
| <div id="console"></div> |
| <canvas id="canvas" width="2" height="2"> </canvas> |
| <script> |
| description("This test ensures WebGL implementations allow OpenGL ES 2.0 features to be turned on but not non OpenGL ES 2.0 features."); |
| |
| debug(""); |
| debug("Canvas.getContext"); |
| |
| if (window.internals) |
| window.internals.settings.setWebGLErrorsToConsoleEnabled(false); |
| |
| var gl = create3DContext(document.getElementById("canvas")); |
| if (!gl) { |
| testFailed("context does not exist"); |
| } else { |
| testPassed("context exists"); |
| |
| debug(""); |
| debug("Checking gl.ENABLE enums."); |
| |
| var invalidEnums = [ |
| 'ALPHA_TEST', |
| 'AUTO_NORMAL', |
| 'CLIP_PLANE0', |
| 'CLIP_PLANE1', |
| 'COLOR_LOGIC_OP', |
| 'COLOR_MATERIAL', |
| 'COLOR_SUM', |
| 'COLOR_TABLE', |
| // 'CONVOLUTION_1D', |
| // 'CONVOLUTION_2D', |
| 'FOG', |
| 'HISTOGRAM', |
| 'INDEX_LOGIC_OP', |
| 'LIGHT0', |
| 'LIGHT1', |
| 'LIGHTING', |
| 'LINE_SMOOTH', |
| 'LINE_STIPPLE', |
| 'MAP1_COLOR_4', |
| 'MAP1_INDEX', |
| 'MAP1_NORMAL', |
| 'MAP1_TEXTURE_COORD_1', |
| 'MAP1_TEXTURE_COORD_2', |
| 'MAP1_TEXTURE_COORD_3', |
| 'MAP1_TEXTURE_COORD_4', |
| 'MAP1_VERTEX_3', |
| 'MAP1_VERTEX_4', |
| 'MAP2_COLOR_4', |
| 'MAP2_INDEX', |
| 'MAP2_NORMAL', |
| 'MAP2_TEXTURE_COORD_1', |
| 'MAP2_TEXTURE_COORD_2', |
| 'MAP2_TEXTURE_COORD_3', |
| 'MAP2_TEXTURE_COORD_4', |
| 'MAP2_VERTEX_3', |
| 'MAP2_VERTEX_4', |
| 'MINMAX', |
| 'MULTISAMPLE', |
| 'NORMALIZE', |
| 'POINT_SMOOTH', |
| 'POINT_SPRITE', |
| 'POLYGON_OFFSET_LINE', |
| 'POLYGON_OFFSET_POINT', |
| 'POLYGON_SMOOTH', |
| 'POLYGON_STIPPLE', |
| 'POST_COLOR_MATRIX_COLOR_TABLE', |
| 'POST_CONVOLUTION_COLOR_TABLE', |
| 'RESCALE_NORMAL', |
| 'SAMPLE_ALPHA_TO_ONE', |
| // 'SEPARABLE_2D', |
| 'TEXTURE_1D', |
| 'TEXTURE_2D', |
| 'TEXTURE_3D', |
| 'TEXTURE_CUBE_MAP', |
| 'TEXTURE_GEN_Q', |
| 'TEXTURE_GEN_R', |
| 'TEXTURE_GEN_S', |
| 'TEXTURE_GEN_T', |
| 'VERTEX_PROGRAM_POINT_SIZE', |
| 'VERTEX_PROGRAM_TWO_SIDE' |
| ]; |
| |
| for (var ii = 0; ii < invalidEnums.length; ++ii) { |
| var name = invalidEnums[ii]; |
| gl.enable(desktopGL[name]); |
| assertMsg(gl.getError() == gl.INVALID_ENUM, |
| "gl.enable must set INVALID_ENUM when passed GL_" + name ); |
| } |
| |
| var validEnums = [ |
| 'BLEND', |
| 'CULL_FACE', |
| 'DEPTH_TEST', |
| 'DITHER', |
| 'POLYGON_OFFSET_FILL', |
| 'SAMPLE_ALPHA_TO_COVERAGE', |
| 'SAMPLE_COVERAGE', |
| 'SCISSOR_TEST', |
| 'STENCIL_TEST' |
| ]; |
| |
| for (var ii = 0; ii < validEnums.length; ++ii) { |
| var name = validEnums[ii]; |
| gl.enable(gl[name]); |
| assertMsg(gl.getError() == gl.NO_ERROR, |
| "gl.enable must succeed when passed gl." + name ); |
| } |
| |
| } |
| |
| debug(""); |
| |
| </script> |
| </body> |
| </html> |