[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-cvs
Subject:    svn commit: r1344594 [12/15] - in /xmlgraphics/fop/branches/Temp_URI_Unification: ./
From:       mehdi () apache ! org
Date:       2012-05-31 8:33:50
Message-ID: 20120531083433.3820F2388C48 () eris ! apache ! org
[Download RAW message or body]

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/intermediate/AbstractIntermediateTest.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java \
Thu May 31 08:33:36 2012 @@ -24,7 +24,6 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.net.MalformedURLException;
 
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.Source;
@@ -139,14 +138,8 @@ public abstract class AbstractIntermedia
      */
     protected FOUserAgent createUserAgent() {
         FOUserAgent userAgent = fopFactory.newFOUserAgent();
-        try {
-            userAgent.setBaseURL(testDir.toURI().toURL().toExternalForm());
-            userAgent.getEventBroadcaster().addEventListener(
-                    new ConsoleEventListenerForTests(testFile.getName(), \
                EventSeverity.FATAL));
-        } catch (MalformedURLException e) {
-            // Shouldn't happen
-            throw new AssertionError();
-        }
+        userAgent.getEventBroadcaster().addEventListener(
+                new ConsoleEventListenerForTests(testFile.getName(), \
EventSeverity.FATAL));  return userAgent;
     }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/intermediate/AreaTreeParserTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -33,6 +33,12 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.TransformerHandler;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.Document;
+
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.MimeConstants;
@@ -43,11 +49,6 @@ import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.layoutengine.LayoutEngineTestUtils;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.render.xml.XMLRenderer;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.w3c.dom.Document;
 
 /**
  * Tests the area tree parser.
@@ -65,6 +66,7 @@ public class AreaTreeParserTestCase exte
     public static Collection<File[]> getParameters() throws IOException {
         return LayoutEngineTestUtils.getLayoutTestFiles();
     }
+
     /**
      * Constructor for the test suite that is used for each test file.
      * @param testFile the test file to run

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/intermediate/IFMimickingTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java \
Thu May 31 08:33:36 2012 @@ -57,9 +57,8 @@ public class IFMimickingTestCase {
 
     @Before
     public void setUp() throws Exception {
-        fopFactory = FopFactory.newInstance();
         File configFile = new File("test/test-no-xml-metrics.xconf");
-        fopFactory.setUserConfig(configFile);
+        fopFactory = FopFactory.newInstance(configFile);
     }
 
     /**
@@ -111,8 +110,7 @@ public class IFMimickingTestCase {
                 userAgent, mime);
 
         //Setup painter
-        IFSerializer serializer = new IFSerializer();
-        serializer.setContext(new IFContext(userAgent));
+        IFSerializer serializer = new IFSerializer(new IFContext(userAgent));
         serializer.mimicDocumentHandler(targetHandler);
         serializer.setResult(domResult);
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/intermediate/IFParserTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFParserTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/IFParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -104,8 +104,7 @@ public class IFParserTestCase extends Ab
 
         FOUserAgent userAgent = createUserAgent();
 
-        IFSerializer serializer = new IFSerializer();
-        serializer.setContext(new IFContext(userAgent));
+        IFSerializer serializer = new IFSerializer(new IFContext(userAgent));
         DOMResult domResult = new DOMResult();
         serializer.setResult(domResult);
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/TestAssistant.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/intermediate/TestAssistant.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/TestAssistant.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/intermediate/TestAssistant.java \
Thu May 31 08:33:36 2012 @@ -43,6 +43,7 @@ import org.apache.xpath.XPathAPI;
 import org.apache.xpath.objects.XObject;
 
 import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.FopFactoryBuilder;
 
 /**
  * Helper class for running FOP tests.
@@ -50,11 +51,9 @@ import org.apache.fop.apps.FopFactory;
 public class TestAssistant {
 
     // configure fopFactory as desired
-    private FopFactory fopFactory = FopFactory.newInstance();
-    private FopFactory fopFactoryWithBase14Kerning = FopFactory.newInstance();
+    protected final File testDir = new File("test/layoutengine/standard-testcases");
 
-    private SAXTransformerFactory tfactory
-            = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
+    private SAXTransformerFactory tfactory = (SAXTransformerFactory) \
SAXTransformerFactory.newInstance();  
     private DocumentBuilderFactory domBuilderFactory;
 
@@ -65,8 +64,6 @@ public class TestAssistant {
      * Main constructor.
      */
     public TestAssistant() {
-        fopFactory.getFontManager().setBase14KerningEnabled(false);
-        fopFactoryWithBase14Kerning.getFontManager().setBase14KerningEnabled(true);
         domBuilderFactory = DocumentBuilderFactory.newInstance();
         domBuilderFactory.setNamespaceAware(true);
         domBuilderFactory.setValidating(false);
@@ -115,19 +112,13 @@ public class TestAssistant {
         return doc.getDocumentElement();
     }
 
-    public FopFactory getFopFactory(boolean base14KerningEnabled) {
-        FopFactory effFactory = (base14KerningEnabled ? fopFactoryWithBase14Kerning \
                : fopFactory);
-        return effFactory;
-    }
-
     public FopFactory getFopFactory(Document testDoc) {
         boolean base14KerningEnabled = isBase14KerningEnabled(testDoc);
-        FopFactory effFactory = getFopFactory(base14KerningEnabled);
-
         boolean strictValidation = isStrictValidation(testDoc);
-        effFactory.setStrictValidation(strictValidation);
-
-        return effFactory;
+        FopFactoryBuilder builder = new \
FopFactoryBuilder(testDir.getParentFile().toURI()); +        \
builder.setStrictFOValidation(strictValidation); +        \
builder.getFontManager().setBase14KerningEnabled(base14KerningEnabled); +        \
return builder.build();  }
 
     private boolean isBase14KerningEnabled(Document testDoc) {

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/layoutengine/LayoutEngineTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java \
Thu May 31 08:33:36 2012 @@ -146,7 +146,6 @@ public class LayoutEngineTestCase {
 
             //Setup FOP for area tree rendering
             FOUserAgent ua = effFactory.newFOUserAgent();
-            ua.setBaseURL(testFile.getParentFile().toURI().toURL().toString());
             ua.getEventBroadcaster().addEventListener(
                     new ConsoleEventListenerForTests(testFile.getName(), \
EventSeverity.WARN));  
@@ -203,14 +202,12 @@ public class LayoutEngineTestCase {
             throws TransformerException {
         try {
             FOUserAgent ua = fopFactory.newFOUserAgent();
-            ua.setBaseURL(testFile.getParentFile().toURI().toURL().toExternalForm());
  ua.getEventBroadcaster().addEventListener(
                     new ConsoleEventListenerForTests(testFile.getName(), \
EventSeverity.WARN));  
             IFRenderer ifRenderer = new IFRenderer(ua);
 
-            IFSerializer serializer = new IFSerializer();
-            serializer.setContext(new IFContext(ua));
+            IFSerializer serializer = new IFSerializer(new IFContext(ua));
             DOMResult result = new DOMResult();
             serializer.setResult(result);
             ifRenderer.setDocumentHandler(serializer);

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/memory/MemoryEater.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/memory/MemoryEater.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/memory/MemoryEater.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/memory/MemoryEater.java \
Thu May 31 08:33:36 2012 @@ -49,7 +49,6 @@ public class MemoryEater {
 
     private SAXTransformerFactory tFactory
             = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
-    private FopFactory fopFactory = FopFactory.newInstance();
     private Templates replicatorTemplates;
 
     private Stats stats;
@@ -62,15 +61,17 @@ public class MemoryEater {
 
     private void eatMemory(File foFile, int runRepeats, int replicatorRepeats) \
throws Exception {  stats = new Stats();
+        FopFactory fopFactory = \
FopFactory.newInstance(foFile.getParentFile().toURI());  for (int i = 0; i < \
                runRepeats; i++) {
-            eatMemory(i, foFile, replicatorRepeats);
+            eatMemory(i, foFile, replicatorRepeats, fopFactory);
             stats.progress(i, runRepeats);
         }
         stats.dumpFinalStats();
         System.out.println(stats.getGoogleChartURL());
     }
 
-    private void eatMemory(int callIndex, File foFile, int replicatorRepeats) throws \
Exception { +    private void eatMemory(int callIndex, File foFile, int \
replicatorRepeats, FopFactory fopFactory) +            throws Exception {
         Source src = new StreamSource(foFile);
 
         Transformer transformer = replicatorTemplates.newTransformer();
@@ -79,7 +80,6 @@ public class MemoryEater {
         OutputStream out = new NullOutputStream(); //write to /dev/nul
         try {
             FOUserAgent userAgent = fopFactory.newFOUserAgent();
-            userAgent.setBaseURL(foFile.getParentFile().toURI().toURL().toExternalForm());
                
             Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
             Result res = new SAXResult(fop.getDefaultHandler());
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/pdf/PDFFactoryTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java \
Thu May 31 08:33:36 2012 @@ -21,9 +21,12 @@ package org.apache.fop.pdf;
 
 import static org.junit.Assert.assertEquals;
 
+import org.junit.Test;
+
+import org.apache.fop.apps.io.DefaultResourceResolver;
+import org.apache.fop.apps.io.URIResolverWrapper;
 import org.apache.fop.fonts.CIDSubset;
 import org.apache.fop.fonts.MultiByteFont;
-import org.junit.Test;
 
 /**
  * Test case for {@link PDFFactory}.
@@ -37,6 +40,10 @@ public class PDFFactoryTestCase {
     @Test
     public void testSubsetFontNamePrefix() {
         class MockedFont extends MultiByteFont {
+            public MockedFont(URIResolverWrapper resolver) {
+                super(resolver);
+            }
+
             @Override
             public int[] getWidths() {
                 return new int[] { 0 };
@@ -49,7 +56,7 @@ public class PDFFactoryTestCase {
         }
         PDFDocument doc = new PDFDocument("Test");
         PDFFactory pdfFactory = new PDFFactory(doc);
-        MockedFont font = new MockedFont();
+        MockedFont font = new \
MockedFont(DefaultResourceResolver.createDefaultWrapper());  
         PDFFont pdfDejaVu = pdfFactory.makeFont("DejaVu", "DejaVu", "TTF", font, \
                font);
         assertEquals("/EAAAAA+DejaVu", pdfDejaVu.getBaseFont().toString());

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/AbstractRenderingTest.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/AbstractRenderingTest.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/AbstractRenderingTest.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/AbstractRenderingTest.java \
Thu May 31 08:33:36 2012 @@ -54,7 +54,7 @@ public abstract class AbstractRenderingT
     /** the JAXP TransformerFactory */
     protected TransformerFactory tFactory = TransformerFactory.newInstance();
     /** the FopFactory */
-    protected FopFactory fopFactory = FopFactory.newInstance();
+    protected final FopFactory fopFactory = FopFactory.newInstance(new \
File(".").toURI());  
     /**
      * Renders a test file.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/RendererFactoryTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/RendererFactoryTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/RendererFactoryTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/RendererFactoryTestCase.java \
Thu May 31 08:33:36 2012 @@ -22,6 +22,8 @@ package org.apache.fop.render;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
+
 import org.junit.Test;
 
 import org.apache.commons.io.output.NullOutputStream;
@@ -45,7 +47,7 @@ public class RendererFactoryTestCase {
 
     @Test
     public void testDocumentHandlerLevel() throws Exception {
-        FopFactory fopFactory = FopFactory.newInstance();
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
         RendererFactory factory = fopFactory.getRendererFactory();
         FOUserAgent ua;
         IFDocumentHandler handler;
@@ -55,8 +57,7 @@ public class RendererFactoryTestCase {
         handler = factory.createDocumentHandler(ua, MimeConstants.MIME_PDF);
 
         ua = fopFactory.newFOUserAgent();
-        overrideHandler = new PDFDocumentHandler();
-        overrideHandler.setContext(new IFContext(ua));
+        overrideHandler = new PDFDocumentHandler(new IFContext(ua));
         ua.setDocumentHandlerOverride(overrideHandler);
         handler = factory.createDocumentHandler(ua, null);
         assertTrue(handler == overrideHandler);
@@ -72,7 +73,7 @@ public class RendererFactoryTestCase {
 
     @Test
     public void testRendererLevel() throws Exception {
-        FopFactory fopFactory = FopFactory.newInstance();
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
         RendererFactory factory = fopFactory.getRendererFactory();
         FOUserAgent ua;
         Renderer renderer;
@@ -87,8 +88,7 @@ public class RendererFactoryTestCase {
 
         ua = fopFactory.newFOUserAgent();
         IFDocumentHandler overrideHandler;
-        overrideHandler = new PDFDocumentHandler();
-        overrideHandler.setContext(new IFContext(ua));
+        overrideHandler = new PDFDocumentHandler(new IFContext(ua));
         ua.setDocumentHandlerOverride(overrideHandler);
         renderer = factory.createRenderer(ua, null);
         assertTrue(renderer instanceof IFRenderer);
@@ -104,7 +104,7 @@ public class RendererFactoryTestCase {
 
     @Test
     public void testFOEventHandlerLevel() throws Exception {
-        FopFactory fopFactory = FopFactory.newInstance();
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
         RendererFactory factory = fopFactory.getRendererFactory();
         FOUserAgent ua;
         FOEventHandler foEventHandler;

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.afp;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+import org.apache.fop.afp.AFPConstants;
+import org.apache.fop.apps.AFPRendererConfBuilder;
+import org.apache.fop.apps.AbstractRendererConfigParserTester;
+import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser;
+import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions;
+
+import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_COLOR;
 +import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE;
 +import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class AFPRendererConfigParserTestCase
+extends AbstractRendererConfigParserTester<AFPRendererConfBuilder, \
AFPRendererConfig> { +
+    public AFPRendererConfigParserTestCase() {
+        super(new AFPRendererConfigParser(), AFPRendererConfBuilder.class);
+    }
+
+    @Test
+    public void testShadingMode() throws Exception {
+        parseConfig();
+        assertEquals(AFPShadingMode.COLOR, conf.getShadingMode());
+        parseConfig(createRenderer().setShading(AFPShadingMode.DITHERED));
+        assertEquals(AFPShadingMode.DITHERED, conf.getShadingMode());
+    }
+
+    @Test
+    public void testResolution() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(Integer.valueOf(240), conf.getResolution());
+        parseConfig(createRenderer().setRenderingResolution(300));
+        assertEquals(Integer.valueOf(300), conf.getResolution());
+    }
+
+    @Test
+    public void testLineWidthCorrection() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(AFPConstants.LINE_WIDTH_CORRECTION, \
conf.getLineWidthCorrection().floatValue(), 0.0001f); +        \
parseConfig(createRenderer().setLineWidthCorrection(1f)); +        \
assertEquals(Float.valueOf(1f), conf.getLineWidthCorrection()); +    }
+
+    @Test
+    public void testResourceGroupFile() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(null, conf.getDefaultResourceGroupFilePath());
+        // TODO yuck!
+        File file = File.createTempFile("AFPRendererConfigParserTestCase", "");
+        try {
+            file.delete();
+            parseConfig(createRenderer().setResourceGroupFile(file.getAbsolutePath()));
 +            assertEquals(file.getAbsolutePath(), \
conf.getDefaultResourceGroupFilePath()); +        } finally {
+            file.delete();
+        }
+    }
+
+    @Test
+    public void testResourceLevelDefaults() throws Exception {
+        parseConfig(createRenderer());
+        assertNull(conf.getResourceLevelDefaults());
+        Map<String, String> levels = new HashMap<String, String>();
+        levels.put("goca", "page");
+        parseConfig(createRenderer().setResourceResourceLevels(levels));
+        assertNotNull(conf.getResourceLevelDefaults());
+    }
+
+    @Test
+    public void testImages() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(false, conf.isColorImages());
+        assertEquals(Integer.valueOf(8), conf.getBitsPerPixel());
+        ImagesModeOptions mode = MODE_GRAYSCALE;
+        parseConfig(createRenderer()
+                .startImages(mode)
+                .setModeAttribute(mode.getModeAttribute(), String.valueOf(1))
+                .endImages());
+        assertEquals(false, conf.isColorImages());
+        assertEquals(Integer.valueOf(1), conf.getBitsPerPixel());
+        mode = MODE_COLOR;
+        parseConfig(createRenderer()
+                .startImages(mode)
+                .setModeAttribute(mode.getModeAttribute(), String.valueOf(false))
+                .endImages());
+        assertEquals(true, conf.isColorImages());
+        assertEquals(false, conf.isCmykImagesSupported());
+        parseConfig(createRenderer()
+                .startImages(mode)
+                .setModeAttribute(mode.getModeAttribute(), String.valueOf(true))
+                .endImages());
+        assertEquals(true, conf.isColorImages());
+        assertEquals(true, conf.isCmykImagesSupported());
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testImagesException1() throws Exception {
+        parseConfig(createRenderer().startImages().endImages());
+        conf.isCmykImagesSupported();
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testImagesException2() throws Exception {
+        parseConfig(createRenderer().startImages(MODE_COLOR).endImages());
+        conf.getBitsPerPixel();
+    }
+
+    @Test
+    public void testImagesNative() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(false, conf.isNativeImagesSupported());
+        parseConfig(createRenderer().startImages().setNativeImageSupport(true).endImages());
 +        assertEquals(true, conf.isNativeImagesSupported());
+    }
+
+    @Test
+    public void testDitheringQuality() throws Exception {
+        parseConfig(createRenderer());
+        assertEquals(0.5f, conf.getDitheringQuality(), 0.001f);
+        parseConfig(createRenderer().startImages().setDitheringQuality("min").endImages());
 +        assertEquals(0.0f, conf.getDitheringQuality(), 0.001f);
+        parseConfig(createRenderer().startImages().setDitheringQuality("max").endImages());
 +        assertEquals(1.0f, conf.getDitheringQuality(), 0.001f);
+        parseConfig(createRenderer().startImages().setDitheringQuality(0.25f).endImages());
 +        assertEquals(0.25f, conf.getDitheringQuality(), 0.001f);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testForNameException() throws Exception {
+        ImagesModeOptions.forName("_");
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java \
Thu May 31 08:33:36 2012 @@ -19,12 +19,9 @@
 
 package org.apache.fop.render.afp;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
+import java.io.File;
 import java.io.IOException;
 
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
@@ -32,24 +29,21 @@ import org.apache.fop.afp.AFPPaintingSta
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FopFactory;
+import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser;
+import org.apache.fop.render.intermediate.IFContext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 /**
  * Test case for {@link AFPRendererConfigurator}.
  */
 public class AFPRendererConfiguratorTestCase {
-    private static FOUserAgent userAgent;
+    private FOUserAgent userAgent;
 
     private AFPRendererConfigurator sut;
 
     /**
-     * The FOUserAgent only needs to be created once.
-     */
-    @BeforeClass
-    public static void createUserAgent() {
-        userAgent = FopFactory.newInstance().newFOUserAgent();
-    }
-
-    /**
      * Assigns an FOUserAgen with a config file at <code>uri</code>
      *
      * @param uri the URI of the config file
@@ -57,8 +51,8 @@ public class AFPRendererConfiguratorTest
     private void setConfigFile(String uri) {
         String confTestsDir = "test/resources/conf/afp/";
         try {
-            userAgent.getFactory().setUserConfig(confTestsDir + uri);
-            sut = new AFPRendererConfigurator(userAgent);
+            userAgent = FopFactory.newInstance(new File(confTestsDir + \
uri)).newFOUserAgent(); +            sut = new AFPRendererConfigurator(userAgent, new \
AFPRendererConfigParser());  } catch (IOException ioe) {
             fail("IOException: " + ioe);
         } catch (SAXException se) {
@@ -80,7 +74,7 @@ public class AFPRendererConfiguratorTest
 
     private void testJpegSettings(String uri, float bitmapEncodingQual, boolean \
canEmbed)  throws FOPException {
-        AFPDocumentHandler docHandler = new AFPDocumentHandler();
+        AFPDocumentHandler docHandler = new AFPDocumentHandler(new \
IFContext(userAgent));  
         setConfigFile(uri);
         sut.configure(docHandler);

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.AbstractRendererConfigParserTester;
+import org.apache.fop.apps.BitmapRendererConfBuilder;
+import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
+
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BILEVEL;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BINARY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_GRAY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGB;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGBA;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_SPEED;
 +import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class AbstractBitmapRendererConfigParserTester
+        extends AbstractRendererConfigParserTester<BitmapRendererConfBuilder, \
BitmapRendererConfig> { +
+    public AbstractBitmapRendererConfigParserTester(BitmapRendererConfigParser \
parser) { +        super(parser, BitmapRendererConfBuilder.class);
+    }
+
+    @Test
+    public void testTransparentPageBackground() throws Exception {
+        parseConfig(createRenderer().setPageBackgroundTransparency(true));
+        assertTrue(conf.hasTransparentBackround());
+        assertNull(conf.getBackgroundColor());
+
+        parseConfig(createRenderer().setPageBackgroundTransparency(false));
+        assertFalse(conf.hasTransparentBackround());
+        assertEquals(Color.WHITE, conf.getBackgroundColor());
+
+        parseConfig(createRenderer());
+        assertEquals(JAVA2D_TRANSPARENT_PAGE_BACKGROUND.getDefaultValue(),
+                conf.hasTransparentBackround());
+    }
+
+    @Test
+    public void testBackgroundColor() throws Exception {
+        parseConfig(createRenderer().setBackgroundColor("black"));
+        assertEquals(Color.BLACK, conf.getBackgroundColor());
+
+        parseConfig(createRenderer().setBackgroundColor("white"));
+        assertEquals(Color.WHITE, conf.getBackgroundColor());
+
+        parseConfig(createRenderer().setBackgroundColor("blue"));
+        assertEquals(Color.BLUE, conf.getBackgroundColor());
+
+        parseConfig(createRenderer().setBackgroundColor("blue")
+                               .setPageBackgroundTransparency(true));
+        assertTrue(conf.hasTransparentBackround());
+        assertNull(conf.getBackgroundColor());
+    }
+
+    @Test
+    public void testAntiAliasing() throws Exception {
+        parseConfig(createRenderer().setAntiAliasing(true));
+        assertTrue(conf.hasAntiAliasing());
+
+        parseConfig(createRenderer().setAntiAliasing(false));
+        assertFalse(conf.hasAntiAliasing());
+    }
+
+    @Test
+    public void testRendererQuality() throws Exception {
+        parseConfig(createRenderer().setRenderingQuality(RENDERING_QUALITY.getName()));
 +        assertTrue(conf.isRenderHighQuality());
+
+        parseConfig(createRenderer().setRenderingQuality(RENDERING_SPEED.getName()));
 +        assertFalse(conf.isRenderHighQuality());
+
+        parseConfig(createRenderer());
+        assertTrue(conf.isRenderHighQuality());
+    }
+
+    @Test
+    public void testColorModes() throws Exception {
+        parseConfig(createRenderer().setColorMode(COLOR_MODE_RGBA.getName()));
+        assertEquals(BufferedImage.TYPE_INT_ARGB, (int) conf.getColorMode());
+
+        parseConfig(createRenderer().setColorMode(COLOR_MODE_RGB.getName()));
+        assertEquals(BufferedImage.TYPE_INT_RGB, (int) conf.getColorMode());
+
+        parseConfig(createRenderer().setColorMode(COLOR_MODE_GRAY.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_GRAY, (int) conf.getColorMode());
+
+        parseConfig(createRenderer().setColorMode(COLOR_MODE_BINARY.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_BINARY, (int) conf.getColorMode());
+
+        parseConfig(createRenderer().setColorMode(COLOR_MODE_BILEVEL.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_BINARY, (int) conf.getColorMode());
+
+        parseConfig(createRenderer());
+        assertEquals(BufferedImage.TYPE_INT_ARGB, (int) conf.getColorMode());
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import java.awt.image.BufferedImage;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.AbstractRendererConfiguratorTest;
+import org.apache.fop.apps.BitmapRendererConfBuilder;
+import org.apache.fop.render.intermediate.IFDocumentHandler;
+import org.apache.fop.util.ColorUtil;
+
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BILEVEL;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BINARY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_GRAY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGB;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGBA;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
 +import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_SPEED;
 +import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+public abstract class AbstractBitmapRendererConfiguratorTest extends
+        AbstractRendererConfiguratorTest<BitmapRendererConfigurator, \
BitmapRendererConfBuilder> { +
+    public AbstractBitmapRendererConfiguratorTest(String mimeType,
+            Class<? extends IFDocumentHandler> docHandlerClass) {
+        super(mimeType, BitmapRendererConfBuilder.class, docHandlerClass);
+    }
+
+    BitmapRenderingSettings settings;
+
+    @Override
+    public void setUpDocumentHandler() {
+        settings = new BitmapRenderingSettings();
+        when(((AbstractBitmapDocumentHandler) \
docHandler).getSettings()).thenReturn(settings); +    }
+
+    @Test
+    public void testSetPageBackgroundColor() throws Exception {
+        // Try a few different colours
+        parseConfig(createBuilder().setBackgroundColor("Blue"));
+        assertEquals(ColorUtil.parseColorString(null, "Blue"), \
settings.getPageBackgroundColor()); +
+        parseConfig(createBuilder().setBackgroundColor("Black"));
+        assertEquals(ColorUtil.parseColorString(null, "Black"), \
settings.getPageBackgroundColor()); +    }
+
+    @Test
+    public void testAntiAliasing() throws Exception {
+        parseConfig(createBuilder().setAntiAliasing(true));
+        assertTrue(settings.isAntiAliasingEnabled());
+
+        parseConfig(createBuilder().setAntiAliasing(false));
+        assertFalse(settings.isAntiAliasingEnabled());
+    }
+
+    @Test
+    public void testTransparentBackground() throws Exception {
+        parseConfig(createBuilder().setPageBackgroundTransparency(true));
+        assertTrue(settings.hasTransparentPageBackground());
+
+        parseConfig(createBuilder().setPageBackgroundTransparency(false));
+        assertFalse(settings.hasTransparentPageBackground());
+    }
+
+    @Test
+    public void testRendererQuality() throws Exception {
+        parseConfig(createBuilder().setRenderingQuality(RENDERING_QUALITY.getName()));
 +        assertTrue(settings.isQualityRenderingEnabled());
+
+        parseConfig(createBuilder().setRenderingQuality(RENDERING_SPEED.getName()));
+        assertFalse(settings.isQualityRenderingEnabled());
+
+        parseConfig(createBuilder());
+        assertTrue(settings.isQualityRenderingEnabled());
+    }
+
+    @Test
+    public void testColorModes() throws Exception {
+        parseConfig(createBuilder().setColorMode(COLOR_MODE_RGBA.getName()));
+        assertEquals(BufferedImage.TYPE_INT_ARGB, settings.getBufferedImageType());
+
+        parseConfig(createBuilder().setColorMode(COLOR_MODE_RGB.getName()));
+        assertEquals(BufferedImage.TYPE_INT_RGB, settings.getBufferedImageType());
+
+        parseConfig(createBuilder().setColorMode(COLOR_MODE_GRAY.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_GRAY, settings.getBufferedImageType());
+
+        parseConfig(createBuilder().setColorMode(COLOR_MODE_BINARY.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_BINARY, \
settings.getBufferedImageType()); +
+        parseConfig(createBuilder().setColorMode(COLOR_MODE_BILEVEL.getName()));
+        assertEquals(BufferedImage.TYPE_BYTE_BINARY, \
settings.getBufferedImageType()); +
+        parseConfig(createBuilder());
+        assertEquals(BufferedImage.TYPE_INT_ARGB, settings.getBufferedImageType());
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
+
+public class BitmapRendererConfigParserTestCase extends \
AbstractBitmapRendererConfigParserTester { +
+    public BitmapRendererConfigParserTestCase() {
+        super(new BitmapRendererConfigParser("bitmap"));
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import org.apache.fop.apps.BitmapRendererConfBuilder;
+import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
+
+public class BitmapRendererConfiguratorTestCase extends \
AbstractBitmapRendererConfiguratorTest { +
+    public BitmapRendererConfiguratorTestCase() {
+        super(BitmapRendererConfBuilder.getMimeType(), \
AbstractBitmapDocumentHandler.class); +    }
+
+    @Override
+    public BitmapRendererConfigurator createConfigurator() {
+        return new BitmapRendererConfigurator(userAgent, new \
BitmapRendererConfigParser(mimeType)); +    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.TIFFRendererConfBuilder;
+import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class TIFFRendererConfigParserTestCase
+        extends AbstractBitmapRendererConfigParserTester {
+
+    public TIFFRendererConfigParserTestCase() {
+        super(new TIFFRendererConfigParser());
+    }
+
+    @Override
+    protected TIFFRendererConfBuilder createRenderer() {
+        builder = new \
FopConfBuilder().setStrictValidation(true).startRendererConfig( +                \
TIFFRendererConfBuilder.class); +        return (TIFFRendererConfBuilder) builder;
+    }
+
+    private TIFFRendererConfig getConfig() {
+        return (TIFFRendererConfig) conf;
+    }
+
+    @Test
+    public void testCompression() throws Exception {
+        for (TIFFCompressionValues value : TIFFCompressionValues.values()) {
+            parseConfig(createRenderer().setCompressionMode(value.getName()));
+            assertEquals(value, getConfig().getCompressionType());
+        }
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import java.awt.image.BufferedImage;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.TIFFRendererConfBuilder;
+import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
+
+import static org.apache.fop.render.bitmap.TIFFCompressionValues.CCITT_T4;
+import static org.apache.fop.render.bitmap.TIFFCompressionValues.CCITT_T6;
+import static org.junit.Assert.assertEquals;
+
+public class TIFFRendererConfiguratorTestCase extends \
AbstractBitmapRendererConfiguratorTest { +
+    public TIFFRendererConfiguratorTestCase() {
+        super(MimeConstants.MIME_TIFF, TIFFDocumentHandler.class);
+    }
+
+    @Override
+    public TIFFRendererConfigurator createConfigurator() {
+        return new TIFFRendererConfigurator(userAgent, new \
TIFFRendererConfigParser()); +    }
+
+    @Override
+    protected TIFFRendererConfBuilder createBuilder() {
+        return new FopConfBuilder().startRendererConfig(TIFFRendererConfBuilder.class);
 +    }
+
+    @Test
+    @Override
+    public void testColorModes() throws Exception {
+        for (TIFFCompressionValues value : TIFFCompressionValues.values()) {
+            parseConfig(createBuilder().setCompressionMode(value.getName()));
+            if (value == CCITT_T6 || value == CCITT_T4) {
+                assertEquals(BufferedImage.TYPE_BYTE_BINARY, \
settings.getBufferedImageType()); +            } else {
+                assertEquals(BufferedImage.TYPE_INT_ARGB, \
settings.getBufferedImageType()); +            }
+        }
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.java2d;
+
+import org.junit.Test;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.apache.fop.apps.AbstractRendererConfigParserTester;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.Java2DRendererConfBuilder;
+import org.apache.fop.render.java2d.Java2DRendererConfig.Java2DRendererConfigParser;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class Java2DRendererConfigParserTestcase
+        extends AbstractRendererConfigParserTester<Java2DRendererConfBuilder, \
Java2DRendererConfig> { +
+    public Java2DRendererConfigParserTestcase() {
+        super(new Java2DRendererConfigParser("Java2D"), \
Java2DRendererConfBuilder.class); +    }
+
+    @Test
+    public void testPageBackgroundTransparency() throws Exception {
+        parseConfig(createRenderer().setPageBackgroundTransparency(true));
+        assertTrue(conf.isPageBackgroundTransparent());
+
+        parseConfig(createRenderer().setPageBackgroundTransparency(false));
+        assertFalse(conf.isPageBackgroundTransparent());
+    }
+
+    @Test
+    public void testNullPageBackgroundTransparency() throws Exception {
+        parseConfig(createRenderer());
+        assertNull(conf.isPageBackgroundTransparent());
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.pcl;
+
+
+import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.pcl.PCLRendererConfig.Options;
+
+import static org.apache.fop.render.pcl.PCLRendererConfig.Options.DISABLE_PJL;
+import static org.apache.fop.render.pcl.PCLRendererConfig.Options.RENDERING_MODE;
+import static org.apache.fop.render.pcl.PCLRendererConfig.Options.TEXT_RENDERING;
+/**
+ * A config builder specific to a particular renderer for specific MIME type.
+ */
+public final class PCLRendererConfBuilder extends RendererConfBuilder {
+
+    public PCLRendererConfBuilder() {
+        super(MimeConstants.MIME_PCL);
+    }
+
+    public PCLRendererConfBuilder setRenderingMode(PCLRenderingMode mode) {
+        return setRenderingMode(mode.getName());
+    }
+
+    public PCLRendererConfBuilder setRenderingMode(String value) {
+        return createTextElement(RENDERING_MODE, value);
+    }
+
+    public PCLRendererConfBuilder setTextRendering(String value) {
+        return createTextElement(TEXT_RENDERING, value);
+    }
+
+    public PCLRendererConfBuilder setDisablePjl(boolean value) {
+        return createTextElement(DISABLE_PJL, String.valueOf(value));
+    }
+
+    private PCLRendererConfBuilder createTextElement(Options option, String value) {
+        createTextElement(option.getName(), value);
+        return this;
+    }
+
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.pcl;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.AbstractRendererConfigParserTester;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class PCLRendererConfigParserTestCase
+        extends AbstractRendererConfigParserTester<PCLRendererConfBuilder, \
PCLRendererConfig> { +
+    public PCLRendererConfigParserTestCase() {
+        super(new PCLRendererConfigParser(), PCLRendererConfBuilder.class);
+    }
+
+    @Test
+    public void testGetMimeType() throws Exception {
+        assertEquals(MimeConstants.MIME_PCL, new \
PCLRendererConfigParser().getMimeType()); +    }
+
+    @Test
+    public void testRenderingMode() throws Exception {
+        parseConfig();
+        assertEquals(null, conf.getRenderingMode());
+        parseConfig(createRenderer().setRenderingMode(PCLRenderingMode.QUALITY));
+        assertEquals(PCLRenderingMode.QUALITY, conf.getRenderingMode());
+    }
+
+    @Test(expected = FOPException.class)
+    public void testRenderingModeException() throws Exception {
+        parseConfig(createRenderer().setRenderingMode("whatever"));
+    }
+
+    @Test
+    public void testTextRendering() throws Exception {
+        parseConfig();
+        assertEquals(false, conf.isTextRendering());
+        parseConfig(createRenderer().setTextRendering("auto"));
+        assertEquals(false, conf.isTextRendering());
+        parseConfig(createRenderer().setTextRendering("bitmap"));
+        assertEquals(true, conf.isTextRendering());
+    }
+
+    @Test(expected = FOPException.class)
+    public void testTextRenderingException() throws Exception {
+        parseConfig(createRenderer().setTextRendering("whatever"));
+    }
+
+    @Test
+    public void testDisablePJL() throws Exception {
+        parseConfig();
+        assertEquals(false, conf.isDisablePjl());
+        parseConfig(createRenderer().setDisablePjl(true));
+        assertEquals(true, conf.isDisablePjl());
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fop.render.pcl;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.AbstractRendererConfiguratorTest;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+public class PCLRendererConfiguratorTestCase extends
+        AbstractRendererConfiguratorTest<PCLRendererConfigurator, \
PCLRendererConfBuilder> { +
+    private PCLRenderingUtil pclUtil;
+
+    public PCLRendererConfiguratorTestCase() {
+        super(MimeConstants.MIME_PCL, PCLRendererConfBuilder.class, \
PCLDocumentHandler.class); +    }
+
+    @Override
+    public PCLRendererConfigurator createConfigurator() {
+        return new PCLRendererConfigurator(userAgent, new \
PCLRendererConfigParser()); +    }
+
+    @Override
+    public void setUpDocumentHandler() {
+        pclUtil = new PCLRenderingUtil(userAgent);
+        when(((PCLDocumentHandler) docHandler).getPCLUtil()).thenReturn(pclUtil);
+    }
+
+    @Test
+    public void testSetRenderingMode() throws Exception {
+        parseConfig(createBuilder().setRenderingMode("bitmap"));
+        assertEquals(PCLRenderingMode.BITMAP, pclUtil.getRenderingMode());
+
+        parseConfig(createBuilder().setRenderingMode("quality"));
+        assertEquals(PCLRenderingMode.QUALITY, pclUtil.getRenderingMode());
+
+        parseConfig(createBuilder().setRenderingMode("speed"));
+        assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode());
+
+        parseConfig(createBuilder());
+        assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode());
+    }
+
+    @Test(expected = FOPException.class)
+    public void testRenderingModeFailureCase() throws Exception {
+        parseConfig(createBuilder().setRenderingMode("fail"));
+        assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode());
+    }
+
+    @Test
+    public void testPJLDisabled() throws Exception {
+        parseConfig(createBuilder().setDisablePjl(true));
+        assertTrue(pclUtil.isPJLDisabled());
+
+        parseConfig(createBuilder().setDisablePjl(false));
+        assertFalse(pclUtil.isPJLDisabled());
+
+        parseConfig(createBuilder());
+        assertFalse(pclUtil.isPJLDisabled());
+    }
+
+    @Test
+    public void testSetAllTextAsBitmaps() throws Exception {
+        parseConfig(createBuilder().setTextRendering("bitmap"));
+        assertTrue(pclUtil.isAllTextAsBitmaps());
+
+        parseConfig(createBuilder().setTextRendering("auto"));
+        assertFalse(pclUtil.isAllTextAsBitmaps());
+
+        parseConfig(createBuilder());
+        assertFalse(pclUtil.isAllTextAsBitmaps());
+    }
+
+    @Test(expected = FOPException.class)
+    public void testSetAllTextAsBitmapsFailureCase() throws Exception {
+        parseConfig(createBuilder().setTextRendering("fail"));
+        assertFalse(pclUtil.isAllTextAsBitmaps());
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/BasePDFTest.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pdf/BasePDFTest.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/BasePDFTest.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/BasePDFTest.java \
Thu May 31 08:33:36 2012 @@ -20,6 +20,8 @@
 package org.apache.fop.render.pdf;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
@@ -28,45 +30,35 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.xml.sax.SAXException;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.fop.AbstractFOPTest;
+
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopConfParser;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
-import org.xml.sax.SAXException;
 
 /**
  * Base class for automated tests that create PDF files
  */
-public class BasePDFTest extends AbstractFOPTest {
+public class BasePDFTest {
 
     /** the FopFactory */
-    protected final FopFactory fopFactory = FopFactory.newInstance();
+    protected final FopFactory fopFactory;
 
     /** the JAXP TransformerFactory */
     protected final TransformerFactory tFactory = TransformerFactory.newInstance();
 
-    /**
-     * Main constructor
-     */
-    protected BasePDFTest() {
-        init();
+    public BasePDFTest(String fopConf) throws SAXException, IOException {
+        fopFactory = FopFactory.newInstance(new File(fopConf));
     }
 
-    /**
-     * initalizes the test
-     */
-    protected void init() {
-        final File uc = getUserConfigFile();
-
-        try {
-            fopFactory.setUserConfig(uc);
-        } catch (Exception e) {
-            throw new RuntimeException("fopFactory.setUserConfig ("
-                    + uc.getAbsolutePath() + ") failed: " + e.getMessage());
-        }
+    public BasePDFTest(InputStream confStream) throws SAXException, IOException {
+        fopFactory = new FopConfParser(confStream, new \
File(".").toURI()).getFopFactoryBuilder() +                                           \
.build();  }
 
     /**
@@ -113,7 +105,7 @@ public class BasePDFTest extends Abstrac
      * get FOP config File
      * @return user config file to be used for testing
      */
-    protected File getUserConfigFile() {
-        return new File("test/test.xconf");
+    protected static String getDefaultConfFile() {
+        return "test/test.xconf";
     }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pdf/PDFAConformanceTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java \
Thu May 31 08:33:36 2012 @@ -22,16 +22,23 @@ package org.apache.fop.render.pdf;
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.io.IOException;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.pdf.PDFConformanceException;
-import org.junit.Test;
 
 /**
  * Tests PDF/A-1 functionality.
  */
 public class PDFAConformanceTestCase extends BasePDFTest {
 
+    public PDFAConformanceTestCase() throws SAXException, IOException {
+        super(getDefaultConfFile());
+    }
+
     private File foBaseDir = new File("test/xml/pdf-a");
     private boolean dumpPDF = Boolean.getBoolean("PDFAConformanceTestCase.dumpPDF");
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pdf/PDFEncodingTestCase.java?rev=1344594&r1=1344593&r2=1344594&view=diff
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java \
                (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java \
Thu May 31 08:33:36 2012 @@ -26,9 +26,11 @@ import java.io.File;
 import java.io.IOException;
 import java.util.StringTokenizer;
 
-import org.apache.fop.apps.FOUserAgent;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FOUserAgent;
 
 /** Test that characters are correctly encoded in a generated PDF file */
 public class PDFEncodingTestCase extends BasePDFTest {
@@ -37,6 +39,10 @@ public class PDFEncodingTestCase extends
     static final String INPUT_FILE = \
"test/xml/pdf-encoding/pdf-encoding-test.xconf";  static final String TEST_MARKER = \
"PDFE_TEST_MARK_";  
+    public PDFEncodingTestCase() throws SAXException, IOException {
+        super(INPUT_FILE);
+    }
+
 
     /**
      * create an FOUserAgent for our tests
@@ -47,11 +53,6 @@ public class PDFEncodingTestCase extends
         return a;
     }
 
-    /** @return our specific config */
-    protected File getUserConfigFile() {
-        return new File(INPUT_FILE);
-    }
-
     /**
      * Test using a standard FOP font
      * @throws Exception checkstyle wants a comment here, even a silly one

Added: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java
                
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/test/j \
ava/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java?rev=1344594&view=auto
 ==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java \
                (added)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java \
Thu May 31 08:33:36 2012 @@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.pdf;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.AbstractRendererConfigParserTester;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+import org.apache.fop.pdf.PDFAMode;
+import org.apache.fop.pdf.PDFXMode;
+import org.apache.fop.pdf.Version;
+import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class PDFRendererConfigParserTestCase
+        extends AbstractRendererConfigParserTester<PDFRendererConfBuilder, \
PDFRendererConfig> { +
+    public PDFRendererConfigParserTestCase() {
+        super(new PDFRendererConfigParser(), PDFRendererConfBuilder.class);
+    }
+
+    @Test
+    public void testUserPassword() throws Exception {
+        String testPassword = "this is a password purely for test purposes";
+        parseConfig(createRenderer()
+                .startEncryptionParams()
+                    .setUserPassword(testPassword)
+                .endEncryptionParams());
+        assertEquals(testPassword, \
conf.getEncryptionParameters().getUserPassword()); +    }
+
+    private void testRestrictEncryptionParameter(PDFRendererConfigOptions option)
+            throws Exception {
+        parseConfig(createRenderer().startEncryptionParams()
+                                .setAllowParam(option)
+                            .endEncryptionParams());
+        assertFalse(testEncryptionParameter(option));
+        parseConfig(createRenderer().startEncryptionParams()
+                            .endEncryptionParams());
+        assertTrue(testEncryptionParameter(option));
+    }
+
+    public boolean testEncryptionParameter(PDFRendererConfigOptions option) throws \
Exception { +        switch (option) {
+        case NO_PRINT:
+            return conf.getEncryptionParameters().isAllowPrint();
+        case NO_ACCESSCONTENT:
+            return conf.getEncryptionParameters().isAllowAccessContent();
+        case NO_ANNOTATIONS:
+            return conf.getEncryptionParameters().isAllowEditAnnotations();
+        case NO_ASSEMBLEDOC:
+            return conf.getEncryptionParameters().isAllowAssembleDocument();
+        case NO_COPY_CONTENT:
+            return conf.getEncryptionParameters().isAllowCopyContent();
+        case NO_EDIT_CONTENT:
+            return conf.getEncryptionParameters().isAllowEditContent();
+        case NO_FILLINFORMS:
+            return conf.getEncryptionParameters().isAllowFillInForms();
+        case NO_PRINTHQ:
+            return conf.getEncryptionParameters().isAllowPrintHq();
+        default:
+            throw new IllegalStateException("Wrong parameter given");
+        }
+
+    }
+
+    @Test
+    public void testAllEncryptionRestrictions() throws Exception {
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_PRINT);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ACCESSCONTENT);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ANNOTATIONS);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ASSEMBLEDOC);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_COPY_CONTENT);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_EDIT_CONTENT);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_FILLINFORMS);
+        testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_PRINTHQ);
+    }
+
+    @Test
+    public void testOwnerPassword() throws Exception {
+        String testPassword = "this is a password purely for test purposes";
+        parseConfig(createRenderer()
+                .startEncryptionParams()
+                    .setOwnerPassword(testPassword)
+                .endEncryptionParams());
+        assertEquals(testPassword, \
conf.getEncryptionParameters().getOwnerPassword()); +    }
+
+    @Test
+    public void testFilterListDefaultFlate() throws Exception {
+        parseConfig(createRenderer().createFilterList(null, "flate"));
+        assertEquals("flate", conf.getFilterMap().get("default").get(0));
+    }
+
+    @Test
+    public void testFilterListDefaultNull() throws Exception {
+        parseConfig(createRenderer().createFilterList(null, "null"));
+        assertEquals("null", conf.getFilterMap().get("default").get(0));
+    }
+
+    @Test
+    public void testFilterListImage() throws Exception {
+        parseConfig(createRenderer().createFilterList("image", "flate", \
"ascii-85")); +        assertEquals("flate", \
conf.getFilterMap().get("image").get(0)); +        assertEquals("ascii-85", \
conf.getFilterMap().get("image").get(1)); +    }
+
+    @Test
+    public void testPDFAMode() throws Exception {
+        parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1A.getName()));
+        assertEquals(PDFAMode.PDFA_1A, conf.getPDFAMode());
+
+        parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1B.getName()));
+        assertEquals(PDFAMode.PDFA_1B, conf.getPDFAMode());
+
+        parseConfig(createRenderer().setPDFAMode(PDFAMode.DISABLED.getName()));
+        assertEquals(null, conf.getPDFAMode());
+    }
+
+    @Test
+    public void testPDFXMode() throws Exception {
+        parseConfig(createRenderer().setPDFXMode(PDFXMode.PDFX_3_2003.getName()));
+        assertEquals(PDFXMode.PDFX_3_2003, conf.getPDFXMode());
+
+        parseConfig(createRenderer().setPDFXMode(PDFXMode.DISABLED.getName()));
+        assertEquals(null, conf.getPDFXMode());
+    }
+
+    @Test
+    public void testEncryptionLength() throws Exception {
+        for (int i = 0; i <= 40; i++) {
+            parseConfig(createRenderer()
+                    .startEncryptionParams()
+                        .setEncryptionLength(i)
+                    .endEncryptionParams());
+            assertEquals(40, \
conf.getEncryptionParameters().getEncryptionLengthInBits()); +        }
+
+        for (int i = 40; i <= 128; i++) {
+            parseConfig(createRenderer()
+                    .startEncryptionParams()
+                        .setEncryptionLength(i)
+                    .endEncryptionParams());
+            int expectedLen = Math.round(i / 8.0f) * 8;
+            assertEquals(expectedLen, conf.getEncryptionParameters()
+                                                 .getEncryptionLengthInBits());
+        }
+
+        for (int i = 128; i < 1000; i += 50) {
+            parseConfig(createRenderer()
+                    .startEncryptionParams()
+                        .setEncryptionLength(i)
+                    .endEncryptionParams());
+            assertEquals(128, \
conf.getEncryptionParameters().getEncryptionLengthInBits()); +        }
+    }
+
+    @Test
+    public void testPDFVersions() throws Exception {
+        for (int i = 0; i <= 7; i++) {
+            pdfVersionTester("1." + i);
+        }
+    }
+
+    private void pdfVersionTester(String version) throws Exception {
+        parseConfig(createRenderer().setPDFVersion(version));
+        assertEquals(Version.getValueOf(version), conf.getPDFVersion());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testErroneousPDFVersions18() throws Exception {
+        pdfVersionTester("1.8");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testErroneousPDFVersionsLessThan1() throws Exception {
+        pdfVersionTester("0.9");
+    }
+
+    @Test(expected = FOPException.class)
+    public void testErroneousPDFVersionsNotSet() throws Exception {
+        pdfVersionTester("");
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java
                
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic