1 description("Test BlendModeType enumeration animations");
5 var filter
= createSVGElement("filter");
6 filter
.setAttribute("id", "filter");
7 rootSVGElement
.appendChild(filter
);
9 var feFlood
= createSVGElement("feFlood");
10 feFlood
.setAttribute("in", "SourceGraphic");
11 feFlood
.setAttribute("flood-color", "green");
12 feFlood
.setAttribute("flood-opacity", "0.5");
13 feFlood
.setAttribute("result", "img");
14 filter
.appendChild(feFlood
);
16 var feBlend
= createSVGElement("feBlend");
17 feBlend
.setAttribute("in", "SourceGraphic");
18 feBlend
.setAttribute("in2", "img");
19 feBlend
.setAttribute("mode", "lighten");
20 filter
.appendChild(feBlend
);
22 var rect
= createSVGElement("rect");
23 rect
.setAttribute("id", "rect");
24 rect
.setAttribute("onclick", "executeTest()");
25 rect
.setAttribute("filter", "url(#filter)");
26 rect
.setAttribute("width", "100");
27 rect
.setAttribute("height", "100");
28 rootSVGElement
.appendChild(rect
);
30 var animate1
= createSVGElement("animate");
31 animate1
.setAttribute("id", "animation");
32 animate1
.setAttribute("attributeName", "mode");
33 animate1
.setAttribute("begin", "rect.click");
34 animate1
.setAttribute("dur", "5s");
35 animate1
.setAttribute("values", "normal;multiply;screen;darken;lighten");
36 animate1
.setAttribute("fill", "freeze");
37 feBlend
.appendChild(animate1
);
39 // Setup animation test
41 shouldBe("feBlend.mode.animVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
42 shouldBe("feBlend.mode.baseVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
46 shouldBe("feBlend.mode.animVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL");
47 shouldBe("feBlend.mode.baseVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
51 shouldBe("feBlend.mode.animVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_MULTIPLY");
52 shouldBe("feBlend.mode.baseVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
56 shouldBe("feBlend.mode.animVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_SCREEN");
57 shouldBe("feBlend.mode.baseVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
61 shouldBe("feBlend.mode.animVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_DARKEN");
62 shouldBe("feBlend.mode.baseVal", "SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN");
65 function executeTest() {
66 const expectedValues
= [
67 // [animationId, time, sampleCallback]
68 ["animation", 0.0, sample1
],
69 ["animation", 0.001, sample2
],
70 ["animation", 0.999, sample2
],
71 ["animation", 1.001, sample3
],
72 ["animation", 1.999, sample3
],
73 ["animation", 2.001, sample4
],
74 ["animation", 2.999, sample4
],
75 ["animation", 3.001, sample5
],
76 ["animation", 3.999, sample5
],
77 ["animation", 4.001, sample1
]
80 runAnimationTest(expectedValues
);
83 var successfullyParsed
= true;