| OLD | NEW |
| 1 description("Test for SVGNumber animation with invalid units."); | 1 description("Test for SVGNumber animation with invalid units."); |
| 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", "0px"); | 19 animate.setAttribute("from", "0px"); |
| 20 animate.setAttribute("to", "1px"); | 20 animate.setAttribute("to", "1px"); |
| 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 sample() { |
| 26 // Check initial/end conditions | 26 // Check initial/end conditions |
| 27 shouldBe("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValu
e(CSSPrimitiveValue.CSS_NUMBER)", "0"); | 27 shouldBe("getComputedStyle(rect).opacity", "'0'"); |
| 28 } | |
| 29 | |
| 30 function sample2() { | |
| 31 shouldBe("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValu
e(CSSPrimitiveValue.CSS_NUMBER)", "0"); | |
| 32 } | |
| 33 | |
| 34 function sample3() { | |
| 35 shouldBe("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValu
e(CSSPrimitiveValue.CSS_NUMBER)", "0"); | |
| 36 } | 28 } |
| 37 | 29 |
| 38 function executeTest() { | 30 function executeTest() { |
| 39 const expectedValues = [ | 31 const expectedValues = [ |
| 40 // [animationId, time, sampleCallback] | 32 // [animationId, time, sampleCallback] |
| 41 ["animation", 0.0, sample1], | 33 ["animation", 0.0, sample], |
| 42 ["animation", 2.0, sample2], | 34 ["animation", 2.0, sample], |
| 43 ["animation", 3.999, sample3], | 35 ["animation", 3.999, sample], |
| 44 ["animation", 4.001, sample1] | 36 ["animation", 4.001, sample] |
| 45 ]; | 37 ]; |
| 46 | 38 |
| 47 runAnimationTest(expectedValues); | 39 runAnimationTest(expectedValues); |
| 48 } | 40 } |
| 49 | 41 |
| 50 var successfullyParsed = true; | 42 var successfullyParsed = true; |
| OLD | NEW |