OLD | NEW |
(Empty) | |
| 1 description("This removes and adds an animation element while the animation is r
epeating"); |
| 2 embedSVGTestCase("resources/repeatn-remove-add-animation.svg"); |
| 3 |
| 4 // Setup animation test |
| 5 function sample1() { |
| 6 expectFillColor(rect1, 0, 255, 0); |
| 7 expectFillColor(rect2, 255, 0, 0); |
| 8 expectFillColor(rect3, 255, 0, 0); |
| 9 expectFillColor(rect4, 255, 0, 0); |
| 10 } |
| 11 |
| 12 function sample2() { |
| 13 expectFillColor(rect1, 0, 255, 0); |
| 14 expectFillColor(rect2, 0, 255, 0); |
| 15 expectFillColor(rect3, 255, 0, 0); |
| 16 expectFillColor(rect4, 255, 0, 0); |
| 17 } |
| 18 |
| 19 function sample3() { |
| 20 expectFillColor(rect1, 0, 255, 0); |
| 21 expectFillColor(rect2, 0, 255, 0); |
| 22 expectFillColor(rect3, 0, 255, 0); |
| 23 expectFillColor(rect4, 255, 0, 0); |
| 24 } |
| 25 |
| 26 function sample4() { |
| 27 expectFillColor(rect1, 0, 255, 0); |
| 28 expectFillColor(rect2, 0, 255, 0); |
| 29 expectFillColor(rect3, 0, 255, 0); |
| 30 expectFillColor(rect4, 0, 255, 0); |
| 31 } |
| 32 |
| 33 function recreate() { |
| 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); |
| 44 } |
| 45 |
| 46 function executeTest() { |
| 47 var rects = rootSVGElement.ownerDocument.getElementsByTagName("rect"); |
| 48 rect1 = rects[0]; |
| 49 rect2 = rects[1]; |
| 50 rect3 = rects[2]; |
| 51 rect4 = rects[3]; |
| 52 |
| 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] |
| 64 ]; |
| 65 |
| 66 runAnimationTest(expectedValues); |
| 67 } |
| 68 |
| 69 window.animationStartsImmediately = true; |
| 70 var successfullyParsed = true; |
OLD | NEW |