OLD | NEW |
1 description("This test checks the SVGLength API"); | 1 description("This test checks the SVGLength API"); |
2 | 2 |
3 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | 3 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
4 var length = svgElement.createSVGLength(); | 4 var length = svgElement.createSVGLength(); |
5 | 5 |
6 debug(""); | 6 debug(""); |
7 debug("Check initial length values"); | 7 debug("Check initial length values"); |
8 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_NUMBER"); | 8 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_NUMBER"); |
9 shouldBe("length.value", "0"); | 9 shouldBe("length.value", "0"); |
10 shouldBe("length.valueInSpecifiedUnits", "0"); | 10 shouldBe("length.valueInSpecifiedUnits", "0"); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 shouldBe("length.value", "2"); | 76 shouldBe("length.value", "2"); |
77 shouldBe("length.valueInSpecifiedUnits", "2"); | 77 shouldBe("length.valueInSpecifiedUnits", "2"); |
78 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 78 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
79 | 79 |
80 shouldThrow("length.valueAsString = ',5 em'"); | 80 shouldThrow("length.valueAsString = ',5 em'"); |
81 shouldBeEqualToString("length.valueAsString", "2px"); | 81 shouldBeEqualToString("length.valueAsString", "2px"); |
82 shouldBe("length.value", "2"); | 82 shouldBe("length.value", "2"); |
83 shouldBe("length.valueInSpecifiedUnits", "2"); | 83 shouldBe("length.valueInSpecifiedUnits", "2"); |
84 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 84 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
85 | 85 |
| 86 shouldThrow("length.valueAsString = null"); |
| 87 shouldBeEqualToString("length.valueAsString", "2px"); |
| 88 shouldBe("length.value", "2"); |
| 89 shouldBe("length.valueInSpecifiedUnits", "2"); |
| 90 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 91 |
86 debug(""); | 92 debug(""); |
87 debug("Check setting invalid 'value' arguments"); | 93 debug("Check setting invalid 'value' arguments"); |
88 shouldThrow("length.value = NaN"); | 94 shouldThrow("length.value = NaN"); |
89 shouldThrow("length.value = Infinity"); | 95 shouldThrow("length.value = Infinity"); |
90 shouldBe("length.value", "2"); | 96 shouldBe("length.value", "2"); |
91 shouldBe("length.valueInSpecifiedUnits", "2"); | 97 shouldBe("length.valueInSpecifiedUnits", "2"); |
92 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 98 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
93 | 99 |
94 debug(""); | 100 debug(""); |
95 debug("Check setting invalid 'valueInSpecifiedUnits' arguments"); | 101 debug("Check setting invalid 'valueInSpecifiedUnits' arguments"); |
96 shouldThrow("length.valueInSpecifiedUnits = NaN"); | 102 shouldThrow("length.valueInSpecifiedUnits = NaN"); |
97 shouldThrow("length.valueInSpecifiedUnits = Infinity"); | 103 shouldThrow("length.valueInSpecifiedUnits = Infinity"); |
98 shouldBe("length.value", "2"); | 104 shouldBe("length.value", "2"); |
99 shouldBe("length.valueInSpecifiedUnits", "2"); | 105 shouldBe("length.valueInSpecifiedUnits", "2"); |
100 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 106 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
101 | 107 |
102 successfullyParsed = true; | 108 successfullyParsed = true; |
OLD | NEW |