wpt / svg / animations / animate-path-from-to-animation-additive.tentative.html

Status: FAIL | Duration: 51ms | Subtests: 0/1 | Open test on wpt.live | wpt.fyi

/svg/animations/animate-path-from-to-animation-additive.tentative.html

<!doctype html>
<title>SVG path 'd' attribute from-to animation with additive='sum'</title>
<link rel="help" href="https://www.w3.org/TR/SVG2/paths.html#TheDProperty"/>
<link rel="help" href="https://w3c.github.io/svgwg/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>
  <path id="path" fill="green" d="M10,10 L30,10 L30,30 L10,30 Z">
    <animate id="animation" attributeName="d"
             from="M0,0 L10,0 L10,10 L0,10 Z"
             to="M20,20 L40,20 L40,40 L20,40 Z"
             additive="sum"
             begin="0s" dur="2s" fill="freeze"/>
  </path>
</svg>
<script>
const rootSVGElement = document.querySelector("svg");

function sample1() {
  // t=0s: base + from = M10,10 L40,10 L40,40 L10,40 Z
  assert_animated_path_equals(path, "M10,10 L40,10 L40,40 L10,40 Z");
}

function sample2() {
  // t=1s: base + lerp(from, to, 0.5) = M20,20 L55,20 L55,55 L20,55 Z
  assert_animated_path_equals(path, "M20,20 L55,20 L55,55 L20,55 Z");
}

function sample3() {
  // t=2s: base + to = M30,30 L70,30 L70,70 L30,70 Z (frozen)
  assert_animated_path_equals(path, "M30,30 L70,30 L70,70 L30,70 Z");
}

smil_async_test((t) => {
  const expectedValues = [
    // [animationId, time, sampleCallback]
    ["animation", 0.0,   sample1],
    ["animation", 1.0,   sample2],
    ["animation", 2.0,   sample3],
    ["animation", 2.001, sample3]
  ];
  runAnimationTest(t, expectedValues);
});
</script>