]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Support -rtf output option.
authorFinn Bock <bckfnn@apache.org>
Mon, 27 Sep 2004 07:42:27 +0000 (07:42 +0000)
committerFinn Bock <bckfnn@apache.org>
Mon, 27 Sep 2004 07:42:27 +0000 (07:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197978 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/tools/TestConverter.java

index 5090575f58b55201b2dbbdba4d6b58d50c5be436..d98ddae3d5be33d539488ceed3bcfaafbf2ed7d8 100644 (file)
@@ -103,6 +103,8 @@ public class TestConverter {
                 tc.setFailOnly(true);
             } else if (args[count].equals("-pdf")) {
                 tc.setRenderType(Fop.RENDER_PDF);
+            } else if (args[count].equals("-rtf")) {
+                tc.setRenderType(Fop.RENDER_RTF);
             } else if (args[count].equals("-d")) {
                 tc.setDebug(true);
             } else if (args[count].equals("-b")) {
@@ -313,8 +315,8 @@ public class TestConverter {
             if (outname.endsWith(".xml") || outname.endsWith(".pdf")) {
                 outname = outname.substring(0, outname.length() - 4);
             }
-            File outputFile = new File(destdir, // assuming only RENDER_PDF or RENDER_XML here
-                                 outname + ((renderType==Fop.RENDER_PDF) ? ".pdf" : ".at.xml"));
+            File outputFile = new File(destdir, 
+                                       outname + makeResultExtension());
 
             outputFile.getParentFile().mkdirs();
             OutputStream outStream = new java.io.BufferedOutputStream(
@@ -338,6 +340,19 @@ public class TestConverter {
         }
     }
 
+    /**
+     * Return a suitable file extension for the output format.
+     */
+    private String makeResultExtension() {
+        if (renderType == Fop.RENDER_PDF) {
+           return ".pdf";
+        } else if (renderType == Fop.RENDER_RTF) {
+           return ".rtf";
+        } else {
+            return ".at.xml";
+        }
+    }
+
     /**
      * Compare files.
      * @param f1 first file