| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description("This test verifying changing the values of detached properties - utilizing the properties of SVGRectElement and SVGTextElement"); |
| |
| var x = document.createElementNS("http://www.w3.org/2000/svg", "rect").x.baseVal; |
| var y = document.createElementNS("http://www.w3.org/2000/svg", "rect").y.baseVal; |
| var width = document.createElementNS("http://www.w3.org/2000/svg", "rect").width.baseVal; |
| var height = document.createElementNS("http://www.w3.org/2000/svg", "rect").height.baseVal; |
| |
| var xList = document.createElementNS("http://www.w3.org/2000/svg", "text").x.baseVal; |
| var yList = document.createElementNS("http://www.w3.org/2000/svg", "text").y.baseVal; |
| var dxList = document.createElementNS("http://www.w3.org/2000/svg", "text").dx.baseVal; |
| var dyList = document.createElementNS("http://www.w3.org/2000/svg", "text").dy.baseVal; |
| |
| var text = document.createElementNS("http://www.w3.org/2000/svg", "text"); |
| |
| x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 10); |
| y.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 20); |
| width.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 100); |
| height.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 200); |
| |
| xList.initialize(x); |
| yList.initialize(y); |
| dxList.initialize(width); |
| dyList.initialize(height); |
| |
| text.x.baseVal.initialize(x); |
| text.y.baseVal.initialize(y); |
| text.dx.baseVal.initialize(width); |
| text.dy.baseVal.initialize(height); |
| |
| text.x.baseVal.getItem(0).newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 100); |
| text.y.baseVal.getItem(0).newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 200); |
| text.dx.baseVal.getItem(0).newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 1000); |
| text.dy.baseVal.getItem(0).newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 2000); |
| |
| debug("Check the SVGLength properties"); |
| shouldBe("x.value", "10"); |
| shouldBe("y.value", "20"); |
| shouldBe("width.value", "100"); |
| shouldBe("height.value", "200"); |
| |
| debug(""); |
| debug("Check the items of the SVGLengthList properties"); |
| shouldBe("xList.getItem(0).value", "10"); |
| shouldBe("yList.getItem(0).value", "20"); |
| shouldBe("dxList.getItem(0).value", "100"); |
| shouldBe("dyList.getItem(0).value", "200"); |
| |
| debug(""); |
| debug("Check the items of the SVGLengthList properties of the SVGTextElement"); |
| shouldBe("text.x.baseVal.getItem(0).value", "100"); |
| shouldBe("text.y.baseVal.getItem(0).value", "200"); |
| shouldBe("text.dx.baseVal.getItem(0).value", "1000"); |
| shouldBe("text.dy.baseVal.getItem(0).value", "2000"); |
| |
| x = text.x.baseVal.getItem(0); |
| y = text.y.baseVal.getItem(0); |
| width = text.dx.baseVal.getItem(0); |
| height = text.dy.baseVal.getItem(0); |
| |
| text.remove(); |
| text = null; |
| |
| debug(""); |
| debug("Check the SVGLength properties after removing the SVGTextElement"); |
| shouldBe("x.value", "100"); |
| shouldBe("y.value", "200"); |
| shouldBe("width.value", "1000"); |
| shouldBe("height.value", "2000"); |
| |
| x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 10); |
| y.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 20); |
| width.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 100); |
| height.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 200); |
| |
| debug(""); |
| debug("Check the SVGLength properties after resetting their values"); |
| shouldBe("x.value", "10"); |
| shouldBe("y.value", "20"); |
| shouldBe("width.value", "100"); |
| shouldBe("height.value", "200"); |
| |
| successfullyParsed = true; |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |