git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1551536 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_0
@@ -1074,6 +1074,7 @@ NOTE: | |||
<pathelement location="${build.codegen-classes.dir}"/> | |||
</classpath> | |||
<fileset dir="${src.dir}" includes="**/*.java"/> | |||
<fileset dir="${test.dir}" includes="**/*.java"/> | |||
<formatter type="xml" toFile="${build.dir}/report_checkstyle.xml"/> | |||
</checkstyle> | |||
<xslt in="${build.dir}/report_checkstyle.xml" out="${build.dir}/report_checkstyle.html" style="${checkstyle.noframes.xslt}"/> |
@@ -6,4 +6,7 @@ | |||
<suppress files="org/apache/fop/complexscripts/bidi/GenerateBidiTestData.java" checks="SimplifyBooleanReturn"/> | |||
<suppress files="org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java" checks="SimplifyBooleanReturn"/> | |||
<suppress files="org/apache/fop/complexscripts/util/CharScript.java" checks="SimplifyBooleanReturn"/> | |||
<suppress files="org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java" checks="AvoidNestedBlocks"/> | |||
<suppress files="org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java" checks="AvoidNestedBlocks"/> | |||
<suppress files="org/apache/fop/fo/flow/MarkersTestCase.java" checks="LocalVariableName"/> | |||
</suppressions> |
@@ -24,13 +24,15 @@ import java.io.InputStream; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.commons.io.output.ByteArrayOutputStream; | |||
import org.apache.batik.transcoder.Transcoder; | |||
import org.apache.batik.transcoder.TranscoderInput; | |||
import org.apache.batik.transcoder.TranscoderOutput; | |||
import org.apache.commons.io.output.ByteArrayOutputStream; | |||
import static org.apache.fop.FOPTestUtils.getBaseDir; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Basic runtime test for FOP's transcoders. It is used to verify that |
@@ -28,11 +28,13 @@ import javax.xml.transform.TransformerFactory; | |||
import javax.xml.transform.sax.SAXResult; | |||
import javax.xml.transform.stream.StreamSource; | |||
import org.apache.fop.apps.FOPException; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.commons.io.output.ByteArrayOutputStream; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.apps.Fop; | |||
import org.apache.fop.apps.FopFactory; | |||
@@ -40,7 +42,6 @@ import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.cli.InputHandler; | |||
import static org.apache.fop.FOPTestUtils.getBaseDir; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Basic runtime test for the old Fop class. It is used to verify that | |||
@@ -136,7 +137,7 @@ public class BasicDriverTestCase { | |||
InputHandler handler = new InputHandler(xmlFile, xsltFile, null); | |||
try { | |||
handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout); | |||
} catch (FOPException e) {} | |||
} catch (FOPException e) { /* NOP */ } | |||
} | |||
} |
@@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; | |||
* Test suite for basic functionality of FOP's Driver API. | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ BasicDriverTestCase.class }) | |||
@SuiteClasses(BasicDriverTestCase.class) | |||
public class BasicDriverTestSuite { | |||
} |
@@ -20,6 +20,7 @@ | |||
package org.apache.fop; | |||
import org.apache.batik.transcoder.Transcoder; | |||
import org.apache.fop.render.ps.PSTranscoder; | |||
/** |
@@ -25,7 +25,10 @@ import org.apache.fop.logging.LoggingElementListObserver; | |||
/** | |||
* Handles some standard tasks for debugging. | |||
*/ | |||
public class DebugHelper { | |||
public final class DebugHelper { | |||
private DebugHelper() { | |||
} | |||
private static boolean elObserversRegistered = false; | |||
@@ -19,8 +19,6 @@ | |||
package org.apache.fop; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.IOException; | |||
import java.io.StringReader; | |||
import java.security.NoSuchAlgorithmException; | |||
@@ -28,13 +26,16 @@ import java.security.NoSuchAlgorithmException; | |||
import javax.xml.parsers.ParserConfigurationException; | |||
import javax.xml.parsers.SAXParserFactory; | |||
import org.apache.fop.util.DigestFilter; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import org.xml.sax.InputSource; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.XMLReader; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.util.DigestFilter; | |||
/** | |||
* Test case for digesting SAX filter. | |||
* |
@@ -19,10 +19,13 @@ | |||
package org.apache.fop; | |||
import static org.junit.Assert.assertEquals; | |||
import java.util.List; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.layoutmgr.BlockKnuthSequence; | |||
import org.apache.fop.layoutmgr.BreakingAlgorithm; | |||
import org.apache.fop.layoutmgr.ElementListObserver; | |||
@@ -30,8 +33,6 @@ import org.apache.fop.layoutmgr.KnuthBox; | |||
import org.apache.fop.layoutmgr.KnuthGlue; | |||
import org.apache.fop.layoutmgr.KnuthPenalty; | |||
import org.apache.fop.layoutmgr.KnuthSequence; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
/** | |||
* Tests the Knuth algorithm implementation. |
@@ -41,6 +41,9 @@ import org.junit.BeforeClass; | |||
import org.junit.Test; | |||
import org.w3c.dom.Document; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.io.output.ByteArrayOutputStream; | |||
import org.apache.xpath.XPathAPI; | |||
@@ -59,8 +62,6 @@ import org.apache.fop.apps.io.ResourceResolverFactory; | |||
import org.apache.fop.render.xml.XMLRenderer; | |||
import static org.apache.fop.FOPTestUtils.getBaseDir; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Tests URI resolution facilities. |
@@ -19,11 +19,11 @@ | |||
package org.apache.fop.afp; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* Test case for {@link AFPObjectAreaInfo}. | |||
*/ |
@@ -19,11 +19,11 @@ | |||
package org.apache.fop.afp; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* Test case for {@link AFPPaintingState}. | |||
*/ |
@@ -26,13 +26,13 @@ import java.io.IOException; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.xmlgraphics.util.MimeConstants; | |||
import org.apache.fop.apps.io.ResourceResolverFactory; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Test case for {@link AFPResourceManager}. | |||
*/ |
@@ -19,8 +19,6 @@ | |||
package org.apache.fop.afp; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
@@ -29,11 +27,11 @@ import java.util.Arrays; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.fop.afp.util.AFPResourceUtil; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.afp.util.AFPResourceUtil; | |||
/** | |||
* Tests the {@link AFPResourceUtil} class. | |||
@@ -133,7 +131,7 @@ public class AFPResourceUtilTestCase { | |||
* names fails. | |||
* @throws Exception - | |||
*/ | |||
@Test(expected=Exception.class) | |||
@Test(expected = Exception.class) | |||
public void testResourceNameMismatch() throws Exception { | |||
testResource(RESOURCE_NAME_MISMATCH, PSEG_B); | |||
} | |||
@@ -156,6 +154,6 @@ public class AFPResourceUtilTestCase { | |||
} | |||
private interface ResourceCopier { | |||
public void copy(InputStream in, OutputStream out) throws IOException; | |||
void copy(InputStream in, OutputStream out) throws IOException; | |||
} | |||
} |
@@ -16,16 +16,17 @@ | |||
*/ | |||
package org.apache.fop.afp.goca; | |||
import static org.junit.Assert.assertEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.afp.fonts.CharacterSet; | |||
import org.apache.fop.afp.fonts.CharacterSetBuilder; | |||
import org.apache.fop.fonts.Typeface; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
public class GraphicsCharacterStringTestCase { | |||
private GraphicsCharacterString gcsCp500; |
@@ -19,10 +19,6 @@ | |||
package org.apache.fop.afp.modca; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
@@ -30,9 +26,14 @@ import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.apache.fop.afp.Streamable; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.afp.Streamable; | |||
/** | |||
* Tests the {@link AbstractAFPObject} class. | |||
*/ |
@@ -19,12 +19,12 @@ | |||
package org.apache.fop.afp.modca; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.Arrays; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Tests the {@linkplain AbstractAFPObject} class. | |||
*/ |
@@ -21,7 +21,8 @@ package org.apache.fop.afp.modca; | |||
import java.io.IOException; | |||
public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> extends AbstractAFPObjectTest<S> { | |||
public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> | |||
extends AbstractAFPObjectTest<S> { | |||
/** | |||
* Test writeStart() - test that the contract is maintained with |
@@ -19,10 +19,6 @@ | |||
package org.apache.fop.afp.modca; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
@@ -33,6 +29,10 @@ import java.util.List; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.afp.modca.triplets.AbstractTriplet; | |||
import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; | |||
import org.apache.fop.afp.modca.triplets.CommentTriplet; |
@@ -19,16 +19,17 @@ | |||
package org.apache.fop.afp.modca; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import org.apache.fop.afp.util.BinaryUtils; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.afp.util.BinaryUtils; | |||
/** | |||
* Test {@link IncludeObject} | |||
*/ |
@@ -19,11 +19,6 @@ | |||
package org.apache.fop.afp.parser; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.EOFException; | |||
@@ -32,6 +27,11 @@ import java.util.Arrays; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
/** | |||
* MODCAParser and MODCAParser.UnparsedStructuredField Unit tests | |||
*/ |
@@ -24,15 +24,16 @@ import java.io.OutputStream; | |||
import org.junit.Test; | |||
import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; | |||
import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; | |||
import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.times; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; | |||
import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; | |||
import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; | |||
public class TransparentDataControlSequenceTestCase { | |||
private EncodedChars encodedChars; |
@@ -19,6 +19,9 @@ | |||
package org.apache.fop.apps; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.avalon.framework.configuration.Configuration; | |||
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; | |||
@@ -28,9 +31,6 @@ import org.apache.fop.fonts.FontManager; | |||
import org.apache.fop.render.RendererConfig; | |||
import org.apache.fop.render.RendererConfig.RendererConfigParser; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public abstract class AbstractRendererConfigParserTester<B extends RendererConfBuilder, | |||
C extends RendererConfig> { | |||
@@ -24,16 +24,17 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.avalon.framework.configuration.ConfigurationException; | |||
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; | |||
import org.apache.fop.render.PrintRendererConfigurator; | |||
import org.apache.fop.render.intermediate.IFDocumentHandler; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public abstract class AbstractRendererConfiguratorTest<T extends PrintRendererConfigurator, B extends RendererConfBuilder> { | |||
public abstract class AbstractRendererConfiguratorTest<T extends PrintRendererConfigurator, | |||
B extends RendererConfBuilder> { | |||
protected final String mimeType; | |||
protected FOUserAgent userAgent; |
@@ -21,7 +21,6 @@ import java.net.URI; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.mockito.Mockito.mock; | |||
@@ -27,6 +27,12 @@ import java.util.List; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.apps.io.ResourceResolverFactory; | |||
import org.apache.fop.area.AreaTreeHandler; | |||
import org.apache.fop.area.Block; | |||
@@ -45,12 +51,6 @@ import org.apache.fop.layoutmgr.PageSequenceLayoutManager; | |||
import org.apache.fop.layoutmgr.StaticContentLayoutManager; | |||
import org.apache.fop.layoutmgr.inline.ContentLayoutManager; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
/** | |||
* Test case for {@link FopFactoryBuilder}. | |||
*/ |
@@ -24,16 +24,15 @@ import java.io.IOException; | |||
import org.junit.Test; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.config.BaseConstructiveUserConfigTest; | |||
import org.apache.fop.render.RendererConfig.RendererConfigParser; | |||
import org.apache.fop.render.pdf.PDFRendererConfig; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.fail; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.config.BaseConstructiveUserConfigTest; | |||
import org.apache.fop.render.RendererConfig.RendererConfigParser; | |||
import org.apache.fop.render.pdf.PDFRendererConfig; | |||
public class FopFactoryTestCase extends BaseConstructiveUserConfigTest { | |||
public FopFactoryTestCase() throws SAXException, IOException { |
@@ -22,10 +22,8 @@ package org.apache.fop.apps; | |||
import org.w3c.dom.Element; | |||
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; | |||
import org.apache.fop.pdf.PDFEncryptionParams; | |||
import org.apache.fop.render.RendererConfigOption; | |||
import org.apache.fop.render.pdf.PDFEncryptionOption; | |||
import org.apache.fop.render.pdf.PDFRendererOption; | |||
import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_LENGTH; | |||
import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_PARAMS; |
@@ -34,6 +34,8 @@ import javax.xml.transform.stream.StreamSource; | |||
import org.xml.sax.SAXException; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.io.output.ByteArrayOutputStream; | |||
@@ -48,7 +50,6 @@ import org.apache.fop.apps.FopFactoryBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import static org.apache.fop.FOPTestUtils.getBaseDir; | |||
import static org.junit.Assert.assertTrue; | |||
public abstract class BaseURIResolutionTest { | |||
@@ -33,14 +33,13 @@ import javax.xml.transform.TransformerException; | |||
import org.junit.Test; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.xmlgraphics.io.Resource; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
public class FontURIResolver extends BaseURIResolutionTest { | |||
public enum Event { |
@@ -19,13 +19,13 @@ | |||
package org.apache.fop.area; | |||
import java.awt.Rectangle; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import java.awt.Rectangle; | |||
/** | |||
* Tests implementations of the {@linkplain Viewport} interface. | |||
*/ |
@@ -19,11 +19,12 @@ | |||
package org.apache.fop.area; | |||
import org.apache.fop.area.inline.InlineViewportTestCase; | |||
import org.junit.runner.RunWith; | |||
import org.junit.runners.Suite; | |||
import org.junit.runners.Suite.SuiteClasses; | |||
import org.apache.fop.area.inline.InlineViewportTestCase; | |||
/** | |||
* A suite of all the tests relating to the {@linkplain Viewport} interface. | |||
*/ |
@@ -19,9 +19,10 @@ | |||
package org.apache.fop.area.inline; | |||
import org.apache.fop.area.ViewportTest; | |||
import org.junit.Test; | |||
import org.apache.fop.area.ViewportTest; | |||
/** | |||
* Tests the {@linkplain InlineViewport} class. | |||
*/ |
@@ -37,7 +37,7 @@ public abstract class ChecksFactory<C extends Check> { | |||
/** | |||
* A factory to create a particular kind of check. | |||
*/ | |||
protected static interface CheckFactory<C> { | |||
protected interface CheckFactory<C> { | |||
/** | |||
* Creates a {@link Check} instance from the given XML element. |
@@ -19,15 +19,16 @@ | |||
package org.apache.fop.cli; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.IOException; | |||
import org.apache.fop.apps.FOPException; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.apps.FOPException; | |||
public class CommandLineOptionsTestCase { | |||
private final CommandLineOptions clo = new CommandLineOptions(); |
@@ -19,26 +19,23 @@ | |||
package org.apache.fop.complexscripts.bidi; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.complexscripts.bidi.UnicodeBidiAlgorithm; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.fail; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
/** | |||
* <p>Test case for Unicode Bidi Algorithm.</p> | |||
* @author Glenn Adams | |||
*/ | |||
public class BidiAlgorithmTestCase { | |||
/** | |||
* logging instance | |||
*/ | |||
private static final Log log = LogFactory.getLog(BidiAlgorithmTestCase.class); // CSOK: ConstantNameCheck | |||
private static final Log log = LogFactory.getLog(BidiAlgorithmTestCase.class); | |||
/** | |||
* Concatenated array of <test-set,test-sequence> tuples | |||
@@ -122,7 +119,7 @@ public class BidiAlgorithmTestCase { | |||
} | |||
if (includeSequence(testSet, testSequence)) { | |||
includedSequences++; | |||
if (! excludeSequence(testSet, testSequence)) { | |||
if (!excludeSequence(testSet, testSequence)) { | |||
if (testBidiAlgorithm(testSet, testSequence, la, ra, ta, bs)) { | |||
passedSequences++; | |||
} | |||
@@ -151,7 +148,7 @@ public class BidiAlgorithmTestCase { | |||
} | |||
private boolean includeSequence(int testSet, int testSequence) { | |||
if (! includeTestSet(testSet)) { | |||
if (!includeTestSet(testSet)) { | |||
return false; | |||
} else { | |||
for (int i = 0, n = INCLUSIONS.length / 2; i < n; i++) { | |||
@@ -196,7 +193,8 @@ public class BidiAlgorithmTestCase { | |||
return false; | |||
} | |||
private boolean testBidiAlgorithm(int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) throws Exception { | |||
private boolean testBidiAlgorithm(int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) | |||
throws Exception { | |||
boolean passed = true; | |||
int n = la.length; | |||
if (ra.length != n) { | |||
@@ -211,14 +209,14 @@ public class BidiAlgorithmTestCase { | |||
// LTR | |||
if ((bs & 2) != 0) { | |||
int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 0, new int [ n ], true); | |||
if (! verifyResults(la, levels, ta, 0, testSet, testSequence)) { | |||
if (!verifyResults(la, levels, ta, 0, testSet, testSequence)) { | |||
passed = false; | |||
} | |||
} | |||
// RTL | |||
if ((bs & 4) != 0) { | |||
int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 1, new int [ n ], true); | |||
if (! verifyResults(la, levels, ta, 1, testSet, testSequence)) { | |||
if (!verifyResults(la, levels, ta, 1, testSet, testSequence)) { | |||
passed = false; | |||
} | |||
} |
@@ -19,14 +19,13 @@ | |||
package org.apache.fop.complexscripts.bidi; | |||
import org.apache.fop.complexscripts.bidi.BidiClass; | |||
import org.apache.fop.util.CharUtilities; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.util.CharUtilities; | |||
public class BidiClassTestCase { | |||
@Test | |||
@@ -46,8 +45,8 @@ public class BidiClassTestCase { | |||
private void testBidiClass(int[] da) throws Exception { | |||
int bc = da[0]; | |||
for (int i = 1, n = da.length; i < n; i += 2) { | |||
int s = da[i+0]; | |||
int e = da[i+1]; | |||
int s = da[i + 0]; | |||
int e = da[i + 1]; | |||
for (int c = s; c < e; c++) { | |||
int cbc = BidiClass.getBidiClass(c); | |||
assertEquals("bad bidi class for CH(" + CharUtilities.format(c) + ")", bc, cbc); |
@@ -65,7 +65,7 @@ public final class BidiTestData { | |||
data = null; | |||
} finally { | |||
if (is != null) { | |||
try { is.close(); } catch (Exception e) {} | |||
try { is.close(); } catch (Exception e) { /* NOP */ } | |||
} | |||
} | |||
return data; |
@@ -21,21 +21,14 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.io.File; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphDefinitionSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphContextTester; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
public class GDEFTestCase { | |||
private static String ttxFilesRoot = "test/resources/complexscripts"; |
@@ -20,18 +20,6 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.io.File; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphContextTester; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.apache.fop.complexscripts.util.ScriptContextTester; | |||
import org.junit.Test; | |||
@@ -40,6 +28,14 @@ import static org.junit.Assert.assertNotNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphContextTester; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.apache.fop.complexscripts.util.ScriptContextTester; | |||
// CSOFF: LineLength | |||
public class GPOSTestCase implements ScriptContextTester, GlyphContextTester { | |||
private static String ttxFilesRoot = "test/resources/complexscripts"; |
@@ -21,18 +21,6 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.io.File; | |||
import java.nio.IntBuffer; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphContextTester; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.apache.fop.complexscripts.util.ScriptContextTester; | |||
import org.junit.Test; | |||
@@ -41,6 +29,14 @@ import static org.junit.Assert.assertNotNull; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphContextTester; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.apache.fop.complexscripts.util.ScriptContextTester; | |||
// CSOFF: LineLength | |||
public class GSUBTestCase implements ScriptContextTester, GlyphContextTester { | |||
private static String ttxFilesRoot = "test/resources/complexscripts"; |
@@ -21,11 +21,9 @@ package org.apache.fop.complexscripts.fonts.ttx; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.nio.IntBuffer; | |||
import java.util.Arrays; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Comparator; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
@@ -41,21 +39,23 @@ import javax.xml.parsers.ParserConfigurationException; | |||
import javax.xml.parsers.SAXParser; | |||
import javax.xml.parsers.SAXParserFactory; | |||
import org.xml.sax.Attributes; | |||
import org.xml.sax.Locator; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.helpers.DefaultHandler; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.complexscripts.fonts.GlyphClassTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphCoverageTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphDefinitionSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphMappingTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Anchor; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.MarkAnchor; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.PairValues; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Value; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.Ligature; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.LigatureSet; | |||
@@ -66,11 +66,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.apache.fop.complexscripts.util.UTF32; | |||
import org.apache.fop.util.CharUtilities; | |||
import org.xml.sax.Attributes; | |||
import org.xml.sax.Locator; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.helpers.DefaultHandler; | |||
// CSOFF: LineLengthCheck | |||
@@ -87,8 +82,6 @@ import org.xml.sax.helpers.DefaultHandler; | |||
* files directly in the FOP distribution. In such cases, <code>TTX</code> files are used | |||
* to distribute a subset of the complex script advanced table information contained in | |||
* certain font files to facilitate testing. | |||
* | |||
* @author Glenn Adams | |||
*/ | |||
public class TTXFile { | |||
@@ -100,22 +93,22 @@ public class TTXFile { | |||
private static final String DEFAULT_LANGUAGE_TAG = "dflt"; | |||
/** ttxfile cache */ | |||
private static Map<String,TTXFile> cache = new HashMap<String,TTXFile>(); | |||
private static Map<String, TTXFile> cache = new HashMap<String, TTXFile>(); | |||
// transient parsing state | |||
private Locator locator; // current document locator | |||
private Stack<String[]> elements; // stack of ttx elements being parsed | |||
private Map<String,Integer> glyphIds; // map of glyph names to glyph identifiers | |||
private Map<String, Integer> glyphIds; // map of glyph names to glyph identifiers | |||
private List<int[]> cmapEntries; // list of <charCode,glyphCode> pairs | |||
private Vector<int[]> hmtxEntries; // vector of <width,lsb> pairs | |||
private Map<String,Integer> glyphClasses; // map of glyph names to glyph classes | |||
private Map<String,Map<String,List<String>>> scripts; // map of script tag to Map<language-tag,List<features-id>>> | |||
private Map<String,List<String>> languages; // map of language tag to List<feature-id> | |||
private Map<String,Object[]> features; // map of feature id to Object[2] : { feature-tag, List<lookup-id> } | |||
private Map<String, Integer> glyphClasses; // map of glyph names to glyph classes | |||
private Map<String, Map<String, List<String>>> scripts; // map of script tag to Map<language-tag,List<features-id>>> | |||
private Map<String, List<String>> languages; // map of language tag to List<feature-id> | |||
private Map<String, Object[]> features; // map of feature id to Object[2] : { feature-tag, List<lookup-id> } | |||
private List<String> languageFeatures; // list of language system feature ids, where first is (possibly null) required feature id | |||
private List<String> featureLookups; // list of lookup ids for feature being constructed | |||
private List<Integer> coverageEntries; // list of entries for coverage table being constructed | |||
private Map<String,GlyphCoverageTable> coverages; // map of coverage table keys to coverage tables | |||
private Map<String, GlyphCoverageTable> coverages; // map of coverage table keys to coverage tables | |||
private List subtableEntries; // list of lookup subtable entries | |||
private List<GlyphSubtable> subtables; // list of constructed subtables | |||
private List<Integer> alternates; // list of alternates in alternate set being constructed | |||
@@ -162,8 +155,8 @@ public class TTXFile { | |||
// resultant state | |||
private int upem; // units per em | |||
private Map<Integer,Integer> cmap; // constructed character map | |||
private Map<Integer,Integer> gmap; // constructed glyph map | |||
private Map<Integer, Integer> cmap; // constructed character map | |||
private Map<Integer, Integer> gmap; // constructed glyph map | |||
private int[][] hmtx; // constructed horizontal metrics - array of design { width, lsb } pairs, indexed by glyph code | |||
private int[] widths; // pdf normalized widths (millipoints) | |||
private GlyphDefinitionTable gdef; // constructed glyph definition table | |||
@@ -172,17 +165,17 @@ public class TTXFile { | |||
public TTXFile() { | |||
elements = new Stack<String[]>(); | |||
glyphIds = new HashMap<String,Integer>(); | |||
glyphIds = new HashMap<String, Integer>(); | |||
cmapEntries = new ArrayList<int[]>(); | |||
hmtxEntries = new Vector<int[]>(); | |||
glyphClasses = new HashMap<String,Integer>(); | |||
scripts = new HashMap<String,Map<String,List<String>>>(); | |||
languages = new HashMap<String,List<String>>(); | |||
features = new HashMap<String,Object[]>(); | |||
glyphClasses = new HashMap<String, Integer>(); | |||
scripts = new HashMap<String, Map<String, List<String>>>(); | |||
languages = new HashMap<String, List<String>>(); | |||
features = new HashMap<String, Object[]>(); | |||
languageFeatures = new ArrayList<String>(); | |||
featureLookups = new ArrayList<String>(); | |||
coverageEntries = new ArrayList<Integer>(); | |||
coverages = new HashMap<String,GlyphCoverageTable>(); | |||
coverages = new HashMap<String, GlyphCoverageTable>(); | |||
subtableEntries = new ArrayList(); | |||
subtables = new ArrayList<GlyphSubtable>(); | |||
alternates = new ArrayList<Integer>(); | |||
@@ -342,7 +335,7 @@ public class TTXFile { | |||
long rest1 = tw % upem; | |||
long storrest = 1000 * rest1; | |||
long ledd2 = (storrest != 0) ? (rest1 / storrest) : 0; | |||
pw = - ((-1000 * tw) / upem - (int) ledd2); | |||
pw = -((-1000 * tw) / upem - (int) ledd2); | |||
} else { | |||
pw = (tw / upem) * 1000 + ((tw % upem) * 1000) / upem; | |||
} | |||
@@ -370,7 +363,7 @@ public class TTXFile { | |||
public static synchronized void clearCache() { | |||
cache.clear(); | |||
} | |||
private class Handler extends DefaultHandler { | |||
private final class Handler extends DefaultHandler { | |||
private Handler() { | |||
} | |||
@Override | |||
@@ -493,7 +486,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("BaseArray")) { | |||
String[] pn = new String[] { null, "MarkBasePos" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("BaseCoverage")) { | |||
@@ -587,7 +580,7 @@ public class TTXFile { | |||
if (glyphClass == null) { | |||
missingRequiredAttribute(en, "class"); | |||
} | |||
if (! glyphIds.containsKey(glyph)) { | |||
if (!glyphIds.containsKey(glyph)) { | |||
unsupportedGlyph(en, glyph); | |||
} else if (isParent(pn1)) { | |||
if (glyphClasses.containsKey(glyph)) { | |||
@@ -675,7 +668,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("DefaultLangSys")) { | |||
String[] pn = new String[] { null, "Script" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} else { | |||
assertLanguageFeaturesClear(); | |||
@@ -718,7 +711,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("Feature")) { | |||
String[] pn = new String[] { null, "FeatureRecord" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} else { | |||
assertFeatureLookupsClear(); | |||
@@ -752,7 +745,7 @@ public class TTXFile { | |||
String[] pn1 = new String[] { null, "GSUB" }; | |||
String[] pn2 = new String[] { null, "GPOS" }; | |||
String[][] pnx = new String[][] { pn1, pn2 }; | |||
if (! isParent(pnx)) { | |||
if (!isParent(pnx)) { | |||
notPermittedInElementContext(en, getParent(), pnx); | |||
} | |||
} else if (en[1].equals("FeatureRecord")) { | |||
@@ -885,7 +878,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("GlyphOrder")) { | |||
String[] pn = new String[] { null, "ttFont" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("InputCoverage")) { | |||
@@ -923,7 +916,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("LangSys")) { | |||
String[] pn = new String[] { null, "LangSysRecord" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} else { | |||
assertLanguageFeaturesClear(); | |||
@@ -953,7 +946,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("LigCaretList")) { | |||
String[] pn = new String[] { null, "GDEF" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("Ligature")) { | |||
@@ -991,7 +984,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("LigatureArray")) { | |||
String[] pn = new String[] { null, "MarkLigPos" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("LigatureAttach")) { | |||
@@ -1139,7 +1132,7 @@ public class TTXFile { | |||
String[] pn1 = new String[] { null, "GSUB" }; | |||
String[] pn2 = new String[] { null, "GPOS" }; | |||
String[][] pnx = new String[][] { pn1, pn2 }; | |||
if (! isParent(pnx)) { | |||
if (!isParent(pnx)) { | |||
notPermittedInElementContext(en, getParent(), pnx); | |||
} | |||
} else if (en[1].equals("LookupListIndex")) { | |||
@@ -1179,7 +1172,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("Mark1Array")) { | |||
String[] pn = new String[] { null, "MarkMarkPos" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("Mark1Coverage")) { | |||
@@ -1220,7 +1213,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("Mark2Array")) { | |||
String[] pn = new String[] { null, "MarkMarkPos" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("Mark2Coverage")) { | |||
@@ -1273,7 +1266,7 @@ public class TTXFile { | |||
String[] pn1 = new String[] { null, "MarkBasePos" }; | |||
String[] pn2 = new String[] { null, "MarkLigPos" }; | |||
String[][] pnx = new String[][] { pn1, pn2 }; | |||
if (! isParent(pnx)) { | |||
if (!isParent(pnx)) { | |||
notPermittedInElementContext(en, getParent(), pnx); | |||
} | |||
} else if (en[1].equals("MarkAttachClassDef")) { | |||
@@ -1549,14 +1542,14 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("Script")) { | |||
String[] pn = new String[] { null, "ScriptRecord" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("ScriptList")) { | |||
String[] pn1 = new String[] { null, "GSUB" }; | |||
String[] pn2 = new String[] { null, "GPOS" }; | |||
String[][] pnx = new String[][] { pn1, pn2 }; | |||
if (! isParent(pnx)) { | |||
if (!isParent(pnx)) { | |||
notPermittedInElementContext(en, getParent(), pnx); | |||
} | |||
} else if (en[1].equals("ScriptRecord")) { | |||
@@ -1890,7 +1883,7 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("cmap")) { | |||
String[] pn = new String[] { null, "ttFont" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("cmap_format_0")) { | |||
@@ -1997,12 +1990,12 @@ public class TTXFile { | |||
} | |||
} else if (en[1].equals("head")) { | |||
String[] pn = new String[] { null, "ttFont" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} | |||
} else if (en[1].equals("hmtx")) { | |||
String[] pn = new String[] { null, "ttFont" }; | |||
if (! isParent(pn)) { | |||
if (!isParent(pn)) { | |||
notPermittedInElementContext(en, getParent(), pn); | |||
} else if (glyphIdMax > 0) { | |||
hmtxEntries.setSize(glyphIdMax + 1); | |||
@@ -2216,7 +2209,7 @@ public class TTXFile { | |||
throw new SAXException("element stack is empty, elements are not balanced"); | |||
} | |||
String[] en = makeExpandedName(uri, localName, qName); | |||
if (! sameExpandedName(enParent, en)) { | |||
if (!sameExpandedName(enParent, en)) { | |||
throw new SAXException("element stack is unbalanced, expanded name mismatch"); | |||
} | |||
if (en[0] != null) { | |||
@@ -2244,7 +2237,7 @@ public class TTXFile { | |||
} else if (en[1].equals("AlternateSet")) { | |||
subtableEntries.add(extractAlternates()); | |||
} else if (en[1].equals("AlternateSubst")) { | |||
if (! sortEntries(coverageEntries, subtableEntries)) { | |||
if (!sortEntries(coverageEntries, subtableEntries)) { | |||
mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); | |||
} | |||
addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_ALTERNATE, extractCoverage()); | |||
@@ -2262,9 +2255,9 @@ public class TTXFile { | |||
} else if (en[1].equals("ChainContextPos") || en[1].equals("ChainContextSubst")) { | |||
GlyphCoverageTable coverage = null; | |||
if (stFormat == 3) { | |||
GlyphCoverageTable igca[] = getCoveragesWithPrefix("in"); | |||
GlyphCoverageTable bgca[] = getCoveragesWithPrefix("bk"); | |||
GlyphCoverageTable lgca[] = getCoveragesWithPrefix("la"); | |||
GlyphCoverageTable[] igca = getCoveragesWithPrefix("in"); | |||
GlyphCoverageTable[] bgca = getCoveragesWithPrefix("bk"); | |||
GlyphCoverageTable[] lgca = getCoveragesWithPrefix("la"); | |||
if ((igca.length == 0) || hasMissingCoverage(igca)) { | |||
missingCoverage(en, "input", igca.length); | |||
} else if (hasMissingCoverage(bgca)) { | |||
@@ -2363,7 +2356,7 @@ public class TTXFile { | |||
} else if (en[1].equals("LigatureSet")) { | |||
subtableEntries.add(extractLigatures()); | |||
} else if (en[1].equals("LigatureSubst")) { | |||
if (! sortEntries(coverageEntries, subtableEntries)) { | |||
if (!sortEntries(coverageEntries, subtableEntries)) { | |||
mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); | |||
} | |||
GlyphCoverageTable coverage = extractCoverage(); | |||
@@ -2475,7 +2468,8 @@ public class TTXFile { | |||
} | |||
GlyphCoverageTable coverage = coverages.get("main"); | |||
addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_PAIR, coverage); | |||
vf1 = vf2 = -1; psIndex = -1; | |||
vf1 = vf2 = -1; | |||
psIndex = -1; | |||
} else if (en[1].equals("PairSet")) { | |||
if (psIndex != pairSets.size()) { | |||
invalidIndex(en, psIndex, pairSets.size()); | |||
@@ -2528,7 +2522,7 @@ public class TTXFile { | |||
addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_SINGLE, coverage); | |||
vf1 = -1; | |||
} else if (en[1].equals("SingleSubst")) { | |||
if (! sortEntries(coverageEntries, subtableEntries)) { | |||
if (!sortEntries(coverageEntries, subtableEntries)) { | |||
mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); | |||
} | |||
GlyphCoverageTable coverage = extractCoverage(); | |||
@@ -2556,7 +2550,7 @@ public class TTXFile { | |||
public void characters(char[] chars, int start, int length) { | |||
} | |||
private String[] getParent() { | |||
if (! elements.empty()) { | |||
if (!elements.empty()) { | |||
return elements.peek(); | |||
} else { | |||
return new String[] { null, null }; | |||
@@ -2572,13 +2566,11 @@ public class TTXFile { | |||
return false; | |||
} else if (enx instanceof String[]) { | |||
String[] en = (String[]) enx; | |||
if (! elements.empty()) { | |||
if (!elements.empty()) { | |||
String[] pn = elements.peek(); | |||
return (pn != null) && sameExpandedName(en, pn); | |||
} else if ((en[0] == null) && (en[1] == null)) { | |||
return true; | |||
} else { | |||
return false; | |||
return ((en[0] == null) && (en[1] == null)); | |||
} | |||
} else { | |||
return false; | |||
@@ -2595,14 +2587,12 @@ public class TTXFile { | |||
return true; | |||
} else if (ln.equals("MarkAnchor")) { | |||
return true; | |||
} else if (ln.equals("Mark2Anchor")) { | |||
return true; | |||
} else { | |||
return false; | |||
return ln.equals("Mark2Anchor"); | |||
} | |||
} | |||
private Map<Integer,Integer> getCMAP() { | |||
Map<Integer,Integer> cmap = new TreeMap(); | |||
private Map<Integer, Integer> getCMAP() { | |||
Map<Integer, Integer> cmap = new TreeMap(); | |||
for (int[] cme : cmapEntries) { | |||
Integer c = Integer.valueOf(cme[0]); | |||
Integer g = Integer.valueOf(cme[1]); | |||
@@ -2610,8 +2600,8 @@ public class TTXFile { | |||
} | |||
return cmap; | |||
} | |||
private Map<Integer,Integer> getGMAP() { | |||
Map<Integer,Integer> gmap = new TreeMap(); | |||
private Map<Integer, Integer> getGMAP() { | |||
Map<Integer, Integer> gmap = new TreeMap(); | |||
for (int[] cme : cmapEntries) { | |||
Integer c = Integer.valueOf(cme[0]); | |||
Integer g = Integer.valueOf(cme[1]); | |||
@@ -2631,7 +2621,7 @@ public class TTXFile { | |||
} | |||
return hmtx; | |||
} | |||
private GlyphClassTable extractClassDefMapping(Map<String,Integer> glyphClasses, int format, boolean clearSourceMap) { | |||
private GlyphClassTable extractClassDefMapping(Map<String, Integer> glyphClasses, int format, boolean clearSourceMap) { | |||
GlyphClassTable ct; | |||
if (format == 1) { | |||
ct = extractClassDefMapping1(extractClassMappings(glyphClasses, clearSourceMap)); | |||
@@ -2685,11 +2675,11 @@ public class TTXFile { | |||
} | |||
return GlyphClassTable.createClassTable(entries); | |||
} | |||
private int[][] extractClassMappings(Map<String,Integer> glyphClasses, boolean clearSourceMap) { | |||
private int[][] extractClassMappings(Map<String, Integer> glyphClasses, boolean clearSourceMap) { | |||
int nc = glyphClasses.size(); | |||
int i = 0; | |||
int[][] cma = new int [ nc ] [ 2 ]; | |||
for (Map.Entry<String,Integer> e : glyphClasses.entrySet()) { | |||
for (Map.Entry<String, Integer> e : glyphClasses.entrySet()) { | |||
Integer gid = glyphIds.get(e.getKey()); | |||
assert gid != null; | |||
int[] m = cma [ i ]; | |||
@@ -2856,8 +2846,8 @@ public class TTXFile { | |||
private void clearLanguageFeatures() { | |||
languageFeatures.clear(); | |||
} | |||
private Map<String,List<String>> extractLanguages() { | |||
Map<String,List<String>> lm = new HashMap(languages); | |||
private Map<String, List<String>> extractLanguages() { | |||
Map<String, List<String>> lm = new HashMap(languages); | |||
clearLanguages(); | |||
return lm; | |||
} | |||
@@ -2923,10 +2913,10 @@ public class TTXFile { | |||
ltFlags = 0; | |||
clearSubtablesInLookup(); | |||
} | |||
private Map<GlyphTable.LookupSpec,List<String>> extractLookups() { | |||
Map<GlyphTable.LookupSpec,List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec,List<String>>(); | |||
private Map<GlyphTable.LookupSpec, List<String>> extractLookups() { | |||
Map<GlyphTable.LookupSpec, List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec, List<String>>(); | |||
for (String st : scripts.keySet()) { | |||
Map<String,List<String>> lm = scripts.get(st); | |||
Map<String, List<String>> lm = scripts.get(st); | |||
if (lm != null) { | |||
for (String lt : lm.keySet()) { | |||
List<String> fids = lm.get(lt); | |||
@@ -3062,7 +3052,7 @@ public class TTXFile { | |||
missingParameter(en, "xAdvance"); | |||
} | |||
String yAdvance = attrs.getValue("YAdvance"); | |||
int ya = 0;; | |||
int ya = 0; | |||
if (yAdvance != null) { | |||
ya = Integer.parseInt(yAdvance); | |||
} else if ((format & GlyphPositioningTable.Value.Y_ADVANCE) != 0) { | |||
@@ -3207,7 +3197,7 @@ public class TTXFile { | |||
if (cm != null) { | |||
for (Anchor[] aa : cm) { | |||
if (aa != null) { | |||
int nc = aa.length;; | |||
int nc = aa.length; | |||
if (nc > ncMax) { | |||
ncMax = nc; | |||
} | |||
@@ -3223,7 +3213,7 @@ public class TTXFile { | |||
if (lam != null) { | |||
for (Anchor[][] cm : lam) { | |||
if (cm != null) { | |||
int nx = cm.length;; | |||
int nx = cm.length; | |||
if (nx > nxMax) { | |||
nxMax = nx; | |||
} | |||
@@ -3424,7 +3414,7 @@ public class TTXFile { | |||
return false; | |||
} | |||
if ((u1 != null) && (u2 != null)) { | |||
if (! u1.equals(u2)) { | |||
if (!u1.equals(u2)) { | |||
return false; | |||
} | |||
} | |||
@@ -3434,7 +3424,7 @@ public class TTXFile { | |||
return false; | |||
} | |||
if ((l1 != null) && (l2 != null)) { | |||
if (! l1.equals(l2)) { | |||
if (!l1.equals(l2)) { | |||
return false; | |||
} | |||
} |
@@ -29,8 +29,6 @@ import org.apache.fop.complexscripts.scripts.arabic.ArabicTestCase; | |||
* Test suite for script specific functionality related to complex scripts. | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ | |||
ArabicTestCase.class | |||
}) | |||
@SuiteClasses(ArabicTestCase.class) | |||
public class ScriptsTestSuite { | |||
} |
@@ -21,30 +21,26 @@ package org.apache.fop.complexscripts.scripts.arabic; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FilenameFilter; | |||
import java.io.FileNotFoundException; | |||
import java.io.FileOutputStream; | |||
import java.io.FilenameFilter; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.io.LineNumberReader; | |||
import java.io.ObjectInputStream; | |||
import java.nio.IntBuffer; | |||
import java.nio.charset.Charset; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
import org.junit.BeforeClass; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; | |||
import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; | |||
import org.apache.fop.complexscripts.fonts.ttx.TTXFile; | |||
import org.apache.fop.complexscripts.util.GlyphSequence; | |||
// CSOFF: LineLength | |||
/** | |||
* Tests for functionality related to the arabic script. | |||
*/ | |||
@@ -52,9 +48,9 @@ public class ArabicTestCase implements ArabicTestConstants { | |||
@Test | |||
public void testArabicWordForms() { | |||
for (String sfn : srcFiles) { | |||
for (String sfn : SRC_FILES) { | |||
try { | |||
processWordForms(new File(datFilesDir)); | |||
processWordForms(new File(DAT_FILES_DIR)); | |||
} catch (Exception e) { | |||
fail(e.getMessage()); | |||
} | |||
@@ -72,7 +68,7 @@ public class ArabicTestCase implements ArabicTestConstants { | |||
private String[] listWordFormFiles(File dfd) { | |||
return dfd.list(new FilenameFilter() { | |||
public boolean accept(File f, String name) { | |||
return hasPrefixFrom(name, srcFiles) && hasExtension(name, WF_FILE_DAT_EXT); | |||
return hasPrefixFrom(name, SRC_FILES) && hasExtension(name, WF_FILE_DAT_EXT); | |||
} | |||
private boolean hasPrefixFrom(String name, String[] prefixes) { | |||
for (String p : prefixes) { | |||
@@ -108,7 +104,7 @@ public class ArabicTestCase implements ArabicTestConstants { | |||
throw new RuntimeException(e.getMessage(), e); | |||
} finally { | |||
if (fis != null) { | |||
try { fis.close(); } catch (Exception e) {} | |||
try { fis.close(); } catch (Exception e) { /* NOP */ } | |||
} | |||
} | |||
} | |||
@@ -129,7 +125,7 @@ public class ArabicTestCase implements ArabicTestConstants { | |||
script = (String) d[0]; | |||
language = (String) d[1]; | |||
tfn = (String) d[3]; | |||
tf = TTXFile.getFromCache(ttxFontsDir + File.separator + tfn); | |||
tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); | |||
assertTrue(tf != null); | |||
gsub = tf.getGSUB(); | |||
assertTrue(gsub != null); |
@@ -24,22 +24,22 @@ package org.apache.fop.complexscripts.scripts.arabic; | |||
*/ | |||
public interface ArabicTestConstants { | |||
final String WF_FILE_SCRIPT = "arab"; | |||
final String WF_FILE_LANGUAGE = "dflt"; | |||
String WF_FILE_SCRIPT = "arab"; | |||
String WF_FILE_LANGUAGE = "dflt"; | |||
String srcFilesDir = "test/resources/complexscripts/arab/data"; | |||
String datFilesDir = "test/resources/complexscripts/arab/data"; | |||
String SRC_FILES_DIR = "test/resources/complexscripts/arab/data"; | |||
String DAT_FILES_DIR = "test/resources/complexscripts/arab/data"; | |||
String[] srcFiles = { | |||
String[] SRC_FILES = { | |||
"arab-001", // unpointed word forms | |||
}; | |||
final String WF_FILE_SRC_EXT = "txt"; | |||
final String WF_FILE_DAT_EXT = "ser"; | |||
String WF_FILE_SRC_EXT = "txt"; | |||
String WF_FILE_DAT_EXT = "ser"; | |||
String ttxFontsDir = "test/resources/complexscripts/arab/ttx"; | |||
String TTX_FONTS_DIR = "test/resources/complexscripts/arab/ttx"; | |||
String[] ttxFonts = { | |||
String[] TTX_FONTS = { | |||
"arab-001.ttx", // simplified arabic | |||
"arab-002.ttx", // traditional arabic | |||
"arab-003.ttx", // lateef |
@@ -40,7 +40,10 @@ import org.apache.fop.complexscripts.util.GlyphSequence; | |||
/** | |||
* Tests for functionality related to the arabic script. | |||
*/ | |||
public class GenerateArabicTestData implements ArabicTestConstants { | |||
public final class GenerateArabicTestData implements ArabicTestConstants { | |||
private GenerateArabicTestData() { | |||
} | |||
public static void main(String[] args) { | |||
boolean compile = false; | |||
@@ -69,9 +72,9 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
} | |||
private static void compile() { | |||
for (String sfn : srcFiles) { | |||
for (String sfn : SRC_FILES) { | |||
try { | |||
String spn = srcFilesDir + File.separator + sfn + "." + WF_FILE_SRC_EXT; | |||
String spn = SRC_FILES_DIR + File.separator + sfn + "." + WF_FILE_SRC_EXT; | |||
compile(WF_FILE_SCRIPT, WF_FILE_LANGUAGE, spn); | |||
} catch (Exception e) { | |||
System.err.println(e.getMessage()); | |||
@@ -81,8 +84,8 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
private static void compile(String script, String language, String spn) { | |||
int fno = 0; | |||
for (String tfn : ttxFonts) { | |||
TTXFile tf = TTXFile.getFromCache(ttxFontsDir + File.separator + tfn); | |||
for (String tfn : TTX_FONTS) { | |||
TTXFile tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); | |||
assert tf != null; | |||
List data = compile(script, language, spn, tfn, tf); | |||
output(makeDataPathName(spn, fno++), data); | |||
@@ -106,7 +109,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
GlyphSequence igs = tf.mapCharsToGlyphs(wf); | |||
GlyphSequence ogs = gsub.substitute(igs, script, language); | |||
int[][] paa = new int [ ogs.getGlyphCount() ] [ 4 ]; | |||
if (! gpos.position(ogs, script, language, 1000, widths, paa)) { | |||
if (!gpos.position(ogs, script, language, 1000, widths, paa)) { | |||
paa = null; | |||
} | |||
data.add(new Object[] { wf, getGlyphs(igs), getGlyphs(ogs), paa }); | |||
@@ -121,7 +124,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
throw new RuntimeException(e.getMessage(), e); | |||
} finally { | |||
if (fis != null) { | |||
try { fis.close(); } catch (Exception e) {} | |||
try { fis.close(); } catch (Exception e) { /* NOP */ } | |||
} | |||
} | |||
} else { | |||
@@ -142,7 +145,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
private static String makeDataPathName(String spn, int fno) { | |||
File f = new File(spn); | |||
return datFilesDir + File.separator + stripExtension(f.getName()) + "-f" + fno + "." + WF_FILE_DAT_EXT; | |||
return DAT_FILES_DIR + File.separator + stripExtension(f.getName()) + "-f" + fno + "." + WF_FILE_DAT_EXT; | |||
} | |||
private static String stripExtension(String s) { | |||
@@ -171,7 +174,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { | |||
throw new RuntimeException(e.getMessage(), e); | |||
} finally { | |||
if (fos != null) { | |||
try { fos.close(); } catch (Exception e) {} | |||
try { fos.close(); } catch (Exception e) { /* NOP */ } | |||
} | |||
} | |||
} |
@@ -30,12 +30,10 @@ import static org.junit.Assert.assertEquals; | |||
/** | |||
* Test number converter functionality. | |||
* | |||
* @author Glenn Adams | |||
*/ | |||
public class NumberConverterTestCase { | |||
static private String[][] formatDecimal = | |||
private static String[][] formatDecimal = | |||
{ | |||
{ "1" }, | |||
{ "0", "0" }, | |||
@@ -45,7 +43,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "1000000000" }, | |||
}; | |||
static private String[][] formatDecimalPadded = | |||
private static String[][] formatDecimalPadded = | |||
{ | |||
{ "001" }, | |||
{ "0", "000" }, | |||
@@ -58,7 +56,7 @@ public class NumberConverterTestCase { | |||
{ "1000", "1000" }, | |||
}; | |||
static private String[][] formatDecimalGrouped = | |||
private static String[][] formatDecimalGrouped = | |||
{ | |||
{ "1", ",", "1" }, | |||
{ "0", "0" }, | |||
@@ -68,7 +66,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "1,0,0,0,0,0,0,0,0,0" }, | |||
}; | |||
static private String[][] formatDecimalGroupedPadded = | |||
private static String[][] formatDecimalGroupedPadded = | |||
{ | |||
{ "001", ",", "2" }, | |||
{ "0", "0,00" }, | |||
@@ -81,7 +79,7 @@ public class NumberConverterTestCase { | |||
{ "1000", "10,00" }, | |||
}; | |||
static private String[][] formatDecimalArabic = | |||
private static String[][] formatDecimalArabic = | |||
{ | |||
{ "\u0661" }, | |||
{ "0", "\u0660" }, | |||
@@ -100,7 +98,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660" }, | |||
}; | |||
static private String[][] formatDecimalArabicPadded = | |||
private static String[][] formatDecimalArabicPadded = | |||
{ | |||
{ "\u0660\u0660\u0661" }, | |||
{ "0", "\u0660\u0660\u0660" }, | |||
@@ -113,7 +111,7 @@ public class NumberConverterTestCase { | |||
{ "1000", "\u0661\u0660\u0660\u0660" }, | |||
}; | |||
static private String[][] formatDecimalArabicGrouped = | |||
private static String[][] formatDecimalArabicGrouped = | |||
{ | |||
{ "\u0661", "\u066c", "1" }, | |||
{ "0", "\u0660" }, | |||
@@ -123,7 +121,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" }, | |||
}; | |||
static private String[][] formatDecimalArabicGroupedPadded = | |||
private static String[][] formatDecimalArabicGroupedPadded = | |||
{ | |||
{ "\u0660\u0660\u0661", "\u066c", "2" }, | |||
{ "0", "\u0660\u066c\u0660\u0660" }, | |||
@@ -136,7 +134,7 @@ public class NumberConverterTestCase { | |||
{ "1000", "\u0661\u0660\u066c\u0660\u0660" }, | |||
}; | |||
static private String[][] formatDecimalThai = | |||
private static String[][] formatDecimalThai = | |||
{ | |||
{ "\u0E51" }, | |||
{ "0", "\u0E50" }, | |||
@@ -155,7 +153,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" }, | |||
}; | |||
static private String[][] formatDecimalThaiPadded = | |||
private static String[][] formatDecimalThaiPadded = | |||
{ | |||
{ "\u0E50\u0E50\u0E51" }, | |||
{ "0", "\u0E50\u0E50\u0E50" }, | |||
@@ -168,7 +166,7 @@ public class NumberConverterTestCase { | |||
{ "1000", "\u0E51\u0E50\u0E50\u0E50" }, | |||
}; | |||
static private String[][] formatRomanLower = | |||
private static String[][] formatRomanLower = | |||
{ | |||
{ "i" }, | |||
{ "0", "0" }, | |||
@@ -206,7 +204,7 @@ public class NumberConverterTestCase { | |||
{ "5000", "5000" }, | |||
}; | |||
static private String[][] formatRomanUpper = | |||
private static String[][] formatRomanUpper = | |||
{ | |||
{ "I" }, | |||
@@ -245,7 +243,7 @@ public class NumberConverterTestCase { | |||
{ "5000", "5000" }, | |||
}; | |||
static private String[][] formatRomanLargeLower = | |||
private static String[][] formatRomanLargeLower = | |||
{ | |||
{ "i", null, null, null, "large" }, | |||
{ "0", "0" }, | |||
@@ -293,7 +291,7 @@ public class NumberConverterTestCase { | |||
{ "200000", "200000" }, | |||
}; | |||
static private String[][] formatRomanLargeUpper = | |||
private static String[][] formatRomanLargeUpper = | |||
{ | |||
{ "I", null, null, null, "large" }, | |||
{ "0", "0" }, | |||
@@ -341,7 +339,7 @@ public class NumberConverterTestCase { | |||
{ "200000", "200000" }, | |||
}; | |||
static private String[][] formatRomanNumberFormsLower = | |||
private static String[][] formatRomanNumberFormsLower = | |||
{ | |||
{ "i", null, null, null, "unicode-number-forms" }, | |||
{ "0", "0" }, | |||
@@ -399,7 +397,7 @@ public class NumberConverterTestCase { | |||
{ "200000", "200000" }, | |||
}; | |||
static private String[][] formatRomanNumberFormsUpper = | |||
private static String[][] formatRomanNumberFormsUpper = | |||
{ | |||
{ "I", null, null, null, "unicode-number-forms" }, | |||
{ "0", "0" }, | |||
@@ -457,7 +455,7 @@ public class NumberConverterTestCase { | |||
{ "200000", "200000" }, | |||
}; | |||
static private String[][] formatAlphabeticLatinLower = | |||
private static String[][] formatAlphabeticLatinLower = | |||
{ | |||
{ "a" }, | |||
{ "0", "0" }, | |||
@@ -478,7 +476,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "bdwgn" }, | |||
}; | |||
static private String[][] formatAlphabeticLatinUpper = | |||
private static String[][] formatAlphabeticLatinUpper = | |||
{ | |||
{ "A" }, | |||
{ "0", "0" }, | |||
@@ -499,7 +497,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "BDWGN" }, | |||
}; | |||
static private String[][] formatAlphabeticArabicHijai = | |||
private static String[][] formatAlphabeticArabicHijai = | |||
{ | |||
{ "\u0627", null, null, "alphabetic" }, | |||
{ "0", "0" }, | |||
@@ -540,7 +538,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "\u0623\u0638\u0636\u0635\u062F" }, | |||
}; | |||
static private String[][] formatAlphabeticArabicAbjadi = | |||
private static String[][] formatAlphabeticArabicAbjadi = | |||
{ | |||
{ "\u0627", null, null, "traditional" }, | |||
{ "0", "0" }, | |||
@@ -581,7 +579,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "\u0623\u0641\u0633\u0646\u062D" }, | |||
}; | |||
static private String[][] formatNumeralArabicAbjadi = | |||
private static String[][] formatNumeralArabicAbjadi = | |||
{ | |||
{ "\u0623", null, null, "traditional" }, | |||
{ "0", "0" }, | |||
@@ -629,7 +627,7 @@ public class NumberConverterTestCase { | |||
{ "2000", "2000" }, | |||
}; | |||
static private String[][] formatAlphabeticHebrew = | |||
private static String[][] formatAlphabeticHebrew = | |||
{ | |||
{ "\u05D0", null, null, "alphabetic" }, | |||
{ "0", "0" }, | |||
@@ -669,7 +667,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "\u05D0\u05DA\u05E9\u05E8\u05D0" }, | |||
}; | |||
static private String[][] formatNumeralHebrewGematria = | |||
private static String[][] formatNumeralHebrewGematria = | |||
{ | |||
{ "\u05D0", null, null, "traditional" }, | |||
{ "0", "0" }, | |||
@@ -717,7 +715,7 @@ public class NumberConverterTestCase { | |||
{ "2000", "2000" }, | |||
}; | |||
static private String[][] formatAlphabeticThai = | |||
private static String[][] formatAlphabeticThai = | |||
{ | |||
{ "\u0E01", null, null, "alphabetic" }, | |||
{ "0", "0" }, | |||
@@ -738,7 +736,7 @@ public class NumberConverterTestCase { | |||
{ "1000000", "\u0E0B\u0E20\u0E17\u0E0C" }, | |||
}; | |||
static private String[][] formatWordEnglishLower = | |||
private static String[][] formatWordEnglishLower = | |||
{ | |||
{ "w", null, null, null, null, "eng" }, | |||
{ "0", "zero" }, | |||
@@ -762,7 +760,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "one billion" } | |||
}; | |||
static private String[][] formatWordEnglishUpper = | |||
private static String[][] formatWordEnglishUpper = | |||
{ | |||
{ "W", null, null, null, null, "eng" }, | |||
{ "0", "ZERO" }, | |||
@@ -786,7 +784,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "ONE BILLION" } | |||
}; | |||
static private String[][] formatWordEnglishTitle = | |||
private static String[][] formatWordEnglishTitle = | |||
{ | |||
{ "Ww", null, null, null, null, "eng" }, | |||
{ "0", "Zero" }, | |||
@@ -810,7 +808,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "One Billion" } | |||
}; | |||
static private String[][] formatWordSpanishLower = | |||
private static String[][] formatWordSpanishLower = | |||
{ | |||
{ "w", null, null, null, null, "spa" }, | |||
{ "0", "cero" }, | |||
@@ -890,7 +888,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "mil millones" } | |||
}; | |||
static private String[][] formatWordSpanishUpper = | |||
private static String[][] formatWordSpanishUpper = | |||
{ | |||
{ "W", null, null, null, null, "spa" }, | |||
{ "0", "CERO" }, | |||
@@ -970,7 +968,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "MIL MILLONES" } | |||
}; | |||
static private String[][] formatWordSpanishTitle = | |||
private static String[][] formatWordSpanishTitle = | |||
{ | |||
{ "Ww", null, null, null, null, "spa" }, | |||
{ "0", "Cero" }, | |||
@@ -1050,7 +1048,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "Mil Millones" } | |||
}; | |||
static private String[][] formatWordFrenchLower = | |||
private static String[][] formatWordFrenchLower = | |||
{ | |||
{ "w", null, null, null, null, "fra" }, | |||
{ "0", "z\u00e9ro" }, | |||
@@ -1141,7 +1139,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "un milliard" } | |||
}; | |||
static private String[][] formatWordFrenchUpper = | |||
private static String[][] formatWordFrenchUpper = | |||
{ | |||
{ "W", null, null, null, null, "fra" }, | |||
{ "0", "Z\u00c9RO" }, | |||
@@ -1232,7 +1230,7 @@ public class NumberConverterTestCase { | |||
{ "1000000000", "UN MILLIARD" } | |||
}; | |||
static private String[][] formatWordFrenchTitle = | |||
private static String[][] formatWordFrenchTitle = | |||
{ | |||
{ "Ww", null, null, null, null, "fra" }, | |||
{ "0", "Z\u00e9ro" }, |
@@ -27,8 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; | |||
* Test suite for bidirectional functionality. | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ | |||
NumberConverterTestCase.class | |||
}) | |||
@SuiteClasses(NumberConverterTestCase.class) | |||
public class UtilTestSuite { | |||
} |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
/** |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
/** |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
/** |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
/** |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest { |
@@ -24,7 +24,6 @@ import java.io.IOException; | |||
import org.xml.sax.SAXException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.MimeConstants; | |||
import org.apache.fop.apps.PDFRendererConfBuilder; | |||
/** |
@@ -19,10 +19,10 @@ | |||
package org.apache.fop.datatypes; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* Tests for URISpecification. | |||
*/ |
@@ -19,6 +19,8 @@ | |||
package org.apache.fop.events; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotNull; | |||
@@ -26,7 +28,6 @@ import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.events.model.EventSeverity; | |||
import org.junit.Test; | |||
public class BasicEventTestCase { | |||
@@ -38,7 +38,10 @@ public interface TestEventProducer extends EventProducer { | |||
*/ | |||
void enjoy(Object source, String what); | |||
public class Provider { | |||
public static final class Provider { | |||
private Provider() { | |||
} | |||
public static TestEventProducer get(EventBroadcaster broadcaster) { | |||
return (TestEventProducer)broadcaster.getEventProducerFor(TestEventProducer.class); |
@@ -19,8 +19,6 @@ | |||
package org.apache.fop.fo; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.util.ArrayList; | |||
@@ -42,6 +40,8 @@ import org.xml.sax.Attributes; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.helpers.DefaultHandler; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; | |||
import org.apache.fop.fo.flow.BasicLink; |
@@ -64,7 +64,7 @@ public final class FODocumentParser { | |||
/** | |||
* A factory to create custom instances of {@link FOEventHandler}. | |||
*/ | |||
public static interface FOEventHandlerFactory { | |||
public interface FOEventHandlerFactory { | |||
/** | |||
* Creates a new {@code FOEventHandler} instance parameterized with the given FO user agent. |
@@ -31,7 +31,6 @@ import org.apache.xmlgraphics.image.loader.ImageManager; | |||
import org.apache.xmlgraphics.image.loader.ImageSessionContext; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.apps.FopFactory; | |||
import org.apache.fop.events.EventBroadcaster; | |||
import org.apache.fop.fo.flow.table.ColumnNumberManager; | |||
import org.apache.fop.fo.flow.table.ColumnNumberManagerHolder; | |||
@@ -46,7 +45,7 @@ public final class FONodeMocks { | |||
/** | |||
* Creates and returns a mock {@link FONode} configured with a mock | |||
* {@link FOEventHandler}. The FO event handler returns a mock {@link FOUserAgent}, | |||
* which in turn returns a mock {@link FopFactory}, which returns a mock | |||
* which in turn returns a mock {@link org.apache.fop.apps.FopFactory}, which returns a mock | |||
* {@link ImageManager}. | |||
* | |||
* @return a mock FO node |
@@ -30,10 +30,6 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.flow.Marker; | |||
import org.apache.fop.fo.flow.Markers; | |||
import org.apache.fop.fo.flow.RetrieveMarker; | |||
import org.apache.fop.fo.flow.RetrieveTableMarker; | |||
public class MarkersTestCase { | |||
@@ -24,8 +24,8 @@ import java.util.Iterator; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.FODocumentParser; | |||
import org.apache.fop.fo.FOEventHandler; | |||
import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; | |||
import org.apache.fop.fo.FOEventHandler; | |||
import org.apache.fop.util.ConsoleEventListenerForTests; | |||
/** |
@@ -19,18 +19,20 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import static org.junit.Assert.assertEquals; | |||
import java.awt.Color; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.FONode.FONodeIterator; | |||
import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; | |||
// CSOFF: LineLength | |||
/** | |||
* A testcase for the resolution of collapsed borders in the FO tree, taking | |||
* conditionality into account. The resolved borders are generated by the |
@@ -19,16 +19,16 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Tests that RowGroupBuilder returns, for each part of a table, the expected number of | |||
* row-groups with the expected number or rows in each. |
@@ -19,12 +19,12 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import static org.junit.Assert.assertEquals; | |||
import java.util.Iterator; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.datatypes.PercentBaseContext; | |||
import org.apache.fop.fo.FObj; | |||
@@ -24,7 +24,6 @@ import java.util.List; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.FOEventHandler; | |||
import org.apache.fop.fo.flow.table.Table; | |||
public class TableHandler extends FOEventHandler { | |||
@@ -19,8 +19,8 @@ | |||
package org.apache.fop.fo.pagination; | |||
import org.junit.runners.Suite; | |||
import org.junit.runner.RunWith; | |||
import org.junit.runners.Suite; | |||
/** | |||
* All test to be added in FOTreeTestSuite | |||
@@ -28,6 +28,6 @@ import org.junit.runner.RunWith; | |||
*/ | |||
@RunWith(Suite.class) | |||
@Suite.SuiteClasses({ PageSequenceMasterTestCase.class, | |||
RepeatablePageMasterAlternativesTestCase.class}) | |||
RepeatablePageMasterAlternativesTestCase.class }) | |||
public final class AllTests { | |||
} |
@@ -19,8 +19,10 @@ | |||
package org.apache.fop.fo.pagination; | |||
import static org.junit.Assert.fail; | |||
import org.junit.Test; | |||
import org.xml.sax.Locator; | |||
import static org.junit.Assert.fail; | |||
import static org.mockito.Matchers.anyBoolean; | |||
import static org.mockito.Matchers.anyInt; | |||
import static org.mockito.Matchers.anyObject; | |||
@@ -33,8 +35,6 @@ import static org.mockito.Mockito.when; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.layoutmgr.BlockLevelEventProducer; | |||
import org.junit.Test; | |||
import org.xml.sax.Locator; | |||
/** |
@@ -19,6 +19,8 @@ | |||
package org.apache.fop.fo.pagination; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.mockito.Matchers.anyBoolean; | |||
import static org.mockito.Matchers.anyInt; | |||
@@ -30,8 +32,6 @@ import org.apache.fop.fo.PropertyList; | |||
import org.apache.fop.fo.expr.NumericProperty; | |||
import org.apache.fop.fo.properties.Property; | |||
import org.junit.Test; | |||
/** | |||
* Unit Test for RepeatablePageMasterAlternatives | |||
* |
@@ -19,12 +19,12 @@ | |||
package org.apache.fop.fo.properties; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.junit.Test; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.Constants; |
@@ -19,16 +19,16 @@ | |||
package org.apache.fop.fo.properties; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import java.lang.reflect.Constructor; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FONodeMocks; |
@@ -24,11 +24,11 @@ import java.io.File; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.apps.io.InternalResourceResolver; | |||
import org.apache.fop.apps.io.ResourceResolverFactory; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* | |||
*/ |
@@ -35,7 +35,7 @@ import static org.junit.Assert.assertTrue; | |||
*/ | |||
public class EmbedFontInfoTestCase { | |||
public EmbedFontInfoTestCase() {} | |||
public EmbedFontInfoTestCase() { } | |||
private EmbedFontInfo sut; | |||
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.fonts; | |||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.net.URI; | |||
@@ -28,13 +27,14 @@ import org.junit.Before; | |||
import org.junit.Test; | |||
import org.xml.sax.SAXException; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.apps.FopConfBuilder; | |||
import org.apache.fop.apps.FopConfParser; | |||
import org.apache.fop.apps.FopFactory; | |||
import static org.apache.fop.apps.FopConfParserTestCase.getFopFactory; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* A test case for {@link FontManagerConfigurator}. | |||
@@ -84,7 +84,7 @@ public class FontManagerConfiguratorTestCase { | |||
/** | |||
* This test is an interesting one; it's basically testing that if a base URI pointing to a | |||
* directory that doesn't exist is used, an error is not thrown. The URI resolver should handle | |||
* any {@link FileNotFoundException}s, not the configuration. We're NOT testing whether a font | |||
* any {@link java.io.FileNotFoundException}s, not the configuration. We're NOT testing whether a font | |||
* can be resolved here, just that the URI resolver accepts it as its base URI. | |||
*/ | |||
@Test |
@@ -26,14 +26,14 @@ import java.util.Random; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import org.apache.fontbox.cff.CFFDataInput; | |||
import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; | |||
import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; | |||
import org.apache.fop.fonts.truetype.OTFSubSetFile; | |||
import static org.junit.Assert.assertEquals; | |||
public class CFFDataReaderTestCase { | |||
private CFFDataReader cffReader; | |||
@@ -113,7 +113,7 @@ public class CFFDataReaderTestCase { | |||
//Array comparison | |||
int[] fontBBox = { -50, -40, 100, 120 }; | |||
DICTEntry fontBBoxEntry = dictMap.get("FontBBox"); | |||
for (int i = 0;i < fontBBoxEntry.getOperands().size();i++) { | |||
for (int i = 0; i < fontBBoxEntry.getOperands().size(); i++) { | |||
assertEquals(fontBBoxEntry.getOperands().get(i).intValue(), fontBBox[i]); | |||
} | |||
//Multi-byte offset (number) | |||
@@ -141,7 +141,7 @@ public class CFFDataReaderTestCase { | |||
}; | |||
Random randGen = new Random(); | |||
byte[] data = new byte[31]; | |||
for (int i = 0;i < data.length;i++) { | |||
for (int i = 0; i < data.length; i++) { | |||
data[i] = (byte)randGen.nextInt(255); | |||
} | |||
testIndex = OTFSubSetFile.concatArray(testIndex, data); |
@@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue; | |||
*/ | |||
public class GlyfTableTestCase { | |||
private final static class DirData { | |||
private static final class DirData { | |||
final long offset; | |||
final long length; |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.fonts.truetype; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import org.junit.Before; | |||
@@ -37,7 +36,7 @@ public class OTFFileTestCase { | |||
/** | |||
* Initializes fonts used for the testing of reading OTF CFF | |||
* @throws IOException | |||
* @throws java.io.IOException | |||
*/ | |||
@Before | |||
public void setUp() throws Exception { | |||
@@ -75,11 +74,11 @@ public class OTFFileTestCase { | |||
int[] gids = {32, 42, 44, 47}; | |||
int[] sourceSansWidths = {516, 555, 572, 383}; | |||
for (int i = 0;i < gids.length;i++) { | |||
for (int i = 0; i < gids.length; i++) { | |||
assertEquals(sourceSansWidths[i], sourceSansProBold.getWidths()[gids[i]]); | |||
} | |||
int[] carolynaWidths = {842, 822, 658, 784}; | |||
for (int i = 0;i < gids.length;i++) { | |||
for (int i = 0; i < gids.length; i++) { | |||
assertEquals(carolynaWidths[i], alexBrush.getWidths()[gids[i]]); | |||
} | |||
} |
@@ -27,6 +27,9 @@ import java.util.Map; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fontbox.cff.CFFDataInput; | |||
import org.apache.fontbox.cff.CFFFont; | |||
import org.apache.fontbox.cff.CFFParser; | |||
@@ -37,9 +40,6 @@ import org.apache.fop.fonts.cff.CFFDataReader; | |||
import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; | |||
import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
public class OTFSubSetFileTestCase extends OTFFileTestCase { | |||
CFFDataReader cffReaderSourceSans; | |||
@@ -85,7 +85,7 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase { | |||
private boolean checkCorrectOffsets(CFFIndexData indexData) { | |||
int last = 0; | |||
for (int i = 0;i < indexData.getOffsets().length;i++) { | |||
for (int i = 0; i < indexData.getOffsets().length; i++) { | |||
if (indexData.getOffsets()[i] < last) { | |||
return false; | |||
} | |||
@@ -107,7 +107,7 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase { | |||
IndexData localIndexData = CFFParser.readIndexData(localSubrs); | |||
CFFIndexData charStrings = cffReader.getCharStringIndex(); | |||
for (int i = 0;i < charStrings.getNumObjects();i++) { | |||
for (int i = 0; i < charStrings.getNumObjects(); i++) { | |||
byte[] charData = charStrings.getValue(i); | |||
Type2CharStringParser parser = new Type2CharStringParser(); | |||
@@ -26,12 +26,12 @@ import java.util.Map; | |||
import org.junit.Test; | |||
import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion; | |||
/** | |||
* Class for testing org.apache.fop.fonts.truetype.TTFFile | |||
*/ |
@@ -25,14 +25,14 @@ import java.net.URI; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.fop.apps.io.InternalResourceResolver; | |||
import org.apache.fop.apps.io.ResourceResolverFactory; | |||
import org.apache.fop.fonts.EmbeddingMode; | |||
import org.apache.fop.fonts.EncodingMode; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Test case for {@link OFFontLoader}. | |||
*/ |
@@ -19,9 +19,6 @@ | |||
package org.apache.fop.fonts.type1; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import java.awt.Rectangle; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
@@ -29,6 +26,9 @@ import java.util.List; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
/** | |||
* Test case for {@link AFMParser}. | |||
*/ |
@@ -19,8 +19,6 @@ | |||
package org.apache.fop.fonts.type1; | |||
import static org.junit.Assert.assertEquals; | |||
import java.io.BufferedReader; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
@@ -30,6 +28,8 @@ import java.io.InputStreamReader; | |||
import org.junit.BeforeClass; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* Test case for {@link AdobeStandardEncoding}. | |||
*/ |
@@ -19,10 +19,6 @@ | |||
package org.apache.fop.fonts.type1; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
import java.awt.Rectangle; | |||
import java.io.IOException; | |||
import java.util.HashMap; | |||
@@ -31,6 +27,10 @@ import java.util.Stack; | |||
import org.junit.Test; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.fonts.NamedCharacter; | |||
import org.apache.fop.fonts.type1.AFMParser.ValueHandler; | |||
@@ -20,6 +20,9 @@ | |||
package org.apache.fop.fotreetest.ext; | |||
import org.xml.sax.Attributes; | |||
import org.xml.sax.Locator; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FOPropertyMapping; | |||
@@ -32,9 +35,6 @@ import org.apache.fop.fo.properties.Property; | |||
import org.apache.fop.fo.properties.SpaceProperty; | |||
import org.apache.fop.fotreetest.ResultCollector; | |||
import org.xml.sax.Attributes; | |||
import org.xml.sax.Locator; | |||
/** | |||
* Defines the assert element for the FOP Test extension. | |||
*/ |
@@ -19,8 +19,8 @@ | |||
package org.apache.fop.fotreetest.ext; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.ElementMapping; | |||
import org.apache.fop.fo.FONode; | |||
/** | |||
* This class provides the element mapping for FOP. |
@@ -19,10 +19,6 @@ | |||
package org.apache.fop.image.loader.batik; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotNull; | |||
import java.awt.image.Raster; | |||
import java.awt.image.RenderedImage; | |||
import java.io.File; | |||
@@ -30,6 +26,10 @@ import java.io.File; | |||
import org.junit.Ignore; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotNull; | |||
import org.apache.xmlgraphics.image.loader.Image; | |||
import org.apache.xmlgraphics.image.loader.ImageFlavor; | |||
import org.apache.xmlgraphics.image.loader.ImageInfo; |
@@ -19,15 +19,15 @@ | |||
package org.apache.fop.image.loader.batik; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNotNull; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import org.junit.Ignore; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNotNull; | |||
import org.apache.xmlgraphics.image.loader.ImageException; | |||
import org.apache.xmlgraphics.image.loader.ImageInfo; | |||
import org.apache.xmlgraphics.image.loader.ImageManager; |
@@ -34,7 +34,6 @@ import javax.xml.validation.SchemaFactory; | |||
import javax.xml.validation.Validator; | |||
import org.w3c.dom.Document; | |||
import org.xml.sax.ErrorHandler; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.SAXParseException; |
@@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; | |||
* JUnit test suite for the area tree XML format | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ AreaTreeParserTestCase.class }) | |||
@SuiteClasses(AreaTreeParserTestCase.class) | |||
public class AreaTreeXMLFormatTestSuite { | |||
} |
@@ -19,8 +19,6 @@ | |||
package org.apache.fop.intermediate; | |||
import static org.junit.Assert.fail; | |||
import java.io.File; | |||
import javax.xml.transform.ErrorListener; | |||
@@ -34,6 +32,8 @@ import javax.xml.transform.stream.StreamSource; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.fail; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.apps.Fop; |
@@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; | |||
* A test suite for testing the Intermediate Format output. | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ IFTestCase.class }) | |||
@SuiteClasses(IFTestCase.class) | |||
public final class IntermediateFormatTestSuite { | |||
} |
@@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; | |||
* JUnit test suite for the intermediate format | |||
*/ | |||
@RunWith(Suite.class) | |||
@SuiteClasses({ IFParserTestCase.class }) | |||
@SuiteClasses(IFParserTestCase.class) | |||
public final class LayoutIFTestSuite { | |||
} |
@@ -22,16 +22,17 @@ package org.apache.fop.layoutengine; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.layoutmgr.KnuthBox; | |||
import org.apache.fop.layoutmgr.KnuthElement; | |||
import org.apache.fop.layoutmgr.KnuthGlue; | |||
import org.apache.fop.layoutmgr.KnuthPenalty; | |||
import org.w3c.dom.CDATASection; | |||
import org.w3c.dom.Element; | |||
import org.w3c.dom.Node; | |||
import org.w3c.dom.NodeList; | |||
import org.w3c.dom.Text; | |||
import org.apache.fop.layoutmgr.KnuthBox; | |||
import org.apache.fop.layoutmgr.KnuthElement; | |||
import org.apache.fop.layoutmgr.KnuthGlue; | |||
import org.apache.fop.layoutmgr.KnuthPenalty; | |||
/** | |||
* Check implementation that checks a Knuth element list. | |||
*/ |
@@ -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({ LayoutEngineTestCase.class }) | |||
@SuiteClasses(LayoutEngineTestCase.class) | |||
public class LayoutEngineTestSuite { | |||
} |
@@ -19,9 +19,10 @@ | |||
package org.apache.fop.layoutengine; | |||
import org.apache.fop.apps.FormattingResults; | |||
import org.w3c.dom.Document; | |||
import org.apache.fop.apps.FormattingResults; | |||
/** | |||
* This class holds references to all the results from the FOP processing run. | |||
*/ |
@@ -23,6 +23,10 @@ import java.awt.Color; | |||
import org.junit.Test; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
import org.apache.fop.fo.flow.table.PrimaryGridUnit; | |||
import org.apache.fop.fo.flow.table.Table; | |||
import org.apache.fop.fo.flow.table.TableCell; | |||
@@ -37,10 +41,6 @@ import org.apache.fop.layoutmgr.PageSequenceLayoutManager; | |||
import org.apache.fop.layoutmgr.PositionIterator; | |||
import org.apache.fop.layoutmgr.RetrieveTableMarkerLayoutManager; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
public class TableCellLayoutManagerTestCase { | |||
// this test aims to check that the first call to addAreas() calls |
@@ -24,9 +24,10 @@ import java.util.ListIterator; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.layoutmgr.ElementListObserver.Observer; | |||
import org.apache.fop.layoutmgr.ElementListUtils; | |||
import org.apache.fop.layoutmgr.ListElement; | |||
import org.apache.fop.layoutmgr.ElementListObserver.Observer; | |||
/** | |||
* <p>Logs all observed element lists. |
@@ -45,7 +45,7 @@ import org.apache.fop.apps.MimeConstants; | |||
/** | |||
* Debug tool to create and process large FO files by replicating them a specified number of times. | |||
*/ | |||
public class MemoryEater { | |||
public final class MemoryEater { | |||
private SAXTransformerFactory tFactory | |||
= (SAXTransformerFactory)SAXTransformerFactory.newInstance(); | |||
@@ -53,7 +53,7 @@ public class MemoryEater { | |||
private Stats stats; | |||
public MemoryEater() throws TransformerConfigurationException, MalformedURLException { | |||
private MemoryEater() throws TransformerConfigurationException, MalformedURLException { | |||
File xsltFile = new File("test/xsl/fo-replicator.xsl"); | |||
Source xslt = new StreamSource(xsltFile); | |||
replicatorTemplates = tFactory.newTemplates(xslt); |
@@ -23,10 +23,11 @@ import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import static org.junit.Assert.assertEquals; | |||
/** | |||
* Test case for {@link AbstractPDFStream}. | |||
*/ |