| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <script>window.enablePixelTesting = true;</script> |
| <script src="../../resources/js-test-pre.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" rotate="90 180 270">ABC</text> |
| </svg> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| <script type="text/javascript"> |
| <![CDATA[ |
| description("This is a test of the simple SVGNumberList API parts."); |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var text1 = document.getElementById("text1"); |
| |
| // Spec: The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated. |
| shouldBeTrue("text1.rotate.baseVal != text1.rotate.animVal"); |
| |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.animVal.numberOfItems", "3"); |
| |
| debug(""); |
| debug("Test uncommon arguments for initialize()"); |
| shouldThrow("text1.rotate.baseVal.initialize(30)"); |
| shouldThrow("text1.rotate.baseVal.initialize('aString')"); |
| shouldThrow("text1.rotate.baseVal.initialize(text1)"); |
| shouldThrow("text1.rotate.baseVal.initialize(null)"); |
| |
| debug(""); |
| debug("Test uncommon arguments for getItem()"); |
| shouldThrow("text1.rotate.baseVal.getItem(30)"); |
| shouldBe("text1.rotate.baseVal.getItem('aString')", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.getItem(text1)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.getItem(null)", "text1.rotate.baseVal.getItem(0)"); |
| |
| debug(""); |
| debug("Test uncommon arguments for insertItemBefore()"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(30)"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore('aString')"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(text1)"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(null)"); |
| |
| shouldBe("text1.rotate.baseVal.insertItemBefore(text1.rotate.baseVal.getItem(1), 'aString')", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "180"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "90"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "270"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "180 90 270"); |
| |
| shouldBe("text1.rotate.baseVal.insertItemBefore(text1.rotate.baseVal.getItem(1), text1)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "90"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "180"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "270"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "90 180 270"); |
| |
| shouldBe("text1.rotate.baseVal.insertItemBefore(text1.rotate.baseVal.getItem(1), null)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "180"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "90"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "270"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "180 90 270"); |
| |
| shouldBe("text1.rotate.baseVal.insertItemBefore(text1.rotate.baseVal.getItem(1), 0)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "90"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "180"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "270"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "90 180 270"); |
| |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(30, 0)"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore('aString', 0)"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(text1, 0)"); |
| shouldThrow("text1.rotate.baseVal.insertItemBefore(null, 0)"); |
| |
| debug(""); |
| debug("Set rotate='1 2 3 4' for text1"); |
| shouldBeUndefined("text1.setAttribute('rotate', '1 2 3 4')"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "4"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "1"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "2"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(3).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "1 2 3 4"); |
| |
| debug(""); |
| debug("Test uncommon arguments for replaceItem()"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(30)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem('aString')"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(text1)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(null)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(30, 0)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem('aString', 0)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(text1, 0)"); |
| shouldThrow("text1.rotate.baseVal.replaceItem(null, 0)"); |
| |
| shouldBe("text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 0)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "4"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "1"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "2"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(3).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "1 2 3 4"); |
| |
| shouldBe("text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 'aString')", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "4"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "1"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "2"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(3).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "1 2 3 4"); |
| |
| shouldBe("text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), text1)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "1 2 3 4"); |
| |
| shouldBe("text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), null)", "text1.rotate.baseVal.getItem(0)"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "1 2 3 4"); |
| |
| debug(""); |
| debug("Set rotate='1 2 3 4' for text1"); |
| shouldBeUndefined("text1.setAttribute('rotate', '1 2 3 4')"); |
| |
| debug(""); |
| debug("Test uncommon arguents for removeItem()"); |
| shouldThrow("text1.rotate.baseVal.removeItem(30)"); |
| |
| shouldBe("text1.rotate.baseVal.removeItem('aString').value", "1"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "2"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(2).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "2 3 4"); |
| |
| shouldBe("text1.rotate.baseVal.removeItem(text1).value", "2"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "2"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "3"); |
| shouldBe("text1.rotate.baseVal.getItem(1).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "3 4"); |
| |
| shouldBe("text1.rotate.baseVal.removeItem(null).value", "3"); |
| shouldBe("text1.rotate.baseVal.numberOfItems", "1"); |
| shouldBe("text1.rotate.baseVal.getItem(0).value", "4"); |
| shouldBeEqualToString("text1.getAttribute('rotate')", "4"); |
| |
| debug(""); |
| debug("Test uncommon arguments for appendItem()"); |
| shouldThrow("text1.rotate.baseVal.appendItem(30)"); |
| shouldThrow("text1.rotate.baseVal.appendItem('aString')"); |
| shouldThrow("text1.rotate.baseVal.appendItem(text1)"); |
| shouldThrow("text1.rotate.baseVal.appendItem(null)"); |
| |
| debug(""); |
| debug("Testing animVal clear throws"); |
| shouldThrow("text1.rotate.animVal.clear()"); |
| shouldBeUndefined("text1.rotate.baseVal.clear()"); |
| |
| ]]> |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |