content/canvas/test/webgl-conformance/conformance/state/gl-enable-enum-test.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!--
michael@0 2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 3 Use of this source code is governed by a BSD-style license that can be
michael@0 4 found in the LICENSE file.
michael@0 5 -->
michael@0 6 <!DOCTYPE html>
michael@0 7 <html>
michael@0 8 <head>
michael@0 9 <meta charset="utf-8">
michael@0 10 <title>WebGL gl.ENABLE enums Conformance Tests</title>
michael@0 11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
michael@0 12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
michael@0 13 <script src="../../resources/js-test-pre.js"></script>
michael@0 14 <script src="../resources/webgl-test.js"></script>
michael@0 15 </head>
michael@0 16 <body>
michael@0 17 <div id="description"></div>
michael@0 18 <div id="console"></div>
michael@0 19 <canvas id="canvas" width="2" height="2"> </canvas>
michael@0 20 <script>
michael@0 21 description("This test ensures WebGL implementations allow OpenGL ES 2.0 features to be turned on but not non OpenGL ES 2.0 features.");
michael@0 22
michael@0 23 debug("");
michael@0 24 debug("Canvas.getContext");
michael@0 25
michael@0 26 var gl = create3DContext(document.getElementById("canvas"));
michael@0 27 if (!gl) {
michael@0 28 testFailed("context does not exist");
michael@0 29 } else {
michael@0 30 testPassed("context exists");
michael@0 31
michael@0 32 debug("");
michael@0 33 debug("Checking gl.ENABLE enums.");
michael@0 34
michael@0 35 var invalidEnums = [
michael@0 36 'ALPHA_TEST',
michael@0 37 'AUTO_NORMAL',
michael@0 38 'CLIP_PLANE0',
michael@0 39 'CLIP_PLANE1',
michael@0 40 'COLOR_LOGIC_OP',
michael@0 41 'COLOR_MATERIAL',
michael@0 42 'COLOR_SUM',
michael@0 43 'COLOR_TABLE',
michael@0 44 // 'CONVOLUTION_1D',
michael@0 45 // 'CONVOLUTION_2D',
michael@0 46 'FOG',
michael@0 47 'HISTOGRAM',
michael@0 48 'INDEX_LOGIC_OP',
michael@0 49 'LIGHT0',
michael@0 50 'LIGHT1',
michael@0 51 'LIGHTING',
michael@0 52 'LINE_SMOOTH',
michael@0 53 'LINE_STIPPLE',
michael@0 54 'MAP1_COLOR_4',
michael@0 55 'MAP1_INDEX',
michael@0 56 'MAP1_NORMAL',
michael@0 57 'MAP1_TEXTURE_COORD_1',
michael@0 58 'MAP1_TEXTURE_COORD_2',
michael@0 59 'MAP1_TEXTURE_COORD_3',
michael@0 60 'MAP1_TEXTURE_COORD_4',
michael@0 61 'MAP1_VERTEX_3',
michael@0 62 'MAP1_VERTEX_4',
michael@0 63 'MAP2_COLOR_4',
michael@0 64 'MAP2_INDEX',
michael@0 65 'MAP2_NORMAL',
michael@0 66 'MAP2_TEXTURE_COORD_1',
michael@0 67 'MAP2_TEXTURE_COORD_2',
michael@0 68 'MAP2_TEXTURE_COORD_3',
michael@0 69 'MAP2_TEXTURE_COORD_4',
michael@0 70 'MAP2_VERTEX_3',
michael@0 71 'MAP2_VERTEX_4',
michael@0 72 'MINMAX',
michael@0 73 'MULTISAMPLE',
michael@0 74 'NORMALIZE',
michael@0 75 'POINT_SMOOTH',
michael@0 76 'POINT_SPRITE',
michael@0 77 'POLYGON_OFFSET_LINE',
michael@0 78 'POLYGON_OFFSET_POINT',
michael@0 79 'POLYGON_SMOOTH',
michael@0 80 'POLYGON_STIPPLE',
michael@0 81 'POST_COLOR_MATRIX_COLOR_TABLE',
michael@0 82 'POST_CONVOLUTION_COLOR_TABLE',
michael@0 83 'RESCALE_NORMAL',
michael@0 84 'SAMPLE_ALPHA_TO_ONE',
michael@0 85 // 'SEPARABLE_2D',
michael@0 86 'TEXTURE_1D',
michael@0 87 'TEXTURE_2D',
michael@0 88 'TEXTURE_3D',
michael@0 89 'TEXTURE_CUBE_MAP',
michael@0 90 'TEXTURE_GEN_Q',
michael@0 91 'TEXTURE_GEN_R',
michael@0 92 'TEXTURE_GEN_S',
michael@0 93 'TEXTURE_GEN_T',
michael@0 94 'VERTEX_PROGRAM_POINT_SIZE',
michael@0 95 'VERTEX_PROGRAM_TWO_SIDE'
michael@0 96 ];
michael@0 97
michael@0 98 for (var ii = 0; ii < invalidEnums.length; ++ii) {
michael@0 99 var name = invalidEnums[ii];
michael@0 100 gl.enable(desktopGL[name]);
michael@0 101 glErrorShouldBe(gl, gl.INVALID_ENUM,
michael@0 102 "gl.enable must set INVALID_ENUM when passed GL_" + name );
michael@0 103 }
michael@0 104
michael@0 105 var validEnums = [
michael@0 106 'BLEND',
michael@0 107 'CULL_FACE',
michael@0 108 'DEPTH_TEST',
michael@0 109 'DITHER',
michael@0 110 'POLYGON_OFFSET_FILL',
michael@0 111 'SAMPLE_ALPHA_TO_COVERAGE',
michael@0 112 'SAMPLE_COVERAGE',
michael@0 113 'SCISSOR_TEST',
michael@0 114 'STENCIL_TEST'
michael@0 115 ];
michael@0 116
michael@0 117 for (var ii = 0; ii < validEnums.length; ++ii) {
michael@0 118 var name = validEnums[ii];
michael@0 119 gl.enable(gl[name]);
michael@0 120 glErrorShouldBe(gl, gl.NO_ERROR,
michael@0 121 "gl.enable must succeed when passed gl." + name );
michael@0 122 }
michael@0 123
michael@0 124 }
michael@0 125
michael@0 126 debug("");
michael@0 127 successfullyParsed = true;
michael@0 128
michael@0 129 </script>
michael@0 130 <script>finishTest();</script>
michael@0 131
michael@0 132 </body>
michael@0 133 </html>

mercurial