Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<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>