OLD | NEW |
1 description("Tests that XML and CSS attributeTypes can be switched between."); | 1 description("Tests that XML and CSS attributeTypes can be switched between."); |
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", "100"); | 7 rect.setAttribute("x", "100"); |
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"); |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 function sample3() { | 34 function sample3() { |
35 // verify that the animation resets. | 35 // verify that the animation resets. |
36 shouldBeCloseEnough("rect.x.animVal.value", "100"); | 36 shouldBeCloseEnough("rect.x.animVal.value", "100"); |
37 // change the animation to a CSS animatable value. | 37 // change the animation to a CSS animatable value. |
38 set.setAttribute("attributeName", "opacity"); | 38 set.setAttribute("attributeName", "opacity"); |
39 set.setAttribute("to", "0.8"); | 39 set.setAttribute("to", "0.8"); |
40 } | 40 } |
41 | 41 |
42 function sample4() { | 42 function sample4() { |
43 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g
etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.8"); | 43 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.8"); |
44 // change the animation to a non-CSS animatable value. | 44 // change the animation to a non-CSS animatable value. |
45 set.setAttribute("attributeName", "x"); | 45 set.setAttribute("attributeName", "x"); |
46 set.setAttribute("to", "200"); | 46 set.setAttribute("to", "200"); |
47 } | 47 } |
48 | 48 |
49 function sample5() { | 49 function sample5() { |
50 // verify that the animation does not run. | 50 // verify that the animation does not run. |
51 shouldBeCloseEnough("rect.x.animVal.value", "100"); | 51 shouldBeCloseEnough("rect.x.animVal.value", "100"); |
52 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g
etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1.0"); | 52 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1.0"); |
53 // change the animationType to XML which is valid. | 53 // change the animationType to XML which is valid. |
54 set.setAttribute("attributeType", "XML"); | 54 set.setAttribute("attributeType", "XML"); |
55 } | 55 } |
56 | 56 |
57 function sample6() { | 57 function sample6() { |
58 shouldBeCloseEnough("rect.x.animVal.value", "200"); | 58 shouldBeCloseEnough("rect.x.animVal.value", "200"); |
59 shouldBe("rect.x.baseVal.value", "100"); | 59 shouldBe("rect.x.baseVal.value", "100"); |
60 } | 60 } |
61 | 61 |
62 function executeTest() { | 62 function executeTest() { |
63 const expectedValues = [ | 63 const expectedValues = [ |
64 // [animationId, time, sampleCallback] | 64 // [animationId, time, sampleCallback] |
65 ["set", 0.0, sample1], | 65 ["set", 0.0, sample1], |
66 ["set", 0.5, sample2], | 66 ["set", 0.5, sample2], |
67 ["set", 1.0, sample3], | 67 ["set", 1.0, sample3], |
68 ["set", 1.5, sample4], | 68 ["set", 1.5, sample4], |
69 ["set", 2.0, sample5], | 69 ["set", 2.0, sample5], |
70 ["set", 2.5, sample6] | 70 ["set", 2.5, sample6] |
71 ]; | 71 ]; |
72 | 72 |
73 runAnimationTest(expectedValues); | 73 runAnimationTest(expectedValues); |
74 } | 74 } |
75 | 75 |
76 window.clickX = 150; | 76 window.clickX = 150; |
77 var successfullyParsed = true; | 77 var successfullyParsed = true; |
OLD | NEW |