diff options
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html')
-rw-r--r-- | testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html new file mode 100644 index 0000000000..e73b573779 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html @@ -0,0 +1,111 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.filter.layers.dropShadow-expected.html"> +<title>Canvas test: 2d.filter.layers.dropShadow</title> +<h1>2d.filter.layers.dropShadow</h1> +<p class="desc">Test CanvasFilter() dropShadow object.</p> +<canvas id="canvas" width="520" height="420"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(520, 420); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'teal'; + ctx.fillRect(0, 0, 520, 50); + ctx.fillRect(0, 100, 520, 50); + ctx.fillRect(0, 200, 520, 50); + ctx.fillRect(0, 300, 520, 50); + + ctx.fillStyle = 'crimson'; + + // Parameter defaults. + ctx.beginLayer({filter: {name: 'dropShadow'}}); + ctx.fillRect(10, 10, 80, 80); + ctx.endLayer(); + // All parameters specified. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5, + floodColor: 'purple', floodOpacity: 0.7}}); + ctx.fillRect(110, 10, 80, 80); + ctx.endLayer(); + // Named color. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'purple'}}); + ctx.fillRect(10, 110, 80, 80); + ctx.endLayer(); + // System color. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'LinkText'}}); + ctx.fillRect(110, 110, 80, 80); + ctx.endLayer(); + // Numerical color. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 1)'}}); + ctx.fillRect(210, 110, 80, 80); + ctx.endLayer(); + // Transparent floodColor. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)'}}); + ctx.fillRect(310, 110, 80, 80); + ctx.endLayer(); + // Transparent floodColor and floodOpacity. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}}); + ctx.fillRect(410, 110, 80, 80); + ctx.endLayer(); + // No blur. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0, + floodColor: 'purple'}}); + ctx.fillRect(10, 210, 80, 80); + ctx.endLayer(); + // Single float blur. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5, + floodColor: 'purple'}}); + ctx.fillRect(110, 210, 80, 80); + ctx.endLayer(); + // Single negative float blur. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5, + floodColor: 'purple'}}); + ctx.fillRect(210, 210, 80, 80); + ctx.endLayer(); + // Two floats (X&Y) blur. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5], + floodColor: 'purple'}}); + ctx.fillRect(310, 210, 80, 80); + ctx.endLayer(); + // Two negative floats (X&Y) blur. + ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5], + floodColor: 'purple'}}); + ctx.fillRect(410, 210, 80, 80); + ctx.endLayer(); + // Degenerate parameter values. + ctx.beginLayer({filter: {name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null, + floodColor: 'purple', floodOpacity: [2]}}); + ctx.fillRect(10, 310, 80, 80); + ctx.endLayer(); + ctx.beginLayer({filter: {name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']], + floodColor: 'purple', floodOpacity: '0.8'}}); + ctx.fillRect(110, 310, 80, 80); + ctx.endLayer(); + ctx.beginLayer({filter: {name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false, + floodColor: 'purple', floodOpacity: ['0.4']}}); + ctx.fillRect(210, 310, 80, 80); + ctx.endLayer(); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> |