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 Extension 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 <script src="../resources/webgl-test-utils.js"></script> |
| 38 </head> |
| 39 <body> |
| 40 <div id="description"></div> |
| 41 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> |
| 42 <div id="console"></div> |
| 43 <script> |
| 44 "use strict"; |
| 45 var randomizeCase = function(str) { |
| 46 var newChars = []; |
| 47 for (var ii = 0; ii < str.length; ++ii) { |
| 48 var c = str.substr(ii, 1); |
| 49 var m = (Math.random() > 0.5) ? c.toLowerCase() : c.toUpperCase(); |
| 50 newChars.push(m); |
| 51 } |
| 52 return newChars.join(""); |
| 53 } |
| 54 |
| 55 description(); |
| 56 debug(""); |
| 57 |
| 58 var wtu = WebGLTestUtils; |
| 59 var canvas = document.getElementById("canvas"); |
| 60 var gl = wtu.create3DContext(canvas); |
| 61 |
| 62 debug("check every extension advertised can be enabled"); |
| 63 var extensions = []; |
| 64 var extensionNames = gl.getSupportedExtensions(); |
| 65 for (var ii = 0; ii < extensionNames.length; ++ii) { |
| 66 var originalName = extensionNames[ii]; |
| 67 var mixedName = randomizeCase(originalName); |
| 68 var extension = gl.getExtension(mixedName); |
| 69 assertMsg(extension, "able to get " + originalName + " as " + mixedName); |
| 70 if (extension) { |
| 71 var kTestString = "this is a test"; |
| 72 var kTestNumber = 123; |
| 73 var kTestFunction = function() { }; |
| 74 var kTestObject = { }; |
| 75 extension.testStringProperty = kTestString; |
| 76 extension.testNumberProperty = kTestNumber; |
| 77 extension.testFunctionProperty = kTestFunction; |
| 78 extension.testObjectProperty = kTestObject; |
| 79 gc(); |
| 80 var extension2 = gl.getExtension(originalName); |
| 81 assertMsg( |
| 82 extension === extension2, |
| 83 "calling getExtension twice for the same extension returns the same
object"); |
| 84 assertMsg( |
| 85 extension2.testStringProperty === kTestString && |
| 86 extension2.testFunctionProperty === kTestFunction && |
| 87 extension2.testObjectProperty === kTestObject && |
| 88 extension2.testNumberProperty === kTestNumber, |
| 89 "object returned by 2nd call to getExtension has same properties"); |
| 90 } |
| 91 } |
| 92 |
| 93 debug(""); |
| 94 var successfullyParsed = true; |
| 95 </script> |
| 96 <script src="../../resources/js-test-post.js"></script> |
| 97 |
| 98 </body> |
| 99 </html> |
OLD | NEW |