OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 |
| 3 /* |
| 4 ** Copyright (c) 2012 The Khronos Group Inc. |
| 5 ** |
| 6 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 7 ** copy of this software and/or associated documentation files (the |
| 8 ** "Materials"), to deal in the Materials without restriction, including |
| 9 ** without limitation the rights to use, copy, modify, merge, publish, |
| 10 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 11 ** permit persons to whom the Materials are furnished to do so, subject to |
| 12 ** the following conditions: |
| 13 ** |
| 14 ** The above copyright notice and this permission notice shall be included |
| 15 ** in all copies or substantial portions of the Materials. |
| 16 ** |
| 17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 */ |
| 25 |
| 26 --> |
| 27 |
| 28 <!DOCTYPE html> |
| 29 <html> |
| 30 <head> |
| 31 <meta charset="utf-8"> |
| 32 <title>WebGL gl.ENABLE enums Conformance Tests</title> |
| 33 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 34 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s
cript> |
| 35 <script src="../../resources/js-test-pre.js"></script> |
| 36 <script src="../resources/webgl-test.js"></script> |
| 37 </head> |
| 38 <body> |
| 39 <div id="description"></div> |
| 40 <div id="console"></div> |
| 41 <canvas id="canvas" width="2" height="2"> </canvas> |
| 42 <script> |
| 43 description("This test ensures WebGL implementations allow OpenGL ES 2.0 feature
s to be turned on but not non OpenGL ES 2.0 features."); |
| 44 |
| 45 debug(""); |
| 46 debug("Canvas.getContext"); |
| 47 |
| 48 var gl = create3DContext(document.getElementById("canvas")); |
| 49 if (!gl) { |
| 50 testFailed("context does not exist"); |
| 51 } else { |
| 52 testPassed("context exists"); |
| 53 |
| 54 debug(""); |
| 55 debug("Checking gl.ENABLE enums."); |
| 56 |
| 57 var invalidEnums = [ |
| 58 'ALPHA_TEST', |
| 59 'AUTO_NORMAL', |
| 60 'CLIP_PLANE0', |
| 61 'CLIP_PLANE1', |
| 62 'COLOR_LOGIC_OP', |
| 63 'COLOR_MATERIAL', |
| 64 'COLOR_SUM', |
| 65 'COLOR_TABLE', |
| 66 // 'CONVOLUTION_1D', |
| 67 // 'CONVOLUTION_2D', |
| 68 'FOG', |
| 69 'HISTOGRAM', |
| 70 'INDEX_LOGIC_OP', |
| 71 'LIGHT0', |
| 72 'LIGHT1', |
| 73 'LIGHTING', |
| 74 'LINE_SMOOTH', |
| 75 'LINE_STIPPLE', |
| 76 'MAP1_COLOR_4', |
| 77 'MAP1_INDEX', |
| 78 'MAP1_NORMAL', |
| 79 'MAP1_TEXTURE_COORD_1', |
| 80 'MAP1_TEXTURE_COORD_2', |
| 81 'MAP1_TEXTURE_COORD_3', |
| 82 'MAP1_TEXTURE_COORD_4', |
| 83 'MAP1_VERTEX_3', |
| 84 'MAP1_VERTEX_4', |
| 85 'MAP2_COLOR_4', |
| 86 'MAP2_INDEX', |
| 87 'MAP2_NORMAL', |
| 88 'MAP2_TEXTURE_COORD_1', |
| 89 'MAP2_TEXTURE_COORD_2', |
| 90 'MAP2_TEXTURE_COORD_3', |
| 91 'MAP2_TEXTURE_COORD_4', |
| 92 'MAP2_VERTEX_3', |
| 93 'MAP2_VERTEX_4', |
| 94 'MINMAX', |
| 95 'MULTISAMPLE', |
| 96 'NORMALIZE', |
| 97 'POINT_SMOOTH', |
| 98 'POINT_SPRITE', |
| 99 'POLYGON_OFFSET_LINE', |
| 100 'POLYGON_OFFSET_POINT', |
| 101 'POLYGON_SMOOTH', |
| 102 'POLYGON_STIPPLE', |
| 103 'POST_COLOR_MATRIX_COLOR_TABLE', |
| 104 'POST_CONVOLUTION_COLOR_TABLE', |
| 105 'RESCALE_NORMAL', |
| 106 'SAMPLE_ALPHA_TO_ONE', |
| 107 // 'SEPARABLE_2D', |
| 108 'TEXTURE_1D', |
| 109 'TEXTURE_2D', |
| 110 'TEXTURE_3D', |
| 111 'TEXTURE_CUBE_MAP', |
| 112 'TEXTURE_GEN_Q', |
| 113 'TEXTURE_GEN_R', |
| 114 'TEXTURE_GEN_S', |
| 115 'TEXTURE_GEN_T', |
| 116 'VERTEX_PROGRAM_POINT_SIZE', |
| 117 'VERTEX_PROGRAM_TWO_SIDE' |
| 118 ]; |
| 119 |
| 120 for (var ii = 0; ii < invalidEnums.length; ++ii) { |
| 121 var name = invalidEnums[ii]; |
| 122 gl.enable(desktopGL[name]); |
| 123 glErrorShouldBe(gl, gl.INVALID_ENUM, |
| 124 "gl.enable must set INVALID_ENUM when passed GL_" + name ); |
| 125 } |
| 126 |
| 127 var validEnums = [ |
| 128 'BLEND', |
| 129 'CULL_FACE', |
| 130 'DEPTH_TEST', |
| 131 'DITHER', |
| 132 'POLYGON_OFFSET_FILL', |
| 133 'SAMPLE_ALPHA_TO_COVERAGE', |
| 134 'SAMPLE_COVERAGE', |
| 135 'SCISSOR_TEST', |
| 136 'STENCIL_TEST' |
| 137 ]; |
| 138 |
| 139 for (var ii = 0; ii < validEnums.length; ++ii) { |
| 140 var name = validEnums[ii]; |
| 141 gl.enable(gl[name]); |
| 142 glErrorShouldBe(gl, gl.NO_ERROR, |
| 143 "gl.enable must succeed when passed gl." + name ); |
| 144 shouldBe('gl.isEnabled(gl.' + name + ')', 'true'); |
| 145 gl.disable(gl[name]); |
| 146 shouldBe('gl.isEnabled(gl.' + name + ')', 'false'); |
| 147 } |
| 148 |
| 149 glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); |
| 150 } |
| 151 |
| 152 debug(""); |
| 153 successfullyParsed = true; |
| 154 |
| 155 </script> |
| 156 <script src="../../resources/js-test-post.js"></script> |
| 157 |
| 158 </body> |
| 159 </html> |
OLD | NEW |