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