OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <!-- |
| 6 |
| 7 /* |
| 8 ** Copyright (c) 2012 The Khronos Group Inc. |
| 9 ** |
| 10 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 11 ** copy of this software and/or associated documentation files (the |
| 12 ** "Materials"), to deal in the Materials without restriction, including |
| 13 ** without limitation the rights to use, copy, modify, merge, publish, |
| 14 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 15 ** permit persons to whom the Materials are furnished to do so, subject to |
| 16 ** the following conditions: |
| 17 ** |
| 18 ** The above copyright notice and this permission notice shall be included |
| 19 ** in all copies or substantial portions of the Materials. |
| 20 ** |
| 21 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 22 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 23 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 24 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 25 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 26 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 27 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 28 */ |
| 29 |
| 30 --> |
| 31 <link rel="stylesheet" type="text/css" href="../unit.css" /> |
| 32 <script type="application/x-javascript" src="../unit.js"></script> |
| 33 <script type="application/x-javascript" src="../util.js"></script> |
| 34 <script type="application/x-javascript" src="quickCheckAPI.js"></script> |
| 35 <script type="application/x-javascript" src="argGenerators-B4.js"></script> |
| 36 |
| 37 <script type="application/x-javascript"> |
| 38 |
| 39 // Test that all GL functions specified in ArgGenerators work |
| 40 // when called with randomly generated valid arguments |
| 41 Tests.testValidArgs = function() { |
| 42 var randomTestCount = 100; |
| 43 for (var name in ArgGenerators) { |
| 44 try { |
| 45 if (!GL[name]) |
| 46 throw (new Error(name + " is missing from the WebGL context")); |
| 47 var argGen = ArgGenerators[name]; |
| 48 var alreadyTriedArgs = {}; |
| 49 if (!argGen.generate) continue; |
| 50 // test each GL function with randomTestCount randomly generated valid arg
s |
| 51 argGeneratorTestRunner(argGen, function(args, gen, setupVars) { |
| 52 if (!gen.noAlreadyTriedCheck) { |
| 53 var src = Object.toSource(args); |
| 54 if (alreadyTriedArgs[src]) |
| 55 return true; |
| 56 |
| 57 alreadyTriedArgs[src] = true; |
| 58 } |
| 59 var ok = false; |
| 60 // if we have an validity checker, assert that the generated args are va
lid |
| 61 if (gen.checkArgValidity) |
| 62 assert("Valid args: "+name+"("+argsToString(args)+")", |
| 63 gen.checkArgValidity.apply(gen, args)); |
| 64 var rv; |
| 65 // assert that GL function works when called with valid args |
| 66 assertOk("This should work: "+name+"("+argsToString(args)+")", |
| 67 function(){rv = GL[name].apply(GL, args); ok = true;}); |
| 68 // if we need to cleanup the return value, do it here |
| 69 // e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() abov
e |
| 70 if (gen.returnValueCleanup) |
| 71 assertOk("Cleaning up return value after "+name+"("+argsToString(args)
+")", |
| 72 function() { gen.returnValueCleanup(rv); }); |
| 73 return ok; |
| 74 }, argGen.testCount || randomTestCount); |
| 75 } catch(e) { |
| 76 testFailed(name, e.name, formatError(e)); |
| 77 } |
| 78 } |
| 79 } |
| 80 |
| 81 </script> |
| 82 <style>canvas{position:absolute;}</style> |
| 83 </head><body> |
| 84 </body></html> |
OLD | NEW |