summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html')
-rw-r--r--testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html92
1 files changed, 92 insertions, 0 deletions
diff --git a/testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html b/testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html
new file mode 100644
index 0000000000..4c734b5373
--- /dev/null
+++ b/testing/web-platform/tests/svg/animations/svgnumberoptionalnumber-animation-4.html
@@ -0,0 +1,92 @@
+<!doctype html>
+<html>
+<title>Test 'by' animation of SVGNumberOptionalNumber.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/SVGAnimationTestCase-testharness.js"></script>
+
+<svg>
+</svg>
+
+<script>
+var rootSVGElement = document.querySelector("svg");
+var epsilon = 1.0;
+
+// Setup test document
+var defs = createSVGElement("defs");
+rootSVGElement.appendChild(defs);
+
+var filter = createSVGElement("filter");
+filter.setAttribute("id", "filter");
+filter.setAttribute("x", "-30%");
+filter.setAttribute("y", "-30%");
+filter.setAttribute("width", "160%");
+filter.setAttribute("height", "160%");
+defs.appendChild(filter);
+
+var feGaussianBlur = createSVGElement("feGaussianBlur");
+feGaussianBlur.setAttribute("id", "blur");
+feGaussianBlur.setAttribute("stdDeviation", "5");
+filter.appendChild(feGaussianBlur);
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("x", "50");
+rect.setAttribute("y", "50");
+rect.setAttribute("width", "200");
+rect.setAttribute("height", "200");
+rect.setAttribute("fill", "green");
+rect.setAttribute("filter", "url(#filter)");
+rect.setAttribute("onclick", "executeTest()");
+rootSVGElement.appendChild(rect);
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "stdDeviation");
+animate.setAttribute("begin", "0s");
+animate.setAttribute("dur", "4s");
+animate.setAttribute("from", "5");
+animate.setAttribute("by", "10");
+feGaussianBlur.appendChild(animate);
+
+// Setup animation test
+function sample1() {
+ assert_approx_equals(feGaussianBlur.stdDeviationX.animVal, 5, epsilon);
+ assert_approx_equals(feGaussianBlur.stdDeviationY.animVal, 5, epsilon);
+
+ assert_equals(feGaussianBlur.stdDeviationX.baseVal, 5);
+ assert_equals(feGaussianBlur.stdDeviationY.baseVal, 5);
+}
+
+function sample2() {
+ assert_approx_equals(feGaussianBlur.stdDeviationX.animVal, 10, epsilon);
+ assert_approx_equals(feGaussianBlur.stdDeviationY.animVal, 10, epsilon);
+
+ assert_equals(feGaussianBlur.stdDeviationX.baseVal, 5);
+ assert_equals(feGaussianBlur.stdDeviationY.baseVal, 5);
+}
+
+function sample3() {
+ assert_approx_equals(feGaussianBlur.stdDeviationX.animVal, 15, epsilon);
+ assert_approx_equals(feGaussianBlur.stdDeviationY.animVal, 15, epsilon);
+
+ assert_equals(feGaussianBlur.stdDeviationX.baseVal, 5);
+ assert_equals(feGaussianBlur.stdDeviationY.baseVal, 5);
+}
+
+smil_async_test((t) => {
+ const expectedValues = [
+ // [animationId, time, sampleCallback]
+ ["animation", 0.0, sample1],
+ ["animation", 2.0, sample2],
+ ["animation", 3.999, sample3],
+ ["animation", 4.001, sample1]
+ ];
+
+ runAnimationTest(t, expectedValues);
+});
+
+window.clickX = 60;
+window.clickY = 60;
+
+</script>