| OLD | NEW |
| 1 description("Test SVGLength animation with invalid value: No spaces after number
and unit."); | 1 description("Test SVGLength animation with invalid value: No spaces after number
and unit."); |
| 2 createSVGTestCase(); | 2 createSVGTestCase(); |
| 3 | 3 |
| 4 // Setup test document | 4 // Setup test document |
| 5 var rect = createSVGElement("rect"); | 5 var rect = createSVGElement("rect"); |
| 6 rect.setAttribute("id", "rect"); | 6 rect.setAttribute("id", "rect"); |
| 7 rect.setAttribute("x", "0"); | 7 rect.setAttribute("x", "0"); |
| 8 rect.setAttribute("width", "100"); | 8 rect.setAttribute("width", "100"); |
| 9 rect.setAttribute("height", "100"); | 9 rect.setAttribute("height", "100"); |
| 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("animate"); | 13 var animate = createSVGElement("animate"); |
| 14 animate.setAttribute("id", "animation"); | 14 animate.setAttribute("id", "animation"); |
| 15 animate.setAttribute("attributeName", "width"); | 15 animate.setAttribute("attributeName", "width"); |
| 16 animate.setAttribute("begin", "click"); | 16 animate.setAttribute("begin", "click"); |
| 17 animate.setAttribute("dur", "4s"); | 17 animate.setAttribute("dur", "4s"); |
| 18 animate.setAttribute("from", "100px "); | 18 animate.setAttribute("from", "100px ERROR"); |
| 19 animate.setAttribute("to", "200px "); | 19 animate.setAttribute("to", "200px ERROR"); |
| 20 rect.appendChild(animate); | 20 rect.appendChild(animate); |
| 21 rootSVGElement.appendChild(rect); | 21 rootSVGElement.appendChild(rect); |
| 22 | 22 |
| 23 // Setup animation test | 23 // Setup animation test |
| 24 function sample1() { | 24 function sample1() { |
| 25 // Check initial/end conditions | 25 // Check initial/end conditions |
| 26 shouldBeCloseEnough("rect.width.animVal.value", "100"); | 26 shouldBeCloseEnough("rect.width.animVal.value", "100"); |
| 27 shouldBe("rect.width.baseVal.value", "100"); | 27 shouldBe("rect.width.baseVal.value", "100"); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function sample2() { | 30 function sample2() { |
| 31 shouldBeCloseEnough("rect.width.animVal.value", "0"); | 31 shouldBeCloseEnough("rect.width.animVal.value", "0"); |
| 32 shouldBe("rect.width.baseVal.value", "100"); | 32 shouldBe("rect.width.baseVal.value", "100"); |
| 33 } | 33 } |
| 34 | 34 |
| 35 function executeTest() { | 35 function executeTest() { |
| 36 const expectedValues = [ | 36 const expectedValues = [ |
| 37 // [animationId, time, sampleCallback] | 37 // [animationId, time, sampleCallback] |
| 38 ["animation", 0.0, sample1], | 38 ["animation", 0.0, sample1], |
| 39 ["animation", 2.0, sample2], | 39 ["animation", 2.0, sample2], |
| 40 ["animation", 3.999, sample2], | 40 ["animation", 3.999, sample2], |
| 41 ["animation", 4.001, sample1] | 41 ["animation", 4.001, sample1] |
| 42 ]; | 42 ]; |
| 43 | 43 |
| 44 runAnimationTest(expectedValues); | 44 runAnimationTest(expectedValues); |
| 45 } | 45 } |
| 46 | 46 |
| 47 var successfullyParsed = true; | 47 var successfullyParsed = true; |
| OLD | NEW |