diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html')
-rw-r--r-- | dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html new file mode 100644 index 000000000..c58b26e15 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html @@ -0,0 +1,161 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>WebGL gl.ENABLE enums Conformance Tests</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/desktop-gl-constants.js"></script> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +"use strict"; +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"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("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]); + wtu.glErrorShouldBe(gl, 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]); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.enable must succeed when passed gl." + name ); + shouldBe('gl.isEnabled(gl.' + name + ')', 'true'); + gl.disable(gl[name]); + shouldBe('gl.isEnabled(gl.' + name + ')', 'false'); + } + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); +} + +debug(""); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> |