1 18 package org.apache.batik.svggen; 19 20 import java.awt.Color ; 21 import java.awt.Dimension ; 22 import java.awt.Rectangle ; 23 24 import java.io.StringWriter ; 25 import java.io.Writer ; 26 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Element ; 29 30 31 import org.apache.batik.dom.svg.SVGDOMImplementation; 32 import org.apache.batik.test.AbstractTest; 33 import org.apache.batik.test.TestReport; 34 35 42 public class Bug21259 extends AbstractTest{ 43 public TestReport runImpl() throws Exception { 44 Document document = 45 SVGDOMImplementation.getDOMImplementation() 46 .createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI , "svg", null); 47 SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document); 48 ctx.setComment("Test"); 49 SVGGraphics2D graphics = new SVGGraphics2D(ctx, false); 50 graphics.setSVGCanvasSize(new Dimension (600, 400)); 51 52 graphics.setColor(Color.red); 53 graphics.setBackground(Color.black); 54 graphics.fill(new Rectangle (0,0,100,100)); 55 56 Element root = document.getDocumentElement(); 58 graphics.getRoot(root); 59 Writer writer = new StringWriter (); 60 graphics.stream(root, writer); 61 62 assertTrue(root.getParentNode() == document); 63 return reportSuccess(); 64 } 65 } 66 | Popular Tags |