Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (C) 2011 Apple Computer, Inc. All rights reserved. |
michael@0 | 3 | |
michael@0 | 4 | Redistribution and use in source and binary forms, with or without |
michael@0 | 5 | modification, are permitted provided that the following conditions |
michael@0 | 6 | are met: |
michael@0 | 7 | 1. Redistributions of source code must retain the above copyright |
michael@0 | 8 | notice, this list of conditions and the following disclaimer. |
michael@0 | 9 | 2. Redistributions in binary form must reproduce the above copyright |
michael@0 | 10 | notice, this list of conditions and the following disclaimer in the |
michael@0 | 11 | documentation and/or other materials provided with the distribution. |
michael@0 | 12 | |
michael@0 | 13 | THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
michael@0 | 14 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
michael@0 | 16 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
michael@0 | 17 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
michael@0 | 18 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
michael@0 | 19 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
michael@0 | 20 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
michael@0 | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
michael@0 | 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
michael@0 | 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 24 | --> |
michael@0 | 25 | |
michael@0 | 26 | <!DOCTYPE html> |
michael@0 | 27 | <html> |
michael@0 | 28 | <head> |
michael@0 | 29 | <meta charset="utf-8"> |
michael@0 | 30 | <title>WebGL gl calls Conformance Tests</title> |
michael@0 | 31 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 32 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 33 | <script src="../resources/webgl-test.js"></script> |
michael@0 | 34 | </head> |
michael@0 | 35 | <body> |
michael@0 | 36 | <div id="description"></div> |
michael@0 | 37 | <div id="console"></div> |
michael@0 | 38 | <canvas id="canvas" width="2" height="2"> </canvas> |
michael@0 | 39 | |
michael@0 | 40 | <script> |
michael@0 | 41 | |
michael@0 | 42 | description("This test ensures basic functionality of the underlying graphics library"); |
michael@0 | 43 | |
michael@0 | 44 | debug(""); |
michael@0 | 45 | debug("Canvas.getContext"); |
michael@0 | 46 | |
michael@0 | 47 | var minimumRequiredStencilMask = 0; |
michael@0 | 48 | var context = create3DContext(document.getElementById("canvas")); |
michael@0 | 49 | if (!context) |
michael@0 | 50 | testFailed("context does not exist"); |
michael@0 | 51 | else { |
michael@0 | 52 | testPassed("context exists"); |
michael@0 | 53 | |
michael@0 | 54 | debug(""); |
michael@0 | 55 | debug("Context contains getError"); |
michael@0 | 56 | if ("getError" in context) |
michael@0 | 57 | testPassed("context contains getError"); |
michael@0 | 58 | else |
michael@0 | 59 | testFailed("context does not contains getError"); |
michael@0 | 60 | |
michael@0 | 61 | debug(""); |
michael@0 | 62 | debug("Check default values"); |
michael@0 | 63 | shouldBe('context.getParameter(context.ACTIVE_TEXTURE)', 'context.TEXTURE0'); |
michael@0 | 64 | shouldBe('(context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] <= 1) && (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] > 0) && (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[1] >= 1)', 'true'); |
michael@0 | 65 | shouldBe('(context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] <= 1) && (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] > 0) && (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[1] >= 1)', 'true'); |
michael@0 | 66 | shouldBe('context.getParameter(context.ARRAY_BUFFER_BINDING)', 'null'); |
michael@0 | 67 | shouldBe('context.getParameter(context.BLEND)', 'false'); |
michael@0 | 68 | shouldBe('context.getParameter(context.BLEND_COLOR)', '[0, 0, 0, 0]'); |
michael@0 | 69 | shouldBe('context.getParameter(context.BLEND_DST_ALPHA)', '0'); |
michael@0 | 70 | shouldBe('context.getParameter(context.BLEND_DST_RGB)', '0'); |
michael@0 | 71 | shouldBe('context.getParameter(context.BLEND_EQUATION_ALPHA)', 'context.FUNC_ADD'); |
michael@0 | 72 | shouldBe('context.getParameter(context.BLEND_EQUATION_RGB)', 'context.FUNC_ADD'); |
michael@0 | 73 | shouldBe('context.getParameter(context.BLEND_SRC_ALPHA)', '1'); |
michael@0 | 74 | shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1'); |
michael@0 | 75 | shouldBe('context.getParameter(context.COLOR_CLEAR_VALUE)', '[0, 0, 0, 0]'); |
michael@0 | 76 | shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[true, true, true, true]'); |
michael@0 | 77 | shouldBe('context.getParameter(context.CULL_FACE)', 'false'); |
michael@0 | 78 | shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK'); |
michael@0 | 79 | shouldBe('context.getParameter(context.CURRENT_PROGRAM)', 'null'); |
michael@0 | 80 | shouldBe('context.getParameter(context.DEPTH_CLEAR_VALUE)', '1'); |
michael@0 | 81 | shouldBe('context.getParameter(context.DEPTH_FUNC)', 'context.LESS'); |
michael@0 | 82 | shouldBe('context.getParameter(context.DEPTH_RANGE)', '[0, 1]'); |
michael@0 | 83 | shouldBe('context.getParameter(context.DEPTH_TEST)', 'false'); |
michael@0 | 84 | shouldBe('context.getParameter(context.DEPTH_WRITEMASK)', 'true'); |
michael@0 | 85 | shouldBe('context.getParameter(context.DITHER)', 'true'); |
michael@0 | 86 | shouldBe('context.getParameter(context.ELEMENT_ARRAY_BUFFER_BINDING)', 'null'); |
michael@0 | 87 | shouldBe('context.getParameter(context.FRONT_FACE)', 'context.CCW'); |
michael@0 | 88 | shouldBe('context.getParameter(context.GENERATE_MIPMAP_HINT)', 'context.DONT_CARE'); |
michael@0 | 89 | shouldBe('context.getParameter(context.LINE_WIDTH)', '1'); |
michael@0 | 90 | shouldBe('context.getParameter(context.POLYGON_OFFSET_FACTOR)', '0'); |
michael@0 | 91 | shouldBe('context.getParameter(context.POLYGON_OFFSET_FILL)', 'false'); |
michael@0 | 92 | shouldBe('context.getParameter(context.POLYGON_OFFSET_UNITS)', '0'); |
michael@0 | 93 | shouldBe('context.getParameter(context.RENDERBUFFER_BINDING)', 'null'); |
michael@0 | 94 | shouldBe('context.getParameter(context.SAMPLE_COVERAGE_INVERT)', 'false'); |
michael@0 | 95 | shouldBe('context.getParameter(context.SAMPLE_COVERAGE_VALUE)', '1'); |
michael@0 | 96 | shouldBe('context.getParameter(context.SCISSOR_BOX)[0]', '0'); |
michael@0 | 97 | shouldBe('context.getParameter(context.SCISSOR_BOX)[1]', '0'); |
michael@0 | 98 | shouldBe('context.getParameter(context.SCISSOR_TEST)', 'false'); |
michael@0 | 99 | shouldBe('context.getParameter(context.STENCIL_BACK_FAIL)', 'context.KEEP'); |
michael@0 | 100 | shouldBe('context.getParameter(context.STENCIL_BACK_FUNC)', 'context.ALWAYS'); |
michael@0 | 101 | shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_FAIL)', 'context.KEEP'); |
michael@0 | 102 | shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_PASS)', 'context.KEEP'); |
michael@0 | 103 | shouldBe('context.getParameter(context.STENCIL_BACK_REF)', '0'); |
michael@0 | 104 | |
michael@0 | 105 | var stencilBits = context.getParameter(context.STENCIL_BITS); |
michael@0 | 106 | minimumRequiredStencilMask = (1 << stencilBits) - 1; |
michael@0 | 107 | |
michael@0 | 108 | shouldBe('context.getParameter(context.STENCIL_BACK_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); |
michael@0 | 109 | shouldBe('context.getParameter(context.STENCIL_BACK_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); |
michael@0 | 110 | |
michael@0 | 111 | // If EXT_packed_depth_stencil is supported, STENCIL_BITS > 0; otherwise, STENCIL_BITS == 0. |
michael@0 | 112 | shouldBe('context.getParameter(context.STENCIL_BITS) >= 0', 'true'); |
michael@0 | 113 | shouldBe('context.getParameter(context.STENCIL_CLEAR_VALUE)', '0'); |
michael@0 | 114 | shouldBe('context.getParameter(context.STENCIL_FAIL)', 'context.KEEP'); |
michael@0 | 115 | shouldBe('context.getParameter(context.STENCIL_FUNC)', 'context.ALWAYS'); |
michael@0 | 116 | shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_FAIL)', 'context.KEEP'); |
michael@0 | 117 | shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_PASS)', 'context.KEEP'); |
michael@0 | 118 | shouldBe('context.getParameter(context.STENCIL_REF)', '0'); |
michael@0 | 119 | shouldBe('context.getParameter(context.STENCIL_TEST)', 'false'); |
michael@0 | 120 | |
michael@0 | 121 | shouldBe('context.getParameter(context.STENCIL_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); |
michael@0 | 122 | shouldBe('context.getParameter(context.STENCIL_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); |
michael@0 | 123 | |
michael@0 | 124 | shouldBe('context.getParameter(context.TEXTURE_BINDING_2D)', 'null'); |
michael@0 | 125 | shouldBe('context.getParameter(context.TEXTURE_BINDING_CUBE_MAP)', 'null'); |
michael@0 | 126 | shouldBe('context.getParameter(context.UNPACK_ALIGNMENT)', '4'); |
michael@0 | 127 | shouldBe('context.getParameter(context.UNPACK_FLIP_Y_WEBGL)', 'false'); |
michael@0 | 128 | shouldBe('context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL)', 'false'); |
michael@0 | 129 | shouldBe('context.getParameter(context.VIEWPORT)', '[0, 0, 2, 2]'); |
michael@0 | 130 | shouldBeNonNull('context.getParameter(context.COMPRESSED_TEXTURE_FORMATS)'); |
michael@0 | 131 | |
michael@0 | 132 | shouldBeTrue('context.getParameter(context.MAX_COMBINED_TEXTURE_IMAGE_UNITS) >= 8'); |
michael@0 | 133 | shouldBeTrue('context.getParameter(context.MAX_CUBE_MAP_TEXTURE_SIZE) >= 16'); |
michael@0 | 134 | shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16'); |
michael@0 | 135 | shouldBeTrue('context.getParameter(context.MAX_RENDERBUFFER_SIZE) >= 1'); |
michael@0 | 136 | shouldBeTrue('context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS) >= 8'); |
michael@0 | 137 | shouldBeTrue('context.getParameter(context.MAX_TEXTURE_SIZE) >= 64'); |
michael@0 | 138 | shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8'); |
michael@0 | 139 | shouldBeTrue('context.getParameter(context.MAX_VERTEX_ATTRIBS) >= 8'); |
michael@0 | 140 | shouldBeTrue('context.getParameter(context.MAX_VERTEX_TEXTURE_IMAGE_UNITS) >= 0'); |
michael@0 | 141 | shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128'); |
michael@0 | 142 | // Note: This requirement should be removed from the spec IMO. Many impelementations |
michael@0 | 143 | // will be based on FBOs and FBOs might have a restriction smaller than the current screen size. |
michael@0 | 144 | // especially if there are multiple screens. |
michael@0 | 145 | shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[0] >= window.screen.width'); |
michael@0 | 146 | shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[1] >= window.screen.height'); |
michael@0 | 147 | } |
michael@0 | 148 | |
michael@0 | 149 | debug(""); |
michael@0 | 150 | successfullyParsed = true; |
michael@0 | 151 | |
michael@0 | 152 | </script> |
michael@0 | 153 | <script>finishTest();</script> |
michael@0 | 154 | |
michael@0 | 155 | </body> |
michael@0 | 156 | </html> |