summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/svg/animations/svgenum-animation-13.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/svg/animations/svgenum-animation-13.html')
-rw-r--r--testing/web-platform/tests/svg/animations/svgenum-animation-13.html103
1 files changed, 103 insertions, 0 deletions
diff --git a/testing/web-platform/tests/svg/animations/svgenum-animation-13.html b/testing/web-platform/tests/svg/animations/svgenum-animation-13.html
new file mode 100644
index 0000000000..c6dbb0c44d
--- /dev/null
+++ b/testing/web-platform/tests/svg/animations/svgenum-animation-13.html
@@ -0,0 +1,103 @@
+<!doctype html>
+<html>
+<meta charset="utf-8">
+<title>Test ChannelSelectorType enumeration animations</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 defsElement = createSVGElement("defs");
+rootSVGElement.appendChild(defsElement);
+
+var feImage1 = createSVGElement("feImage");
+feImage1.setAttribute("result", "Map");
+feImage1.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/sphere.png");
+
+var feImage2 = createSVGElement("feImage");
+feImage2.setAttribute("result", "Texture");
+feImage2.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/DisplaceChecker.png");
+
+var displacementMap = createSVGElement("feDisplacementMap");
+displacementMap.setAttribute("in", "Texture");
+displacementMap.setAttribute("in2", "Map");
+displacementMap.setAttribute("scale", "64");
+displacementMap.setAttribute("xChannelSelector", "B");
+displacementMap.setAttribute("yChannelSelector", "G");
+
+var filter = createSVGElement("filter");
+filter.setAttribute("id", "filter");
+filter.setAttribute("filterUnit", "objectBoundingBox");
+filter.setAttribute("x", "0");
+filter.setAttribute("y", "0");
+filter.setAttribute("width", "1");
+filter.setAttribute("height", "1");
+filter.appendChild(feImage1);
+filter.appendChild(feImage2);
+filter.appendChild(displacementMap);
+defsElement.appendChild(filter);
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("onclick", "executeTest()");
+rect.setAttribute("width", "100");
+rect.setAttribute("height", "100");
+rect.setAttribute("filter", "url(#filter)");
+rootSVGElement.appendChild(rect);
+
+var animate1 = createSVGElement("animate");
+animate1.setAttribute("id", "animation");
+animate1.setAttribute("attributeName", "xChannelSelector");
+animate1.setAttribute("begin", "0s");
+animate1.setAttribute("dur", "4s");
+animate1.setAttribute("values", "R;G;B;A");
+animate1.setAttribute("fill", "freeze");
+displacementMap.appendChild(animate1);
+
+// Setup animation test
+function sample1() {
+ assert_equals(displacementMap.xChannelSelector.animVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+ assert_equals(displacementMap.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+}
+
+function sample2() {
+ assert_equals(displacementMap.xChannelSelector.animVal, SVGFEDisplacementMapElement.SVG_CHANNEL_R);
+ assert_equals(displacementMap.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+}
+
+function sample3() {
+ assert_equals(displacementMap.xChannelSelector.animVal, SVGFEDisplacementMapElement.SVG_CHANNEL_G);
+ assert_equals(displacementMap.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+}
+
+function sample4() {
+ assert_equals(displacementMap.xChannelSelector.animVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(displacementMap.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+}
+
+smil_async_test((t) => {
+ const expectedValues = [
+ // [animationId, time, sampleCallback]
+ ["animation", 0.0, sample1],
+ ["animation", 0.001, sample2],
+ ["animation", 0.999, sample2],
+ ["animation", 1.001, sample3],
+ ["animation", 1.999, sample3],
+ ["animation", 2.001, sample1],
+ ["animation", 2.999, sample1],
+ ["animation", 3.001, sample4],
+ ["animation", 3.999, sample4],
+ ["animation", 4.001, sample4]
+ ];
+
+ runAnimationTest(t, expectedValues);
+});
+
+</script> \ No newline at end of file