Index: LayoutTests/svg/dom/SVGTransformList-with-existing-item.html |
diff --git a/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html b/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ad93a00cd2247f5722f8c66ea8358ffc369b183c |
--- /dev/null |
+++ b/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html |
@@ -0,0 +1,70 @@ |
+<!DOCTYPE HTML> |
+<script src="../../resources/js-test.js"></script> |
+<script src="resources/SVGTransformList-helper.js"></script> |
+ |
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> |
+ <circle id="circle1" cx="40" cy="40" r="40" fill="green" transform="scale(2,2)"/> |
+ <circle id="circle2" cx="40" cy="40" r="40" fill="green" transform="scale(2,2)"/> |
+</svg> |
+ |
+<script type="text/javascript"> |
+ description("This is a test of more SVGTransformList API parts."); |
+ |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ var svg = document.getElementById("svg"); |
+ var circle1 = document.getElementById("circle1"); |
+ var circle2 = document.getElementById("circle2"); |
+ |
+ var translate = svg.createSVGTransform(); |
+ translate.setTranslate(100, 100); |
+ |
+ var scale = svg.createSVGTransform(); |
+ scale.setScale(3, 3); |
+ |
+ var transformList1 = circle1.transform.baseVal; |
+ var transformList2 = circle2.transform.baseVal; |
+ |
+ debug("Test appendItem with SVGTransform that already exist in a list"); |
+ transformList1.appendItem(translate); |
+ transformList2.appendItem(translate); |
+ shouldBe("transformList1.numberOfItems", "2"); |
+ shouldBe("transformList2.numberOfItems", "2"); |
+ shouldBeEqualToString("transformList1.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]"); |
+ shouldBeEqualToString("transformList2.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]"); |
+ |
+ debug(""); |
+ debug("Test changing SVGTransform value"); |
+ translate.setTranslate(200, 200); |
+ shouldBeEqualToString("transformList1.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]"); |
+ shouldBeEqualToString("transformList2.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]"); |
+ |
+ debug(""); |
+ debug("Test insertItemBefore with SVGTransform that already exist in a list"); |
+ transformList1.insertItemBefore(translate,0); |
+ transformList2.insertItemBefore(translate,0); |
+ shouldBeEqualToString("transformList1.getItem(0).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]"); |
+ shouldBeEqualToString("transformList2.getItem(0).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]"); |
+ shouldBe("transformList1.numberOfItems", "3"); |
+ shouldBe("transformList2.numberOfItems", "3"); |
+ |
+ debug(""); |
+ debug("Test replaceItem with SVGTransform that already exist in a list"); |
+ transformList1.replaceItem(scale,2); |
+ transformList2.replaceItem(scale,2); |
+ shouldBeEqualToString("transformList1.getItem(2).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]"); |
+ shouldBeEqualToString("transformList2.getItem(2).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]"); |
+ shouldBe("transformList1.numberOfItems", "3"); |
+ shouldBe("transformList2.numberOfItems", "3"); |
+ |
+ debug(""); |
+ debug("Test initialize with SVGTransform that already exist in a list"); |
+ transformList1.initialize(scale); |
+ transformList2.initialize(scale); |
+ shouldBeEqualToString("transformList1.getItem(0).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]"); |
+ shouldBeEqualToString("transformList2.getItem(0).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]"); |
+ shouldBe("transformList1.numberOfItems", "1"); |
+ shouldBe("transformList2.numberOfItems", "1"); |
+ |
+</script> |