Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /svg/animations/animate-path-by-animation-additive-mismatch.tentative.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>SVG path 'd' attribute by animation with additive='sum' and mismatched commands</title>
<link rel="help" href="https://www.w3.org/TR/SVG2/paths.html#TheDProperty"/>
<link rel="help" href="https://svgwg.org/specs/animations/#AdditionAttributes"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/SVGAnimationTestCase-testharness.js"></script>
<script src="support/animated-path-helpers.js"></script>
<svg>
<!-- Base value has L (lineto) commands, by value has Q (quadratic curve) commands -->
<path id="path" fill="green" d="M10,10 L30,10 L30,30 L10,30 Z">
<animate id="animation" attributeName="d"
by="M20,20 Q40,20 40,40 Q20,40 20,20 Z"
additive="sum"
begin="0s" dur="2s" fill="freeze"/>
</path>
</svg>
<script>
const rootSVGElement = document.querySelector("svg");
// Mismatched commands cause blending to fail; addition also fails so animated value stays unchanged.
function sample() {
// All times: base value (blending and addition both fail)
assert_animated_path_equals(path, "M10,10 L30,10 L30,30 L10,30 Z");
}
smil_async_test((t) => {
const expectedValues = [
// [animationId, time, sampleCallback]
["animation", 0.0, sample],
["animation", 1.0, sample],
["animation", 2.0, sample],
["animation", 2.001, sample]
];
runAnimationTest(t, expectedValues);
});
</script>