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 |
| 35 <script type="application/x-javascript"> |
| 36 |
| 37 Tests.testGetWebGL = function() { |
| 38 var canvas = document.getElementById('webgl'); |
| 39 var gl; |
| 40 assertOk(function(){gl = getGLContext(canvas)}); |
| 41 assertEquals("ctx.canvas === canvas", gl.canvas, canvas); |
| 42 assertOk(function(){g2d = canvas.getContext('2d')}); |
| 43 assert("Should get a null 2d context after getting webgl context", g2d === nul
l); |
| 44 } |
| 45 |
| 46 Tests.testGet2D = function() { |
| 47 var canvas = document.getElementById('2d'); |
| 48 var g2d; |
| 49 var gl; |
| 50 assertOk(function(){g2d = canvas.getContext('2d')}); |
| 51 assertOk(function(){gl = getGLContext(canvas)}); |
| 52 assert("Should get a null WebGL context after getting 2D context", gl === null
); |
| 53 } |
| 54 </script> |
| 55 <style>canvas{position:absolute;}</style> |
| 56 </head><body> |
| 57 <canvas id="2d" width="1" height="1"></canvas> |
| 58 <canvas id="webgl" width="1" height="1"></canvas> |
| 59 </body></html> |
OLD | NEW |