1 var svgNS = "http://www.w3.org/2000/svg";
3 var svgRoot = document.createElementNS(svgNS, "svg");
4 document.documentElement.appendChild(svgRoot);
6 var svgText = document.createElementNS(svgNS, "text");
7 svgText.style.fontFamily = "Ahem";
8 svgText.style.fontSize = "20px";
9 svgText.appendChild(document.createTextNode("abc"));
10 svgRoot.appendChild(svgText);
12 shouldThrow("svgText.getSubStringLength(-1, 2)");
13 shouldThrow("svgText.getSubStringLength(-1, 0)");
14 shouldBe("svgText.getSubStringLength(1, 3)", "40");
15 shouldBe("svgText.getSubStringLength(0, 4)", "60");
16 shouldThrow("svgText.getSubStringLength(3, 0)");
18 shouldBe("svgText.getSubStringLength(0, 0)", "0");
19 shouldBe("svgText.getSubStringLength(2, 0)", "0");
21 shouldBe("svgText.getSubStringLength(0, 1)", "20");
22 shouldBe("svgText.getSubStringLength(1, 1)", "20");
23 shouldBe("svgText.getSubStringLength(2, 1)", "20");
24 shouldBe("svgText.getSubStringLength(0, 3)", "60");
26 shouldNotThrow("svgText.getSubStringLength(1, -1)");
27 shouldNotThrow("svgText.getSubStringLength(2, -1)");
28 shouldThrow("svgText.getSubStringLength(3, -1)");
29 shouldThrow("svgText.getSubStringLength(3, -3)");
32 document.documentElement.removeChild(svgRoot);
34 var successfullyParsed = true;