4 <script src=
"../../resources/js-test.js"></script>
11 var falseAttributes
= {
15 function testAttributes(expectedAttributes
, checkValue
) {
17 if (arguments
.length
!= 1 && arguments
.length
!= 2)
20 var canvas
= document
.createElement("canvas");
21 var initialAttributes
= {};
22 var isUndefinedOrNull
= arguments
.length
== 2 &&
23 (checkValue
== undefined || checkValue
== null);
25 if (isUndefinedOrNull
)
26 for (key
in expectedAttributes
)
27 initialAttributes
[key
] = checkValue
;
29 var context
= canvas
.getContext("2d", initialAttributes
);
31 window
.actualContextAttributes
= context
.getContextAttributes();
33 for (key
in expectedAttributes
)
34 shouldBe("actualContextAttributes." + key
,
35 expectedAttributes
[key
].toString());
43 debug("Testing default value:");
44 testAttributes(trueAttributes
);
47 debug("Testing undefined value:");
48 testAttributes(trueAttributes
, undefined);
51 debug("Testing null value:");
52 testAttributes(falseAttributes
, null);