From eb8f9e82d215f6daae9a0702063b0ab86ef859b3 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Mon, 10 Aug 2015 12:13:36 +0000 Subject: FOP-2473: SVG text using filters not shown git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1695041 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/ps/ImageHandlingTestCase.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test') diff --git a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java index 02e96806f..3c05e9ad7 100644 --- a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java +++ b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -18,18 +18,27 @@ /* $Id$ */ package org.apache.fop.render.ps; + +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import org.junit.Test; +import org.w3c.dom.Document; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.apache.commons.io.IOUtils; +import org.apache.batik.anim.dom.SAXSVGDocumentFactory; + +import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; import org.apache.xmlgraphics.ps.DSCConstants; +import org.apache.xmlgraphics.ps.PSGenerator; import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.dsc.DSCException; import org.apache.xmlgraphics.ps.dsc.DSCParser; @@ -39,6 +48,8 @@ import org.apache.xmlgraphics.ps.dsc.events.DSCCommentTitle; import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.intermediate.IFContext; /** @@ -159,4 +170,26 @@ public class ImageHandlingTestCase extends AbstractPostScriptTest { return sb.toString(); } + @Test + public void testPSImageHandlerSVG() throws IOException { + FOUserAgent ua = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + String svg = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " Hello SVG with FOP\n" + + ""; + SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(null); + Document doc = factory.createDocument(null, IOUtils.toInputStream(svg)); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + new PSImageHandlerSVG().handleImage( + new PSRenderingContext(ua, new PSGenerator(bos), new FontInfo()), + new ImageXMLDOM(null, doc, ""), + new Rectangle()); + assertTrue(bos.toString().contains("/DataSource Data")); + } } -- cgit v1.2.3