| OLD | NEW |
| (Empty) |
| 1 <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 2 <head> | |
| 3 <script>window.enablePixelTesting = true;</script> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="250" height="250"> | |
| 8 <g transform="translate(10, 10)"> | |
| 9 <path id="path1" d="M 0 0 L 100 100 L 100 0 L 100 100 v 100 L 0 100" fil
l="green"/> | |
| 10 <path transform="translate(110, 0)" id="path2" d="M 0 0 h 100 L 200 100
h -100" fill="green"/> | |
| 11 </g> | |
| 12 </svg> | |
| 13 | |
| 14 <p id="description"></p> | |
| 15 <div id="console"></div> | |
| 16 <script type="text/javascript"> | |
| 17 <![CDATA[ | |
| 18 description("This is a test of the SVGPathSegList::replaceItem() API."); | |
| 19 | |
| 20 var svg = document.getElementById("svg"); | |
| 21 var path1 = document.getElementById("path1"); | |
| 22 var path2 = document.getElementById("path2"); | |
| 23 | |
| 24 debug(""); | |
| 25 debug("Check initial 'pathSegList' value of path1"); | |
| 26 shouldBe("path1.pathSegList.numberOfItems", "6"); | |
| 27 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
| 28 shouldBe("path1.pathSegList.getItem(0).x", "0"); | |
| 29 shouldBe("path1.pathSegList.getItem(0).y", "0"); | |
| 30 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 31 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
| 32 shouldBe("path1.pathSegList.getItem(1).y", "100"); | |
| 33 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 34 shouldBe("path1.pathSegList.getItem(2).x", "100"); | |
| 35 shouldBe("path1.pathSegList.getItem(2).y", "0"); | |
| 36 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 37 shouldBe("path1.pathSegList.getItem(3).x", "100"); | |
| 38 shouldBe("path1.pathSegList.getItem(3).y", "100"); | |
| 39 shouldBeEqualToString("path1.pathSegList.getItem(4).toString()", "[object SV
GPathSegLinetoVerticalRel]"); | |
| 40 shouldBe("path1.pathSegList.getItem(4).y", "100"); | |
| 41 shouldBeEqualToString("path1.pathSegList.getItem(5).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 42 shouldBe("path1.pathSegList.getItem(5).x", "0"); | |
| 43 shouldBe("path1.pathSegList.getItem(5).y", "100"); | |
| 44 | |
| 45 debug(""); | |
| 46 debug("Check initial 'pathSegList' value of path2"); | |
| 47 shouldBe("path2.pathSegList.numberOfItems", "4"); | |
| 48 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
| 49 shouldBe("path2.pathSegList.getItem(0).x", "0"); | |
| 50 shouldBe("path2.pathSegList.getItem(0).y", "0"); | |
| 51 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoHorizontalRel]"); | |
| 52 shouldBe("path2.pathSegList.getItem(1).x", "100"); | |
| 53 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 54 shouldBe("path2.pathSegList.getItem(2).x", "200"); | |
| 55 shouldBe("path2.pathSegList.getItem(2).y", "100"); | |
| 56 shouldBeEqualToString("path2.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoHorizontalRel]"); | |
| 57 shouldBe("path2.pathSegList.getItem(3).x", "-100"); | |
| 58 | |
| 59 debug(""); | |
| 60 debug("Replace second item with third item of path1"); | |
| 61 shouldBeEqualToString("path1.pathSegList.replaceItem(path1.pathSegList.getIt
em(2), 1).toString()", "[object SVGPathSegLinetoAbs]"); | |
| 62 | |
| 63 debug(""); | |
| 64 debug("Replace third item of path2 with fourth item of path1"); | |
| 65 shouldBeEqualToString("path2.pathSegList.replaceItem(path1.pathSegList.getIt
em(4), 2).toString()", "[object SVGPathSegLinetoVerticalRel]"); | |
| 66 | |
| 67 debug(""); | |
| 68 debug("Reset points attribute to M 0 0 L 100 0 v 100"); | |
| 69 shouldBeUndefined("path1.setAttribute('d', 'M 0 0 L 100 0 v 100 h 100')"); | |
| 70 | |
| 71 debug(""); | |
| 72 debug("Replace fourth item of path1 with third item of path2"); | |
| 73 shouldBeEqualToString("path1.pathSegList.replaceItem(path2.pathSegList.getIt
em(3), 3).toString()", "[object SVGPathSegLinetoHorizontalRel]"); | |
| 74 | |
| 75 debug(""); | |
| 76 debug("Check final 'pathSegList' value of path1"); | |
| 77 shouldBe("path1.pathSegList.numberOfItems", "4"); | |
| 78 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
| 79 shouldBe("path1.pathSegList.getItem(0).x", "0"); | |
| 80 shouldBe("path1.pathSegList.getItem(0).y", "0"); | |
| 81 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
| 82 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
| 83 shouldBe("path1.pathSegList.getItem(1).y", "0"); | |
| 84 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoVerticalRel]"); | |
| 85 shouldBe("path1.pathSegList.getItem(2).y", "100"); | |
| 86 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoHorizontalRel]"); | |
| 87 shouldBe("path1.pathSegList.getItem(3).x", "-100"); | |
| 88 | |
| 89 debug(""); | |
| 90 debug("Check final 'pathSegList' value of path2"); | |
| 91 shouldBe("path2.pathSegList.numberOfItems", "4"); | |
| 92 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
| 93 shouldBe("path2.pathSegList.getItem(0).x", "0"); | |
| 94 shouldBe("path2.pathSegList.getItem(0).y", "0"); | |
| 95 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoHorizontalRel]"); | |
| 96 shouldBe("path2.pathSegList.getItem(1).x", "100"); | |
| 97 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoVerticalRel]"); | |
| 98 shouldBe("path2.pathSegList.getItem(2).y", "100"); | |
| 99 shouldBeEqualToString("path2.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoHorizontalRel]"); | |
| 100 shouldBe("path2.pathSegList.getItem(3).x", "-100"); | |
| 101 | |
| 102 ]]> | |
| 103 </script> | |
| 104 </body> | |
| 105 </html> | |
| OLD | NEW |