| OLD | NEW |
| (Empty) |
| 1 description("This test checks the use of SVGAnimatedEnumeration within SVGTextPa
thElement"); | |
| 2 | |
| 3 var textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "te
xtPath"); | |
| 4 textPathElement.setAttribute("method", "align"); | |
| 5 textPathElement.setAttribute("spacing", "auto"); | |
| 6 | |
| 7 // method | |
| 8 debug(""); | |
| 9 debug("Check initial 'method' value"); | |
| 10 shouldBeEqualToString("textPathElement.method.toString()", "[object SVGAnimatedE
numeration]"); | |
| 11 shouldBeEqualToString("typeof(textPathElement.method.baseVal)", "number"); | |
| 12 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_ALIGN"); | |
| 13 | |
| 14 debug(""); | |
| 15 debug("Switch to 'stretch'"); | |
| 16 shouldBe("textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYP
E_STRETCH", "SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH"); | |
| 17 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_STRETCH"); | |
| 18 shouldBeEqualToString("textPathElement.getAttribute('method')", "stretch"); | |
| 19 | |
| 20 debug(""); | |
| 21 debug("Try setting invalid values"); | |
| 22 shouldThrow("textPathElement.method.baseVal = 3"); | |
| 23 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_STRETCH"); | |
| 24 shouldBeEqualToString("textPathElement.getAttribute('method')", "stretch"); | |
| 25 | |
| 26 shouldThrow("textPathElement.method.baseVal = -1"); | |
| 27 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_STRETCH"); | |
| 28 shouldBeEqualToString("textPathElement.getAttribute('method')", "stretch"); | |
| 29 | |
| 30 shouldThrow("textPathElement.method.baseVal = 0"); | |
| 31 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_STRETCH"); | |
| 32 shouldBeEqualToString("textPathElement.getAttribute('method')", "stretch"); | |
| 33 | |
| 34 debug(""); | |
| 35 debug("Switch to 'align'"); | |
| 36 shouldBe("textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYP
E_ALIGN", "SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN"); | |
| 37 shouldBe("textPathElement.method.baseVal", "SVGTextPathElement.TEXTPATH_METHODTY
PE_ALIGN"); | |
| 38 shouldBeEqualToString("textPathElement.getAttribute('method')", "align"); | |
| 39 | |
| 40 // spacing | |
| 41 debug(""); | |
| 42 debug("Check initial 'spacing' value"); | |
| 43 shouldBeEqualToString("textPathElement.spacing.toString()", "[object SVGAnimated
Enumeration]"); | |
| 44 shouldBeEqualToString("typeof(textPathElement.spacing.baseVal)", "number"); | |
| 45 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_AUTO"); | |
| 46 | |
| 47 debug(""); | |
| 48 debug("Switch to 'exact'"); | |
| 49 shouldBe("textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGT
YPE_EXACT", "SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT"); | |
| 50 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_EXACT"); | |
| 51 shouldBeEqualToString("textPathElement.getAttribute('spacing')", "exact"); | |
| 52 | |
| 53 debug(""); | |
| 54 debug("Try setting invalid values"); | |
| 55 shouldThrow("textPathElement.spacing.baseVal = 3"); | |
| 56 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_EXACT"); | |
| 57 shouldBeEqualToString("textPathElement.getAttribute('spacing')", "exact"); | |
| 58 | |
| 59 shouldThrow("textPathElement.spacing.baseVal = -1"); | |
| 60 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_EXACT"); | |
| 61 shouldBeEqualToString("textPathElement.getAttribute('spacing')", "exact"); | |
| 62 | |
| 63 shouldThrow("textPathElement.spacing.baseVal = 0"); | |
| 64 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_EXACT"); | |
| 65 shouldBeEqualToString("textPathElement.getAttribute('spacing')", "exact"); | |
| 66 | |
| 67 debug(""); | |
| 68 debug("Switch to 'auto'"); | |
| 69 shouldBe("textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGT
YPE_AUTO", "SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO"); | |
| 70 shouldBe("textPathElement.spacing.baseVal", "SVGTextPathElement.TEXTPATH_SPACING
TYPE_AUTO"); | |
| 71 shouldBeEqualToString("textPathElement.getAttribute('spacing')", "auto"); | |
| 72 | |
| 73 successfullyParsed = true; | |
| OLD | NEW |