| OLD | NEW |
| 1 description("Test for SVGNumber animation with different exponents."); | 1 description("Test for SVGNumber animation with different exponents."); |
| 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("opacity", "0"); | 11 rect.setAttribute("opacity", "0"); |
| 12 rect.setAttribute("onclick", "executeTest()"); | 12 rect.setAttribute("onclick", "executeTest()"); |
| 13 | 13 |
| 14 var animate = createSVGElement("animate"); | 14 var animate = createSVGElement("animate"); |
| 15 animate.setAttribute("id", "animation"); | 15 animate.setAttribute("id", "animation"); |
| 16 animate.setAttribute("attributeName", "opacity"); | 16 animate.setAttribute("attributeName", "opacity"); |
| 17 animate.setAttribute("begin", "click"); | 17 animate.setAttribute("begin", "click"); |
| 18 animate.setAttribute("dur", "4s"); | 18 animate.setAttribute("dur", "4s"); |
| 19 animate.setAttribute("from", "0e10"); | 19 animate.setAttribute("from", "0e10"); |
| 20 animate.setAttribute("to", ".1e1"); | 20 animate.setAttribute("to", ".1e1"); |
| 21 rect.appendChild(animate); | 21 rect.appendChild(animate); |
| 22 rootSVGElement.appendChild(rect); | 22 rootSVGElement.appendChild(rect); |
| 23 | 23 |
| 24 // Setup animation test | 24 // Setup animation test |
| 25 function sample1() { | 25 function sample1() { |
| 26 // Check initial/end conditions | 26 // Check initial/end conditions |
| 27 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g
etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0"); | 27 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0"); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function sample2() { | 30 function sample2() { |
| 31 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g
etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5"); | 31 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5"); |
| 32 } | 32 } |
| 33 | 33 |
| 34 function sample3() { | 34 function sample3() { |
| 35 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g
etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1"); | 35 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1"); |
| 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", 2.0, sample2], | 42 ["animation", 2.0, sample2], |
| 43 ["animation", 3.999, sample3], | 43 ["animation", 3.999, sample3], |
| 44 ["animation", 4.001, sample1] | 44 ["animation", 4.001, sample1] |
| 45 ]; | 45 ]; |
| 46 | 46 |
| 47 runAnimationTest(expectedValues); | 47 runAnimationTest(expectedValues); |
| 48 } | 48 } |
| 49 | 49 |
| 50 var successfullyParsed = true; | 50 var successfullyParsed = true; |
| OLD | NEW |