| OLD | NEW |
| 1 description('Tests that an animateTransform with attributeType "auto" acts as "X
ML". Should result in a translated 100x100 rect and only PASS messages.'); | 1 description('Tests that an animateTransform with attributeType "auto" acts as "X
ML". Should result in a translated 100x100 rect and only PASS messages.'); |
| 2 createSVGTestCase(); | 2 createSVGTestCase(); |
| 3 | 3 |
| 4 // Setup test document | 4 // Setup test document |
| 5 | 5 |
| 6 var rect = createSVGElement("rect"); | 6 var rect = createSVGElement("rect"); |
| 7 rect.setAttribute("id", "rect"); | 7 rect.setAttribute("id", "rect"); |
| 8 rect.setAttribute("width", "200"); | 8 rect.setAttribute("width", "200"); |
| 9 rect.setAttribute("height", "200"); | 9 rect.setAttribute("height", "200"); |
| 10 rect.setAttribute("fill", "green"); | 10 rect.setAttribute("fill", "green"); |
| 11 rect.setAttribute("onclick", "executeTest()"); | 11 rect.setAttribute("onclick", "executeTest()"); |
| 12 | 12 |
| 13 var animate = createSVGElement("animateTransform"); | 13 var animate = createSVGElement("animateTransform"); |
| 14 animate.setAttribute("id", "animation"); | 14 animate.setAttribute("id", "animation"); |
| 15 animate.setAttribute("attributeName", "transform"); | 15 animate.setAttribute("attributeName", "transform"); |
| 16 animate.setAttribute("attributeType", "auto"); | 16 animate.setAttribute("attributeType", "auto"); |
| 17 animate.setAttribute("type", "translate"); | 17 animate.setAttribute("type", "translate"); |
| 18 animate.setAttribute("from", "0, 0"); | 18 animate.setAttribute("from", "0, 0"); |
| 19 animate.setAttribute("to", "200, 200"); | 19 animate.setAttribute("to", "200, 200"); |
| 20 animate.setAttribute("begin", "rect.click"); | 20 animate.setAttribute("begin", "rect.click"); |
| 21 animate.setAttribute("dur", "4s"); | 21 animate.setAttribute("dur", "4s"); |
| 22 animate.setAttribute("fill", "freeze"); | 22 animate.setAttribute("fill", "freeze"); |
| 23 rect.appendChild(animate); | 23 rect.appendChild(animate); |
| 24 | 24 |
| 25 rootSVGElement.appendChild(rect); | 25 rootSVGElement.appendChild(rect); |
| 26 | 26 |
| 27 // Setup animation test | 27 // Setup animation test |
| 28 function sample1() { | 28 function sample1() { |
| 29 expectTranslationMatrix("rootSVGElement.getTransformToElement(rect)", "0", "
0"); | 29 expectTranslationMatrix("getTransformToElement(rootSVGElement, rect)", "0",
"0"); |
| 30 } | 30 } |
| 31 function sample2() { | 31 function sample2() { |
| 32 expectTranslationMatrix("rootSVGElement.getTransformToElement(rect)", "-100"
, "-100"); | 32 expectTranslationMatrix("getTransformToElement(rootSVGElement, rect)", "-100
", "-100"); |
| 33 } | 33 } |
| 34 function sample3() { | 34 function sample3() { |
| 35 expectTranslationMatrix("rootSVGElement.getTransformToElement(rect)", "-200"
, "-200"); | 35 expectTranslationMatrix("getTransformToElement(rootSVGElement, rect)", "-200
", "-200"); |
| 36 } | 36 } |
| 37 | 37 |
| 38 function executeTest() { | 38 function executeTest() { |
| 39 const expectedValues = [ | 39 const expectedValues = [ |
| 40 // [animationId, time, sampleCallback] | 40 // [animationId, time, sampleCallback] |
| 41 ["animation", 0.0, sample1], | 41 ["animation", 0.0, sample1], |
| 42 ["animation", 0.001, sample1], | 42 ["animation", 0.001, sample1], |
| 43 ["animation", 2.0, sample2], | 43 ["animation", 2.0, sample2], |
| 44 ["animation", 3.999, sample3], | 44 ["animation", 3.999, sample3], |
| 45 ["animation", 4.001, sample3] | 45 ["animation", 4.001, sample3] |
| 46 ]; | 46 ]; |
| 47 | 47 |
| 48 runAnimationTest(expectedValues); | 48 runAnimationTest(expectedValues); |
| 49 } | 49 } |
| 50 | 50 |
| 51 var successfullyParsed = true; | 51 var successfullyParsed = true; |
| OLD | NEW |