Index: LayoutTests/fast/canvas/canvas-context-attributes-default-value.html |
diff --git a/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html b/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..46378c6ab9a95361f01a6958cfe0e6e7408e6b85 |
--- /dev/null |
+++ b/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html |
@@ -0,0 +1,52 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+ |
+ var checkAttributes = { |
+ alpha : true, |
+ }; |
+ |
+ 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(checkAttributes); |
+ debug("") |
+ |
+ debug("Testing undefined value:"); |
+ testAttributes(checkAttributes, undefined); |
+ debug("") |
+ |
+ debug("Testing null value:"); |
+ testAttributes(checkAttributes, null); |
+ debug("") |
+ |
+</script> |
+</body> |