diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/tests/html/canvas/element/layers | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/element/layers')
15 files changed, 304 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter-expected.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter-expected.html new file mode 100644 index 0000000000..5fc1ac9acd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter-expected.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.filter</title> +<h1>2d.layer.ctm.filter</h1> +<p class="desc">Checks that parent transforms affect layer filters.</p> + +<svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feDropShadow dx="5" dy="5" stdDeviation="0" flood-color="grey" /> + </filter> + + <g filter="url(#filter)"> + <g transform="translate(30, 90) scale(2) rotate(90)"> + <rect x="-30" y="-5" width=60 height=10></rect> + </g> + </g> + + <g transform="translate(80, 90) scale(2) rotate(90)"> + <g filter="url(#filter)"> + <rect x="-30" y="-5" width=60 height=10></rect> + </g> + </g> +</svg> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter.html new file mode 100644 index 0000000000..3d56ac3601 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.filter.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.filter-expected.html"> +<title>Canvas test: 2d.layer.ctm.filter</title> +<h1>2d.layer.ctm.filter</h1> +<p class="desc">Checks that parent transforms affect layer filters.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + // Transforms inside the layer should not apply to the layer's filter. + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.translate(30, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); + + // Transforms in the layer's parent should apply to the layer's filter. + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.getTransform.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.getTransform.html new file mode 100644 index 0000000000..7a69c59527 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.getTransform.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.getTransform</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.layer.ctm.getTransform</h1> +<p class="desc">Tests getTransform inside layers.</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("Tests getTransform inside layers."); +_addTest(function(canvas, ctx) { + + ctx.translate(10, 20); + ctx.beginLayer(); + ctx.scale(2, 3); + const m = ctx.getTransform(); + assert_array_equals([m.a, m.b, m.c, m.d, m.e, m.f], [2, 0, 0, 3, 10, 20]); + ctx.endLayer(); + +}); +</script> + diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform-expected.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform-expected.html new file mode 100644 index 0000000000..fd4c1746c7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform-expected.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.resetTransform</title> +<h1>2d.layer.ctm.resetTransform</h1> +<p class="desc">Tests resetTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 20, 20); + + ctx.translate(40, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform.html new file mode 100644 index 0000000000..9291f8f3f2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.resetTransform.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.resetTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.resetTransform</title> +<h1>2d.layer.ctm.resetTransform</h1> +<p class="desc">Tests resetTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(40, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.resetTransform(); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 20, 20); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform-expected.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform-expected.html new file mode 100644 index 0000000000..45a3d095e1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform-expected.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.setTransform</title> +<h1>2d.layer.ctm.setTransform</h1> +<p class="desc">Tests setTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + ctx.setTransform(4, 0, 0, 2, 20, 10); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 10, 10); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform.html new file mode 100644 index 0000000000..b5d98ba45f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.setTransform.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.setTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.setTransform</title> +<h1>2d.layer.ctm.setTransform</h1> +<p class="desc">Tests setTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.setTransform(4, 0, 0, 2, 20, 10); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 10, 10); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html new file mode 100644 index 0000000000..312ca19b4c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title> +<h1>2d.layer.ctm.shadow-in-transformed-layer</h1> +<p class="desc">Check shadows inside of a transformed layer.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'grey'; + ctx.fillRect(-30, -5, 60, 10); + + const canvas2 = new OffscreenCanvas(100, 100); + const ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = 'blue'; + ctx2.fillRect(0, 0, 40, 10); + ctx.drawImage(canvas2, -30, -30); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer.html new file mode 100644 index 0000000000..f047bd30b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.ctm.shadow-in-transformed-layer.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html"> +<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title> +<h1>2d.layer.ctm.shadow-in-transformed-layer</h1> +<p class="desc">Check shadows inside of a transformed layer.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + + ctx.beginLayer(); + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'grey'; + ctx.fillRect(-30, -5, 60, 10); + + const canvas2 = new OffscreenCanvas(100, 100); + const ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = 'blue'; + ctx2.fillRect(0, 0, 40, 10); + ctx.drawImage(canvas2, -30, -30); + + ctx.endLayer(); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage-expected.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage-expected.html new file mode 100644 index 0000000000..26f6e75214 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage-expected.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.drawImage</title> +<h1>2d.layer.drawImage</h1> +<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'skyblue'; + ctx.fillRect(0, 0, 100, 100); + + ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10, + stdDeviation: 0, floodColor: 'navy'}}); + + ctx.fillStyle = 'maroon'; + ctx.fillRect(20, 20, 50, 50); + + ctx.globalCompositeOperation = 'xor'; + + // Should xor only with the layer content, not the parents'. + ctx.fillStyle = 'pink'; + ctx.fillRect(40, 40, 50, 50); + + ctx.endLayer(); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage.html new file mode 100644 index 0000000000..58206c3eb8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.drawImage.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.drawImage-expected.html"> +<title>Canvas test: 2d.layer.drawImage</title> +<h1>2d.layer.drawImage</h1> +<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'skyblue'; + ctx.fillRect(0, 0, 100, 100); + + ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10, + stdDeviation: 0, floodColor: 'navy'}}); + + ctx.fillStyle = 'maroon'; + ctx.fillRect(20, 20, 50, 50); + + ctx.globalCompositeOperation = 'xor'; + + // The image should xor only with the layer content, not the parents'. + const canvas_image = new OffscreenCanvas(200,200); + const ctx_image = canvas_image.getContext("2d"); + ctx_image.fillStyle = 'pink'; + ctx_image.fillRect(40, 40, 50, 50); + ctx.drawImage(canvas_image, 0, 0); + + ctx.endLayer(); +</script> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html index 17e0f0c8c5..98ea67e9e9 100644 --- a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-2453"> <title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> <h1>2d.layer.global-states.filter.alpha.blending</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html index 71a27cf710..29041d4933 100644 --- a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-5204"> <title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> <h1>2d.layer.global-states.filter.alpha.composite</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html index 5133aa170e..85718cffba 100644 --- a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6766"> <title>Canvas test: 2d.layer.global-states.filter.alpha</title> <h1>2d.layer.global-states.filter.alpha</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html index 6aa8e75a95..aaeb167ccf 100644 --- a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6311"> <title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> <h1>2d.layer.global-states.filter.alpha.shadow</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> |