From 02303acdd92bbdd79dfe9b8866617209b183ae26 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Mon, 7 Nov 2011 18:18:29 +0000 Subject: [PATCH] Bugzilla 52136: Added to build file JUnit target that uses a regex to run all of the test cases. Patch by Mehdi Houshmand, applied with minor modifications git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1198853 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 94 +++++-------- .../org/apache/fop/fonts/FontDetector.java | 12 +- .../apache/fop/fonts/FontEventAdapter.java | 5 + .../apache/fop/fonts/FontEventListener.java | 6 + .../apache/fop/fonts/FontEventProducer.java | 8 ++ .../apache/fop/fonts/FontEventProducer.xml | 1 + .../fop/fonts/FontInfoConfigurator.java | 6 +- .../fop/fonts/autodetect/FontFileFinder.java | 18 ++- .../fop/tools/fontlist/FontListMain.java | 4 + status.xml | 4 + ....java => AbstractBasicTranscoderTest.java} | 2 +- ...tFOPTestCase.java => AbstractFOPTest.java} | 9 +- .../org/apache/fop/BasicDriverTestCase.java | 2 +- .../fop/BasicPDFTranscoderTestCase.java | 2 +- .../apache/fop/BasicPSTranscoderTestCase.java | 2 +- .../org/apache/fop/GenericFOPTestCase.java | 129 ------------------ .../org/apache/fop/StandardTestSuite.java | 20 +-- .../org/apache/fop/URIResolutionTestCase.java | 2 +- ....java => CharactersetEncoderTestCase.java} | 2 +- ...stCase.java => AbstractAFPObjectTest.java} | 2 +- ...e.java => AbstractNamedAFPObjectTest.java} | 4 +- ...java => AbstractStructuredObjectTest.java} | 2 +- ... AbstractTripletStructuredObjectTest.java} | 11 +- .../fop/afp/modca/IncludeObjectTestCase.java | 2 +- .../fop/area/BlockViewportTestCase.java | 2 +- .../fop/area/RegionViewportTestCase.java | 2 +- ...iewportTestCase.java => ViewportTest.java} | 2 +- .../area/inline/InlineViewportTestCase.java | 4 +- ...va => BaseConstructiveUserConfigTest.java} | 2 +- ...ava => BaseDestructiveUserConfigTest.java} | 2 +- ...gTestCase.java => BaseUserConfigTest.java} | 8 +- .../config/FontAttributesMissingTestCase.java | 2 +- .../fop/config/FontBaseBadTestCase.java | 2 +- .../fop/config/FontEmbedUrlBadTestCase.java | 2 +- .../config/FontEmbedUrlMalformedTestCase.java | 2 +- .../fop/config/FontMetricsUrlBadTestCase.java | 2 +- .../FontMetricsUrlMalformedTestCase.java | 2 +- .../FontTripletAttributeMissingTestCase.java | 2 +- .../fop/config/FontsAutoDetectTestCase.java | 2 +- .../fop/config/FontsDirectoryBadTestCase.java | 36 ----- .../FontsDirectoryRecursiveTestCase.java | 2 +- .../fop/config/FontsSubstitutionTestCase.java | 2 +- .../fop/config/UserConfigTestSuite.java | 1 - .../org/apache/fop/events/EventChecker.java | 6 +- .../fop/events/EventProcessingTestCase.java | 65 +++++---- ...leTestCase.java => AbstractTableTest.java} | 4 +- .../CollapsedConditionalBorderTestCase.java | 2 +- ...CheckTestCase.java => ErrorCheckTest.java} | 4 +- .../fo/flow/table/IllegalRowSpanTestCase.java | 2 +- .../flow/table/RowGroupBuilderTestCase.java | 2 +- .../TableColumnColumnNumberTestCase.java | 2 +- .../fo/flow/table/TooManyColumnsTestCase.java | 2 +- ...fTest.java => DejaVuLGCSerifTestCase.java} | 4 +- ...odeTest.java => EncodingModeTestCase.java} | 2 +- ...{FOTreeTester.java => FOTreeTestCase.java} | 4 +- .../fop/fotreetest/FOTreeTestSuite.java | 15 +- ...actIFTestCase.java => AbstractIFTest.java} | 4 +- ...ase.java => AbstractIntermediateTest.java} | 4 +- .../intermediate/AreaTreeParserTestCase.java | 2 +- .../fop/intermediate/IFParserTestCase.java | 2 +- .../apache/fop/intermediate/IFTestCase.java | 2 +- ...eTester.java => LayoutEngineTestCase.java} | 4 +- .../layoutengine/LayoutEngineTestSuite.java | 2 +- ...stCase.java => AbstractRenderingTest.java} | 2 +- ...Test.java => RendererFactoryTestCase.java} | 7 +- ...tAFPTestCase.java => AbstractAFPTest.java} | 4 +- .../fop/render/afp/NoOperationTestCase.java | 2 +- ...sTest.java => PageBoundariesTestCase.java} | 2 +- ...eScaleTest.java => PageScaleTestCase.java} | 2 +- ...{BasePDFTestCase.java => BasePDFTest.java} | 6 +- .../render/pdf/PDFAConformanceTestCase.java | 2 +- .../fop/render/pdf/PDFEncodingTestCase.java | 2 +- .../render/pdf/PDFsRGBSettingsTestCase.java | 2 +- ...tCase.java => AbstractPostScriptTest.java} | 4 +- .../fop/render/ps/ImageHandlingTestCase.java | 14 +- .../ps/ResourceOptimizationTestCase.java | 11 +- ...Test.java => LineBreakStatusTestCase.java} | 2 +- ...sTest.java => LineBreakUtilsTestCase.java} | 4 +- ...OptMaxTest.java => MinOptMaxTestCase.java} | 4 +- 79 files changed, 259 insertions(+), 373 deletions(-) rename test/java/org/apache/fop/{AbstractBasicTranscoderTestCase.java => AbstractBasicTranscoderTest.java} (96%) rename test/java/org/apache/fop/{AbstractFOPTestCase.java => AbstractFOPTest.java} (82%) rename test/java/org/apache/fop/afp/fonts/{CharactersetEncoderTest.java => CharactersetEncoderTestCase.java} (99%) rename test/java/org/apache/fop/afp/modca/{AbstractAFPObjectTestCase.java => AbstractAFPObjectTest.java} (98%) rename test/java/org/apache/fop/afp/modca/{AbstractNamedAFPObjectTestCase.java => AbstractNamedAFPObjectTest.java} (93%) rename test/java/org/apache/fop/afp/modca/{AbstractStructuredObjectTestCase.java => AbstractStructuredObjectTest.java} (93%) rename test/java/org/apache/fop/afp/modca/{AbstractTripletStructuredObjectTestCase.java => AbstractTripletStructuredObjectTest.java} (96%) rename test/java/org/apache/fop/area/{ViewportTestCase.java => ViewportTest.java} (97%) rename test/java/org/apache/fop/config/{BaseConstructiveUserConfigTestCase.java => BaseConstructiveUserConfigTest.java} (93%) rename test/java/org/apache/fop/config/{BaseDestructiveUserConfigTestCase.java => BaseDestructiveUserConfigTest.java} (94%) rename test/java/org/apache/fop/config/{BaseUserConfigTestCase.java => BaseUserConfigTest.java} (93%) rename test/java/org/apache/fop/fo/flow/table/{AbstractTableTestCase.java => AbstractTableTest.java} (93%) rename test/java/org/apache/fop/fo/flow/table/{ErrorCheckTestCase.java => ErrorCheckTest.java} (91%) rename test/java/org/apache/fop/fonts/{DejaVuLGCSerifTest.java => DejaVuLGCSerifTestCase.java} (97%) rename test/java/org/apache/fop/fonts/{EncodingModeTest.java => EncodingModeTestCase.java} (97%) rename test/java/org/apache/fop/fotreetest/{FOTreeTester.java => FOTreeTestCase.java} (98%) rename test/java/org/apache/fop/intermediate/{AbstractIFTestCase.java => AbstractIFTest.java} (97%) rename test/java/org/apache/fop/intermediate/{AbstractIntermediateTestCase.java => AbstractIntermediateTest.java} (98%) rename test/java/org/apache/fop/layoutengine/{LayoutEngineTester.java => LayoutEngineTestCase.java} (99%) rename test/java/org/apache/fop/render/{AbstractRenderingTestCase.java => AbstractRenderingTest.java} (98%) rename test/java/org/apache/fop/render/{RendererFactoryTest.java => RendererFactoryTestCase.java} (98%) rename test/java/org/apache/fop/render/afp/{AbstractAFPTestCase.java => AbstractAFPTest.java} (92%) rename test/java/org/apache/fop/render/extensions/prepress/{PageBoundariesTest.java => PageBoundariesTestCase.java} (99%) rename test/java/org/apache/fop/render/extensions/prepress/{PageScaleTest.java => PageScaleTestCase.java} (98%) rename test/java/org/apache/fop/render/pdf/{BasePDFTestCase.java => BasePDFTest.java} (96%) rename test/java/org/apache/fop/render/ps/{AbstractPostScriptTestCase.java => AbstractPostScriptTest.java} (95%) rename test/java/org/apache/fop/text/linebreak/{LineBreakStatusTest.java => LineBreakStatusTestCase.java} (99%) rename test/java/org/apache/fop/text/linebreak/{LineBreakUtilsTest.java => LineBreakUtilsTestCase.java} (97%) rename test/java/org/apache/fop/traits/{MinOptMaxTest.java => MinOptMaxTestCase.java} (99%) diff --git a/build.xml b/build.xml index 542ff25de..90ae3c6ea 100644 --- a/build.xml +++ b/build.xml @@ -179,8 +179,10 @@ list of possible build targets. + + @@ -283,57 +285,22 @@ list of possible build targets. + + + + + + - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - + + @@ -703,10 +670,10 @@ list of possible build targets. - + - + @@ -716,7 +683,7 @@ list of possible build targets. - + @@ -729,7 +696,7 @@ list of possible build targets. - + @@ -744,7 +711,7 @@ list of possible build targets. - + @@ -759,7 +726,7 @@ list of possible build targets. JAR needs to be updated. --> - + @@ -791,7 +758,7 @@ list of possible build targets. - + @@ -816,6 +783,20 @@ list of possible build targets. + + + + + + + + + + + + + + @@ -861,17 +842,16 @@ list of possible build targets. outfile="TEST-intermediate-format"/> - + - + - - + NOTE: ************************************************************************** @@ -1353,7 +1333,7 @@ NOTE: - + diff --git a/src/java/org/apache/fop/fonts/FontDetector.java b/src/java/org/apache/fop/fonts/FontDetector.java index 88e4c6e69..8cfb0da12 100644 --- a/src/java/org/apache/fop/fonts/FontDetector.java +++ b/src/java/org/apache/fop/fonts/FontDetector.java @@ -27,10 +27,12 @@ import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + +import org.apache.xmlgraphics.util.ClasspathResource; + import org.apache.fop.apps.FOPException; import org.apache.fop.fonts.autodetect.FontFileFinder; import org.apache.fop.util.LogUtil; -import org.apache.xmlgraphics.util.ClasspathResource; /** * Detector of operating system and classpath fonts @@ -45,17 +47,21 @@ public class FontDetector { private final FontManager fontManager; private final FontAdder fontAdder; private final boolean strict; + private final FontEventListener eventListener; /** * Main constructor * @param manager the font manager * @param adder the font adder * @param strict true if an Exception should be thrown if an error is found. + * @param listener for throwing font related events */ - public FontDetector(FontManager manager, FontAdder adder, boolean strict) { + public FontDetector(FontManager manager, FontAdder adder, boolean strict, + FontEventListener listener) { this.fontManager = manager; this.fontAdder = adder; this.strict = strict; + this.eventListener = listener; } /** @@ -66,7 +72,7 @@ public class FontDetector { public void detect(List fontInfoList) throws FOPException { // search in font base if it is defined and // is a directory but don't recurse - FontFileFinder fontFileFinder = new FontFileFinder(); + FontFileFinder fontFileFinder = new FontFileFinder(eventListener); String fontBaseURL = fontManager.getFontBaseURL(); if (fontBaseURL != null) { try { diff --git a/src/java/org/apache/fop/fonts/FontEventAdapter.java b/src/java/org/apache/fop/fonts/FontEventAdapter.java index 77846ee77..85a43393e 100644 --- a/src/java/org/apache/fop/fonts/FontEventAdapter.java +++ b/src/java/org/apache/fop/fonts/FontEventAdapter.java @@ -61,4 +61,9 @@ public class FontEventAdapter implements FontEventListener { getEventProducer().glyphNotAvailable(source, ch, fontName); } + /** {@inheritDoc} */ + public void fontDirectoryNotFound(Object source, String dir) { + getEventProducer().fontDirectoryNotFound(source, dir); + } + } diff --git a/src/java/org/apache/fop/fonts/FontEventListener.java b/src/java/org/apache/fop/fonts/FontEventListener.java index 740a05fdc..5f9e7b6c6 100644 --- a/src/java/org/apache/fop/fonts/FontEventListener.java +++ b/src/java/org/apache/fop/fonts/FontEventListener.java @@ -48,4 +48,10 @@ public interface FontEventListener { */ void glyphNotAvailable(Object source, char ch, String fontName); + /** + * An error occurred trying to find the font directory specified in the config file. + * @param source the event source + * @param dir the directory in the config file + */ + void fontDirectoryNotFound(Object source, String dir); } diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.java b/src/java/org/apache/fop/fonts/FontEventProducer.java index ae4294318..702d3efb6 100644 --- a/src/java/org/apache/fop/fonts/FontEventProducer.java +++ b/src/java/org/apache/fop/fonts/FontEventProducer.java @@ -71,4 +71,12 @@ public interface FontEventProducer extends EventProducer { */ void glyphNotAvailable(Object source, char ch, String fontName); + /** + * An error occurred trying to find the font directory specified in the config file. + * @param source the event sourece + * @param dir the directory in the config file + * @event.severity WARN + */ + void fontDirectoryNotFound(Object source, String dir); + } diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.xml b/src/java/org/apache/fop/fonts/FontEventProducer.xml index 6ea587036..27fd587b1 100644 --- a/src/java/org/apache/fop/fonts/FontEventProducer.xml +++ b/src/java/org/apache/fop/fonts/FontEventProducer.xml @@ -20,4 +20,5 @@ Font "{requested}" not found. Substituting with "{effective}". Unable to load font file: {fontURL}.[ Reason: {e}] Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}". + '{dir}' does not exist or is not a directory. diff --git a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java index 67bb2e295..1f1116990 100644 --- a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java +++ b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java @@ -33,6 +33,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.apps.FOPException; import org.apache.fop.fonts.autodetect.FontFileFinder; import org.apache.fop.fonts.autodetect.FontInfoFinder; @@ -88,7 +89,8 @@ public class FontInfoConfigurator { // native o/s search (autodetect) configuration boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null); if (autodetectFonts) { - FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict); + FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict, + listener); fontDetector.detect(fontInfoList); } @@ -139,7 +141,7 @@ public class FontInfoConfigurator { } // add fonts found in directory - FontFileFinder fontFileFinder = new FontFileFinder(recursive ? -1 : 1); + FontFileFinder fontFileFinder = new FontFileFinder(recursive ? -1 : 1, listener); List fontURLList; try { fontURLList = fontFileFinder.find(directory); diff --git a/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java b/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java index 9a0a73e2f..3c1a94f63 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java +++ b/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java @@ -34,6 +34,8 @@ import org.apache.commons.io.filefilter.WildcardFileFilter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.fop.fonts.FontEventListener; + /** * Helps to autodetect/locate available operating system fonts. */ @@ -44,20 +46,24 @@ public class FontFileFinder extends DirectoryWalker implements FontFinder { /** default depth limit of recursion when searching for font files **/ public static final int DEFAULT_DEPTH_LIMIT = -1; + private final FontEventListener eventListener; /** * Default constructor + * @param listener for throwing font related events */ - public FontFileFinder() { - super(getDirectoryFilter(), getFileFilter(), DEFAULT_DEPTH_LIMIT); + public FontFileFinder(FontEventListener listener) { + this(DEFAULT_DEPTH_LIMIT, listener); } /** * Constructor * @param depthLimit recursion depth limit + * @param listener for throwing font related events */ - public FontFileFinder(int depthLimit) { + public FontFileFinder(int depthLimit, FontEventListener listener) { super(getDirectoryFilter(), getFileFilter(), depthLimit); + eventListener = listener; } /** @@ -163,6 +169,12 @@ public class FontFileFinder extends DirectoryWalker implements FontFinder { public List find(String dir) throws IOException { List results = new java.util.ArrayList(); super.walk(new File(dir), results); + File directory = new File(dir); + if (!directory.isDirectory()) { + eventListener.fontDirectoryNotFound(this, dir); + } else { + super.walk(directory, results); + } return results; } } diff --git a/src/java/org/apache/fop/tools/fontlist/FontListMain.java b/src/java/org/apache/fop/tools/fontlist/FontListMain.java index d31da92c2..92c2acffd 100644 --- a/src/java/org/apache/fop/tools/fontlist/FontListMain.java +++ b/src/java/org/apache/fop/tools/fontlist/FontListMain.java @@ -143,6 +143,10 @@ public final class FontListMain { //ignore } + public void fontDirectoryNotFound(Object source, String msg) { + //ignore + } + }; FontListGenerator listGenerator = new FontListGenerator(); diff --git a/status.xml b/status.xml index 4d8fc1455..e9c708f63 100644 --- a/status.xml +++ b/status.xml @@ -60,6 +60,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Added to build file JUnit target that uses a regex to run all of the test cases. This + reduces the risk that some of them are omitted when building FOP. + Allow JPEG images to be embedded in an AFP document as is, without being decoded and encoded. diff --git a/test/java/org/apache/fop/AbstractBasicTranscoderTestCase.java b/test/java/org/apache/fop/AbstractBasicTranscoderTest.java similarity index 96% rename from test/java/org/apache/fop/AbstractBasicTranscoderTestCase.java rename to test/java/org/apache/fop/AbstractBasicTranscoderTest.java index e249a8a23..f046ee615 100644 --- a/test/java/org/apache/fop/AbstractBasicTranscoderTestCase.java +++ b/test/java/org/apache/fop/AbstractBasicTranscoderTest.java @@ -34,7 +34,7 @@ import org.junit.Test; * Basic runtime test for FOP's transcoders. It is used to verify that * nothing obvious is broken after compiling. */ -public abstract class AbstractBasicTranscoderTestCase extends AbstractFOPTestCase { +public abstract class AbstractBasicTranscoderTest extends AbstractFOPTest { /** * Creates the transcoder to test. diff --git a/test/java/org/apache/fop/AbstractFOPTestCase.java b/test/java/org/apache/fop/AbstractFOPTest.java similarity index 82% rename from test/java/org/apache/fop/AbstractFOPTestCase.java rename to test/java/org/apache/fop/AbstractFOPTest.java index 58108a036..eac140d31 100644 --- a/test/java/org/apache/fop/AbstractFOPTestCase.java +++ b/test/java/org/apache/fop/AbstractFOPTest.java @@ -24,19 +24,14 @@ import java.io.File; /** * Abstract base test class for FOP's tests. */ -public abstract class AbstractFOPTestCase { +public abstract class AbstractFOPTest { /** * Returns the base directory to use for the tests. * @return the base directory */ protected static File getBaseDir() { - String basedir = System.getProperty("basedir"); - if (basedir != null) { - return new File(basedir); - } else { - return new File("."); - } + return new File("."); } } diff --git a/test/java/org/apache/fop/BasicDriverTestCase.java b/test/java/org/apache/fop/BasicDriverTestCase.java index f02debd1d..2fc23edfd 100644 --- a/test/java/org/apache/fop/BasicDriverTestCase.java +++ b/test/java/org/apache/fop/BasicDriverTestCase.java @@ -42,7 +42,7 @@ import org.junit.Test; * Basic runtime test for the old Fop class. It is used to verify that * nothing obvious is broken after compiling. */ -public class BasicDriverTestCase extends AbstractFOPTestCase { +public class BasicDriverTestCase extends AbstractFOPTest { private FopFactory fopFactory = FopFactory.newInstance(); diff --git a/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java b/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java index 61fbdb5a4..de35db94e 100644 --- a/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java +++ b/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java @@ -26,7 +26,7 @@ import org.apache.fop.svg.PDFTranscoder; * Basic runtime test for the PDF transcoder. It is used to verify that * nothing obvious is broken after compiling. */ -public class BasicPDFTranscoderTestCase extends AbstractBasicTranscoderTestCase { +public class BasicPDFTranscoderTestCase extends AbstractBasicTranscoderTest { @Override protected Transcoder createTranscoder() { diff --git a/test/java/org/apache/fop/BasicPSTranscoderTestCase.java b/test/java/org/apache/fop/BasicPSTranscoderTestCase.java index 40429a44f..f2f233a5a 100644 --- a/test/java/org/apache/fop/BasicPSTranscoderTestCase.java +++ b/test/java/org/apache/fop/BasicPSTranscoderTestCase.java @@ -26,7 +26,7 @@ import org.apache.fop.render.ps.PSTranscoder; * Basic runtime test for the PS transcoder. It is used to verify that * nothing obvious is broken after compiling. */ -public class BasicPSTranscoderTestCase extends AbstractBasicTranscoderTestCase { +public class BasicPSTranscoderTestCase extends AbstractBasicTranscoderTest { @Override protected Transcoder createTranscoder() { diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java index 26fa296a7..e69de29bb 100644 --- a/test/java/org/apache/fop/GenericFOPTestCase.java +++ b/test/java/org/apache/fop/GenericFOPTestCase.java @@ -1,129 +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; -import static org.junit.Assert.fail; - -import java.io.ByteArrayOutputStream; -import java.io.StringReader; -import java.security.DigestOutputStream; -import java.security.MessageDigest; -import java.util.Date; - -import javax.xml.parsers.SAXParserFactory; - -import org.junit.Before; -import org.junit.Test; -import org.xml.sax.InputSource; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Fop; -import org.apache.fop.apps.FopFactory; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.util.DigestFilter; - -/** - * Framework for simple regression testing. - * The testcase reads a control XML file which specifies a FO source, - * a MD5 for the source to help diferentiating failures caused by causal - * source modification from failures caused by regression, a renderer (only - * PDF currently supported) and a MD5 for the result. - * - */ -public final class GenericFOPTestCase { - - // configure fopFactory as desired - private FopFactory fopFactory = FopFactory.newInstance(); - - private SAXParserFactory parserFactory; - - @Before - public void setUp() throws Exception { - parserFactory = SAXParserFactory.newInstance(); - parserFactory.setNamespaceAware(true); - } - - @org.junit.Test - public void testSimple() throws Exception { - final String digestIn = "17bf13298796065f7775db8707133aeb"; - final String digestOut = "e2761f51152f6663911e567901596707"; - final String fo - = "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " This is a blind text." - + " " - + " " - + ""; - renderPDF(fo, digestIn, digestOut); - } - - private String digestToString(byte[] value) { - StringBuffer buffer = new StringBuffer(2 * value.length); - for (int i = 0; i < value.length; i++) { - int val = value[i]; - int hi = (val >> 4) & 0xF; - int lo = val & 0xF; - if (hi < 10) { - buffer.append((char) (hi + 0x30)); - } else { - buffer.append((char) (hi + 0x61 - 10)); - } - if (lo < 10) { - buffer.append((char) (lo + 0x30)); - } else { - buffer.append((char) (lo + 0x61 - 10)); - } - } - return buffer.toString(); - } - - private void renderPDF(String fo, String digestIn, String digestOut) - throws Exception { - FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); - foUserAgent.setCreationDate(new Date(10000)); - MessageDigest outDigest = MessageDigest.getInstance("MD5"); - DigestOutputStream out = new DigestOutputStream(new ByteArrayOutputStream(), outDigest); - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); - InputSource source = new InputSource(new StringReader(fo)); - DigestFilter filter = new DigestFilter("MD5"); - filter.setParent(parserFactory.newSAXParser().getXMLReader()); - filter.setContentHandler(fop.getDefaultHandler()); - filter.parse(source); - String digestInActual = digestToString(filter.getDigestValue()); - if (!digestIn.equals(digestInActual)) { - fail("input MD5: was " + digestInActual + ", expected " + digestIn); - } - String digestOutActual = digestToString(outDigest.digest()); - if (!digestOut.equals(digestOutActual)) { - fail( - "output MD5: was " - + digestOutActual - + ", expected " - + digestOut); - } - } - -} diff --git a/test/java/org/apache/fop/StandardTestSuite.java b/test/java/org/apache/fop/StandardTestSuite.java index 1dacd9614..e6800b3c4 100644 --- a/test/java/org/apache/fop/StandardTestSuite.java +++ b/test/java/org/apache/fop/StandardTestSuite.java @@ -23,16 +23,16 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.fop.afp.fonts.CharactersetEncoderTest; +import org.apache.fop.afp.fonts.CharactersetEncoderTestCase; import org.apache.fop.afp.parser.MODCAParserTestCase; import org.apache.fop.area.ViewportTestSuite; -import org.apache.fop.fonts.DejaVuLGCSerifTest; +import org.apache.fop.fonts.DejaVuLGCSerifTestCase; import org.apache.fop.fonts.truetype.GlyfTableTestCase; import org.apache.fop.image.loader.batik.ImageLoaderTestCase; import org.apache.fop.image.loader.batik.ImagePreloaderTestCase; import org.apache.fop.intermediate.IFMimickingTestCase; -import org.apache.fop.render.extensions.prepress.PageBoundariesTest; -import org.apache.fop.render.extensions.prepress.PageScaleTest; +import org.apache.fop.render.extensions.prepress.PageBoundariesTestCase; +import org.apache.fop.render.extensions.prepress.PageScaleTestCase; import org.apache.fop.render.pdf.PDFAConformanceTestCase; import org.apache.fop.render.pdf.PDFCMapTestCase; import org.apache.fop.render.pdf.PDFEncodingTestCase; @@ -40,7 +40,7 @@ import org.apache.fop.render.pdf.PDFsRGBSettingsTestCase; import org.apache.fop.render.pdf.RenderPDFTestSuite; import org.apache.fop.render.ps.PSTestSuite; import org.apache.fop.render.rtf.RichTextFormatTestSuite; -import org.apache.fop.traits.MinOptMaxTest; +import org.apache.fop.traits.MinOptMaxTestCase; /** * Test suite for basic functionality of FOP. @@ -53,22 +53,22 @@ import org.apache.fop.traits.MinOptMaxTest; PDFEncodingTestCase.class, PDFCMapTestCase.class, PDFsRGBSettingsTestCase.class, - DejaVuLGCSerifTest.class, + DejaVuLGCSerifTestCase.class, RichTextFormatTestSuite.class, ImageLoaderTestCase.class, ImagePreloaderTestCase.class, IFMimickingTestCase.class, - PageBoundariesTest.class, - PageScaleTest.class, + PageBoundariesTestCase.class, + PageScaleTestCase.class, org.apache.fop.afp.AFPTestSuite.class, GlyfTableTestCase.class, ViewportTestSuite.class, RenderPDFTestSuite.class, MODCAParserTestCase.class, - CharactersetEncoderTest.class, + CharactersetEncoderTestCase.class, org.apache.fop.render.afp.AFPTestSuite.class, PSTestSuite.class, - MinOptMaxTest.class + MinOptMaxTestCase.class }) public class StandardTestSuite { } diff --git a/test/java/org/apache/fop/URIResolutionTestCase.java b/test/java/org/apache/fop/URIResolutionTestCase.java index 16968e1b7..97d1c9c25 100644 --- a/test/java/org/apache/fop/URIResolutionTestCase.java +++ b/test/java/org/apache/fop/URIResolutionTestCase.java @@ -56,7 +56,7 @@ import org.w3c.dom.Document; /** * Tests URI resolution facilities. */ -public class URIResolutionTestCase extends AbstractFOPTestCase { +public class URIResolutionTestCase extends AbstractFOPTest { // configure fopFactory as desired private FopFactory fopFactory = FopFactory.newInstance(); diff --git a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTest.java b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java similarity index 99% rename from test/java/org/apache/fop/afp/fonts/CharactersetEncoderTest.java rename to test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java index 3b5c945d8..dd776e41c 100644 --- a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTest.java +++ b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java @@ -33,7 +33,7 @@ import org.junit.Test; /** * Test {@link CharactersetEncoder} */ -public class CharactersetEncoderTest { +public class CharactersetEncoderTestCase { private CharactersetEncoder singlebyteEncoder; private CharactersetEncoder doublebyteEncoder; diff --git a/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTestCase.java b/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java similarity index 98% rename from test/java/org/apache/fop/afp/modca/AbstractAFPObjectTestCase.java rename to test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java index b987a13f7..451616ad9 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTestCase.java +++ b/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java @@ -36,7 +36,7 @@ import org.junit.Test; /** * Tests the {@link AbstractAFPObject} class. */ -public abstract class AbstractAFPObjectTestCase { +public abstract class AbstractAFPObjectTest { private S sut; diff --git a/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTestCase.java b/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java similarity index 93% rename from test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTestCase.java rename to test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java index 4b03b87d8..5c863b6e4 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTestCase.java +++ b/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java @@ -28,8 +28,8 @@ import org.junit.Test; /** * Tests the {@linkplain AbstractAFPObject} class. */ -public abstract class AbstractNamedAFPObjectTestCase - extends AbstractAFPObjectTestCase { +public abstract class AbstractNamedAFPObjectTest + extends AbstractAFPObjectTest { @Test public void testCopySF() { diff --git a/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTestCase.java b/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java similarity index 93% rename from test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTestCase.java rename to test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java index e5bf70c7a..faef0a4f6 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTestCase.java +++ b/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java @@ -21,7 +21,7 @@ package org.apache.fop.afp.modca; import java.io.IOException; -public abstract class AbstractStructuredObjectTestCase extends AbstractAFPObjectTestCase { +public abstract class AbstractStructuredObjectTest extends AbstractAFPObjectTest { /** * Test writeStart() - test that the contract is maintained with diff --git a/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTestCase.java b/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java similarity index 96% rename from test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTestCase.java rename to test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java index f43eb0646..10c154550 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTestCase.java +++ b/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java @@ -30,18 +30,20 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.junit.Before; +import org.junit.Test; + import org.apache.fop.afp.modca.triplets.AbstractTriplet; import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; import org.apache.fop.afp.modca.triplets.CommentTriplet; import org.apache.fop.afp.modca.triplets.ObjectAreaSizeTriplet; import org.apache.fop.afp.modca.triplets.Triplet; -import org.junit.Before; /** * Test {@link AbstractTripletStructuredObject} */ -public abstract class AbstractTripletStructuredObjectTestCase - extends AbstractStructuredObjectTestCase { +public class AbstractTripletStructuredObjectTest + extends AbstractStructuredObjectTest { private static final List TRIPLETS; @@ -136,6 +138,7 @@ public abstract class AbstractTripletStructuredObjectTestCase expectedList = TRIPLETS; @@ -154,4 +157,4 @@ public abstract class AbstractTripletStructuredObjectTestCase { +public class IncludeObjectTestCase extends AbstractNamedAFPObjectTest { @Before public void setUp() throws Exception { diff --git a/test/java/org/apache/fop/area/BlockViewportTestCase.java b/test/java/org/apache/fop/area/BlockViewportTestCase.java index 8cca4b244..f825fdda5 100644 --- a/test/java/org/apache/fop/area/BlockViewportTestCase.java +++ b/test/java/org/apache/fop/area/BlockViewportTestCase.java @@ -24,7 +24,7 @@ import org.junit.Test; /** * Tests the {@linkplain BlockViewport} class. */ -public class BlockViewportTestCase extends ViewportTestCase { +public class BlockViewportTestCase extends ViewportTest { @Test public void testNonClip() throws Exception { diff --git a/test/java/org/apache/fop/area/RegionViewportTestCase.java b/test/java/org/apache/fop/area/RegionViewportTestCase.java index e6cd8fe36..638126efb 100644 --- a/test/java/org/apache/fop/area/RegionViewportTestCase.java +++ b/test/java/org/apache/fop/area/RegionViewportTestCase.java @@ -27,7 +27,7 @@ import org.junit.Test; /** * Tests the {@linkplain RegionViewport} class. */ -public class RegionViewportTestCase extends ViewportTestCase { +public class RegionViewportTestCase extends ViewportTest { private RegionViewport createRegionViewport(int x, int y, int ipd, int bpd) { Rectangle2D v = new Rectangle(x, y, ipd, bpd); diff --git a/test/java/org/apache/fop/area/ViewportTestCase.java b/test/java/org/apache/fop/area/ViewportTest.java similarity index 97% rename from test/java/org/apache/fop/area/ViewportTestCase.java rename to test/java/org/apache/fop/area/ViewportTest.java index d09b327b9..cb2282071 100644 --- a/test/java/org/apache/fop/area/ViewportTestCase.java +++ b/test/java/org/apache/fop/area/ViewportTest.java @@ -29,7 +29,7 @@ import java.awt.Rectangle; /** * Tests implementations of the {@linkplain Viewport} interface. */ -public abstract class ViewportTestCase { +public abstract class ViewportTest { protected void checkNonClip(Viewport v) throws Exception { assertFalse(v.hasClip()); diff --git a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java index d6d6c395e..edcf99d14 100644 --- a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java +++ b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java @@ -19,13 +19,13 @@ package org.apache.fop.area.inline; -import org.apache.fop.area.ViewportTestCase; +import org.apache.fop.area.ViewportTest; import org.junit.Test; /** * Tests the {@linkplain InlineViewport} class. */ -public class InlineViewportTestCase extends ViewportTestCase { +public class InlineViewportTestCase extends ViewportTest { @Test public void testNonClip() throws Exception { diff --git a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java similarity index 93% rename from test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java rename to test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java index 3583729e9..fbcd9a441 100644 --- a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java +++ b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java @@ -26,7 +26,7 @@ import org.junit.Test; /** * Super class of several user config cases. */ -public abstract class BaseConstructiveUserConfigTestCase extends BaseUserConfigTestCase { +public abstract class BaseConstructiveUserConfigTest extends BaseUserConfigTest { /** * Test using a standard FOP font diff --git a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java similarity index 94% rename from test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java rename to test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java index 2ea259e78..eb8d202c3 100644 --- a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java +++ b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java @@ -27,7 +27,7 @@ import org.junit.Test; /** * Super class for several user configuration failure cases. */ -public abstract class BaseDestructiveUserConfigTestCase extends BaseUserConfigTestCase { +public abstract class BaseDestructiveUserConfigTest extends BaseUserConfigTest { /** * Test the user configuration failure. diff --git a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseUserConfigTest.java similarity index 93% rename from test/java/org/apache/fop/config/BaseUserConfigTestCase.java rename to test/java/org/apache/fop/config/BaseUserConfigTest.java index ad884782d..645aea536 100644 --- a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java +++ b/test/java/org/apache/fop/config/BaseUserConfigTest.java @@ -29,23 +29,23 @@ 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.BasePDFTestCase; +import org.apache.fop.render.pdf.BasePDFTest; import org.xml.sax.SAXException; /** * Basic runtime test for FOP's font configuration. It is used to verify that * nothing obvious is broken after compiling. */ -public abstract class BaseUserConfigTestCase extends BasePDFTestCase { +public abstract class BaseUserConfigTest extends BasePDFTest { protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); /** logging instance */ - protected Log log = LogFactory.getLog(BaseUserConfigTestCase.class); + protected Log log = LogFactory.getLog(BaseUserConfigTest.class); /** - * @see org.apache.fop.render.pdf.BasePDFTestCase#init() + * @see org.apache.fop.render.pdf.BasePDFTest#init() */ protected void init() { // do nothing diff --git a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java index fe14a9928..7e17291d6 100644 --- a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java +++ b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font is without a metrics-url or an embed-url */ -public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTestCase { +public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontBaseBadTestCase.java b/test/java/org/apache/fop/config/FontBaseBadTestCase.java index bffda3055..eb49ca9fe 100644 --- a/test/java/org/apache/fop/config/FontBaseBadTestCase.java +++ b/test/java/org/apache/fop/config/FontBaseBadTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * This font base does not exist and a relative font path is used. */ -public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase { +public class FontBaseBadTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java index 1640024fb..9e341f8b4 100644 --- a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java +++ b/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font has an embed-url that does not exist on filesystem. */ -public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTestCase { +public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java index b45df16bc..e3f0a6a88 100644 --- a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java +++ b/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font has a malformed embed-url */ -public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase { +public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java index c22cd3eb2..352d43920 100644 --- a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java +++ b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font has a metrics-url that does not exist on filesystem */ -public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTestCase { +public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java index 27853adf9..ddf3ee8a6 100644 --- a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java +++ b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font has a malformed metrics-url */ -public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase { +public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java index 186dd85df..8aa2acb81 100644 --- a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java +++ b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * this font has a missing font triplet attribute */ -public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTestCase { +public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java index c435a08cf..cf9d19f99 100644 --- a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java +++ b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java @@ -19,7 +19,7 @@ package org.apache.fop.config; -public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTestCase { +public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest { @Override public String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java index c19c161a3..e69de29bb 100644 --- a/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java +++ b/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java @@ -1,36 +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 metrics-url that does not exist on filesystem - */ -public class FontsDirectoryBadTestCase extends BaseDestructiveUserConfigTestCase { - - @Override - public String getUserConfigFilename() { - return "test_fonts_directory_bad.xconf"; - } - - @Override - protected String getFontFOFilePath() { - return "test/xml/bugtests/font-dir.fo"; - } -} diff --git a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java index 7eec1cab6..3817e7966 100644 --- a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java +++ b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java @@ -22,7 +22,7 @@ package org.apache.fop.config; /** * tests font directory on system */ -public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTestCase { +public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTest { @Override protected String getUserConfigFilename() { diff --git a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java index 7ae576e9b..0918d5867 100644 --- a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java +++ b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java @@ -36,7 +36,7 @@ import org.apache.fop.render.PrintRenderer; * Tests the font substitution mechanism */ public class FontsSubstitutionTestCase extends - BaseConstructiveUserConfigTestCase { + BaseConstructiveUserConfigTest { @Override protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile) diff --git a/test/java/org/apache/fop/config/UserConfigTestSuite.java b/test/java/org/apache/fop/config/UserConfigTestSuite.java index d90efe37b..374d41fab 100644 --- a/test/java/org/apache/fop/config/UserConfigTestSuite.java +++ b/test/java/org/apache/fop/config/UserConfigTestSuite.java @@ -34,7 +34,6 @@ import org.junit.runners.Suite.SuiteClasses; FontMetricsUrlBadTestCase.class, FontEmbedUrlBadTestCase.class, FontMetricsUrlMalformedTestCase.class, - FontMetricsUrlMalformedTestCase.class, FontsDirectoryRecursiveTestCase.class, FontsAutoDetectTestCase.class, FontsSubstitutionTestCase.class, diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java index 85193c01b..dac67a8cc 100644 --- a/test/java/org/apache/fop/events/EventChecker.java +++ b/test/java/org/apache/fop/events/EventChecker.java @@ -36,11 +36,9 @@ class EventChecker implements EventListener { public void processEvent(Event event) { // Always create the message to make sure there is no error in the formatting process - String msg = EventFormatter.format(event); - if (event.getEventID().equals(expectedEventID)) { + String id = event.getEventID(); + if (id.equals(expectedEventID)) { eventReceived = true; - } else { - fail("Unexpected event: id = " + event.getEventID() + ": " + msg); } } diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java index 9660e5b79..16adbfbac 100644 --- a/test/java/org/apache/fop/events/EventProcessingTestCase.java +++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -20,6 +20,7 @@ package org.apache.fop.events; import java.io.File; +import java.io.IOException; import javax.xml.transform.Result; import javax.xml.transform.Source; @@ -29,9 +30,16 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; +import org.junit.Test; +import org.xml.sax.SAXException; + import org.apache.commons.io.output.NullOutputStream; + +import org.apache.xmlgraphics.util.MimeConstants; + import org.apache.fop.ResourceEventProducer; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.area.AreaEventProducer; @@ -40,8 +48,6 @@ import org.apache.fop.fo.flow.table.TableEventProducer; import org.apache.fop.fonts.FontEventProducer; import org.apache.fop.layoutmgr.BlockLevelEventProducer; import org.apache.fop.layoutmgr.inline.InlineLevelEventProducer; -import org.apache.xmlgraphics.util.MimeConstants; -import org.junit.Test; /** * Tests that the event notification system runs smoothly. @@ -52,68 +58,77 @@ public class EventProcessingTestCase { private final TransformerFactory tFactory = TransformerFactory.newInstance(); - private final File basedir; - - public EventProcessingTestCase() { - String base = System.getProperty("basedir"); - if (base != null) { - basedir = new File(base); - } else { - basedir = new File("."); - } - } - - private void doTest(String filename, String expectedEventID) - throws FOPException, TransformerException { - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, new NullOutputStream()); + private void doTest(String filename, String fopConf, String expectedEventID) + throws FOPException, TransformerException, IOException, SAXException { EventChecker eventChecker = new EventChecker(expectedEventID); - fop.getUserAgent().getEventBroadcaster().addEventListener(eventChecker); + if (fopConf != null) { + fopFactory.setUserConfig(fopConf); + } + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.getEventBroadcaster().addEventListener(eventChecker); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream()); Transformer transformer = tFactory.newTransformer(); - Source src = new StreamSource(new File(basedir, filename)); + Source src = new StreamSource(new File("test/events/" + filename)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); eventChecker.end(); } + private void doTest(String filename, String expectedEventID) throws + FOPException, TransformerException, IOException, SAXException { + doTest(filename, null, expectedEventID); + } + @Test - public void testArea() throws FOPException, TransformerException { + public void testArea() throws TransformerException, IOException, SAXException { doTest("area.fo", AreaEventProducer.class.getName() + ".unresolvedIDReferenceOnPage"); } @Test - public void testResource() throws FOPException, TransformerException { + public void testResource() throws FOPException, TransformerException, IOException, + SAXException { doTest("resource.fo", ResourceEventProducer.class.getName() + ".imageNotFound"); } @Test - public void testValidation() throws FOPException, TransformerException { + public void testValidation() throws FOPException, TransformerException, IOException, + SAXException { doTest("validation.fo", FOValidationEventProducer.class.getName() + ".invalidPropertyValue"); } @Test - public void testTable() throws FOPException, TransformerException { + public void testTable() throws FOPException, TransformerException, IOException, SAXException { doTest("table.fo", TableEventProducer.class.getName() + ".noTablePaddingWithCollapsingBorderModel"); } @Test - public void testBlockLevel() throws FOPException, TransformerException { + public void testBlockLevel() throws FOPException, TransformerException, IOException, + SAXException { doTest("block-level.fo", BlockLevelEventProducer.class.getName() + ".overconstrainedAdjustEndIndent"); } @Test - public void testInlineLevel() throws FOPException, TransformerException { + public void testInlineLevel() throws FOPException, TransformerException, IOException, + SAXException { doTest("inline-level.fo", InlineLevelEventProducer.class.getName() + ".lineOverflows"); } @Test - public void testFont() throws FOPException, TransformerException { + public void testFont() throws FOPException, TransformerException, IOException, SAXException { doTest("font.fo", FontEventProducer.class.getName() + ".fontSubstituted"); } + + @Test + public void testFontWithBadDirectory() throws FOPException, TransformerException, IOException, + SAXException { + doTest("font.fo", "test/config/test_fonts_directory_bad.xconf", + FontEventProducer.class.getName() + ".fontDirectoryNotFound"); + } } diff --git a/test/java/org/apache/fop/fo/flow/table/AbstractTableTestCase.java b/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java similarity index 93% rename from test/java/org/apache/fop/fo/flow/table/AbstractTableTestCase.java rename to test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java index 90d89d702..69bbc8d8c 100644 --- a/test/java/org/apache/fop/fo/flow/table/AbstractTableTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java @@ -28,13 +28,13 @@ import org.apache.fop.fotreetest.FOTreeUnitTester; /** * Superclass for testcases related to tables, factoring the common stuff. */ -abstract class AbstractTableTestCase extends FOTreeUnitTester { +abstract class AbstractTableTest extends FOTreeUnitTester { private FOTreeUnitTester.FOEventHandlerFactory tableHandlerFactory; private TableHandler tableHandler; - public AbstractTableTestCase() throws Exception { + public AbstractTableTest() throws Exception { super(); tableHandlerFactory = new FOEventHandlerFactory() { public FOEventHandler createFOEventHandler(FOUserAgent foUserAgent) { diff --git a/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java b/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java index 7501c1b9a..0c567b976 100644 --- a/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java @@ -35,7 +35,7 @@ import org.junit.Test; * conditionality into account. The resolved borders are generated by the * collapsed-conditional-borders_test-generator.py Python script. */ -public class CollapsedConditionalBorderTestCase extends AbstractTableTestCase { +public class CollapsedConditionalBorderTestCase extends AbstractTableTest { private final Integer border0pt = new Integer(0); diff --git a/test/java/org/apache/fop/fo/flow/table/ErrorCheckTestCase.java b/test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java similarity index 91% rename from test/java/org/apache/fop/fo/flow/table/ErrorCheckTestCase.java rename to test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java index a3a6b9e71..724259a75 100644 --- a/test/java/org/apache/fop/fo/flow/table/ErrorCheckTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java @@ -26,9 +26,9 @@ import org.apache.fop.fo.ValidationException; /** * Abstract class for testing erroneous files, checking that a ValidationException is thrown. */ -abstract class ErrorCheckTestCase extends AbstractTableTestCase { +abstract class ErrorCheckTest extends AbstractTableTest { - public ErrorCheckTestCase() throws Exception { + public ErrorCheckTest() throws Exception { super(); } diff --git a/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java b/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java index 5473f098a..024e15c2e 100644 --- a/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java @@ -25,7 +25,7 @@ import org.junit.Test; * Testcase checking that cells spanning further than their parent element aren't * accepted. */ -public class IllegalRowSpanTestCase extends ErrorCheckTestCase { +public class IllegalRowSpanTestCase extends ErrorCheckTest { public IllegalRowSpanTestCase() throws Exception { super(); diff --git a/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java b/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java index 48c25faca..3df0338ab 100644 --- a/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java @@ -33,7 +33,7 @@ import org.junit.Test; * Tests that RowGroupBuilder returns, for each part of a table, the expected number of * row-groups with the expected number or rows in each. */ -public class RowGroupBuilderTestCase extends AbstractTableTestCase { +public class RowGroupBuilderTestCase extends AbstractTableTest { public RowGroupBuilderTestCase() throws Exception { super(); diff --git a/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java b/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java index 0f24ae68c..4f7d9e054 100644 --- a/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java @@ -28,7 +28,7 @@ import org.apache.fop.fo.FObj; import org.junit.Test; -public class TableColumnColumnNumberTestCase extends AbstractTableTestCase { +public class TableColumnColumnNumberTestCase extends AbstractTableTest { /** * A percentBaseContext that mimics the behaviour of TableLM for computing the widths diff --git a/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java b/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java index 665a88759..284fd1d2f 100644 --- a/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java @@ -21,7 +21,7 @@ package org.apache.fop.fo.flow.table; import org.junit.Test; -public class TooManyColumnsTestCase extends ErrorCheckTestCase { +public class TooManyColumnsTestCase extends ErrorCheckTest { public TooManyColumnsTestCase() throws Exception { super(); diff --git a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java similarity index 97% rename from test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java rename to test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java index 013d04d13..f3767675c 100644 --- a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java +++ b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java @@ -29,14 +29,14 @@ import org.junit.Test; /** * */ -public class DejaVuLGCSerifTest { +public class DejaVuLGCSerifTestCase { private FontResolver fontResolver = FontManager.createMinimalFontResolver(); private CustomFont font; /** * sets up the testcase by loading the DejaVu Font. - * + * * @throws Exception * if the test fails. */ diff --git a/test/java/org/apache/fop/fonts/EncodingModeTest.java b/test/java/org/apache/fop/fonts/EncodingModeTestCase.java similarity index 97% rename from test/java/org/apache/fop/fonts/EncodingModeTest.java rename to test/java/org/apache/fop/fonts/EncodingModeTestCase.java index 310916a04..1ec22e1ef 100644 --- a/test/java/org/apache/fop/fonts/EncodingModeTest.java +++ b/test/java/org/apache/fop/fonts/EncodingModeTestCase.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; -public class EncodingModeTest { +public class EncodingModeTestCase { @Test public void testGetName() { diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTester.java b/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java similarity index 98% rename from test/java/org/apache/fop/fotreetest/FOTreeTester.java rename to test/java/org/apache/fop/fotreetest/FOTreeTestCase.java index 3eb7a490d..aa0cbe841 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeTester.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java @@ -49,7 +49,7 @@ import org.apache.fop.util.ConsoleEventListenerForTests; * Test driver class for FO tree tests. */ @RunWith(Parameterized.class) -public class FOTreeTester { +public class FOTreeTestCase { @BeforeClass public static void registerElementListObservers() { @@ -84,7 +84,7 @@ public class FOTreeTester { * * @param testFile the FO file to test */ - public FOTreeTester(File testFile) { + public FOTreeTestCase(File testFile) { fopFactory.addElementMapping(new TestElementMapping()); this.testFile = testFile; } diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java index 6e6f62b92..f128055ac 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java @@ -19,20 +19,25 @@ package org.apache.fop.fotreetest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + import org.apache.fop.fo.flow.table.CollapsedConditionalBorderTestCase; import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase; import org.apache.fop.fo.flow.table.RowGroupBuilderTestCase; import org.apache.fop.fo.flow.table.TableColumnColumnNumberTestCase; import org.apache.fop.fo.flow.table.TooManyColumnsTestCase; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; /** * JUnit test suit for running layout engine test under JUnit control. */ @RunWith(Suite.class) -@Suite.SuiteClasses({ TooManyColumnsTestCase.class, IllegalRowSpanTestCase.class, - RowGroupBuilderTestCase.class, TableColumnColumnNumberTestCase.class, - CollapsedConditionalBorderTestCase.class, FOTreeTester.class }) +@Suite.SuiteClasses({ + TooManyColumnsTestCase.class, + IllegalRowSpanTestCase.class, + RowGroupBuilderTestCase.class, + TableColumnColumnNumberTestCase.class, + CollapsedConditionalBorderTestCase.class, + FOTreeTestCase.class }) public final class FOTreeTestSuite { } diff --git a/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java b/test/java/org/apache/fop/intermediate/AbstractIFTest.java similarity index 97% rename from test/java/org/apache/fop/intermediate/AbstractIFTestCase.java rename to test/java/org/apache/fop/intermediate/AbstractIFTest.java index 7bdebd706..cdb7e0cf9 100644 --- a/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java +++ b/test/java/org/apache/fop/intermediate/AbstractIFTest.java @@ -48,7 +48,7 @@ import org.apache.fop.render.intermediate.IFSerializer; /** * A common super-class for intermediate format test cases. */ -abstract class AbstractIFTestCase extends AbstractIntermediateTestCase { +abstract class AbstractIFTest extends AbstractIntermediateTest { private static final Schema IF_SCHEMA; @@ -89,7 +89,7 @@ abstract class AbstractIFTestCase extends AbstractIntermediateTestCase { * @param testFile the file containing the document and the tests * @throws IOException if an I/O error occurs while loading the test case */ - public AbstractIFTestCase(File testFile) throws IOException { + public AbstractIFTest(File testFile) throws IOException { super(testFile); } diff --git a/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java b/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java similarity index 98% rename from test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java rename to test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java index 6705d7e3d..567d2adba 100644 --- a/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java +++ b/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java @@ -51,7 +51,7 @@ import org.apache.fop.util.ConsoleEventListenerForTests; /** * Abstract base class for intermediate format tests. */ -public abstract class AbstractIntermediateTestCase { +public abstract class AbstractIntermediateTest { /** the test environment */ protected static TestAssistant testAssistant = new TestAssistant(); @@ -76,7 +76,7 @@ public abstract class AbstractIntermediateTestCase { * @param testFile the test file to run * @throws IOException if an I/O error occurs while loading the test case */ - public AbstractIntermediateTestCase(File testFile) + public AbstractIntermediateTest(File testFile) throws IOException { this.testFile = testFile; } diff --git a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java index 6c06971e6..a0de2e8ab 100644 --- a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java +++ b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java @@ -53,7 +53,7 @@ import org.w3c.dom.Document; * Tests the area tree parser. */ @RunWith(Parameterized.class) -public class AreaTreeParserTestCase extends AbstractIntermediateTestCase { +public class AreaTreeParserTestCase extends AbstractIntermediateTest { /** * Creates the parameters for this test. diff --git a/test/java/org/apache/fop/intermediate/IFParserTestCase.java b/test/java/org/apache/fop/intermediate/IFParserTestCase.java index 52d322e3e..c37897dc1 100644 --- a/test/java/org/apache/fop/intermediate/IFParserTestCase.java +++ b/test/java/org/apache/fop/intermediate/IFParserTestCase.java @@ -46,7 +46,7 @@ import org.apache.fop.render.intermediate.IFSerializer; * Tests the intermediate format parser. */ @RunWith(Parameterized.class) -public class IFParserTestCase extends AbstractIFTestCase { +public class IFParserTestCase extends AbstractIFTest { /** * Gets the parameters for this test diff --git a/test/java/org/apache/fop/intermediate/IFTestCase.java b/test/java/org/apache/fop/intermediate/IFTestCase.java index a6ff171e3..562302ba4 100644 --- a/test/java/org/apache/fop/intermediate/IFTestCase.java +++ b/test/java/org/apache/fop/intermediate/IFTestCase.java @@ -43,7 +43,7 @@ import org.w3c.dom.NodeList; * Test case for the IF output. */ @RunWith(Parameterized.class) -public class IFTestCase extends AbstractIFTestCase { +public class IFTestCase extends AbstractIFTest { /** * Gets the files for this test. diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java similarity index 99% rename from test/java/org/apache/fop/layoutengine/LayoutEngineTester.java rename to test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java index 33f621f84..46908a448 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java @@ -70,7 +70,7 @@ import org.apache.fop.util.DelegatingContentHandler; * files. */ @RunWith(Parameterized.class) -public class LayoutEngineTester { +public class LayoutEngineTestCase { private static File areaTreeBackupDir; @BeforeClass @@ -108,7 +108,7 @@ public class LayoutEngineTester { * * @param testFile the test file */ - public LayoutEngineTester(File testFile) { + public LayoutEngineTestCase(File testFile) { this.ifTester = new IFTester(tfactory, areaTreeBackupDir); this.testFile = testFile; } diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java index 00a660999..2a70f255d 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * JUnit test suit for running layout engine test under JUnit control. */ @RunWith(Suite.class) -@SuiteClasses({ LayoutEngineTester.class }) +@SuiteClasses({ LayoutEngineTestCase.class }) public class LayoutEngineTestSuite { } diff --git a/test/java/org/apache/fop/render/AbstractRenderingTestCase.java b/test/java/org/apache/fop/render/AbstractRenderingTest.java similarity index 98% rename from test/java/org/apache/fop/render/AbstractRenderingTestCase.java rename to test/java/org/apache/fop/render/AbstractRenderingTest.java index 9eecfb106..1f91f5b06 100644 --- a/test/java/org/apache/fop/render/AbstractRenderingTestCase.java +++ b/test/java/org/apache/fop/render/AbstractRenderingTest.java @@ -41,7 +41,7 @@ import org.apache.fop.apps.MimeConstants; /** * Abstract base class for rendering (output) verification tests. */ -public abstract class AbstractRenderingTestCase { +public abstract class AbstractRenderingTest { private static final Map MIME_MAP = new java.util.HashMap(); diff --git a/test/java/org/apache/fop/render/RendererFactoryTest.java b/test/java/org/apache/fop/render/RendererFactoryTestCase.java similarity index 98% rename from test/java/org/apache/fop/render/RendererFactoryTest.java rename to test/java/org/apache/fop/render/RendererFactoryTestCase.java index 4f1c50986..9ca4c2545 100644 --- a/test/java/org/apache/fop/render/RendererFactoryTest.java +++ b/test/java/org/apache/fop/render/RendererFactoryTestCase.java @@ -22,7 +22,10 @@ package org.apache.fop.render; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.junit.Test; + import org.apache.commons.io.output.NullOutputStream; + import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; @@ -34,12 +37,11 @@ import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFRenderer; import org.apache.fop.render.pdf.PDFDocumentHandler; import org.apache.fop.render.rtf.RTFHandler; -import org.junit.Test; /** * Tests for {@link RendererFactory}. */ -public class RendererFactoryTest { +public class RendererFactoryTestCase { @Test public void testDocumentHandlerLevel() throws Exception { @@ -51,7 +53,6 @@ public class RendererFactoryTest { ua = fopFactory.newFOUserAgent(); handler = factory.createDocumentHandler(ua, MimeConstants.MIME_PDF); - assertTrue(handler instanceof PDFDocumentHandler); ua = fopFactory.newFOUserAgent(); overrideHandler = new PDFDocumentHandler(); diff --git a/test/java/org/apache/fop/render/afp/AbstractAFPTestCase.java b/test/java/org/apache/fop/render/afp/AbstractAFPTest.java similarity index 92% rename from test/java/org/apache/fop/render/afp/AbstractAFPTestCase.java rename to test/java/org/apache/fop/render/afp/AbstractAFPTest.java index 7f081a4d0..916c68395 100644 --- a/test/java/org/apache/fop/render/afp/AbstractAFPTestCase.java +++ b/test/java/org/apache/fop/render/afp/AbstractAFPTest.java @@ -23,12 +23,12 @@ import java.io.File; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRenderingTestCase; +import org.apache.fop.render.AbstractRenderingTest; /** * Abstract base class for AFP verification tests. */ -abstract class AbstractAFPTestCase extends AbstractRenderingTestCase { +abstract class AbstractAFPTest extends AbstractRenderingTest { /** * Renders a test file. diff --git a/test/java/org/apache/fop/render/afp/NoOperationTestCase.java b/test/java/org/apache/fop/render/afp/NoOperationTestCase.java index eadc14f48..78578a2b6 100644 --- a/test/java/org/apache/fop/render/afp/NoOperationTestCase.java +++ b/test/java/org/apache/fop/render/afp/NoOperationTestCase.java @@ -37,7 +37,7 @@ import org.junit.Test; /** * Tests generation of afp:no-operation (NOPs). */ -public class NoOperationTestCase extends AbstractAFPTestCase { +public class NoOperationTestCase extends AbstractAFPTest { /** * Tests afp:no-operation. diff --git a/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java b/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java similarity index 99% rename from test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java rename to test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java index 7ec515ece..6e48845c1 100644 --- a/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java +++ b/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java @@ -31,7 +31,7 @@ import org.junit.Test; /** * Tests for the fox:bleed, fox:crop-offset, fox:crop-box extension properties. */ -public class PageBoundariesTest { +public class PageBoundariesTestCase { private static final Dimension TEST_AREA_SIZE = new Dimension(20000, 15000); diff --git a/test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java b/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java similarity index 98% rename from test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java rename to test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java index 0908e869e..ff07e63ce 100644 --- a/test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java +++ b/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java @@ -30,7 +30,7 @@ import org.junit.Test; /** * Tests for the fox:scale extension property. */ -public class PageScaleTest { +public class PageScaleTestCase { /** 1 value is used for both x and y. */ @Test diff --git a/test/java/org/apache/fop/render/pdf/BasePDFTestCase.java b/test/java/org/apache/fop/render/pdf/BasePDFTest.java similarity index 96% rename from test/java/org/apache/fop/render/pdf/BasePDFTestCase.java rename to test/java/org/apache/fop/render/pdf/BasePDFTest.java index 256f78839..09db7538d 100644 --- a/test/java/org/apache/fop/render/pdf/BasePDFTestCase.java +++ b/test/java/org/apache/fop/render/pdf/BasePDFTest.java @@ -30,7 +30,7 @@ import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.FileUtils; import org.apache.commons.io.output.ByteArrayOutputStream; -import org.apache.fop.AbstractFOPTestCase; +import org.apache.fop.AbstractFOPTest; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; @@ -40,7 +40,7 @@ import org.xml.sax.SAXException; /** * Base class for automated tests that create PDF files */ -public class BasePDFTestCase extends AbstractFOPTestCase { +public class BasePDFTest extends AbstractFOPTest { /** the FopFactory */ protected final FopFactory fopFactory = FopFactory.newInstance(); @@ -51,7 +51,7 @@ public class BasePDFTestCase extends AbstractFOPTestCase { /** * Main constructor */ - protected BasePDFTestCase() { + protected BasePDFTest() { init(); } diff --git a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java index 67c4df280..fa6d9d89e 100644 --- a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java @@ -30,7 +30,7 @@ import org.junit.Test; /** * Tests PDF/A-1 functionality. */ -public class PDFAConformanceTestCase extends BasePDFTestCase { +public class PDFAConformanceTestCase extends BasePDFTest { private File foBaseDir = new File("test/xml/pdf-a"); private boolean dumpPDF = Boolean.getBoolean("PDFAConformanceTestCase.dumpPDF"); diff --git a/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java b/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java index b385e5598..122c23967 100644 --- a/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java @@ -31,7 +31,7 @@ import org.junit.Ignore; import org.junit.Test; /** Test that characters are correctly encoded in a generated PDF file */ -public class PDFEncodingTestCase extends BasePDFTestCase { +public class PDFEncodingTestCase extends BasePDFTest { private File foBaseDir = new File("test/xml/pdf-encoding"); private final boolean dumpPDF = Boolean.getBoolean("PDFEncodingTestCase.dumpPDF"); static final String INPUT_FILE = "test/xml/pdf-encoding/pdf-encoding-test.xconf"; diff --git a/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java b/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java index 6818537a8..dd67e97fa 100644 --- a/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java @@ -29,7 +29,7 @@ import org.junit.Test; /** * Tests the disables-srgb-colorspace setting. */ -public class PDFsRGBSettingsTestCase extends BasePDFTestCase { +public class PDFsRGBSettingsTestCase extends BasePDFTest { private File foBaseDir = new File("test/xml/pdf-a"); diff --git a/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java b/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java similarity index 95% rename from test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java rename to test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java index cdd1ee567..dcbc2d757 100644 --- a/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java +++ b/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java @@ -33,12 +33,12 @@ import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRenderingTestCase; +import org.apache.fop.render.AbstractRenderingTest; /** * Abstract base class for PostScript verification tests. */ -public abstract class AbstractPostScriptTestCase extends AbstractRenderingTestCase { +public abstract class AbstractPostScriptTest extends AbstractRenderingTest { /** * Renders a test file. diff --git a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java index f4c3617e3..416372187 100644 --- a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java +++ b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -25,9 +25,10 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import org.junit.Test; + import org.apache.commons.io.IOUtils; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.render.intermediate.IFContext; + import org.apache.xmlgraphics.ps.DSCConstants; import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.dsc.DSCException; @@ -36,12 +37,14 @@ import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentTitle; import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; -import org.junit.Test; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.render.intermediate.IFContext; /** * Tests the image handling in PostScript output. */ -public class ImageHandlingTestCase extends AbstractPostScriptTestCase { +public class ImageHandlingTestCase extends AbstractPostScriptTest { /** * Tests JPEG handling. @@ -71,7 +74,8 @@ public class ImageHandlingTestCase extends AbstractPostScriptTestCase { ua.setDocumentHandlerOverride(handler); // Prepare output file - File outputFile = renderFile(ua, "ps-jpeg-image.fo", "-if-l" + psUtil.getLanguageLevel()); + File outputFile = renderFile(ua, "ps-jpeg-image.fo", + "-if-l" + psUtil.getLanguageLevel()); verifyPostScriptFile(outputFile, psUtil.getLanguageLevel()); } diff --git a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java index 91787aca1..e4cb743b4 100644 --- a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java +++ b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java @@ -31,9 +31,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.Set; +import org.junit.Test; + import org.apache.commons.io.IOUtils; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.render.intermediate.IFContext; + import org.apache.xmlgraphics.ps.DSCConstants; import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.dsc.DSCException; @@ -49,13 +50,15 @@ import org.apache.xmlgraphics.ps.dsc.events.DSCCommentEndOfFile; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentIncludeResource; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; -import org.junit.Test; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.render.intermediate.IFContext; /** * Tests the PostScript resource optimization (selective de-duplication of * images that are used multiple times). */ -public class ResourceOptimizationTestCase extends AbstractPostScriptTestCase { +public class ResourceOptimizationTestCase extends AbstractPostScriptTest { /** * Tests resource optimization. diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java similarity index 99% rename from test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java rename to test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java index 97ac470e3..42ca8dee6 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java @@ -27,7 +27,7 @@ import org.junit.Test; /** * JUnit test case for the LineBreakStatus class */ -public class LineBreakStatusTest { +public class LineBreakStatusTestCase { /* * These symbols are used to indicate the break action returned diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java similarity index 97% rename from test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java rename to test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java index 9c5b0d8c6..015c1846f 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java @@ -28,7 +28,7 @@ import org.junit.Test; * * */ -public class LineBreakUtilsTest { +public class LineBreakUtilsTestCase { @Test public void testLineBreakProperty() { @@ -61,7 +61,7 @@ public class LineBreakUtilsTest { LineBreakUtils.getLineBreakPairProperty( LineBreakUtils.LINE_BREAK_PROPERTY_AL, LineBreakUtils.LINE_BREAK_PROPERTY_OP), - LineBreakUtils.DIRECT_BREAK); + LineBreakUtils.INDIRECT_BREAK); assertEquals( LineBreakUtils.getLineBreakPairProperty( LineBreakUtils.LINE_BREAK_PROPERTY_LF, diff --git a/test/java/org/apache/fop/traits/MinOptMaxTest.java b/test/java/org/apache/fop/traits/MinOptMaxTestCase.java similarity index 99% rename from test/java/org/apache/fop/traits/MinOptMaxTest.java rename to test/java/org/apache/fop/traits/MinOptMaxTestCase.java index 9e08a63cb..73465fdcc 100644 --- a/test/java/org/apache/fop/traits/MinOptMaxTest.java +++ b/test/java/org/apache/fop/traits/MinOptMaxTestCase.java @@ -27,9 +27,9 @@ import static org.junit.Assert.fail; import org.junit.Test; /** - * Tests the {@link MinOptMaxTest} class. + * Tests the {@link MinOptMax} class. */ -public class MinOptMaxTest { +public class MinOptMaxTestCase { /** * Tests that the constant MinOptMax.ZERO is really zero. -- 2.39.5