1 17 18 19 20 package org.apache.fop; 21 22 import java.io.File ; 23 import java.io.InputStream ; 24 25 import org.apache.batik.transcoder.Transcoder; 26 import org.apache.batik.transcoder.TranscoderInput; 27 import org.apache.batik.transcoder.TranscoderOutput; 28 import org.apache.commons.io.output.ByteArrayOutputStream; 29 30 34 public abstract class AbstractBasicTranscoderTestCase extends AbstractFOPTestCase { 35 36 39 public AbstractBasicTranscoderTestCase(String name) { 40 super(name); 41 } 42 43 47 protected abstract Transcoder createTranscoder(); 48 49 54 public void testGenericPDFTranscoder() throws Exception { 55 Transcoder transcoder = createTranscoder(); 57 58 File svgFile = new File (getBaseDir(), "test/resources/fop/svg/text.svg"); 60 InputStream in = new java.io.FileInputStream (svgFile); 61 try { 62 TranscoderInput input = new TranscoderInput(in); 63 64 ByteArrayOutputStream out = new ByteArrayOutputStream(); 66 try { 67 TranscoderOutput output = new TranscoderOutput(out); 68 69 transcoder.transcode(input, output); 71 } finally { 72 out.close(); 73 } 74 assertTrue("Some output expected", out.size() > 0); 75 } finally { 76 in.close(); 77 } 78 } 79 80 } 81 | Popular Tags |