<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>window.enablePixelTesting = true;</script>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<text id="text1" x="50" y="50" requiredExtensions="1 2 3">ABC</text>
</svg>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
<![CDATA[
description("This is a test of the simple SVGStringList API parts.");
var text1 = document.getElementById("text1");
shouldBe("text1.requiredExtensions.numberOfItems", "3");
debug("");
debug("Test uncommon arguments for initialize()");
shouldBeEqualToString("text1.requiredExtensions.initialize('30')", "30");
shouldBe("text1.requiredExtensions.numberOfItems", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "30");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "30");
shouldBeEqualToString("text1.requiredExtensions.initialize(text1)", "[object SVGTextElement]");
shouldBe("text1.requiredExtensions.numberOfItems", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "[object SVGTextElement]");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.initialize(0)", "0");
shouldBe("text1.requiredExtensions.numberOfItems", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "0");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "0");
shouldBeEqualToString("text1.requiredExtensions.initialize('aString')", "aString");
shouldBe("text1.requiredExtensions.numberOfItems", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "aString");
debug("");
debug("Test uncommon arguments for getItem()");
shouldThrow("text1.requiredExtensions.getItem(30)");
shouldBe("text1.requiredExtensions.getItem('aString')", "text1.requiredExtensions.getItem(0)");
shouldBe("text1.requiredExtensions.getItem(text1)", "text1.requiredExtensions.getItem(0)");
shouldBe("text1.requiredExtensions.getItem(null)", "text1.requiredExtensions.getItem(0)");
debug("");
debug("Test uncommon arguments for insertItemBefore()");
shouldThrow("text1.requiredExtensions.insertItemBefore(30)");
shouldThrow("text1.requiredExtensions.insertItemBefore('aString')");
shouldThrow("text1.requiredExtensions.insertItemBefore(text1)");
shouldThrow("text1.requiredExtensions.insertItemBefore(null)");
shouldThrow("text1.requiredExtensions.insertItemBefore(text1.requiredExtensions.getItem(1), 'aString')");
shouldThrow("text1.requiredExtensions.insertItemBefore(text1.requiredExtensions.getItem(1), text1)");
shouldThrow("text1.requiredExtensions.insertItemBefore(text1.requiredExtensions.getItem(1), null)");
shouldThrow("text1.requiredExtensions.insertItemBefore(text1.requiredExtensions.getItem(1), 0)");
shouldBeEqualToString("text1.requiredExtensions.insertItemBefore(30, 0)", "30");
shouldBe("text1.requiredExtensions.numberOfItems", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "30 aString");
shouldBeEqualToString("text1.requiredExtensions.insertItemBefore('aString', 0)", "aString");
shouldBe("text1.requiredExtensions.numberOfItems", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "aString");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "aString 30 aString");
shouldBeEqualToString("text1.requiredExtensions.insertItemBefore(text1, 0)", "[object SVGTextElement]");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "aString");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "[object SVGTextElement] aString 30 aString");
shouldBeEqualToString("text1.requiredExtensions.insertItemBefore(null, 0)", "null");
shouldBe("text1.requiredExtensions.numberOfItems", "5");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "null");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "aString");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(4)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "null [object SVGTextElement] aString 30 aString");
debug("");
debug("Set requiredExtensions='1 2 3 4' for text1");
shouldBeUndefined("text1.setAttribute('requiredExtensions', '1 2 3 4')");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
debug("");
debug("Test uncommon arguments for replaceItem() - part 1");
shouldThrow("text1.requiredExtensions.replaceItem(30)");
shouldThrow("text1.requiredExtensions.replaceItem('aString')");
shouldThrow("text1.requiredExtensions.replaceItem(text1)");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(null, 0)", "null");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "null");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "null 2 3 4");
shouldBeEqualToString("text1.requiredExtensions.replaceItem('aString', 3)", "aString");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "null");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "null 2 3 aString");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(text1, 2)", "[object SVGTextElement]");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "null");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "null 2 [object SVGTextElement] aString");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(1, 1)", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "null");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "null 1 [object SVGTextElement] aString");
debug("");
debug("Set requiredExtensions='1 2 3 4' for text1");
shouldBeUndefined("text1.setAttribute('requiredExtensions', '1 2 3 4')");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
debug("");
debug("Test uncommon arguments for replaceItem() - part 2");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(text1.requiredExtensions.getItem(0), 0)", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(text1.requiredExtensions.getItem(0), 'aString')", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(text1.requiredExtensions.getItem(0), text1)", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
shouldBeEqualToString("text1.requiredExtensions.replaceItem(text1.requiredExtensions.getItem(0), null)", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "1");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "1 2 3 4");
debug("");
debug("Test uncommon arguments for removeItem()");
shouldThrow("text1.requiredExtensions.removeItem(30)");
shouldBeEqualToString("text1.requiredExtensions.removeItem('aString')", "1");
shouldBe("text1.requiredExtensions.numberOfItems", "3");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "2 3 4");
shouldBeEqualToString("text1.requiredExtensions.removeItem(text1)", "2");
shouldBe("text1.requiredExtensions.numberOfItems", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "4");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "3 4");
shouldBeEqualToString("text1.requiredExtensions.removeItem(null)", "3");
shouldBe("text1.requiredExtensions.numberOfItems", "1");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "4");
debug("");
debug("Test uncommon arguments for appendItem()");
shouldBeEqualToString("text1.requiredExtensions.appendItem(30)", "30");
shouldBe("text1.requiredExtensions.numberOfItems", "2");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "30");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "4 30");
shouldBeEqualToString("text1.requiredExtensions.appendItem('aString')", "aString");
shouldBe("text1.requiredExtensions.numberOfItems", "3");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "aString");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "4 30 aString");
shouldBeEqualToString("text1.requiredExtensions.appendItem(text1)", "[object SVGTextElement]");
shouldBe("text1.requiredExtensions.numberOfItems", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "aString");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "[object SVGTextElement]");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "4 30 aString [object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.appendItem(null)", "null");
shouldBe("text1.requiredExtensions.numberOfItems", "5");
shouldBeEqualToString("text1.requiredExtensions.getItem(0)", "4");
shouldBeEqualToString("text1.requiredExtensions.getItem(1)", "30");
shouldBeEqualToString("text1.requiredExtensions.getItem(2)", "aString");
shouldBeEqualToString("text1.requiredExtensions.getItem(3)", "[object SVGTextElement]");
shouldBeEqualToString("text1.requiredExtensions.getItem(4)", "null");
shouldBeEqualToString("text1.getAttribute('requiredExtensions')", "4 30 aString [object SVGTextElement] null");
debug("");
debug("clear() requiredExtensions list so text on top shows up");
shouldBeUndefined("text1.requiredExtensions.clear()");
]]>
</script>
</body>
</html>