diff options
author | Glenn Adams <gadams@apache.org> | 2016-03-03 09:49:26 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2016-03-03 09:49:26 +0000 |
commit | c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262 (patch) | |
tree | f553e13b28bd90fd2067bf390509f9290260d330 /test/java/org/apache/fop/config | |
parent | 82804d6ffcb68841cd7adf9740469f3a79c372c8 (diff) | |
download | xmlgraphics-fop-c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262.tar.gz xmlgraphics-fop-c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262.zip |
Transition source to standard maven hierarchy (initial).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/maven@1733433 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/config')
11 files changed, 0 insertions, 558 deletions
diff --git a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java deleted file mode 100644 index 7a3cab3bb..000000000 --- a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java +++ /dev/null @@ -1,53 +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; - -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 - */ - @Test - public void testUserConfig() throws Exception { - try { - convertFO(); - } catch (Exception e) { - // this should *not* happen! - e.printStackTrace(); - fail(e.getMessage()); - } - } -} diff --git a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java deleted file mode 100644 index 4050e9b2d..000000000 --- a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java +++ /dev/null @@ -1,46 +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; - -import java.io.IOException; -import java.io.InputStream; - -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(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 deleted file mode 100644 index 1af57d985..000000000 --- a/test/java/org/apache/fop/config/BaseUserConfigTest.java +++ /dev/null @@ -1,81 +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; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import org.xml.sax.SAXException; - -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 static org.apache.fop.FOPTestUtils.getBaseDir; - -/** - * Basic runtime test for FOP's font configuration. It is used to verify that - * nothing obvious is broken after compiling. - */ -public abstract class BaseUserConfigTest extends BasePDFTest { - - protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); - - /** logging instance */ - protected Log log = LogFactory.getLog(BaseUserConfigTest.class); - - - public BaseUserConfigTest(InputStream confStream) throws SAXException, IOException { - super(confStream); - } - - /** - * @see org.apache.fop.render.pdf.BasePDFTest#init() - */ - protected void init() { - // do nothing - } - - protected void convertFO() throws Exception { - final File baseDir = getBaseDir(); - final String fontFOFilePath = getFontFOFilePath(); - File foFile = new File(baseDir, fontFOFilePath); - final boolean dumpOutput = false; - FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); - convertFO(foFile, foUserAgent, dumpOutput); - } - - /** - * get test FOP config File - * @return fo test filepath - */ - protected String getFontFOFilePath() { - return "test/xml/bugtests/font.fo"; - } - - /** get base config directory */ - protected static String getBaseConfigDir() { - return "test/config/"; - } -} diff --git a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java deleted file mode 100644 index fa4babfa2..000000000 --- a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java +++ /dev/null @@ -1,44 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -/** - * this font is without a metrics-url or an embed-url - */ -public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTest { - - 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/FontMetricsUrlBadTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java deleted file mode 100644 index 591104412..000000000 --- a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java +++ /dev/null @@ -1,44 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -/** - * this font has a metrics-url that does not exist on filesystem - */ -public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTest { - - 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 deleted file mode 100644 index 11538dc33..000000000 --- a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java +++ /dev/null @@ -1,44 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -/** - * this font has a malformed metrics-url - */ -public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTest { - - 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 deleted file mode 100644 index 4bacc180c..000000000 --- a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java +++ /dev/null @@ -1,44 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -/** - * this font has a missing font triplet attribute - */ -public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTest { - - 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 deleted file mode 100644 index e05e44ab1..000000000 --- a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java +++ /dev/null @@ -1,38 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest { - - 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 deleted file mode 100644 index aab7a2e7c..000000000 --- a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java +++ /dev/null @@ -1,41 +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; - -import java.io.IOException; - -import org.xml.sax.SAXException; - -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.PDFRendererConfBuilder; - -/** - * tests font directory on system - */ -public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTest { - - 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 deleted file mode 100644 index 1ac79e353..000000000 --- a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java +++ /dev/null @@ -1,83 +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; - -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; -import org.apache.fop.fonts.FontInfo; -import org.apache.fop.fonts.FontManager; -import org.apache.fop.fonts.FontTriplet; -import org.apache.fop.fonts.base14.Base14FontCollection; -import org.apache.fop.render.PrintRenderer; - -/** - * Tests the font substitution mechanism - */ -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) - throws Exception { - PrintRenderer renderer = (PrintRenderer) ua.getRendererFactory() - .createRenderer(ua, MimeConstants.MIME_PDF); - FontInfo fontInfo = new FontInfo(); - renderer.setupFontInfo(fontInfo); - FontManager fontManager = ua.getFontManager(); - FontCollection[] fontCollections = new FontCollection[] { - new Base14FontCollection(fontManager.isBase14KerningEnabled()), - new CustomFontCollection(fontManager.getResourceResolver(), renderer.getFontList(), - ua.isComplexScriptFeaturesEnabled()) - }; - fontManager.setup(fontInfo, fontCollections); - FontTriplet triplet = new FontTriplet("Times", "italic", - Font.WEIGHT_NORMAL); - String internalFontKey = fontInfo.getInternalFontKey(triplet); - // Times italic should now be mapped to the 15th font (custom font) - // not the original base 14 (F6) - if (!"F15".equals(internalFontKey)) { - throw new Exception("font substitution failed :" + triplet); - } - return null; - } -} diff --git a/test/java/org/apache/fop/config/UserConfigTestSuite.java b/test/java/org/apache/fop/config/UserConfigTestSuite.java deleted file mode 100644 index 9cb5c4270..000000000 --- a/test/java/org/apache/fop/config/UserConfigTestSuite.java +++ /dev/null @@ -1,40 +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; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -/** - * Test suite for font configuration. - */ -@RunWith(Suite.class) -@SuiteClasses({ - FontAttributesMissingTestCase.class, - FontTripletAttributeMissingTestCase.class, - FontMetricsUrlBadTestCase.class, - FontMetricsUrlMalformedTestCase.class, - FontsDirectoryRecursiveTestCase.class, - FontsAutoDetectTestCase.class, - FontsSubstitutionTestCase.class -}) -public class UserConfigTestSuite { -} |