summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/svg
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/svg')
-rw-r--r--testing/web-platform/tests/svg/crashtests/chrome-bug-333487749.html14
-rw-r--r--testing/web-platform/tests/svg/layout/svg-embed-intrinsic-size-min-size.html16
-rw-r--r--testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size-ref.html3
-rw-r--r--testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size.html16
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/green-100x100.svg3
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/non-scaling-stroke-001.html30
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/paint-context-007-ref.svg29
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/paint-context-007.svg32
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/paint-context-008-ref.svg22
-rw-r--r--testing/web-platform/tests/svg/painting/reftests/paint-context-008.svg33
-rw-r--r--testing/web-platform/tests/svg/painting/scripted/marker-element-added.html29
-rw-r--r--testing/web-platform/tests/svg/path/property/serialization.svg2
-rw-r--r--testing/web-platform/tests/svg/types/scripted/SVGLength-rlh.html31
13 files changed, 259 insertions, 1 deletions
diff --git a/testing/web-platform/tests/svg/crashtests/chrome-bug-333487749.html b/testing/web-platform/tests/svg/crashtests/chrome-bug-333487749.html
new file mode 100644
index 0000000000..1613f4998a
--- /dev/null
+++ b/testing/web-platform/tests/svg/crashtests/chrome-bug-333487749.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<body style="mask: url(#marker)">
+ <svg>
+ <marker id="marker">
+ <rect width="10" height="10" fill="yellow"/>
+ </marker>
+ <path d="M50,50h100" marker-start="url(#marker1)"/>
+ </svg>
+</body>
+<script>
+ document.documentElement.offsetTop;
+ document.documentElement.style.display = 'none';
+ document.documentElement.offsetTop;
+</script>
diff --git a/testing/web-platform/tests/svg/layout/svg-embed-intrinsic-size-min-size.html b/testing/web-platform/tests/svg/layout/svg-embed-intrinsic-size-min-size.html
new file mode 100644
index 0000000000..79dfb07b42
--- /dev/null
+++ b/testing/web-platform/tests/svg/layout/svg-embed-intrinsic-size-min-size.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1894363">
+<link rel="match" href="svg-intrinsic-size-min-size-ref.html">
+<style>
+ embed {
+ width: auto;
+ height: auto;
+ vertical-align: top;
+ }
+</style>
+<div style="width: min-content; background-color: green">
+ <embed src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='56' height='56' viewBox='0 0 56 56'></svg>">
+</div>
diff --git a/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size-ref.html b/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size-ref.html
new file mode 100644
index 0000000000..f9ae2910d8
--- /dev/null
+++ b/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div style="width: 56px; height: 56px; background-color: green"></div>
diff --git a/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size.html b/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size.html
new file mode 100644
index 0000000000..41c68e56e1
--- /dev/null
+++ b/testing/web-platform/tests/svg/layout/svg-intrinsic-size-min-size.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1894363">
+<link rel="match" href="svg-intrinsic-size-min-size-ref.html">
+<style>
+ svg {
+ width: auto;
+ height: auto;
+ vertical-align: top;
+ }
+</style>
+<div style="width: min-content; background-color: green">
+ <svg width="56" height="56" viewBox="0 0 56 56"></svg>
+</div>
diff --git a/testing/web-platform/tests/svg/painting/reftests/green-100x100.svg b/testing/web-platform/tests/svg/painting/reftests/green-100x100.svg
new file mode 100644
index 0000000000..120941444a
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/green-100x100.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect width="100" height="100" fill="green"/>
+</svg>
diff --git a/testing/web-platform/tests/svg/painting/reftests/non-scaling-stroke-001.html b/testing/web-platform/tests/svg/painting/reftests/non-scaling-stroke-001.html
new file mode 100644
index 0000000000..a9870ac8bb
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/non-scaling-stroke-001.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<title>non-scaling-stroke with scaling</title>
+<link rel="help" href="https://svgwg.org/svg2-draft/painting.html#PaintingVectorEffects" />
+<link rel="match" href="green-100x100.svg" />
+<body>
+ <style>
+ body {
+ border: none;
+ margin: 0;
+ width: 200px;
+ height: 200px;
+ transform: scale(2);
+ }
+ svg {
+ width: 100px;
+ height: 100px;
+ }
+ rect {
+ fill: red;
+ stroke: green;
+ stroke-width: 50px;
+ vector-effect: non-scaling-stroke;
+ }
+ </style>
+ <svg>
+ <rect width="75" height="75"/>
+ </svg>
+</body>
+</html>
diff --git a/testing/web-platform/tests/svg/painting/reftests/paint-context-007-ref.svg b/testing/web-platform/tests/svg/painting/reftests/paint-context-007-ref.svg
new file mode 100644
index 0000000000..0328272c6a
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/paint-context-007-ref.svg
@@ -0,0 +1,29 @@
+<svg id="svg-root"
+ width="100%" height="100%" viewBox="0 0 400 300"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+ <g id="testmeta">
+ <title>Paint: 'context-fill' and 'context-stroke' in 'use' with transform</title>
+ <html:link rel="author"
+ title="Stefan Zager"
+ href="mailto:szager@chromium.org"/>
+ </g>
+
+ <defs>
+ <linearGradient id="lg1" x2="125%">
+ <stop offset="0" stop-color="red"/>
+ <stop offset="1" stop-color="blue"/>
+ </linearGradient>
+
+ <linearGradient id="lg2" x1="-25%">
+ <stop offset="0" stop-color="red"/>
+ <stop offset="1" stop-color="blue"/>
+ </linearGradient>
+ </defs>
+
+ <g id="test-reference">
+ <rect x="50" y="90" width="240" height="120" fill="url(#lg1)"/>
+ <path d="M 110 30 l 240 120 l -240 120 Z" fill="url(#lg2)" />
+ </g>
+</svg>
diff --git a/testing/web-platform/tests/svg/painting/reftests/paint-context-007.svg b/testing/web-platform/tests/svg/painting/reftests/paint-context-007.svg
new file mode 100644
index 0000000000..50360a302e
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/paint-context-007.svg
@@ -0,0 +1,32 @@
+<svg id="svg-root"
+ width="100%" height="100%" viewBox="0 0 400 300"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+ <g id="testmeta">
+ <title>Paint: 'context-fill' and 'context-stroke' in 'use' with transform</title>
+ <html:link rel="author"
+ title="Stefan Zager"
+ href="mailto:szager@chromium.org"/>
+ <html:link rel="help"
+ href="https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint"/>
+ <html:link rel="match" href="paint-context-007-ref.svg" />
+ </g>
+
+ <defs>
+ <linearGradient id="lg">
+ <stop offset="0" stop-color="red"/>
+ <stop offset="1" stop-color="blue"/>
+ </linearGradient>
+
+ <g id="shapes">
+ <rect x="50" y="90" width="240" height="120" fill="context-fill"/>
+ <path d="M 170 -30 l -120 240 l 240 0 Z" fill="context-fill"
+ transform-origin="170 150" transform="rotate(90)"/>
+ </g>
+ </defs>
+
+ <g id="test-body-content">
+ <use x="0" y="0" fill="url(#lg)" xlink:href="#shapes"/>
+ </g>
+</svg>
diff --git a/testing/web-platform/tests/svg/painting/reftests/paint-context-008-ref.svg b/testing/web-platform/tests/svg/painting/reftests/paint-context-008-ref.svg
new file mode 100644
index 0000000000..49d4f8947b
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/paint-context-008-ref.svg
@@ -0,0 +1,22 @@
+<svg id="svg-root"
+ width="100%" height="100%" viewBox="0 0 400 300"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+ <g id="testmeta">
+ <title>Paint: paint server transform for 'context-fill' based on nearest 'use' ancestor</title>
+ <html:link rel="author"
+ title="Stefan Zager"
+ href="mailto:szager@chromium.org"/>
+ </g>
+
+ <defs>
+ <pattern id="grid" x="0" y="0" width="0.125" height="0.25" stroke="blue" stroke-width="0.03125" patternContentUnits="objectBoundingBox">
+ <path fill="none" d="M 0.0625 0 l 0.0625 0.125 l -0.0625 0.125 l -0.0625 -0.125 Z"/>
+ </pattern>
+ </defs>
+
+ <g id="test-reference">
+ <rect x="69" y="113" width="256" height="128" fill="url(#grid)"/>
+ </g>
+</svg>
diff --git a/testing/web-platform/tests/svg/painting/reftests/paint-context-008.svg b/testing/web-platform/tests/svg/painting/reftests/paint-context-008.svg
new file mode 100644
index 0000000000..83308f09b1
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/reftests/paint-context-008.svg
@@ -0,0 +1,33 @@
+<svg id="svg-root"
+ width="100%" height="100%" viewBox="0 0 400 300"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+ <g id="testmeta">
+ <title>Paint: paint server transform for 'context-fill' based on nearest 'use' ancestor</title>
+ <html:link rel="author"
+ title="Stefan Zager"
+ href="mailto:szager@chromium.org"/>
+ <html:link rel="help"
+ href="https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint"/>
+ <html:link rel="match" href="paint-context-008-ref.svg" />
+ </g>
+
+ <defs>
+ <pattern id="grid" x="0" y="0" width="0.125" height="0.25" stroke="blue" stroke-width="0.03125" patternContentUnits="objectBoundingBox">
+ <path fill="none" d="M 0.0625 0 l 0.0625 0.125 l -0.0625 0.125 l -0.0625 -0.125 Z"/>
+ </pattern>
+
+ <g id="shapes">
+ <rect x="50" y="90" width="256" height="128" fill="context-fill"/>
+ </g>
+
+ <g id="intermediate">
+ <use x="19" y="23" fill="url(#grid)" xlink:href="#shapes"/>
+ </g>
+ </defs>
+
+ <g id="test-body-content">
+ <use xlink:href="#intermediate"/>
+ </g>
+</svg>
diff --git a/testing/web-platform/tests/svg/painting/scripted/marker-element-added.html b/testing/web-platform/tests/svg/painting/scripted/marker-element-added.html
new file mode 100644
index 0000000000..39d3cb190c
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/scripted/marker-element-added.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html class="reftest-wait">
+<title>&lt;marker> element added after first paint</title>
+<script src="/common/reftest-wait.js"></script>
+<script src="/common/rendering-utils.js"></script>
+<link rel="match" href="../../struct/reftests/reference/green-100x100.html">
+<svg>
+ <path d="M0,0h100" marker-start="url(#m)"/>
+</svg>
+<script>
+ function createSvgElement(name, attrData) {
+ const svgNs = 'http://www.w3.org/2000/svg';
+ const element = document.createElementNS(svgNs, name);
+ attrData.forEach(([name, value]) => element.setAttribute(name, value));
+ return element;
+ }
+ waitForAtLeastOneFrame().then(() => {
+ const svgNs = 'http://www.w3.org/2000/svg';
+ const markerElement = createSvgElement('marker', [
+ ['id', 'm'], ['orient', '0'], ['overflow', 'visible']
+ ]);
+ markerElement.appendChild(createSvgElement('rect', [
+ ['width', '100'], ['height', '100'], ['fill', 'green']
+ ]));
+ const svg = document.querySelector('svg');
+ svg.insertBefore(markerElement, svg.firstElementChild);
+ takeScreenshot();
+ });
+</script>
diff --git a/testing/web-platform/tests/svg/path/property/serialization.svg b/testing/web-platform/tests/svg/path/property/serialization.svg
index 3199beb92b..2ad336d5f7 100644
--- a/testing/web-platform/tests/svg/path/property/serialization.svg
+++ b/testing/web-platform/tests/svg/path/property/serialization.svg
@@ -17,7 +17,7 @@
let test2 = 'path("M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z")';
test_valid_value('d', test2);
- test_computed_value('d', test2);
+ test_computed_value('d', test2, 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 260 220 Z")');
let test3 = 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")';
test_valid_value('d', test3, 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")');
diff --git a/testing/web-platform/tests/svg/types/scripted/SVGLength-rlh.html b/testing/web-platform/tests/svg/types/scripted/SVGLength-rlh.html
new file mode 100644
index 0000000000..411013b65b
--- /dev/null
+++ b/testing/web-platform/tests/svg/types/scripted/SVGLength-rlh.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<title>SVGLength with 'rlh' unit</title>
+<link rel="help" href="https://www.w3.org/TR/SVG/types.html#InterfaceSVGLength">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+:root {
+ font-family: initial;
+ font-size: 20px;
+}
+</style>
+<div style="font-size: 10px">
+ <div id="rlh_ref" style="width:10rlh"></div>
+ <svg>
+ <text id="rlh_test" x="10rlh"></text>
+ </svg>
+</div>
+<script>
+ let ref_width = rlh_ref.offsetWidth;
+ let rlh_length = rlh_test.x.baseVal[0];
+
+ test(() => {
+ assert_equals(rlh_length.unitType, SVGLength.SVG_LENGTHTYPE_UNKNOWN);
+ assert_equals(rlh_length.value, ref_width);
+ }, "rlh unit in SVGLength");
+
+ test(() => {
+ rlh_length.value = ref_width * 2;
+ assert_equals(rlh_length.valueInSpecifiedUnits, 20);
+ }, "Convert back to rlh from new user unit value");
+</script>