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