aboutsummaryrefslogtreecommitdiffstats
path: root/test/java/org/apache/fop/config
diff options
context:
space:
mode:
Diffstat (limited to 'test/java/org/apache/fop/config')
-rw-r--r--test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java11
-rw-r--r--test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java26
-rw-r--r--test/java/org/apache/fop/config/BaseUserConfigTest.java60
-rw-r--r--test/java/org/apache/fop/config/FOURIResolverTestCase.java2
-rw-r--r--test/java/org/apache/fop/config/FontAttributesMissingTestCase.java20
-rw-r--r--test/java/org/apache/fop/config/FontBaseBadTestCase.java31
-rw-r--r--test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java31
-rw-r--r--test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java31
-rw-r--r--test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java20
-rw-r--r--test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java20
-rw-r--r--test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java20
-rw-r--r--test/java/org/apache/fop/config/FontsAutoDetectTestCase.java17
-rw-r--r--test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java17
-rw-r--r--test/java/org/apache/fop/config/FontsSubstitutionTestCase.java33
-rw-r--r--test/java/org/apache/fop/config/SingleFopConfParseTestCase.java68
-rw-r--r--test/java/org/apache/fop/config/UserConfigTestSuite.java18
16 files changed, 229 insertions, 196 deletions
diff --git a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java
index fbcd9a441..7a3cab3bb 100644
--- a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java
+++ b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java
@@ -19,15 +19,23 @@
package org.apache.fop.config;
-import static org.junit.Assert.fail;
+import java.io.IOException;
+import java.io.InputStream;
import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import static org.junit.Assert.fail;
/**
* Super class of several user config cases.
*/
public abstract class BaseConstructiveUserConfigTest extends BaseUserConfigTest {
+ public BaseConstructiveUserConfigTest(InputStream confStream) throws SAXException, IOException {
+ super(confStream);
+ }
+
/**
* Test using a standard FOP font
* @throws Exception checkstyle wants a comment here, even a silly one
@@ -35,7 +43,6 @@ public abstract class BaseConstructiveUserConfigTest extends BaseUserConfigTest
@Test
public void testUserConfig() throws Exception {
try {
- initConfig();
convertFO();
} catch (Exception e) {
// this should *not* happen!
diff --git a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java
index eb8d202c3..4050e9b2d 100644
--- a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java
+++ b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java
@@ -19,30 +19,28 @@
package org.apache.fop.config;
-import static org.junit.Assert.fail;
+import java.io.IOException;
+import java.io.InputStream;
-import org.apache.fop.apps.FOPException;
import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FOPException;
/**
* Super class for several user configuration failure cases.
*/
public abstract class BaseDestructiveUserConfigTest extends BaseUserConfigTest {
+ public BaseDestructiveUserConfigTest(InputStream confStream) throws SAXException, IOException {
+ super(confStream);
+ }
+
/**
* Test the user configuration failure.
*/
- @Test
- public void testUserConfig() {
- try {
- initConfig();
- convertFO();
- fail( getName() + ": Expected Configuration Exception" );
- } catch (FOPException e) {
- // this *should* happen!
- } catch (Exception e) {
- e.printStackTrace();
- fail( getName() + ": Expected FOPException but got: " + e.getMessage() );
- }
+ @Test(expected = FOPException.class)
+ public void testUserConfig() throws Exception {
+ convertFO();
}
}
diff --git a/test/java/org/apache/fop/config/BaseUserConfigTest.java b/test/java/org/apache/fop/config/BaseUserConfigTest.java
index 645aea536..1af57d985 100644
--- a/test/java/org/apache/fop/config/BaseUserConfigTest.java
+++ b/test/java/org/apache/fop/config/BaseUserConfigTest.java
@@ -19,18 +19,20 @@
package org.apache.fop.config;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+
+import org.xml.sax.SAXException;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.render.pdf.BasePDFTest;
-import org.xml.sax.SAXException;
+
+import static org.apache.fop.FOPTestUtils.getBaseDir;
/**
* Basic runtime test for FOP's font configuration. It is used to verify that
@@ -44,6 +46,10 @@ public abstract class BaseUserConfigTest extends BasePDFTest {
protected Log log = LogFactory.getLog(BaseUserConfigTest.class);
+ public BaseUserConfigTest(InputStream confStream) throws SAXException, IOException {
+ super(confStream);
+ }
+
/**
* @see org.apache.fop.render.pdf.BasePDFTest#init()
*/
@@ -51,10 +57,6 @@ public abstract class BaseUserConfigTest extends BasePDFTest {
// do nothing
}
- protected void initConfig() throws Exception {
- fopFactory.setUserConfig(getUserConfig());
- }
-
protected void convertFO() throws Exception {
final File baseDir = getBaseDir();
final String fontFOFilePath = getFontFOFilePath();
@@ -72,46 +74,8 @@ public abstract class BaseUserConfigTest extends BasePDFTest {
return "test/xml/bugtests/font.fo";
}
- /**
- * get test FOP Configuration
- * @return fo test filepath
- * @throws IOException
- * @throws SAXException
- * @throws ConfigurationException
- */
- protected Configuration getUserConfig(String configString) throws ConfigurationException, SAXException, IOException {
- return cfgBuilder.build(new ByteArrayInputStream(configString.getBytes()));
- }
-
/** get base config directory */
- protected String getBaseConfigDir() {
- return "test/config";
- }
-
- /**
- * @return user config File
- */
- protected abstract String getUserConfigFilename();
-
- /**
- * The name of this test.
- */
- public String getName() {
- return getUserConfigFilename();
- }
-
- protected File getUserConfigFile() {
- return new File(getBaseConfigDir() + File.separator + getUserConfigFilename());
- }
-
- /**
- * get test FOP Configuration
- * @return fo test filepath
- * @throws IOException
- * @throws SAXException
- * @throws ConfigurationException
- */
- protected Configuration getUserConfig() throws ConfigurationException, SAXException, IOException {
- return cfgBuilder.buildFromFile(getUserConfigFile());
+ protected static String getBaseConfigDir() {
+ return "test/config/";
}
}
diff --git a/test/java/org/apache/fop/config/FOURIResolverTestCase.java b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
index 1ffe8b065..0358638b3 100644
--- a/test/java/org/apache/fop/config/FOURIResolverTestCase.java
+++ b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.fail;
import java.net.MalformedURLException;
-import org.apache.fop.apps.FOURIResolver;
+import org.apache.fop.apps.io.FOURIResolver;
import org.junit.Test;
/**
diff --git a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
index 7e17291d6..8d7d46928 100644
--- a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
+++ b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
@@ -19,13 +19,27 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
/**
* this font is without a metrics-url or an embed-url
*/
public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTest {
- @Override
- public String getUserConfigFilename() {
- return "test_font_attributes_missing.xconf";
+ public FontAttributesMissingTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().setStrictValidation(true)
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont(null, null)
+ .addTriplet("Gladiator", "normal", "normal")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontBaseBadTestCase.java b/test/java/org/apache/fop/config/FontBaseBadTestCase.java
deleted file mode 100644
index eb49ca9fe..000000000
--- a/test/java/org/apache/fop/config/FontBaseBadTestCase.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.config;
-
-/**
- * This font base does not exist and a relative font path is used.
- */
-public class FontBaseBadTestCase extends BaseDestructiveUserConfigTest {
-
- @Override
- public String getUserConfigFilename() {
- return "test_fontbase_bad.xconf";
- }
-}
diff --git a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
deleted file mode 100644
index 9e341f8b4..000000000
--- a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.config;
-
-/**
- * this font has an embed-url that does not exist on filesystem.
- */
-public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTest {
-
- @Override
- public String getUserConfigFilename() {
- return "test_font_embedurl_bad.xconf";
- }
-}
diff --git a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
deleted file mode 100644
index e3f0a6a88..000000000
--- a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.config;
-
-/**
- * this font has a malformed embed-url
- */
-public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTest {
-
- @Override
- public String getUserConfigFilename() {
- return "test_font_embedurl_malformed.xconf";
- }
-}
diff --git a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
index 352d43920..84e8ee804 100644
--- a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
@@ -19,13 +19,27 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
/**
* this font has a metrics-url that does not exist on filesystem
*/
public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTest {
- @Override
- public String getUserConfigFilename() {
- return "test_font_metricsurl_bad.xconf";
+ public FontMetricsUrlBadTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().setStrictValidation(true)
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont("test/doesnotexist.ttf.ansi.xml", null)
+ .addTriplet("Gladiator-Ansi", "normal", "normal")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
index ddf3ee8a6..3479c3794 100644
--- a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
+++ b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
@@ -19,13 +19,27 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
/**
* this font has a malformed metrics-url
*/
public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTest {
- @Override
- public String getUserConfigFilename() {
- return "test_font_metricsurl_malformed.xconf";
+ public FontMetricsUrlMalformedTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().setStrictValidation(true)
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont("badprotocol:test/glb12.ttf.xml", null)
+ .addTriplet("Gladiator", "normal", "normal")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
index 8aa2acb81..800e06d32 100644
--- a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
+++ b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
@@ -19,13 +19,27 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
/**
* this font has a missing font triplet attribute
*/
public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTest {
- @Override
- public String getUserConfigFilename() {
- return "test_font_tripletattribute_missing.xconf";
+ public FontTripletAttributeMissingTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().setStrictValidation(true)
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont(null, "test/resources/fonts/ttf/glb12.ttf")
+ .addTriplet("Gladiator", null, "normal")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
index cf9d19f99..c9f6d98ff 100644
--- a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
+++ b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
@@ -19,10 +19,21 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest {
- @Override
- public String getUserConfigFilename() {
- return "test_fonts_autodetect.xconf";
+ public FontsAutoDetectTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .addAutoDetect()
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
index 3817e7966..2776c2cce 100644
--- a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
+++ b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
@@ -19,13 +19,24 @@
package org.apache.fop.config;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+
/**
* tests font directory on system
*/
public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTest {
- @Override
- protected String getUserConfigFilename() {
- return "test_fonts_directory_recursive.xconf";
+ public FontsDirectoryRecursiveTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .addDirectory("test/resources/fonts", true)
+ .endFontConfig()
+ .endRendererConfig().build());
}
}
diff --git a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
index 1499c9186..8ccaa24d4 100644
--- a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
+++ b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
@@ -20,9 +20,14 @@
package org.apache.fop.config;
import java.io.File;
+import java.io.IOException;
+
+import org.xml.sax.SAXException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
import org.apache.fop.fonts.CustomFontCollection;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontCollection;
@@ -35,8 +40,21 @@ import org.apache.fop.render.PrintRenderer;
/**
* Tests the font substitution mechanism
*/
-public class FontsSubstitutionTestCase extends
- BaseConstructiveUserConfigTest {
+public class FontsSubstitutionTestCase extends BaseConstructiveUserConfigTest {
+
+ public FontsSubstitutionTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder()
+ .startFontsConfig()
+ .substituteFonts("Times", "italic", null, "Gladiator", "normal", "bold")
+ .endFontsConfig()
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont(null, "resources/fonts/ttf/glb12.ttf")
+ .addTriplet("Gladiator", "normal", "bold")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
+ }
@Override
protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile)
@@ -45,11 +63,11 @@ public class FontsSubstitutionTestCase extends
.createRenderer(ua, MimeConstants.MIME_PDF);
FontInfo fontInfo = new FontInfo();
renderer.setupFontInfo(fontInfo);
- FontManager fontManager = ua.getFactory().getFontManager();
+ FontManager fontManager = ua.getFontManager();
FontCollection[] fontCollections = new FontCollection[] {
new Base14FontCollection(fontManager.isBase14KerningEnabled()),
- new CustomFontCollection(renderer.getFontResolver(), renderer.getFontList(),
- ua.isComplexScriptFeaturesEnabled())
+ new CustomFontCollection(fontManager.getURIResolver(), renderer.getFontList(),
+ ua.isComplexScriptFeaturesEnabled())
};
fontManager.setup(fontInfo, fontCollections);
FontTriplet triplet = new FontTriplet("Times", "italic",
@@ -62,9 +80,4 @@ public class FontsSubstitutionTestCase extends
}
return null;
}
-
- @Override
- public String getUserConfigFilename() {
- return "test_fonts_substitution.xconf";
- }
}
diff --git a/test/java/org/apache/fop/config/SingleFopConfParseTestCase.java b/test/java/org/apache/fop/config/SingleFopConfParseTestCase.java
new file mode 100644
index 000000000..430de318b
--- /dev/null
+++ b/test/java/org/apache/fop/config/SingleFopConfParseTestCase.java
@@ -0,0 +1,68 @@
+/*
+ * 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.config;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import org.apache.fop.apps.FopConfBuilder;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PDFRendererConfBuilder;
+import org.apache.fop.render.RendererConfig.RendererConfigParser;
+import org.apache.fop.render.pdf.PDFRendererConfig;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class SingleFopConfParseTestCase extends BaseConstructiveUserConfigTest {
+
+ public SingleFopConfParseTestCase() throws SAXException, IOException {
+ super(new FopConfBuilder().setStrictValidation(true)
+ .startRendererConfig(PDFRendererConfBuilder.class)
+ .startFontsConfig()
+ .startFont(null, "test/resources/fonts/ttf/glb12.ttf.xml")
+ .addTriplet("Gladiator", "normal", "normal")
+ .endFont()
+ .endFontConfig()
+ .endRendererConfig().build());
+ }
+
+ @Test
+ @Override
+ public void testUserConfig() throws Exception {
+ RendererConfigParser mock = mock(RendererConfigParser.class);
+ when(mock.getMimeType()).thenReturn(MimeConstants.MIME_PDF);
+ try {
+ convertFO();
+ PDFRendererConfig config = (PDFRendererConfig) fopFactory.getRendererConfig(null, null,
+ mock);
+ convertFO();
+ assertEquals(config, fopFactory.getRendererConfig(null, null, mock));
+ } catch (Exception e) {
+ // this should *not* happen!
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+}
diff --git a/test/java/org/apache/fop/config/UserConfigTestSuite.java b/test/java/org/apache/fop/config/UserConfigTestSuite.java
index 374d41fab..91329f6ec 100644
--- a/test/java/org/apache/fop/config/UserConfigTestSuite.java
+++ b/test/java/org/apache/fop/config/UserConfigTestSuite.java
@@ -28,16 +28,14 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses({
- FontBaseBadTestCase.class,
- FontAttributesMissingTestCase.class,
- FontTripletAttributeMissingTestCase.class,
- FontMetricsUrlBadTestCase.class,
- FontEmbedUrlBadTestCase.class,
- FontMetricsUrlMalformedTestCase.class,
- FontsDirectoryRecursiveTestCase.class,
- FontsAutoDetectTestCase.class,
- FontsSubstitutionTestCase.class,
- FOURIResolverTestCase.class
+ FontAttributesMissingTestCase.class,
+ FontTripletAttributeMissingTestCase.class,
+ FontMetricsUrlBadTestCase.class,
+ FontMetricsUrlMalformedTestCase.class,
+ FontsDirectoryRecursiveTestCase.class,
+ FontsAutoDetectTestCase.class,
+ FontsSubstitutionTestCase.class,
+ FOURIResolverTestCase.class
})
public class UserConfigTestSuite {
}