Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>Canvas test: 2d.filter.layers.dropShadow.exceptions</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.filter.layers.dropShadow.exceptions</h1>
<p class="desc">Test exceptions on CanvasFilter() dropShadow object</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("Test exceptions on CanvasFilter() dropShadow object");
_addTest(function(canvas, ctx) {
// Should not throw an error.
// dx
ctx.beginLayer({filter:
{name: 'dropShadow', dx: 10}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: -1}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: 0.5}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: null}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: true}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: false}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: []}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: [20]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dx: '30'}}); ctx.endLayer();
// dy
ctx.beginLayer({filter:
{name: 'dropShadow', dy: 10}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: -1}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: 0.5}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: null}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: true}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: false}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: []}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: [20]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', dy: '30'}}); ctx.endLayer();
// floodOpacity
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: null}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: true}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: false}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: []}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer();
// stdDeviation
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: -1}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: 0.5}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: null}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: true}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: false}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: []}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [20]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: '30'}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [10, -1]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [0.5, null]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [true, false]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [[], [20]]}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: ['30', ['40']]}}); ctx.endLayer();
// floodColor
ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 'red'}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 'canvas'}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: '#aabbccdd'}}); ctx.endLayer();
ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: '#abcd'}}); ctx.endLayer();
// Should throw a TypeError.
// dx
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: NaN}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: -Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: undefined}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: 'test'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: {}}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dx: [1, 2]}}); ctx.endLayer(); });
// dy
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: NaN}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: -Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: undefined}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: 'test'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: {}}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', dy: [1, 2]}}); ctx.endLayer(); });
// floodOpacity
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: NaN}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: -Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: undefined}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: 'test'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: {}}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodOpacity: [1, 2]}}); ctx.endLayer(); });
// stdDeviation
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: NaN}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: -Infinity}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: undefined}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: 'test'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: {}}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, 2, 3]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, NaN]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, Infinity]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, -Infinity]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, undefined]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, 'test']}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, {}]}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', stdDeviation: [1, [2, 3]]}}); ctx.endLayer(); });
// floodColor
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 'test'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: 10}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: undefined}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: null}}); ctx.endLayer(); });
assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
{name: 'dropShadow', floodColor: NaN}}); ctx.endLayer(); });
});
</script>