| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 64 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 65 | 65 |
| 66 debug(""); | 66 debug(""); |
| 67 debug("Check setting invalid 'valueAsString' arguments"); | 67 debug("Check setting invalid 'valueAsString' arguments"); |
| 68 shouldThrow("length.valueAsString = '10deg'"); | 68 shouldThrow("length.valueAsString = '10deg'"); |
| 69 shouldBeEqualToString("length.valueAsString", "2px"); | 69 shouldBeEqualToString("length.valueAsString", "2px"); |
| 70 shouldBe("length.value", "2"); | 70 shouldBe("length.value", "2"); |
| 71 shouldBe("length.valueInSpecifiedUnits", "2"); | 71 shouldBe("length.valueInSpecifiedUnits", "2"); |
| 72 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 72 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 73 | 73 |
| 74 shouldThrow("length.valueAsString = '1pX'"); | 74 shouldNotThrow("length.valueAsString = '1pX'"); |
| 75 shouldBeEqualToString("length.valueAsString", "2px"); | 75 shouldBeEqualToString("length.valueAsString", "1px"); |
| 76 shouldBe("length.value", "2"); | 76 shouldBe("length.value", "1"); |
| 77 shouldBe("length.valueInSpecifiedUnits", "2"); | 77 shouldBe("length.valueInSpecifiedUnits", "1"); |
| 78 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 78 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 79 | 79 |
| 80 length.valueAsString = "2px"; // reset to 2px |
| 81 |
| 80 shouldThrow("length.valueAsString = ',5 em'"); | 82 shouldThrow("length.valueAsString = ',5 em'"); |
| 81 shouldBeEqualToString("length.valueAsString", "2px"); | 83 shouldBeEqualToString("length.valueAsString", "2px"); |
| 82 shouldBe("length.value", "2"); | 84 shouldBe("length.value", "2"); |
| 83 shouldBe("length.valueInSpecifiedUnits", "2"); | 85 shouldBe("length.valueInSpecifiedUnits", "2"); |
| 84 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 86 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 85 | 87 |
| 86 debug(""); | 88 debug(""); |
| 87 debug("Check setting invalid 'value' arguments"); | 89 debug("Check setting invalid 'value' arguments"); |
| 88 shouldThrow("length.value = NaN"); | 90 shouldThrow("length.value = NaN"); |
| 89 shouldThrow("length.value = Infinity"); | 91 shouldThrow("length.value = Infinity"); |
| 90 shouldBe("length.value", "2"); | 92 shouldBe("length.value", "2"); |
| 91 shouldBe("length.valueInSpecifiedUnits", "2"); | 93 shouldBe("length.valueInSpecifiedUnits", "2"); |
| 92 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 94 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 93 | 95 |
| 94 debug(""); | 96 debug(""); |
| 95 debug("Check setting invalid 'valueInSpecifiedUnits' arguments"); | 97 debug("Check setting invalid 'valueInSpecifiedUnits' arguments"); |
| 96 shouldThrow("length.valueInSpecifiedUnits = NaN"); | 98 shouldThrow("length.valueInSpecifiedUnits = NaN"); |
| 97 shouldThrow("length.valueInSpecifiedUnits = Infinity"); | 99 shouldThrow("length.valueInSpecifiedUnits = Infinity"); |
| 98 shouldBe("length.value", "2"); | 100 shouldBe("length.value", "2"); |
| 99 shouldBe("length.valueInSpecifiedUnits", "2"); | 101 shouldBe("length.valueInSpecifiedUnits", "2"); |
| 100 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); | 102 shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX"); |
| 101 | 103 |
| 102 successfullyParsed = true; | 104 successfullyParsed = true; |
| OLD | NEW |