OLD | NEW |
1 description("Animate SVGMarkerElement orientAttr from an angle to auto"); | 1 description("Animate SVGMarkerElement orientAttr from auto to auto-start-reverse
"); |
2 createSVGTestCase(); | 2 createSVGTestCase(); |
3 | 3 |
4 // Setup test document | 4 // Setup test document |
5 | 5 |
6 var marker = createSVGElement("marker"); | 6 var marker = createSVGElement("marker"); |
7 marker.setAttribute("id", "marker"); | 7 marker.setAttribute("id", "marker"); |
8 marker.setAttribute("viewBox", "0 0 10 10"); | 8 marker.setAttribute("viewBox", "0 0 10 10"); |
9 marker.setAttribute("markerWidth", "2"); | 9 marker.setAttribute("markerWidth", "2"); |
10 marker.setAttribute("markerHeight", "2"); | 10 marker.setAttribute("markerHeight", "2"); |
11 marker.setAttribute("refX", "5"); | 11 marker.setAttribute("refX", "5"); |
(...skipping 19 matching lines...) Expand all Loading... |
31 path.setAttribute("marker-end", "url(#marker)"); | 31 path.setAttribute("marker-end", "url(#marker)"); |
32 path.setAttribute("d", "M 130 135 L 180 135 L 180 185"); | 32 path.setAttribute("d", "M 130 135 L 180 135 L 180 185"); |
33 path.setAttribute("transform", "translate(-130, -120)"); | 33 path.setAttribute("transform", "translate(-130, -120)"); |
34 rootSVGElement.appendChild(path); | 34 rootSVGElement.appendChild(path); |
35 | 35 |
36 var animate1 = createSVGElement("animate"); | 36 var animate1 = createSVGElement("animate"); |
37 animate1.setAttribute("id", "animation"); | 37 animate1.setAttribute("id", "animation"); |
38 animate1.setAttribute("attributeName", "orient"); | 38 animate1.setAttribute("attributeName", "orient"); |
39 animate1.setAttribute("begin", "path.click"); | 39 animate1.setAttribute("begin", "path.click"); |
40 animate1.setAttribute("dur", "4s"); | 40 animate1.setAttribute("dur", "4s"); |
41 animate1.setAttribute("from", "90deg"); | 41 animate1.setAttribute("from", "auto"); |
42 animate1.setAttribute("to", "auto"); | 42 animate1.setAttribute("to", "auto-start-reverse"); |
43 animate1.setAttribute("fill", "freeze"); | 43 animate1.setAttribute("fill", "freeze"); |
44 marker.appendChild(animate1); | 44 marker.appendChild(animate1); |
45 | 45 |
46 // Setup animation test | 46 // Setup animation test |
47 function sample1() { | 47 function sample1() { |
48 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0"); | 48 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0"); |
49 shouldBe("marker.orientAngle.baseVal.value", "0"); | 49 shouldBe("marker.orientAngle.baseVal.value", "0"); |
50 | 50 |
51 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); | 51 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); |
52 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); | 52 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); |
53 } | 53 } |
54 | 54 |
55 function sample2() { | 55 function sample2() { |
56 shouldBeCloseEnough("marker.orientAngle.animVal.value", "90"); | 56 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0"); |
57 shouldBe("marker.orientAngle.baseVal.value", "0"); | 57 shouldBe("marker.orientAngle.baseVal.value", "0"); |
58 | 58 |
59 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); | 59 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AU
TO"); |
60 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); | 60 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); |
61 } | 61 } |
62 | 62 |
63 function sample3() { | 63 function sample3() { |
64 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0"); | 64 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0"); |
65 shouldBe("marker.orientAngle.baseVal.value", "0"); | 65 shouldBe("marker.orientAngle.baseVal.value", "0"); |
66 | 66 |
67 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AU
TO"); | 67 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_UN
KNOWN"); |
68 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); | 68 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AN
GLE"); |
69 } | 69 } |
70 | 70 |
71 function executeTest() { | 71 function executeTest() { |
72 const expectedValues = [ | 72 const expectedValues = [ |
73 // [animationId, time, sampleCallback] | 73 // [animationId, time, sampleCallback] |
74 ["animation", 0.0, sample1], | 74 ["animation", 0.0, sample1], |
75 ["animation", 0.001, sample2], | 75 ["animation", 0.001, sample2], |
76 ["animation", 1.999, sample2], | 76 ["animation", 1.999, sample2], |
77 ["animation", 2.001, sample3], | 77 ["animation", 2.001, sample3], |
78 ["animation", 3.999, sample3], | 78 ["animation", 3.999, sample3], |
79 ["animation", 4.001, sample3] | 79 ["animation", 4.001, sample3] |
80 ]; | 80 ]; |
81 | 81 |
82 runAnimationTest(expectedValues); | 82 runAnimationTest(expectedValues); |
83 } | 83 } |
84 | 84 |
85 var successfullyParsed = true; | 85 var successfullyParsed = true; |
OLD | NEW |