| OLD | NEW |
| 1 description("Tests animation on 'currentColor'."); | 1 description("Tests animation on 'currentColor'."); |
| 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("width", "100px"); | 7 rect.setAttribute("width", "100px"); |
| 8 rect.setAttribute("height", "100px"); | 8 rect.setAttribute("height", "100px"); |
| 9 rect.setAttribute("fill", "currentColor"); | 9 rect.setAttribute("fill", "currentColor"); |
| 10 rect.setAttribute("color", "red"); | 10 rect.setAttribute("color", "red"); |
| 11 rect.setAttribute("onclick", "executeTest()"); | 11 rect.setAttribute("onclick", "executeTest()"); |
| 12 | 12 |
| 13 var animateColor = createSVGElement("animateColor"); | 13 var animateColor = createSVGElement("animateColor"); |
| 14 animateColor.setAttribute("id", "animateColor"); | 14 animateColor.setAttribute("id", "animateColor"); |
| 15 animateColor.setAttribute("attributeName", "color"); | 15 animateColor.setAttribute("attributeName", "color"); |
| 16 animateColor.setAttribute("from", "red"); | 16 animateColor.setAttribute("from", "red"); |
| 17 animateColor.setAttribute("to", "green"); | 17 animateColor.setAttribute("to", "green"); |
| 18 animateColor.setAttribute("dur", "3s"); | 18 animateColor.setAttribute("dur", "3s"); |
| 19 animateColor.setAttribute("begin", "click"); | 19 animateColor.setAttribute("begin", "click"); |
| 20 animateColor.setAttribute("fill", "freeze"); | 20 animateColor.setAttribute("fill", "freeze"); |
| 21 rect.appendChild(animateColor); | 21 rect.appendChild(animateColor); |
| 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 debug(""); | 26 debug(""); |
| 27 debug("Initial condition:"); | 27 debug("Initial condition:"); |
| 28 | 28 |
| 29 expectFillColor(rect, 255, 0, 0); | 29 expectFillColor(rect, 255, 0, 0); |
| 30 shouldBeEqualToString("fillPaint.uri", ""); | |
| 31 shouldBe("fillPaint.paintType", "SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR"); | |
| 32 shouldBe("fillPaint.colorType", "SVGColor.SVG_COLORTYPE_CURRENTCOLOR"); | |
| 33 } | 30 } |
| 34 | 31 |
| 35 function sample2() { | 32 function sample2() { |
| 36 debug(""); | 33 debug(""); |
| 37 debug("Half-time condition:"); | 34 debug("Half-time condition:"); |
| 38 | 35 |
| 39 expectFillColor(rect, 128, 64, 0); | 36 expectFillColor(rect, 128, 64, 0); |
| 40 shouldBeEqualToString("fillPaint.uri", ""); | |
| 41 shouldBe("fillPaint.paintType", "SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR"); | |
| 42 shouldBe("fillPaint.colorType", "SVGColor.SVG_COLORTYPE_CURRENTCOLOR"); | |
| 43 } | 37 } |
| 44 | 38 |
| 45 function sample3() { | 39 function sample3() { |
| 46 debug(""); | 40 debug(""); |
| 47 debug("End condition:"); | 41 debug("End condition:"); |
| 48 | 42 |
| 49 expectFillColor(rect, 0, 128, 0); | 43 expectFillColor(rect, 0, 128, 0); |
| 50 shouldBeEqualToString("fillPaint.uri", ""); | |
| 51 shouldBe("fillPaint.paintType", "SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR"); | |
| 52 shouldBe("fillPaint.colorType", "SVGColor.SVG_COLORTYPE_CURRENTCOLOR"); | |
| 53 } | 44 } |
| 54 | 45 |
| 55 function executeTest() { | 46 function executeTest() { |
| 56 const expectedValues = [ | 47 const expectedValues = [ |
| 57 // [animationId, time, sampleCallback] | 48 // [animationId, time, sampleCallback] |
| 58 ["animateColor", 0.0, sample1], | 49 ["animateColor", 0.0, sample1], |
| 59 ["animateColor", 1.5, sample2], | 50 ["animateColor", 1.5, sample2], |
| 60 ["animateColor", 3.0, sample3] | 51 ["animateColor", 3.0, sample3] |
| 61 ]; | 52 ]; |
| 62 | 53 |
| 63 runAnimationTest(expectedValues); | 54 runAnimationTest(expectedValues); |
| 64 } | 55 } |
| 65 | 56 |
| 66 var successfullyParsed = true; | 57 var successfullyParsed = true; |
| OLD | NEW |