OLD | NEW |
1 description("Tests that an animateTransform with invalid attributeType does not
animate. Should result in a 100x100 rect and only PASS messages."); | 1 description("Tests that an animateTransform with invalid attributeType does not
animate. Should result in a 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", "CSS"); | 16 animate.setAttribute("attributeType", "CSS"); |
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 sample() { | 28 function sample() { |
29 expectTranslationMatrix("rootSVGElement.getTransformToElement(rect)", "0", "
0"); | 29 expectTranslationMatrix("getTransformToElement(rootSVGElement, rect)", "0",
"0"); |
30 } | 30 } |
31 | 31 |
32 function executeTest() { | 32 function executeTest() { |
33 const expectedValues = [ | 33 const expectedValues = [ |
34 // [animationId, time, sampleCallback] | 34 // [animationId, time, sampleCallback] |
35 ["animation", 0.0, sample], | 35 ["animation", 0.0, sample], |
36 ["animation", 0.001, sample], | 36 ["animation", 0.001, sample], |
37 ["animation", 2.0, sample], | 37 ["animation", 2.0, sample], |
38 ["animation", 3.999, sample], | 38 ["animation", 3.999, sample], |
39 ["animation", 4.001, sample] | 39 ["animation", 4.001, sample] |
40 ]; | 40 ]; |
41 | 41 |
42 runAnimationTest(expectedValues); | 42 runAnimationTest(expectedValues); |
43 } | 43 } |
44 | 44 |
45 var successfullyParsed = true; | 45 var successfullyParsed = true; |
OLD | NEW |