diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html')
-rw-r--r-- | testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html b/testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html new file mode 100644 index 0000000000..9e75bdf17a --- /dev/null +++ b/testing/web-platform/tests/svg/animations/multiple-begin-additive-animation.html @@ -0,0 +1,136 @@ +<!doctype html> +<html> +<meta charset="utf-8"> +<title>This tests additive='sum' support on animate elements with multiple begin times</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> + +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"> +<rect width="100" height="100" fill="green"> + <animate id="an1" attributeName="y" attributeType="XML" begin="0s" dur="12s" from="100" to="900" fill="freeze" /> + <animate attributeName="x" attributeType="XML" calcMode="discrete" begin="0s; 2s" from="0" to="400" dur="8s" additive="sum" /> +</rect> +</svg> + +<script> +var rootSVGElement = document.querySelector("svg"); +var epsilon = 1.0; + +// Setup animation test +function checkBaseValues() { +return; + assert_equals(rect.x.baseVal.value, 0); + assert_equals(rect.y.baseVal.value, 0); +} + +function sample1() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 100, epsilon); + checkBaseValues(); +} + +function sample2() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 166.67, epsilon); + checkBaseValues(); +} + +function sample3() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 366.60, epsilon); + checkBaseValues(); +} + +function sample4() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 366.73, epsilon); + checkBaseValues(); +} + +function sample5() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 499.93, epsilon); + checkBaseValues(); +} + +function sample6() { + assert_equals(rect.x.animVal.value, 400); + assert_approx_equals(rect.y.animVal.value, 500.06, epsilon); + checkBaseValues(); +} + +function sample7() { + assert_equals(rect.x.animVal.value, 400); + assert_approx_equals(rect.y.animVal.value, 566.67, epsilon); + checkBaseValues(); +} + +function sample8() { + assert_equals(rect.x.animVal.value, 400); + assert_approx_equals(rect.y.animVal.value, 633.33, epsilon); + checkBaseValues(); +} + +function sample9() { + assert_equals(rect.x.animVal.value, 400); + assert_approx_equals(rect.y.animVal.value, 700, epsilon); + checkBaseValues(); +} + +function sample10() { + assert_equals(rect.x.animVal.value, 400); + assert_approx_equals(rect.y.animVal.value, 766.60, epsilon); + checkBaseValues(); +} + +function sample11() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 766.67, epsilon); + checkBaseValues(); +} + +function sample12() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 833.33, epsilon); + checkBaseValues(); +} + +function sample13() { + assert_equals(rect.x.animVal.value, 0); + assert_approx_equals(rect.y.animVal.value, 900, epsilon); + checkBaseValues(); +} + +smil_async_test((t) => { + rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0]; + + // All animations in the test file use the same duration, so it's not needed to list all sample points individually for an5/an6/an7/an8. + const expectedValues = [ + // [animationId, time, sampleCallback] + ["an1", 0.0, sample1], + ["an1", 1.0, sample2], + ["an1", 3.999, sample3], + ["an1", 4.001, sample4], + ["an1", 5.999, sample5], + ["an1", 6.001, sample6], + ["an1", 7.0, sample7], + ["an1", 7.999, sample8], + ["an1", 8.001, sample8], + ["an1", 9.0, sample9], + ["an1", 9.999, sample10], + ["an1", 10.001, sample11], + ["an1", 11.0, sample12], + ["an1", 11.999, sample13], + ["an1", 12.001, sample13], + ["an1", 60.0, sample13] + ]; + + runAnimationTest(t, expectedValues); +}); + +window.animationStartsImmediately = true; + +</script>
\ No newline at end of file |