OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 <script> |
| 6 |
| 7 var checkAttributes = { |
| 8 alpha : true, |
| 9 }; |
| 10 |
| 11 function testAttributes(expectedAttributes, checkValue) { |
| 12 |
| 13 if (arguments.length != 1 && arguments.length != 2) |
| 14 return; |
| 15 |
| 16 var canvas = document.createElement("canvas"); |
| 17 var initialAttributes = {}; |
| 18 var isUndefinedOrNull = arguments.length == 2 && |
| 19 (checkValue == undefined || checkValue == null); |
| 20 |
| 21 if (isUndefinedOrNull) |
| 22 for (key in expectedAttributes) |
| 23 initialAttributes[key] = checkValue; |
| 24 |
| 25 var context = canvas.getContext("2d", initialAttributes); |
| 26 |
| 27 window.actualContextAttributes = context.getContextAttributes(); |
| 28 |
| 29 for (key in expectedAttributes) |
| 30 shouldBe("actualContextAttributes." + key, |
| 31 expectedAttributes[key].toString()); |
| 32 } |
| 33 |
| 34 </script> |
| 35 </head> |
| 36 <body> |
| 37 <script> |
| 38 |
| 39 debug("Testing default value:"); |
| 40 testAttributes(checkAttributes); |
| 41 debug("") |
| 42 |
| 43 debug("Testing undefined value:"); |
| 44 testAttributes(checkAttributes, undefined); |
| 45 debug("") |
| 46 |
| 47 debug("Testing null value:"); |
| 48 testAttributes(checkAttributes, null); |
| 49 debug("") |
| 50 |
| 51 </script> |
| 52 </body> |
OLD | NEW |