summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html')
-rw-r--r--testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html b/testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html
new file mode 100644
index 0000000000..cfa58266ea
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/canvas-context/2d.canvas.context.invalid.args.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.canvas.context.invalid.args</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.canvas.context.invalid.args</h1>
+<p class="desc">Calling getContext with invalid arguments.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Calling getContext with invalid arguments.");
+_addTest(function(canvas, ctx) {
+
+ _assertSame(canvas.getContext(''), null, "canvas.getContext('')", "null");
+ _assertSame(canvas.getContext('2d#'), null, "canvas.getContext('2d#')", "null");
+ _assertSame(canvas.getContext('This is clearly not a valid context name.'), null, "canvas.getContext('This is clearly not a valid context name.')", "null");
+ _assertSame(canvas.getContext('2d\0'), null, "canvas.getContext('2d\\0')", "null");
+ _assertSame(canvas.getContext('2\uFF44'), null, "canvas.getContext('2\\uFF44')", "null");
+ _assertSame(canvas.getContext('2D'), null, "canvas.getContext('2D')", "null");
+ assert_throws_js(TypeError, function() { canvas.getContext(); });
+ _assertSame(canvas.getContext('null'), null, "canvas.getContext('null')", "null");
+ _assertSame(canvas.getContext('undefined'), null, "canvas.getContext('undefined')", "null");
+
+});
+</script>
+