Add first test for importing SVG into an existing drawing
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1424 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
fc82f2965b
commit
24aaa973d7
|
@ -219,6 +219,31 @@
|
|||
equals(svgCanvas.getPrivateMethods().toXml("&"), "&", "Escaped & properly");
|
||||
// TODO: what about " and ' ?
|
||||
});
|
||||
|
||||
test("Test importing SVG into existing drawing", function() {
|
||||
expect(3);
|
||||
|
||||
var doc = svgCanvas.setSvgString('<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">'+
|
||||
'<g><title>Layer 1</title>'+
|
||||
'<circle cx="200" cy="200" r="50" fill="blue"/>'+
|
||||
'<ellipse cx="300" cy="100" rx="40" ry="30" fill="green"/>'+
|
||||
'</g>'+
|
||||
'</svg>');
|
||||
|
||||
svgCanvas.importSvgString('<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">'+
|
||||
'<circle cx="50" cy="50" r="40" fill="yellow"/>'+
|
||||
'<rect width="20" height="20" fill="blue"/>'+
|
||||
'</svg>');
|
||||
|
||||
var svgcontent = document.getElementById("svgcontent"),
|
||||
circles = svgcontent.getElementsByTagNameNS(svgns, "circle"),
|
||||
rects = svgcontent.getElementsByTagNameNS(svgns, "rect"),
|
||||
ellipses = svgcontent.getElementsByTagNameNS(svgns, "ellipse");
|
||||
equals(circles.length, 2, "Found two circles upon importing");
|
||||
equals(rects.length, 1, "Found one rectangle upon importing");
|
||||
equals(ellipses.length, 1, "Found one ellipse upon importing");
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Reference in New Issue