1 description("This removes and adds an animation element while the animation is repeating");
2 embedSVGTestCase("resources/repeatn-remove-add-animation.svg");
4 // Setup animation test
6 expectFillColor(rect1
, 0, 255, 0);
7 expectFillColor(rect2
, 255, 0, 0);
8 expectFillColor(rect3
, 255, 0, 0);
9 expectFillColor(rect4
, 255, 0, 0);
13 expectFillColor(rect1
, 0, 255, 0);
14 expectFillColor(rect2
, 0, 255, 0);
15 expectFillColor(rect3
, 255, 0, 0);
16 expectFillColor(rect4
, 255, 0, 0);
20 expectFillColor(rect1
, 0, 255, 0);
21 expectFillColor(rect2
, 0, 255, 0);
22 expectFillColor(rect3
, 0, 255, 0);
23 expectFillColor(rect4
, 255, 0, 0);
27 expectFillColor(rect1
, 0, 255, 0);
28 expectFillColor(rect2
, 0, 255, 0);
29 expectFillColor(rect3
, 0, 255, 0);
30 expectFillColor(rect4
, 0, 255, 0);
34 var anim1
= rootSVGElement
.ownerDocument
.getElementById("anim");
35 anim1
.parentNode
.removeChild(anim1
);
36 var anim2
= createSVGElement("animate");
37 anim2
.setAttribute("id", "anim");
38 anim2
.setAttribute("attributeName", "visibility");
39 anim2
.setAttribute("to", "visible");
40 anim2
.setAttribute("begin", "0s");
41 anim2
.setAttribute("dur", "2s");
42 anim2
.setAttribute("repeatCount", "4");
43 rootSVGElement
.appendChild(anim2
);
46 function executeTest() {
47 var rects
= rootSVGElement
.ownerDocument
.getElementsByTagName("rect");
53 const expectedValues
= [
54 // [animationId, time, sampleCallback]
55 ["anim", 0.0, sample1
],
56 ["anim", 0.001, sample1
],
57 ["anim", 2.0, sample1
],
58 ["anim", 2.001, sample2
],
59 ["anim", 4.0, sample2
],
60 ["anim", 4.001, sample3
],
61 ["anim", 5.0, recreate
],
62 ["anim", 6.0, sample3
],
63 ["anim", 6.001, sample4
]
66 runAnimationTest(expectedValues
);
69 window
.animationStartsImmediately
= true;
70 var successfullyParsed
= true;