Browse Source

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
pull/18/head
Vincent Hennebert 12 years ago
parent
commit
8fc0b589b5
79 changed files with 259 additions and 373 deletions
  1. 37
    57
      build.xml
  2. 9
    3
      src/java/org/apache/fop/fonts/FontDetector.java
  3. 5
    0
      src/java/org/apache/fop/fonts/FontEventAdapter.java
  4. 6
    0
      src/java/org/apache/fop/fonts/FontEventListener.java
  5. 8
    0
      src/java/org/apache/fop/fonts/FontEventProducer.java
  6. 1
    0
      src/java/org/apache/fop/fonts/FontEventProducer.xml
  7. 4
    2
      src/java/org/apache/fop/fonts/FontInfoConfigurator.java
  8. 15
    3
      src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
  9. 4
    0
      src/java/org/apache/fop/tools/fontlist/FontListMain.java
  10. 4
    0
      status.xml
  11. 1
    1
      test/java/org/apache/fop/AbstractBasicTranscoderTest.java
  12. 2
    7
      test/java/org/apache/fop/AbstractFOPTest.java
  13. 1
    1
      test/java/org/apache/fop/BasicDriverTestCase.java
  14. 1
    1
      test/java/org/apache/fop/BasicPDFTranscoderTestCase.java
  15. 1
    1
      test/java/org/apache/fop/BasicPSTranscoderTestCase.java
  16. 0
    129
      test/java/org/apache/fop/GenericFOPTestCase.java
  17. 10
    10
      test/java/org/apache/fop/StandardTestSuite.java
  18. 1
    1
      test/java/org/apache/fop/URIResolutionTestCase.java
  19. 1
    1
      test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java
  20. 1
    1
      test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java
  21. 2
    2
      test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java
  22. 1
    1
      test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java
  23. 7
    4
      test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java
  24. 1
    1
      test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java
  25. 1
    1
      test/java/org/apache/fop/area/BlockViewportTestCase.java
  26. 1
    1
      test/java/org/apache/fop/area/RegionViewportTestCase.java
  27. 1
    1
      test/java/org/apache/fop/area/ViewportTest.java
  28. 2
    2
      test/java/org/apache/fop/area/inline/InlineViewportTestCase.java
  29. 1
    1
      test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java
  30. 1
    1
      test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java
  31. 4
    4
      test/java/org/apache/fop/config/BaseUserConfigTest.java
  32. 1
    1
      test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
  33. 1
    1
      test/java/org/apache/fop/config/FontBaseBadTestCase.java
  34. 1
    1
      test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
  35. 1
    1
      test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
  36. 1
    1
      test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
  37. 1
    1
      test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
  38. 1
    1
      test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
  39. 1
    1
      test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
  40. 0
    36
      test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java
  41. 1
    1
      test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
  42. 1
    1
      test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
  43. 0
    1
      test/java/org/apache/fop/config/UserConfigTestSuite.java
  44. 2
    4
      test/java/org/apache/fop/events/EventChecker.java
  45. 40
    25
      test/java/org/apache/fop/events/EventProcessingTestCase.java
  46. 2
    2
      test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java
  47. 1
    1
      test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java
  48. 2
    2
      test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java
  49. 1
    1
      test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java
  50. 1
    1
      test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java
  51. 1
    1
      test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java
  52. 1
    1
      test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java
  53. 2
    2
      test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java
  54. 1
    1
      test/java/org/apache/fop/fonts/EncodingModeTestCase.java
  55. 2
    2
      test/java/org/apache/fop/fotreetest/FOTreeTestCase.java
  56. 10
    5
      test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java
  57. 2
    2
      test/java/org/apache/fop/intermediate/AbstractIFTest.java
  58. 2
    2
      test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java
  59. 1
    1
      test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
  60. 1
    1
      test/java/org/apache/fop/intermediate/IFParserTestCase.java
  61. 1
    1
      test/java/org/apache/fop/intermediate/IFTestCase.java
  62. 2
    2
      test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java
  63. 1
    1
      test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
  64. 1
    1
      test/java/org/apache/fop/render/AbstractRenderingTest.java
  65. 4
    3
      test/java/org/apache/fop/render/RendererFactoryTestCase.java
  66. 2
    2
      test/java/org/apache/fop/render/afp/AbstractAFPTest.java
  67. 1
    1
      test/java/org/apache/fop/render/afp/NoOperationTestCase.java
  68. 1
    1
      test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java
  69. 1
    1
      test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java
  70. 3
    3
      test/java/org/apache/fop/render/pdf/BasePDFTest.java
  71. 1
    1
      test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
  72. 1
    1
      test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
  73. 1
    1
      test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java
  74. 2
    2
      test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java
  75. 9
    5
      test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java
  76. 7
    4
      test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java
  77. 1
    1
      test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java
  78. 2
    2
      test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java
  79. 2
    2
      test/java/org/apache/fop/traits/MinOptMaxTestCase.java

+ 37
- 57
build.xml View File

@@ -179,8 +179,10 @@ list of possible build targets.
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.sandbox-classes.dir" value="${build.dir}/sandbox-classes"/>
<property name="build.codegen-classes.dir" value="${build.dir}/codegen-classes"/>
<property name="build.codegen.fonts.dir" value="${build.gensrc.dir}/org/apache/fop/fonts/"/>
<property name="build.javadocs.dir" value="${build.dir}/javadocs"/>
<property name="build.examples.dir" value="${build.dir}/examples"/>
<property name="build.unit.tests.dir" value="${build.dir}/test-classes"/>
<property name="build.tests.dir" value="${build.dir}/tests"/>
<property name="build.viewer.resources.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/resources"/>
<property name="build.viewer.images.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/images"/>
@@ -283,57 +285,22 @@ list of possible build targets.
<!-- =================================================================== -->
<!-- Generate the source code -->
<!-- =================================================================== -->
<macrodef name="create-font">
<attribute name="name"/>
<sequential>
<xslt in="${src.codegen.fonts.dir}/@{name}.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.codegen.fonts.dir}/base14/@{name}.java"/>
</sequential>
</macrodef>
<target name="codegen" depends="init" description="Generates the java files from the xml resources">
<echo message="Generating the java files from xml resources"/>
<mkdir dir="${build.gensrc.dir}"/>
<mkdir dir="${build.gensrc.dir}/org/apache/fop/fonts/base14"/>
<xslt in="${src.codegen.fonts.dir}/encodings.xml" style="${src.codegen.fonts.dir}/code-point-mapping.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/CodePointMapping.java"/>
<!-- Task unrolled because of a bug in Xalan included in some
JDK 1.4 releases
<xslt basedir="src/codegen" includes="Helvetica*.xml,Times*.xml,Courier*.xml"
style="${src.codegen.fonts.dir}/font-file.xsl"
destdir="${build.gensrc.dir}/org/apache/fop/fonts/base14" extension=".java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
-->
<xslt in="${src.codegen.fonts.dir}/Courier.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/Courier.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/CourierOblique.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/CourierOblique.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/CourierBold.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/CourierBold.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/CourierBoldOblique.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/CourierBoldOblique.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/Helvetica.xml" style="${src.codegen.fonts.dir}/font-file.xsl" destdir="${build.gensrc.dir}/org/apache/fop/fonts/base14" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/Helvetica.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/HelveticaBold.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/HelveticaBold.java">
<xslt in="${src.codegen.fonts.dir}/encodings.xml" style="${src.codegen.fonts.dir}/code-point-mapping.xsl" out="${build.codegen.fonts.dir}/CodePointMapping.java"/>
<xslt basedir="${src.codegen.fonts.dir}" includes="Helvetica*.xml,Times*.xml,Courier*.xml" style="${src.codegen.fonts.dir}/font-file.xsl" destdir="${build.codegen.fonts.dir}/base14/" extension=".java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/HelveticaOblique.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/HelveticaOblique.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/HelveticaBoldOblique.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/HelveticaBoldOblique.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/TimesRoman.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/TimesRoman.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/TimesItalic.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/TimesItalic.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/TimesBold.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/TimesBold.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/TimesBoldItalic.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/TimesBoldItalic.java">
<param name="encoding" expression="WinAnsiEncoding"/>
</xslt>
<xslt in="${src.codegen.fonts.dir}/Symbol.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/Symbol.java"/>
<xslt in="${src.codegen.fonts.dir}/ZapfDingbats.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.gensrc.dir}/org/apache/fop/fonts/base14/ZapfDingbats.java"/>
<create-font name="Symbol"/>
<create-font name="ZapfDingbats"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
@@ -703,10 +670,10 @@ list of possible build targets.
</patternset>
</target>
<target name="junit-compile-java" depends="package, transcoder-pkg, junit-with-xmlunit, junit-without-xmlunit" if="junit.present">
<mkdir dir="${build.dir}/test-classes"/>
<mkdir dir="${build.unit.tests.dir}"/>
<mkdir dir="${build.dir}/test-gensrc"/>
<mkdir dir="${junit.reports.dir}"/>
<javac destdir="${build.dir}/test-classes" includeAntRuntime="true">
<javac destdir="${build.unit.tests.dir}" includeAntRuntime="true">
<src path="${test.dir}/java"/>
<patternset refid="test-sources"/>
<classpath>
@@ -716,7 +683,7 @@ list of possible build targets.
</fileset>
</classpath>
</javac>
<copy todir="${build.dir}/test-classes">
<copy todir="${build.unit.tests.dir}">
<fileset dir="${test.dir}/java">
<include name="**/*.xsl"/>
</fileset>
@@ -729,7 +696,7 @@ list of possible build targets.
<include name="**/*.java"/>
</fileset>
</eventResourceGenerator>
<copy todir="${build.dir}/test-classes">
<copy todir="${build.unit.tests.dir}">
<fileset dir="${test.dir}/java">
<include name="META-INF/**"/>
<include name="**/*.xml"/>
@@ -744,7 +711,7 @@ list of possible build targets.
<target name="junit-compile" depends="junit-compile-java, junit-compile-copy-resources" description="Compiles FOP's JUnit tests" if="junit.present"/>
<target name="junit-transcoder" depends="junit-compile" description="Runs FOP's JUnit transcoder tests" if="junit.present">
<path id="transcoder-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-build-classpath"/>
<fileset dir="${build.dir}">
<include name="fop-transcoder.jar"/>
@@ -759,7 +726,7 @@ list of possible build targets.
JAR needs to be updated.
-->
<path id="transcoder-all-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-build-classpath"/>
<fileset dir="build">
<include name="fop-transcoder-allinone.jar"/>
@@ -791,7 +758,7 @@ list of possible build targets.
<echo message="${hyphenation.message}"/>
</target>
<path id="standard-junit-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-tools-build-classpath"/>
<pathelement location="${build.dir}/fop.jar"/>
</path>
@@ -816,6 +783,20 @@ list of possible build targets.
</junit>
</sequential>
</macrodef>
<target name="junit-all" depends="junit-compile, junit-transcoder, junit-layout-hyphenation, setup-xml-schema" description="Runs FOP's JUnit basic tests" if="junit.present">
<junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
<sysproperty key="jawa.awt.headless" value="true"/>
<formatter type="brief" usefile="false"/>
<formatter type="plain" usefile="true"/>
<formatter type="xml" usefile="true"/>
<classpath>
<path refid="standard-junit-classpath"/>
</classpath>
<batchtest todir="${junit.reports.dir}">
<fileset dir="${build.unit.tests.dir}" includes="**/*TestCase.class"/>
</batchtest>
</junit>
</target>
<target name="junit-basic" depends="junit-compile" description="Runs FOP's JUnit basic tests" if="junit.present">
<junit-run title="Standard test suite" testsuite="org.apache.fop.StandardTestSuite" outfile="TEST-standard-tests-suite"/>
</target>
@@ -861,17 +842,16 @@ list of possible build targets.
outfile="TEST-intermediate-format"/>
</target>
<target name="junit-events" depends="junit-compile" description="Runs FOP's event JUnit tests" if="junit.present">
<junit-run title="event" basedir="test/events" testsuite="org.apache.fop.events.EventProcessingTestCase" outfile="TEST-events"/>
<junit-run title="event" testsuite="org.apache.fop.events.EventProcessingTestCase" outfile="TEST-events"/>
</target>
<target name="junit-text-linebreak" depends="junit-compile" description="Runs FOP's JUnit unicode linebreak tests" if="junit.present">
<junit-run title="Unicode UAX#14 support" testsuite="org.apache.fop.text.linebreak.LineBreakStatusTest" outfile="TEST-linebreak"/>
<junit-run title="Unicode UAX#14 support" testsuite="org.apache.fop.text.linebreak.LineBreakStatusTestCase" outfile="TEST-linebreak"/>
</target>
<target name="junit-render-pdf" depends="junit-compile">
<junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
</target>
<target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf"/>
<target name="junit-full" depends="junit-reduced, junit-layout, junit-area-tree-xml-format, junit-intermediate-format"/>
<target name="junit" depends="junit-full" description="Runs all of FOP's JUnit tests" if="junit.present">
<target name="junit" depends="junit-all" description="Runs all of FOP's JUnit tests" if="junit.present">
<fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/><not><isset property="hyphenation.present"/></not></or></condition>
NOTE:
**************************************************************************
@@ -1353,7 +1333,7 @@ NOTE:
<!-- Special target for Gump -->
<!-- =================================================================== -->
<target name="gump" depends="package,transcoder-pkg"/>
<target name="gump-test" depends="junit-full">
<target name="gump-test" depends="junit-all">
<fail>
<condition>
<or>

+ 9
- 3
src/java/org/apache/fop/fonts/FontDetector.java View File

@@ -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<EmbedFontInfo> 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 {

+ 5
- 0
src/java/org/apache/fop/fonts/FontEventAdapter.java View File

@@ -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);
}

}

+ 6
- 0
src/java/org/apache/fop/fonts/FontEventListener.java View File

@@ -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);
}

+ 8
- 0
src/java/org/apache/fop/fonts/FontEventProducer.java View File

@@ -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);

}

+ 1
- 0
src/java/org/apache/fop/fonts/FontEventProducer.xml View File

@@ -20,4 +20,5 @@
<message key="fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message>
<message key="fontLoadingErrorAtAutoDetection">Unable to load font file: {fontURL}.[ Reason: {e}]</message>
<message key="glyphNotAvailable">Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}".</message>
<message key="fontDirectoryNotFound">'{dir}' does not exist or is not a directory.</message>
</catalogue>

+ 4
- 2
src/java/org/apache/fop/fonts/FontInfoConfigurator.java View File

@@ -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<URL> fontURLList;
try {
fontURLList = fontFileFinder.find(directory);

+ 15
- 3
src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java View File

@@ -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<URL> find(String dir) throws IOException {
List<URL> results = new java.util.ArrayList<URL>();
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;
}
}

+ 4
- 0
src/java/org/apache/fop/tools/fontlist/FontListMain.java View File

@@ -143,6 +143,10 @@ public final class FontListMain {
//ignore
}

public void fontDirectoryNotFound(Object source, String msg) {
//ignore
}

};

FontListGenerator listGenerator = new FontListGenerator();

+ 4
- 0
status.xml View File

@@ -60,6 +60,10 @@
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
<action context="Code" dev="VH" type="add" fixes-bug="52136" due-to="Mehdi Houshmand">
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.
</action>
<action context="Code" dev="PH" type="add" fixes-bug="52089" due-to="JM, Mehdi Houshmand">
Allow JPEG images to be embedded in an AFP document as is, without being decoded and
encoded.

test/java/org/apache/fop/AbstractBasicTranscoderTestCase.java → test/java/org/apache/fop/AbstractBasicTranscoderTest.java View File

@@ -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.

test/java/org/apache/fop/AbstractFOPTestCase.java → test/java/org/apache/fop/AbstractFOPTest.java View File

@@ -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(".");
}

}

+ 1
- 1
test/java/org/apache/fop/BasicDriverTestCase.java View File

@@ -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();


+ 1
- 1
test/java/org/apache/fop/BasicPDFTranscoderTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/BasicPSTranscoderTestCase.java View File

@@ -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() {

+ 0
- 129
test/java/org/apache/fop/GenericFOPTestCase.java View File

@@ -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
= "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>"
+ " <fo:layout-master-set>"
+ " <fo:simple-page-master master-name='simple'"
+ " page-height='25cm' page-width='20cm'>"
+ " <fo:region-body/>"
+ " </fo:simple-page-master>"
+ " </fo:layout-master-set>"
+ " <fo:page-sequence master-reference='simple'>"
+ " <fo:flow flow-name='xsl-region-body'>"
+ " <fo:block>This is a blind text.</fo:block>"
+ " </fo:flow>"
+ " </fo:page-sequence>"
+ "</fo:root>";
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);
}
}

}

+ 10
- 10
test/java/org/apache/fop/StandardTestSuite.java View File

@@ -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 {
}

+ 1
- 1
test/java/org/apache/fop/URIResolutionTestCase.java View File

@@ -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();

test/java/org/apache/fop/afp/fonts/CharactersetEncoderTest.java → test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java View File

@@ -33,7 +33,7 @@ import org.junit.Test;
/**
* Test {@link CharactersetEncoder}
*/
public class CharactersetEncoderTest {
public class CharactersetEncoderTestCase {
private CharactersetEncoder singlebyteEncoder;
private CharactersetEncoder doublebyteEncoder;


test/java/org/apache/fop/afp/modca/AbstractAFPObjectTestCase.java → test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java View File

@@ -36,7 +36,7 @@ import org.junit.Test;
/**
* Tests the {@link AbstractAFPObject} class.
*/
public abstract class AbstractAFPObjectTestCase<S extends AbstractAFPObject> {
public abstract class AbstractAFPObjectTest<S extends AbstractAFPObject> {

private S sut;


test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTestCase.java → test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java View File

@@ -28,8 +28,8 @@ import org.junit.Test;
/**
* Tests the {@linkplain AbstractAFPObject} class.
*/
public abstract class AbstractNamedAFPObjectTestCase<S extends AbstractNamedAFPObject>
extends AbstractAFPObjectTestCase<S> {
public abstract class AbstractNamedAFPObjectTest<S extends AbstractNamedAFPObject>
extends AbstractAFPObjectTest<S> {
@Test
public void testCopySF() {


test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTestCase.java → test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java View File

@@ -21,7 +21,7 @@ package org.apache.fop.afp.modca;

import java.io.IOException;

public abstract class AbstractStructuredObjectTestCase<S extends AbstractStructuredObject> extends AbstractAFPObjectTestCase<S> {
public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> extends AbstractAFPObjectTest<S> {

/**
* Test writeStart() - test that the contract is maintained with

test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTestCase.java → test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java View File

@@ -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<S extends AbstractTripletStructuredObject>
extends AbstractStructuredObjectTestCase<AbstractTripletStructuredObject> {
public class AbstractTripletStructuredObjectTest<S extends AbstractTripletStructuredObject>
extends AbstractStructuredObjectTest<AbstractTripletStructuredObject> {

private static final List<AbstractTriplet> TRIPLETS;

@@ -136,6 +138,7 @@ public abstract class AbstractTripletStructuredObjectTestCase<S extends Abstract
/**
* Test addTriplets() - ensure all triplets are added.
*/
@Test
public void testAddTriplets() {
// Tested on empty object
List<AbstractTriplet> expectedList = TRIPLETS;
@@ -154,4 +157,4 @@ public abstract class AbstractTripletStructuredObjectTestCase<S extends Abstract
emptyStructuredObject.addTriplets(null);
}

}
}

+ 1
- 1
test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java View File

@@ -32,7 +32,7 @@ import org.junit.Test;
/**
* Test {@link IncludeObject}
*/
public class IncludeObjectTestCase extends AbstractNamedAFPObjectTestCase<IncludeObject> {
public class IncludeObjectTestCase extends AbstractNamedAFPObjectTest<IncludeObject> {

@Before
public void setUp() throws Exception {

+ 1
- 1
test/java/org/apache/fop/area/BlockViewportTestCase.java View File

@@ -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 {

+ 1
- 1
test/java/org/apache/fop/area/RegionViewportTestCase.java View File

@@ -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);

test/java/org/apache/fop/area/ViewportTestCase.java → test/java/org/apache/fop/area/ViewportTest.java View File

@@ -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());

+ 2
- 2
test/java/org/apache/fop/area/inline/InlineViewportTestCase.java View File

@@ -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 {

test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java → test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java View File

@@ -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

test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java → test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java View File

@@ -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.

test/java/org/apache/fop/config/BaseUserConfigTestCase.java → test/java/org/apache/fop/config/BaseUserConfigTest.java View File

@@ -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

+ 1
- 1
test/java/org/apache/fop/config/FontAttributesMissingTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontBaseBadTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontsAutoDetectTestCase.java View File

@@ -19,7 +19,7 @@

package org.apache.fop.config;

public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTestCase {
public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest {

@Override
public String getUserConfigFilename() {

+ 0
- 36
test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java View File

@@ -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";
}
}

+ 1
- 1
test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java View File

@@ -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() {

+ 1
- 1
test/java/org/apache/fop/config/FontsSubstitutionTestCase.java View File

@@ -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)

+ 0
- 1
test/java/org/apache/fop/config/UserConfigTestSuite.java View File

@@ -34,7 +34,6 @@ import org.junit.runners.Suite.SuiteClasses;
FontMetricsUrlBadTestCase.class,
FontEmbedUrlBadTestCase.class,
FontMetricsUrlMalformedTestCase.class,
FontMetricsUrlMalformedTestCase.class,
FontsDirectoryRecursiveTestCase.class,
FontsAutoDetectTestCase.class,
FontsSubstitutionTestCase.class,

+ 2
- 4
test/java/org/apache/fop/events/EventChecker.java View File

@@ -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);
}
}


+ 40
- 25
test/java/org/apache/fop/events/EventProcessingTestCase.java View File

@@ -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");
}
}

test/java/org/apache/fop/fo/flow/table/AbstractTableTestCase.java → test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java View File

@@ -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) {

+ 1
- 1
test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java View File

@@ -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);


test/java/org/apache/fop/fo/flow/table/ErrorCheckTestCase.java → test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java View File

@@ -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();
}


+ 1
- 1
test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java View File

@@ -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();

+ 1
- 1
test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java View File

@@ -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();

+ 1
- 1
test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java View File

@@ -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

+ 1
- 1
test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java View File

@@ -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();

test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java → test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java View File

@@ -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.
*/

test/java/org/apache/fop/fonts/EncodingModeTest.java → test/java/org/apache/fop/fonts/EncodingModeTestCase.java View File

@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class EncodingModeTest {
public class EncodingModeTestCase {

@Test
public void testGetName() {

test/java/org/apache/fop/fotreetest/FOTreeTester.java → test/java/org/apache/fop/fotreetest/FOTreeTestCase.java View File

@@ -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;
}

+ 10
- 5
test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java View File

@@ -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 {
}

test/java/org/apache/fop/intermediate/AbstractIFTestCase.java → test/java/org/apache/fop/intermediate/AbstractIFTest.java View File

@@ -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);
}


test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java → test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java View File

@@ -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;
}

+ 1
- 1
test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java View File

@@ -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.

+ 1
- 1
test/java/org/apache/fop/intermediate/IFParserTestCase.java View File

@@ -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

+ 1
- 1
test/java/org/apache/fop/intermediate/IFTestCase.java View File

@@ -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.

test/java/org/apache/fop/layoutengine/LayoutEngineTester.java → test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java View File

@@ -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;
}

+ 1
- 1
test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java View File

@@ -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 {
}

test/java/org/apache/fop/render/AbstractRenderingTestCase.java → test/java/org/apache/fop/render/AbstractRenderingTest.java View File

@@ -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<String, String> MIME_MAP = new java.util.HashMap<String, String>();


test/java/org/apache/fop/render/RendererFactoryTest.java → test/java/org/apache/fop/render/RendererFactoryTestCase.java View File

@@ -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();

test/java/org/apache/fop/render/afp/AbstractAFPTestCase.java → test/java/org/apache/fop/render/afp/AbstractAFPTest.java View File

@@ -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.

+ 1
- 1
test/java/org/apache/fop/render/afp/NoOperationTestCase.java View File

@@ -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.

test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java → test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java View File

@@ -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);


test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java → test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java View File

@@ -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

test/java/org/apache/fop/render/pdf/BasePDFTestCase.java → test/java/org/apache/fop/render/pdf/BasePDFTest.java View File

@@ -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();
}


+ 1
- 1
test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java View File

@@ -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");

+ 1
- 1
test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java View File

@@ -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";

+ 1
- 1
test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java View File

@@ -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");


test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java → test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java View File

@@ -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.

+ 9
- 5
test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java View File

@@ -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());
}


+ 7
- 4
test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java View File

@@ -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.

test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java → test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java View File

@@ -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

test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java → test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java View File

@@ -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,

test/java/org/apache/fop/traits/MinOptMaxTest.java → test/java/org/apache/fop/traits/MinOptMaxTestCase.java View File

@@ -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 <code>MinOptMax.ZERO</code> is really zero.

Loading…
Cancel
Save