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

<property name="build.classes.dir" value="${build.dir}/classes"/> <property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.sandbox-classes.dir" value="${build.dir}/sandbox-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-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.javadocs.dir" value="${build.dir}/javadocs"/>
<property name="build.examples.dir" value="${build.dir}/examples"/> <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.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.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"/> <property name="build.viewer.images.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/images"/>
<!-- =================================================================== --> <!-- =================================================================== -->
<!-- Generate the source code --> <!-- 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"> <target name="codegen" depends="init" description="Generates the java files from the xml resources">
<echo message="Generating the java files from xml resources"/> <echo message="Generating the java files from xml resources"/>
<mkdir dir="${build.gensrc.dir}"/> <mkdir dir="${build.gensrc.dir}"/>
<mkdir dir="${build.gensrc.dir}/org/apache/fop/fonts/base14"/> <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"/> <param name="encoding" expression="WinAnsiEncoding"/>
</xslt> </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> </target>
<!-- =================================================================== --> <!-- =================================================================== -->
<!-- Compiles the source directory --> <!-- Compiles the source directory -->
</patternset> </patternset>
</target> </target>
<target name="junit-compile-java" depends="package, transcoder-pkg, junit-with-xmlunit, junit-without-xmlunit" if="junit.present"> <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="${build.dir}/test-gensrc"/>
<mkdir dir="${junit.reports.dir}"/> <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"/> <src path="${test.dir}/java"/>
<patternset refid="test-sources"/> <patternset refid="test-sources"/>
<classpath> <classpath>
</fileset> </fileset>
</classpath> </classpath>
</javac> </javac>
<copy todir="${build.dir}/test-classes">
<copy todir="${build.unit.tests.dir}">
<fileset dir="${test.dir}/java"> <fileset dir="${test.dir}/java">
<include name="**/*.xsl"/> <include name="**/*.xsl"/>
</fileset> </fileset>
<include name="**/*.java"/> <include name="**/*.java"/>
</fileset> </fileset>
</eventResourceGenerator> </eventResourceGenerator>
<copy todir="${build.dir}/test-classes">
<copy todir="${build.unit.tests.dir}">
<fileset dir="${test.dir}/java"> <fileset dir="${test.dir}/java">
<include name="META-INF/**"/> <include name="META-INF/**"/>
<include name="**/*.xml"/> <include name="**/*.xml"/>
<target name="junit-compile" depends="junit-compile-java, junit-compile-copy-resources" description="Compiles FOP's JUnit tests" if="junit.present"/> <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"> <target name="junit-transcoder" depends="junit-compile" description="Runs FOP's JUnit transcoder tests" if="junit.present">
<path id="transcoder-classpath"> <path id="transcoder-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-build-classpath"/> <path refid="libs-build-classpath"/>
<fileset dir="${build.dir}"> <fileset dir="${build.dir}">
<include name="fop-transcoder.jar"/> <include name="fop-transcoder.jar"/>
JAR needs to be updated. JAR needs to be updated.
--> -->
<path id="transcoder-all-classpath"> <path id="transcoder-all-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-build-classpath"/> <path refid="libs-build-classpath"/>
<fileset dir="build"> <fileset dir="build">
<include name="fop-transcoder-allinone.jar"/> <include name="fop-transcoder-allinone.jar"/>
<echo message="${hyphenation.message}"/> <echo message="${hyphenation.message}"/>
</target> </target>
<path id="standard-junit-classpath"> <path id="standard-junit-classpath">
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.unit.tests.dir}"/>
<path refid="libs-tools-build-classpath"/> <path refid="libs-tools-build-classpath"/>
<pathelement location="${build.dir}/fop.jar"/> <pathelement location="${build.dir}/fop.jar"/>
</path> </path>
</junit> </junit>
</sequential> </sequential>
</macrodef> </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"> <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"/> <junit-run title="Standard test suite" testsuite="org.apache.fop.StandardTestSuite" outfile="TEST-standard-tests-suite"/>
</target> </target>
outfile="TEST-intermediate-format"/> outfile="TEST-intermediate-format"/>
</target> </target>
<target name="junit-events" depends="junit-compile" description="Runs FOP's event JUnit tests" if="junit.present"> <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>
<target name="junit-text-linebreak" depends="junit-compile" description="Runs FOP's JUnit unicode linebreak tests" if="junit.present"> <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>
<target name="junit-render-pdf" depends="junit-compile"> <target name="junit-render-pdf" depends="junit-compile">
<junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/> <junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
</target> </target>
<target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf"/> <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> <fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/><not><isset property="hyphenation.present"/></not></or></condition>
NOTE: NOTE:
************************************************************************** **************************************************************************
<!-- Special target for Gump --> <!-- Special target for Gump -->
<!-- =================================================================== --> <!-- =================================================================== -->
<target name="gump" depends="package,transcoder-pkg"/> <target name="gump" depends="package,transcoder-pkg"/>
<target name="gump-test" depends="junit-full">
<target name="gump-test" depends="junit-all">
<fail> <fail>
<condition> <condition>
<or> <or>

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

import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

import org.apache.xmlgraphics.util.ClasspathResource;

import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.autodetect.FontFileFinder; import org.apache.fop.fonts.autodetect.FontFileFinder;
import org.apache.fop.util.LogUtil; import org.apache.fop.util.LogUtil;
import org.apache.xmlgraphics.util.ClasspathResource;


/** /**
* Detector of operating system and classpath fonts * Detector of operating system and classpath fonts
private final FontManager fontManager; private final FontManager fontManager;
private final FontAdder fontAdder; private final FontAdder fontAdder;
private final boolean strict; private final boolean strict;
private final FontEventListener eventListener;


/** /**
* Main constructor * Main constructor
* @param manager the font manager * @param manager the font manager
* @param adder the font adder * @param adder the font adder
* @param strict true if an Exception should be thrown if an error is found. * @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.fontManager = manager;
this.fontAdder = adder; this.fontAdder = adder;
this.strict = strict; this.strict = strict;
this.eventListener = listener;
} }


/** /**
public void detect(List<EmbedFontInfo> fontInfoList) throws FOPException { public void detect(List<EmbedFontInfo> fontInfoList) throws FOPException {
// search in font base if it is defined and // search in font base if it is defined and
// is a directory but don't recurse // is a directory but don't recurse
FontFileFinder fontFileFinder = new FontFileFinder();
FontFileFinder fontFileFinder = new FontFileFinder(eventListener);
String fontBaseURL = fontManager.getFontBaseURL(); String fontBaseURL = fontManager.getFontBaseURL();
if (fontBaseURL != null) { if (fontBaseURL != null) {
try { try {

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

getEventProducer().glyphNotAvailable(source, ch, fontName); 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

*/ */
void glyphNotAvailable(Object source, char ch, String fontName); 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

*/ */
void glyphNotAvailable(Object source, char ch, String fontName); 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

<message key="fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message> <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="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="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> </catalogue>

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

import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.autodetect.FontFileFinder; import org.apache.fop.fonts.autodetect.FontFileFinder;
import org.apache.fop.fonts.autodetect.FontInfoFinder; import org.apache.fop.fonts.autodetect.FontInfoFinder;
// native o/s search (autodetect) configuration // native o/s search (autodetect) configuration
boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null); boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null);
if (autodetectFonts) { if (autodetectFonts) {
FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict);
FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict,
listener);
fontDetector.detect(fontInfoList); fontDetector.detect(fontInfoList);
} }


} }


// add fonts found in directory // add fonts found in directory
FontFileFinder fontFileFinder = new FontFileFinder(recursive ? -1 : 1);
FontFileFinder fontFileFinder = new FontFileFinder(recursive ? -1 : 1, listener);
List<URL> fontURLList; List<URL> fontURLList;
try { try {
fontURLList = fontFileFinder.find(directory); fontURLList = fontFileFinder.find(directory);

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

import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;


import org.apache.fop.fonts.FontEventListener;

/** /**
* Helps to autodetect/locate available operating system fonts. * Helps to autodetect/locate available operating system fonts.
*/ */


/** default depth limit of recursion when searching for font files **/ /** default depth limit of recursion when searching for font files **/
public static final int DEFAULT_DEPTH_LIMIT = -1; public static final int DEFAULT_DEPTH_LIMIT = -1;
private final FontEventListener eventListener;


/** /**
* Default constructor * 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 * Constructor
* @param depthLimit recursion depth limit * @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); super(getDirectoryFilter(), getFileFilter(), depthLimit);
eventListener = listener;
} }


/** /**
public List<URL> find(String dir) throws IOException { public List<URL> find(String dir) throws IOException {
List<URL> results = new java.util.ArrayList<URL>(); List<URL> results = new java.util.ArrayList<URL>();
super.walk(new File(dir), results); 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; return results;
} }
} }

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

//ignore //ignore
} }


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

}; };


FontListGenerator listGenerator = new FontListGenerator(); FontListGenerator listGenerator = new FontListGenerator();

+ 4
- 0
status.xml View File

documents. Example: the fix of marks layering will be such a case when it's done. documents. Example: the fix of marks layering will be such a case when it's done.
--> -->
<release version="FOP Trunk" date="TBD"> <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"> <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 Allow JPEG images to be embedded in an AFP document as is, without being decoded and
encoded. encoded.

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

* Basic runtime test for FOP's transcoders. It is used to verify that * Basic runtime test for FOP's transcoders. It is used to verify that
* nothing obvious is broken after compiling. * nothing obvious is broken after compiling.
*/ */
public abstract class AbstractBasicTranscoderTestCase extends AbstractFOPTestCase {
public abstract class AbstractBasicTranscoderTest extends AbstractFOPTest {


/** /**
* Creates the transcoder to test. * Creates the transcoder to test.

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

/** /**
* Abstract base test class for FOP's tests. * 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. * Returns the base directory to use for the tests.
* @return the base directory * @return the base directory
*/ */
protected static File getBaseDir() { 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

* Basic runtime test for the old Fop class. It is used to verify that * Basic runtime test for the old Fop class. It is used to verify that
* nothing obvious is broken after compiling. * nothing obvious is broken after compiling.
*/ */
public class BasicDriverTestCase extends AbstractFOPTestCase {
public class BasicDriverTestCase extends AbstractFOPTest {


private FopFactory fopFactory = FopFactory.newInstance(); private FopFactory fopFactory = FopFactory.newInstance();



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

* Basic runtime test for the PDF transcoder. It is used to verify that * Basic runtime test for the PDF transcoder. It is used to verify that
* nothing obvious is broken after compiling. * nothing obvious is broken after compiling.
*/ */
public class BasicPDFTranscoderTestCase extends AbstractBasicTranscoderTestCase {
public class BasicPDFTranscoderTestCase extends AbstractBasicTranscoderTest {


@Override @Override
protected Transcoder createTranscoder() { protected Transcoder createTranscoder() {

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

* Basic runtime test for the PS transcoder. It is used to verify that * Basic runtime test for the PS transcoder. It is used to verify that
* nothing obvious is broken after compiling. * nothing obvious is broken after compiling.
*/ */
public class BasicPSTranscoderTestCase extends AbstractBasicTranscoderTestCase {
public class BasicPSTranscoderTestCase extends AbstractBasicTranscoderTest {


@Override @Override
protected Transcoder createTranscoder() { protected Transcoder createTranscoder() {

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

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

import org.junit.runners.Suite; import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses; 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.afp.parser.MODCAParserTestCase;
import org.apache.fop.area.ViewportTestSuite; 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.fonts.truetype.GlyfTableTestCase;
import org.apache.fop.image.loader.batik.ImageLoaderTestCase; import org.apache.fop.image.loader.batik.ImageLoaderTestCase;
import org.apache.fop.image.loader.batik.ImagePreloaderTestCase; import org.apache.fop.image.loader.batik.ImagePreloaderTestCase;
import org.apache.fop.intermediate.IFMimickingTestCase; 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.PDFAConformanceTestCase;
import org.apache.fop.render.pdf.PDFCMapTestCase; import org.apache.fop.render.pdf.PDFCMapTestCase;
import org.apache.fop.render.pdf.PDFEncodingTestCase; import org.apache.fop.render.pdf.PDFEncodingTestCase;
import org.apache.fop.render.pdf.RenderPDFTestSuite; import org.apache.fop.render.pdf.RenderPDFTestSuite;
import org.apache.fop.render.ps.PSTestSuite; import org.apache.fop.render.ps.PSTestSuite;
import org.apache.fop.render.rtf.RichTextFormatTestSuite; 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. * Test suite for basic functionality of FOP.
PDFEncodingTestCase.class, PDFEncodingTestCase.class,
PDFCMapTestCase.class, PDFCMapTestCase.class,
PDFsRGBSettingsTestCase.class, PDFsRGBSettingsTestCase.class,
DejaVuLGCSerifTest.class,
DejaVuLGCSerifTestCase.class,
RichTextFormatTestSuite.class, RichTextFormatTestSuite.class,
ImageLoaderTestCase.class, ImageLoaderTestCase.class,
ImagePreloaderTestCase.class, ImagePreloaderTestCase.class,
IFMimickingTestCase.class, IFMimickingTestCase.class,
PageBoundariesTest.class,
PageScaleTest.class,
PageBoundariesTestCase.class,
PageScaleTestCase.class,
org.apache.fop.afp.AFPTestSuite.class, org.apache.fop.afp.AFPTestSuite.class,
GlyfTableTestCase.class, GlyfTableTestCase.class,
ViewportTestSuite.class, ViewportTestSuite.class,
RenderPDFTestSuite.class, RenderPDFTestSuite.class,
MODCAParserTestCase.class, MODCAParserTestCase.class,
CharactersetEncoderTest.class,
CharactersetEncoderTestCase.class,
org.apache.fop.render.afp.AFPTestSuite.class, org.apache.fop.render.afp.AFPTestSuite.class,
PSTestSuite.class, PSTestSuite.class,
MinOptMaxTest.class
MinOptMaxTestCase.class
}) })
public class StandardTestSuite { public class StandardTestSuite {
} }

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

/** /**
* Tests URI resolution facilities. * Tests URI resolution facilities.
*/ */
public class URIResolutionTestCase extends AbstractFOPTestCase {
public class URIResolutionTestCase extends AbstractFOPTest {


// configure fopFactory as desired // configure fopFactory as desired
private FopFactory fopFactory = FopFactory.newInstance(); 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

/** /**
* Test {@link CharactersetEncoder} * Test {@link CharactersetEncoder}
*/ */
public class CharactersetEncoderTest {
public class CharactersetEncoderTestCase {
private CharactersetEncoder singlebyteEncoder; private CharactersetEncoder singlebyteEncoder;
private CharactersetEncoder doublebyteEncoder; private CharactersetEncoder doublebyteEncoder;



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

/** /**
* Tests the {@link AbstractAFPObject} class. * Tests the {@link AbstractAFPObject} class.
*/ */
public abstract class AbstractAFPObjectTestCase<S extends AbstractAFPObject> {
public abstract class AbstractAFPObjectTest<S extends AbstractAFPObject> {


private S sut; private S sut;



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

/** /**
* Tests the {@linkplain AbstractAFPObject} class. * 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 @Test
public void testCopySF() { public void testCopySF() {



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



import java.io.IOException; 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 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

import java.util.Collections; import java.util.Collections;
import java.util.List; 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.AbstractTriplet;
import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet;
import org.apache.fop.afp.modca.triplets.CommentTriplet; import org.apache.fop.afp.modca.triplets.CommentTriplet;
import org.apache.fop.afp.modca.triplets.ObjectAreaSizeTriplet; import org.apache.fop.afp.modca.triplets.ObjectAreaSizeTriplet;
import org.apache.fop.afp.modca.triplets.Triplet; import org.apache.fop.afp.modca.triplets.Triplet;
import org.junit.Before;


/** /**
* Test {@link AbstractTripletStructuredObject} * 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; private static final List<AbstractTriplet> TRIPLETS;


/** /**
* Test addTriplets() - ensure all triplets are added. * Test addTriplets() - ensure all triplets are added.
*/ */
@Test
public void testAddTriplets() { public void testAddTriplets() {
// Tested on empty object // Tested on empty object
List<AbstractTriplet> expectedList = TRIPLETS; List<AbstractTriplet> expectedList = TRIPLETS;
emptyStructuredObject.addTriplets(null); emptyStructuredObject.addTriplets(null);
} }


}
}

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

/** /**
* Test {@link IncludeObject} * Test {@link IncludeObject}
*/ */
public class IncludeObjectTestCase extends AbstractNamedAFPObjectTestCase<IncludeObject> {
public class IncludeObjectTestCase extends AbstractNamedAFPObjectTest<IncludeObject> {


@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {

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

/** /**
* Tests the {@linkplain BlockViewport} class. * Tests the {@linkplain BlockViewport} class.
*/ */
public class BlockViewportTestCase extends ViewportTestCase {
public class BlockViewportTestCase extends ViewportTest {


@Test @Test
public void testNonClip() throws Exception { public void testNonClip() throws Exception {

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

/** /**
* Tests the {@linkplain RegionViewport} class. * 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) { private RegionViewport createRegionViewport(int x, int y, int ipd, int bpd) {
Rectangle2D v = new Rectangle(x, y, ipd, 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

/** /**
* Tests implementations of the {@linkplain Viewport} interface. * Tests implementations of the {@linkplain Viewport} interface.
*/ */
public abstract class ViewportTestCase {
public abstract class ViewportTest {


protected void checkNonClip(Viewport v) throws Exception { protected void checkNonClip(Viewport v) throws Exception {
assertFalse(v.hasClip()); assertFalse(v.hasClip());

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



package org.apache.fop.area.inline; package org.apache.fop.area.inline;


import org.apache.fop.area.ViewportTestCase;
import org.apache.fop.area.ViewportTest;
import org.junit.Test; import org.junit.Test;


/** /**
* Tests the {@linkplain InlineViewport} class. * Tests the {@linkplain InlineViewport} class.
*/ */
public class InlineViewportTestCase extends ViewportTestCase {
public class InlineViewportTestCase extends ViewportTest {


@Test @Test
public void testNonClip() throws Exception { public void testNonClip() throws Exception {

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

/** /**
* Super class of several user config cases. * 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 using a standard FOP font

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

/** /**
* Super class for several user configuration failure cases. * 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 the user configuration failure.

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

import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.fop.apps.FOUserAgent; 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; import org.xml.sax.SAXException;


/** /**
* Basic runtime test for FOP's font configuration. It is used to verify that * Basic runtime test for FOP's font configuration. It is used to verify that
* nothing obvious is broken after compiling. * nothing obvious is broken after compiling.
*/ */
public abstract class BaseUserConfigTestCase extends BasePDFTestCase {
public abstract class BaseUserConfigTest extends BasePDFTest {


protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();


/** logging instance */ /** 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() { protected void init() {
// do nothing // do nothing

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

/** /**
* this font is without a metrics-url or an embed-url * this font is without a metrics-url or an embed-url
*/ */
public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTestCase {
public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* This font base does not exist and a relative font path is used. * This font base does not exist and a relative font path is used.
*/ */
public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase {
public class FontBaseBadTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* this font has an embed-url that does not exist on filesystem. * this font has an embed-url that does not exist on filesystem.
*/ */
public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* this font has a malformed embed-url * this font has a malformed embed-url
*/ */
public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* this font has a metrics-url that does not exist on filesystem * this font has a metrics-url that does not exist on filesystem
*/ */
public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* this font has a malformed metrics-url * this font has a malformed metrics-url
*/ */
public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

/** /**
* this font has a missing font triplet attribute * this font has a missing font triplet attribute
*/ */
public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTestCase {
public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTest {


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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



package org.apache.fop.config; package org.apache.fop.config;


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


@Override @Override
public String getUserConfigFilename() { public String getUserConfigFilename() {

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

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

/** /**
* tests font directory on system * tests font directory on system
*/ */
public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTestCase {
public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTest {


@Override @Override
protected String getUserConfigFilename() { protected String getUserConfigFilename() {

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

* Tests the font substitution mechanism * Tests the font substitution mechanism
*/ */
public class FontsSubstitutionTestCase extends public class FontsSubstitutionTestCase extends
BaseConstructiveUserConfigTestCase {
BaseConstructiveUserConfigTest {


@Override @Override
protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile) protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile)

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

FontMetricsUrlBadTestCase.class, FontMetricsUrlBadTestCase.class,
FontEmbedUrlBadTestCase.class, FontEmbedUrlBadTestCase.class,
FontMetricsUrlMalformedTestCase.class, FontMetricsUrlMalformedTestCase.class,
FontMetricsUrlMalformedTestCase.class,
FontsDirectoryRecursiveTestCase.class, FontsDirectoryRecursiveTestCase.class,
FontsAutoDetectTestCase.class, FontsAutoDetectTestCase.class,
FontsSubstitutionTestCase.class, FontsSubstitutionTestCase.class,

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



public void processEvent(Event event) { public void processEvent(Event event) {
// Always create the message to make sure there is no error in the formatting process // 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; eventReceived = true;
} else {
fail("Unexpected event: id = " + event.getEventID() + ": " + msg);
} }
} }



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

package org.apache.fop.events; package org.apache.fop.events;


import java.io.File; import java.io.File;
import java.io.IOException;


import javax.xml.transform.Result; import javax.xml.transform.Result;
import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource; 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.commons.io.output.NullOutputStream;

import org.apache.xmlgraphics.util.MimeConstants;

import org.apache.fop.ResourceEventProducer; import org.apache.fop.ResourceEventProducer;
import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop; import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.FopFactory;
import org.apache.fop.area.AreaEventProducer; import org.apache.fop.area.AreaEventProducer;
import org.apache.fop.fonts.FontEventProducer; import org.apache.fop.fonts.FontEventProducer;
import org.apache.fop.layoutmgr.BlockLevelEventProducer; import org.apache.fop.layoutmgr.BlockLevelEventProducer;
import org.apache.fop.layoutmgr.inline.InlineLevelEventProducer; 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. * Tests that the event notification system runs smoothly.


private final TransformerFactory tFactory = TransformerFactory.newInstance(); 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); 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(); 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()); Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res); transformer.transform(src, res);
eventChecker.end(); eventChecker.end();
} }


private void doTest(String filename, String expectedEventID) throws
FOPException, TransformerException, IOException, SAXException {
doTest(filename, null, expectedEventID);
}

@Test @Test
public void testArea() throws FOPException, TransformerException {
public void testArea() throws TransformerException, IOException, SAXException {
doTest("area.fo", doTest("area.fo",
AreaEventProducer.class.getName() + ".unresolvedIDReferenceOnPage"); AreaEventProducer.class.getName() + ".unresolvedIDReferenceOnPage");
} }


@Test @Test
public void testResource() throws FOPException, TransformerException {
public void testResource() throws FOPException, TransformerException, IOException,
SAXException {
doTest("resource.fo", doTest("resource.fo",
ResourceEventProducer.class.getName() + ".imageNotFound"); ResourceEventProducer.class.getName() + ".imageNotFound");
} }


@Test @Test
public void testValidation() throws FOPException, TransformerException {
public void testValidation() throws FOPException, TransformerException, IOException,
SAXException {
doTest("validation.fo", doTest("validation.fo",
FOValidationEventProducer.class.getName() + ".invalidPropertyValue"); FOValidationEventProducer.class.getName() + ".invalidPropertyValue");
} }


@Test @Test
public void testTable() throws FOPException, TransformerException {
public void testTable() throws FOPException, TransformerException, IOException, SAXException {
doTest("table.fo", doTest("table.fo",
TableEventProducer.class.getName() + ".noTablePaddingWithCollapsingBorderModel"); TableEventProducer.class.getName() + ".noTablePaddingWithCollapsingBorderModel");
} }


@Test @Test
public void testBlockLevel() throws FOPException, TransformerException {
public void testBlockLevel() throws FOPException, TransformerException, IOException,
SAXException {
doTest("block-level.fo", doTest("block-level.fo",
BlockLevelEventProducer.class.getName() + ".overconstrainedAdjustEndIndent"); BlockLevelEventProducer.class.getName() + ".overconstrainedAdjustEndIndent");
} }


@Test @Test
public void testInlineLevel() throws FOPException, TransformerException {
public void testInlineLevel() throws FOPException, TransformerException, IOException,
SAXException {
doTest("inline-level.fo", doTest("inline-level.fo",
InlineLevelEventProducer.class.getName() + ".lineOverflows"); InlineLevelEventProducer.class.getName() + ".lineOverflows");
} }


@Test @Test
public void testFont() throws FOPException, TransformerException {
public void testFont() throws FOPException, TransformerException, IOException, SAXException {
doTest("font.fo", doTest("font.fo",
FontEventProducer.class.getName() + ".fontSubstituted"); 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

/** /**
* Superclass for testcases related to tables, factoring the common stuff. * 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 FOTreeUnitTester.FOEventHandlerFactory tableHandlerFactory;


private TableHandler tableHandler; private TableHandler tableHandler;


public AbstractTableTestCase() throws Exception {
public AbstractTableTest() throws Exception {
super(); super();
tableHandlerFactory = new FOEventHandlerFactory() { tableHandlerFactory = new FOEventHandlerFactory() {
public FOEventHandler createFOEventHandler(FOUserAgent foUserAgent) { public FOEventHandler createFOEventHandler(FOUserAgent foUserAgent) {

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

* conditionality into account. The resolved borders are generated by the * conditionality into account. The resolved borders are generated by the
* collapsed-conditional-borders_test-generator.py Python script. * 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); 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

/** /**
* Abstract class for testing erroneous files, checking that a ValidationException is thrown. * 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(); super();
} }



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

* Testcase checking that cells spanning further than their parent element aren't * Testcase checking that cells spanning further than their parent element aren't
* accepted. * accepted.
*/ */
public class IllegalRowSpanTestCase extends ErrorCheckTestCase {
public class IllegalRowSpanTestCase extends ErrorCheckTest {


public IllegalRowSpanTestCase() throws Exception { public IllegalRowSpanTestCase() throws Exception {
super(); super();

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

* Tests that RowGroupBuilder returns, for each part of a table, the expected number of * Tests that RowGroupBuilder returns, for each part of a table, the expected number of
* row-groups with the expected number or rows in each. * row-groups with the expected number or rows in each.
*/ */
public class RowGroupBuilderTestCase extends AbstractTableTestCase {
public class RowGroupBuilderTestCase extends AbstractTableTest {


public RowGroupBuilderTestCase() throws Exception { public RowGroupBuilderTestCase() throws Exception {
super(); super();

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

import org.junit.Test; 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 * 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



import org.junit.Test; import org.junit.Test;


public class TooManyColumnsTestCase extends ErrorCheckTestCase {
public class TooManyColumnsTestCase extends ErrorCheckTest {


public TooManyColumnsTestCase() throws Exception { public TooManyColumnsTestCase() throws Exception {
super(); super();

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

/** /**
* *
*/ */
public class DejaVuLGCSerifTest {
public class DejaVuLGCSerifTestCase {


private FontResolver fontResolver = FontManager.createMinimalFontResolver(); private FontResolver fontResolver = FontManager.createMinimalFontResolver();
private CustomFont font; private CustomFont font;


/** /**
* sets up the testcase by loading the DejaVu Font. * sets up the testcase by loading the DejaVu Font.
*
*
* @throws Exception * @throws Exception
* if the test fails. * if the test fails.
*/ */

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



import org.junit.Test; import org.junit.Test;


public class EncodingModeTest {
public class EncodingModeTestCase {


@Test @Test
public void testGetName() { public void testGetName() {

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

* Test driver class for FO tree tests. * Test driver class for FO tree tests.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class FOTreeTester {
public class FOTreeTestCase {


@BeforeClass @BeforeClass
public static void registerElementListObservers() { public static void registerElementListObservers() {
* *
* @param testFile the FO file to test * @param testFile the FO file to test
*/ */
public FOTreeTester(File testFile) {
public FOTreeTestCase(File testFile) {
fopFactory.addElementMapping(new TestElementMapping()); fopFactory.addElementMapping(new TestElementMapping());
this.testFile = testFile; this.testFile = testFile;
} }

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



package org.apache.fop.fotreetest; 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.CollapsedConditionalBorderTestCase;
import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase; import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase;
import org.apache.fop.fo.flow.table.RowGroupBuilderTestCase; import org.apache.fop.fo.flow.table.RowGroupBuilderTestCase;
import org.apache.fop.fo.flow.table.TableColumnColumnNumberTestCase; import org.apache.fop.fo.flow.table.TableColumnColumnNumberTestCase;
import org.apache.fop.fo.flow.table.TooManyColumnsTestCase; 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. * JUnit test suit for running layout engine test under JUnit control.
*/ */
@RunWith(Suite.class) @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 { public final class FOTreeTestSuite {
} }

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

/** /**
* A common super-class for intermediate format test cases. * 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; private static final Schema IF_SCHEMA;


* @param testFile the file containing the document and the tests * @param testFile the file containing the document and the tests
* @throws IOException if an I/O error occurs while loading the test case * @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); super(testFile);
} }



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

/** /**
* Abstract base class for intermediate format tests. * Abstract base class for intermediate format tests.
*/ */
public abstract class AbstractIntermediateTestCase {
public abstract class AbstractIntermediateTest {


/** the test environment */ /** the test environment */
protected static TestAssistant testAssistant = new TestAssistant(); protected static TestAssistant testAssistant = new TestAssistant();
* @param testFile the test file to run * @param testFile the test file to run
* @throws IOException if an I/O error occurs while loading the test case * @throws IOException if an I/O error occurs while loading the test case
*/ */
public AbstractIntermediateTestCase(File testFile)
public AbstractIntermediateTest(File testFile)
throws IOException { throws IOException {
this.testFile = testFile; this.testFile = testFile;
} }

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

* Tests the area tree parser. * Tests the area tree parser.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class AreaTreeParserTestCase extends AbstractIntermediateTestCase {
public class AreaTreeParserTestCase extends AbstractIntermediateTest {


/** /**
* Creates the parameters for this test. * Creates the parameters for this test.

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

* Tests the intermediate format parser. * Tests the intermediate format parser.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class IFParserTestCase extends AbstractIFTestCase {
public class IFParserTestCase extends AbstractIFTest {


/** /**
* Gets the parameters for this test * Gets the parameters for this test

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

* Test case for the IF output. * Test case for the IF output.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class IFTestCase extends AbstractIFTestCase {
public class IFTestCase extends AbstractIFTest {


/** /**
* Gets the files for this test. * Gets the files for this test.

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

* files. * files.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class LayoutEngineTester {
public class LayoutEngineTestCase {
private static File areaTreeBackupDir; private static File areaTreeBackupDir;


@BeforeClass @BeforeClass
* *
* @param testFile the test file * @param testFile the test file
*/ */
public LayoutEngineTester(File testFile) {
public LayoutEngineTestCase(File testFile) {
this.ifTester = new IFTester(tfactory, areaTreeBackupDir); this.ifTester = new IFTester(tfactory, areaTreeBackupDir);
this.testFile = testFile; this.testFile = testFile;
} }

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

* JUnit test suit for running layout engine test under JUnit control. * JUnit test suit for running layout engine test under JUnit control.
*/ */
@RunWith(Suite.class) @RunWith(Suite.class)
@SuiteClasses({ LayoutEngineTester.class })
@SuiteClasses({ LayoutEngineTestCase.class })
public class LayoutEngineTestSuite { public class LayoutEngineTestSuite {
} }

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

/** /**
* Abstract base class for rendering (output) verification tests. * 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>(); 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

import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;


import org.junit.Test;

import org.apache.commons.io.output.NullOutputStream; import org.apache.commons.io.output.NullOutputStream;

import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.FopFactory;
import org.apache.fop.render.intermediate.IFRenderer; import org.apache.fop.render.intermediate.IFRenderer;
import org.apache.fop.render.pdf.PDFDocumentHandler; import org.apache.fop.render.pdf.PDFDocumentHandler;
import org.apache.fop.render.rtf.RTFHandler; import org.apache.fop.render.rtf.RTFHandler;
import org.junit.Test;


/** /**
* Tests for {@link RendererFactory}. * Tests for {@link RendererFactory}.
*/ */
public class RendererFactoryTest {
public class RendererFactoryTestCase {


@Test @Test
public void testDocumentHandlerLevel() throws Exception { public void testDocumentHandlerLevel() throws Exception {


ua = fopFactory.newFOUserAgent(); ua = fopFactory.newFOUserAgent();
handler = factory.createDocumentHandler(ua, MimeConstants.MIME_PDF); handler = factory.createDocumentHandler(ua, MimeConstants.MIME_PDF);
assertTrue(handler instanceof PDFDocumentHandler);


ua = fopFactory.newFOUserAgent(); ua = fopFactory.newFOUserAgent();
overrideHandler = new PDFDocumentHandler(); overrideHandler = new PDFDocumentHandler();

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



import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants; 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 base class for AFP verification tests.
*/ */
abstract class AbstractAFPTestCase extends AbstractRenderingTestCase {
abstract class AbstractAFPTest extends AbstractRenderingTest {


/** /**
* Renders a test file. * Renders a test file.

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

/** /**
* Tests generation of afp:no-operation (NOPs). * Tests generation of afp:no-operation (NOPs).
*/ */
public class NoOperationTestCase extends AbstractAFPTestCase {
public class NoOperationTestCase extends AbstractAFPTest {


/** /**
* Tests afp:no-operation. * 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

/** /**
* Tests for the fox:bleed, fox:crop-offset, fox:crop-box extension properties. * 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); 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

/** /**
* Tests for the fox:scale extension property. * Tests for the fox:scale extension property.
*/ */
public class PageScaleTest {
public class PageScaleTestCase {


/** 1 value is used for both x and y. */ /** 1 value is used for both x and y. */
@Test @Test

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



import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.output.ByteArrayOutputStream; 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.FOUserAgent;
import org.apache.fop.apps.Fop; import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.FopFactory;
/** /**
* Base class for automated tests that create PDF files * Base class for automated tests that create PDF files
*/ */
public class BasePDFTestCase extends AbstractFOPTestCase {
public class BasePDFTest extends AbstractFOPTest {


/** the FopFactory */ /** the FopFactory */
protected final FopFactory fopFactory = FopFactory.newInstance(); protected final FopFactory fopFactory = FopFactory.newInstance();
/** /**
* Main constructor * Main constructor
*/ */
protected BasePDFTestCase() {
protected BasePDFTest() {
init(); init();
} }



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

/** /**
* Tests PDF/A-1 functionality. * 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 File foBaseDir = new File("test/xml/pdf-a");
private boolean dumpPDF = Boolean.getBoolean("PDFAConformanceTestCase.dumpPDF"); private boolean dumpPDF = Boolean.getBoolean("PDFAConformanceTestCase.dumpPDF");

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

import org.junit.Test; import org.junit.Test;


/** Test that characters are correctly encoded in a generated PDF file */ /** 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 File foBaseDir = new File("test/xml/pdf-encoding");
private final boolean dumpPDF = Boolean.getBoolean("PDFEncodingTestCase.dumpPDF"); private final boolean dumpPDF = Boolean.getBoolean("PDFEncodingTestCase.dumpPDF");
static final String INPUT_FILE = "test/xml/pdf-encoding/pdf-encoding-test.xconf"; 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

/** /**
* Tests the disables-srgb-colorspace setting. * 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"); 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



import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants; 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. * Abstract base class for PostScript verification tests.
*/ */
public abstract class AbstractPostScriptTestCase extends AbstractRenderingTestCase {
public abstract class AbstractPostScriptTest extends AbstractRenderingTest {


/** /**
* Renders a test file. * Renders a test file.

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

import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;


import org.junit.Test;

import org.apache.commons.io.IOUtils; 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.DSCConstants;
import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.DSCException; import org.apache.xmlgraphics.ps.dsc.DSCException;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentTitle; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentTitle;
import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; 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. * Tests the image handling in PostScript output.
*/ */
public class ImageHandlingTestCase extends AbstractPostScriptTestCase {
public class ImageHandlingTestCase extends AbstractPostScriptTest {


/** /**
* Tests JPEG handling. * Tests JPEG handling.
ua.setDocumentHandlerOverride(handler); ua.setDocumentHandlerOverride(handler);


// Prepare output file // 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()); verifyPostScriptFile(outputFile, psUtil.getLanguageLevel());
} }



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

import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;


import org.junit.Test;

import org.apache.commons.io.IOUtils; 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.DSCConstants;
import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.DSCException; import org.apache.xmlgraphics.ps.dsc.DSCException;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentIncludeResource; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentIncludeResource;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; 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 * Tests the PostScript resource optimization (selective de-duplication of
* images that are used multiple times). * images that are used multiple times).
*/ */
public class ResourceOptimizationTestCase extends AbstractPostScriptTestCase {
public class ResourceOptimizationTestCase extends AbstractPostScriptTest {


/** /**
* Tests resource optimization. * Tests resource optimization.

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

/** /**
* JUnit test case for the LineBreakStatus class * JUnit test case for the LineBreakStatus class
*/ */
public class LineBreakStatusTest {
public class LineBreakStatusTestCase {


/* /*
* These symbols are used to indicate the break action returned * 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

* *
* *
*/ */
public class LineBreakUtilsTest {
public class LineBreakUtilsTestCase {


@Test @Test
public void testLineBreakProperty() { public void testLineBreakProperty() {
LineBreakUtils.getLineBreakPairProperty( LineBreakUtils.getLineBreakPairProperty(
LineBreakUtils.LINE_BREAK_PROPERTY_AL, LineBreakUtils.LINE_BREAK_PROPERTY_AL,
LineBreakUtils.LINE_BREAK_PROPERTY_OP), LineBreakUtils.LINE_BREAK_PROPERTY_OP),
LineBreakUtils.DIRECT_BREAK);
LineBreakUtils.INDIRECT_BREAK);
assertEquals( assertEquals(
LineBreakUtils.getLineBreakPairProperty( LineBreakUtils.getLineBreakPairProperty(
LineBreakUtils.LINE_BREAK_PROPERTY_LF, LineBreakUtils.LINE_BREAK_PROPERTY_LF,

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

import org.junit.Test; 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. * Tests that the constant <code>MinOptMax.ZERO</code> is really zero.

Loading…
Cancel
Save