<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}"/>
<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>
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
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;
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
InputHandler handler = new InputHandler(xmlFile, xsltFile, null);
try {
handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout);
- } catch (FOPException e) {}
+ } catch (FOPException e) { /* NOP */ }
}
}
* Test suite for basic functionality of FOP's Driver API.
*/
@RunWith(Suite.class)
-@SuiteClasses({ BasicDriverTestCase.class })
+@SuiteClasses(BasicDriverTestCase.class)
public class BasicDriverTestSuite {
}
package org.apache.fop;
import org.apache.batik.transcoder.Transcoder;
+
import org.apache.fop.render.ps.PSTranscoder;
/**
/**
* Handles some standard tasks for debugging.
*/
-public class DebugHelper {
+public final class DebugHelper {
+
+ private DebugHelper() {
+ }
private static boolean elObserversRegistered = false;
package org.apache.fop;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.io.StringReader;
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.
*
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;
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.
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;
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.
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}.
*/
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}.
*/
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}.
*/
package org.apache.fop.afp;
-import static org.junit.Assert.assertTrue;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
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.
* names fails.
* @throws Exception -
*/
- @Test(expected=Exception.class)
+ @Test(expected = Exception.class)
public void testResourceNameMismatch() throws Exception {
testResource(RESOURCE_NAME_MISMATCH, PSEG_B);
}
}
private interface ResourceCopier {
- public void copy(InputStream in, OutputStream out) throws IOException;
+ void copy(InputStream in, OutputStream out) throws IOException;
}
}
*/
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;
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;
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.
*/
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.
*/
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
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;
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;
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}
*/
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;
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
*/
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;
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;
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> {
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;
import org.junit.Test;
-
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
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;
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}.
*/
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 {
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;
import org.xml.sax.SAXException;
+import static org.junit.Assert.assertTrue;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.fop.apps.MimeConstants;
import static org.apache.fop.FOPTestUtils.getBaseDir;
-import static org.junit.Assert.assertTrue;
public abstract class BaseURIResolutionTest {
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 {
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.
*/
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.
*/
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.
*/
/**
* 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.
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();
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
}
if (includeSequence(testSet, testSequence)) {
includedSequences++;
- if (! excludeSequence(testSet, testSequence)) {
+ if (!excludeSequence(testSet, testSequence)) {
if (testBidiAlgorithm(testSet, testSequence, la, ra, ta, bs)) {
passedSequences++;
}
}
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++) {
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) {
// 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;
}
}
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
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);
data = null;
} finally {
if (is != null) {
- try { is.close(); } catch (Exception e) {}
+ try { is.close(); } catch (Exception e) { /* NOP */ }
}
}
return data;
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";
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;
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";
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;
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";
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;
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;
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
* 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 {
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
// 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
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>();
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;
}
public static synchronized void clearCache() {
cache.clear();
}
- private class Handler extends DefaultHandler {
+ private final class Handler extends DefaultHandler {
private Handler() {
}
@Override
}
} 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")) {
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)) {
}
} else if (en[1].equals("DefaultLangSys")) {
String[] pn = new String[] { null, "Script" };
- if (! isParent(pn)) {
+ if (!isParent(pn)) {
notPermittedInElementContext(en, getParent(), pn);
} else {
assertLanguageFeaturesClear();
}
} else if (en[1].equals("Feature")) {
String[] pn = new String[] { null, "FeatureRecord" };
- if (! isParent(pn)) {
+ if (!isParent(pn)) {
notPermittedInElementContext(en, getParent(), pn);
} else {
assertFeatureLookupsClear();
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")) {
}
} 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")) {
}
} else if (en[1].equals("LangSys")) {
String[] pn = new String[] { null, "LangSysRecord" };
- if (! isParent(pn)) {
+ if (!isParent(pn)) {
notPermittedInElementContext(en, getParent(), pn);
} else {
assertLanguageFeaturesClear();
}
} 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")) {
}
} 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")) {
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")) {
}
} 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")) {
}
} 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")) {
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")) {
}
} 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")) {
}
} 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")) {
}
} 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);
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) {
} 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());
} 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)) {
} 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();
}
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());
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();
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 };
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;
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]);
}
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]);
}
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));
}
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 ];
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;
}
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);
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) {
if (cm != null) {
for (Anchor[] aa : cm) {
if (aa != null) {
- int nc = aa.length;;
+ int nc = aa.length;
if (nc > ncMax) {
ncMax = nc;
}
if (lam != null) {
for (Anchor[][] cm : lam) {
if (cm != null) {
- int nx = cm.length;;
+ int nx = cm.length;
if (nx > nxMax) {
nxMax = nx;
}
return false;
}
if ((u1 != null) && (u2 != null)) {
- if (! u1.equals(u2)) {
+ if (!u1.equals(u2)) {
return false;
}
}
return false;
}
if ((l1 != null) && (l2 != null)) {
- if (! l1.equals(l2)) {
+ if (!l1.equals(l2)) {
return false;
}
}
* Test suite for script specific functionality related to complex scripts.
*/
@RunWith(Suite.class)
-@SuiteClasses({
- ArabicTestCase.class
-})
+@SuiteClasses(ArabicTestCase.class)
public class ScriptsTestSuite {
}
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.
*/
@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());
}
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) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (fis != null) {
- try { fis.close(); } catch (Exception e) {}
+ try { fis.close(); } catch (Exception e) { /* NOP */ }
}
}
}
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);
*/
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
/**
* 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;
}
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());
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);
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 });
throw new RuntimeException(e.getMessage(), e);
} finally {
if (fis != null) {
- try { fis.close(); } catch (Exception e) {}
+ try { fis.close(); } catch (Exception e) { /* NOP */ }
}
}
} else {
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) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (fos != null) {
- try { fos.close(); } catch (Exception e) {}
+ try { fos.close(); } catch (Exception e) { /* NOP */ }
}
}
}
/**
* Test number converter functionality.
- *
- * @author Glenn Adams
*/
public class NumberConverterTestCase {
- static private String[][] formatDecimal =
+ private static String[][] formatDecimal =
{
{ "1" },
{ "0", "0" },
{ "1000000000", "1000000000" },
};
- static private String[][] formatDecimalPadded =
+ private static String[][] formatDecimalPadded =
{
{ "001" },
{ "0", "000" },
{ "1000", "1000" },
};
- static private String[][] formatDecimalGrouped =
+ private static String[][] formatDecimalGrouped =
{
{ "1", ",", "1" },
{ "0", "0" },
{ "1000000000", "1,0,0,0,0,0,0,0,0,0" },
};
- static private String[][] formatDecimalGroupedPadded =
+ private static String[][] formatDecimalGroupedPadded =
{
{ "001", ",", "2" },
{ "0", "0,00" },
{ "1000", "10,00" },
};
- static private String[][] formatDecimalArabic =
+ private static String[][] formatDecimalArabic =
{
{ "\u0661" },
{ "0", "\u0660" },
{ "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" },
{ "1000", "\u0661\u0660\u0660\u0660" },
};
- static private String[][] formatDecimalArabicGrouped =
+ private static String[][] formatDecimalArabicGrouped =
{
{ "\u0661", "\u066c", "1" },
{ "0", "\u0660" },
{ "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" },
{ "1000", "\u0661\u0660\u066c\u0660\u0660" },
};
- static private String[][] formatDecimalThai =
+ private static String[][] formatDecimalThai =
{
{ "\u0E51" },
{ "0", "\u0E50" },
{ "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" },
{ "1000", "\u0E51\u0E50\u0E50\u0E50" },
};
- static private String[][] formatRomanLower =
+ private static String[][] formatRomanLower =
{
{ "i" },
{ "0", "0" },
{ "5000", "5000" },
};
- static private String[][] formatRomanUpper =
+ private static String[][] formatRomanUpper =
{
{ "I" },
{ "5000", "5000" },
};
- static private String[][] formatRomanLargeLower =
+ private static String[][] formatRomanLargeLower =
{
{ "i", null, null, null, "large" },
{ "0", "0" },
{ "200000", "200000" },
};
- static private String[][] formatRomanLargeUpper =
+ private static String[][] formatRomanLargeUpper =
{
{ "I", null, null, null, "large" },
{ "0", "0" },
{ "200000", "200000" },
};
- static private String[][] formatRomanNumberFormsLower =
+ private static String[][] formatRomanNumberFormsLower =
{
{ "i", null, null, null, "unicode-number-forms" },
{ "0", "0" },
{ "200000", "200000" },
};
- static private String[][] formatRomanNumberFormsUpper =
+ private static String[][] formatRomanNumberFormsUpper =
{
{ "I", null, null, null, "unicode-number-forms" },
{ "0", "0" },
{ "200000", "200000" },
};
- static private String[][] formatAlphabeticLatinLower =
+ private static String[][] formatAlphabeticLatinLower =
{
{ "a" },
{ "0", "0" },
{ "1000000", "bdwgn" },
};
- static private String[][] formatAlphabeticLatinUpper =
+ private static String[][] formatAlphabeticLatinUpper =
{
{ "A" },
{ "0", "0" },
{ "1000000", "BDWGN" },
};
- static private String[][] formatAlphabeticArabicHijai =
+ private static String[][] formatAlphabeticArabicHijai =
{
{ "\u0627", null, null, "alphabetic" },
{ "0", "0" },
{ "1000000", "\u0623\u0638\u0636\u0635\u062F" },
};
- static private String[][] formatAlphabeticArabicAbjadi =
+ private static String[][] formatAlphabeticArabicAbjadi =
{
{ "\u0627", null, null, "traditional" },
{ "0", "0" },
{ "1000000", "\u0623\u0641\u0633\u0646\u062D" },
};
- static private String[][] formatNumeralArabicAbjadi =
+ private static String[][] formatNumeralArabicAbjadi =
{
{ "\u0623", null, null, "traditional" },
{ "0", "0" },
{ "2000", "2000" },
};
- static private String[][] formatAlphabeticHebrew =
+ private static String[][] formatAlphabeticHebrew =
{
{ "\u05D0", null, null, "alphabetic" },
{ "0", "0" },
{ "1000000", "\u05D0\u05DA\u05E9\u05E8\u05D0" },
};
- static private String[][] formatNumeralHebrewGematria =
+ private static String[][] formatNumeralHebrewGematria =
{
{ "\u05D0", null, null, "traditional" },
{ "0", "0" },
{ "2000", "2000" },
};
- static private String[][] formatAlphabeticThai =
+ private static String[][] formatAlphabeticThai =
{
{ "\u0E01", null, null, "alphabetic" },
{ "0", "0" },
{ "1000000", "\u0E0B\u0E20\u0E17\u0E0C" },
};
- static private String[][] formatWordEnglishLower =
+ private static String[][] formatWordEnglishLower =
{
{ "w", null, null, null, null, "eng" },
{ "0", "zero" },
{ "1000000000", "one billion" }
};
- static private String[][] formatWordEnglishUpper =
+ private static String[][] formatWordEnglishUpper =
{
{ "W", null, null, null, null, "eng" },
{ "0", "ZERO" },
{ "1000000000", "ONE BILLION" }
};
- static private String[][] formatWordEnglishTitle =
+ private static String[][] formatWordEnglishTitle =
{
{ "Ww", null, null, null, null, "eng" },
{ "0", "Zero" },
{ "1000000000", "One Billion" }
};
- static private String[][] formatWordSpanishLower =
+ private static String[][] formatWordSpanishLower =
{
{ "w", null, null, null, null, "spa" },
{ "0", "cero" },
{ "1000000000", "mil millones" }
};
- static private String[][] formatWordSpanishUpper =
+ private static String[][] formatWordSpanishUpper =
{
{ "W", null, null, null, null, "spa" },
{ "0", "CERO" },
{ "1000000000", "MIL MILLONES" }
};
- static private String[][] formatWordSpanishTitle =
+ private static String[][] formatWordSpanishTitle =
{
{ "Ww", null, null, null, null, "spa" },
{ "0", "Cero" },
{ "1000000000", "Mil Millones" }
};
- static private String[][] formatWordFrenchLower =
+ private static String[][] formatWordFrenchLower =
{
{ "w", null, null, null, null, "fra" },
{ "0", "z\u00e9ro" },
{ "1000000000", "un milliard" }
};
- static private String[][] formatWordFrenchUpper =
+ private static String[][] formatWordFrenchUpper =
{
{ "W", null, null, null, null, "fra" },
{ "0", "Z\u00c9RO" },
{ "1000000000", "UN MILLIARD" }
};
- static private String[][] formatWordFrenchTitle =
+ private static String[][] formatWordFrenchTitle =
{
{ "Ww", null, null, null, null, "fra" },
{ "0", "Z\u00e9ro" },
* Test suite for bidirectional functionality.
*/
@RunWith(Suite.class)
-@SuiteClasses({
- NumberConverterTestCase.class
-})
+@SuiteClasses(NumberConverterTestCase.class)
public class UtilTestSuite {
}
import org.xml.sax.SAXException;
import org.apache.fop.apps.FopConfBuilder;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.PDFRendererConfBuilder;
/**
import org.xml.sax.SAXException;
import org.apache.fop.apps.FopConfBuilder;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.PDFRendererConfBuilder;
/**
import org.xml.sax.SAXException;
import org.apache.fop.apps.FopConfBuilder;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.PDFRendererConfBuilder;
/**
import org.xml.sax.SAXException;
import org.apache.fop.apps.FopConfBuilder;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.PDFRendererConfBuilder;
/**
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 {
import org.xml.sax.SAXException;
import org.apache.fop.apps.FopConfBuilder;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.PDFRendererConfBuilder;
/**
package org.apache.fop.datatypes;
-import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* Tests for URISpecification.
*/
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;
import static org.junit.Assert.fail;
import org.apache.fop.events.model.EventSeverity;
-import org.junit.Test;
public class BasicEventTestCase {
*/
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);
package org.apache.fop.fo;
-import static org.junit.Assert.assertArrayEquals;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
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;
/**
* 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.
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;
/**
* 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
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 {
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;
/**
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
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.
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;
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 {
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
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({ PageSequenceMasterTestCase.class,
- RepeatablePageMasterAlternativesTestCase.class})
+ RepeatablePageMasterAlternativesTestCase.class })
public final class AllTests {
}
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;
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;
/**
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;
import org.apache.fop.fo.expr.NumericProperty;
import org.apache.fop.fo.properties.Property;
-import org.junit.Test;
-
/**
* Unit Test for RepeatablePageMasterAlternatives
*
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;
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;
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;
-
/**
*
*/
*/
public class EmbedFontInfoTestCase {
- public EmbedFontInfoTestCase() {}
+ public EmbedFontInfoTestCase() { }
private EmbedFontInfo sut;
package org.apache.fop.fonts;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
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}.
/**
* 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
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;
//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)
};
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);
*/
public class GlyfTableTestCase {
- private final static class DirData {
+ private static final class DirData {
final long offset;
final long length;
package org.apache.fop.fonts.truetype;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
import org.junit.Before;
/**
* Initializes fonts used for the testing of reading OTF CFF
- * @throws IOException
+ * @throws java.io.IOException
*/
@Before
public void setUp() throws Exception {
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]]);
}
}
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;
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;
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;
}
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();
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
*/
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}.
*/
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;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
* Test case for {@link AFMParser}.
*/
package org.apache.fop.fonts.type1;
-import static org.junit.Assert.assertEquals;
-
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* Test case for {@link AdobeStandardEncoding}.
*/
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;
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;
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;
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.
*/
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.
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;
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;
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;
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;
* JUnit test suite for the area tree XML format
*/
@RunWith(Suite.class)
-@SuiteClasses({ AreaTreeParserTestCase.class })
+@SuiteClasses(AreaTreeParserTestCase.class)
public class AreaTreeXMLFormatTestSuite {
}
package org.apache.fop.intermediate;
-import static org.junit.Assert.fail;
-
import java.io.File;
import javax.xml.transform.ErrorListener;
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;
* A test suite for testing the Intermediate Format output.
*/
@RunWith(Suite.class)
-@SuiteClasses({ IFTestCase.class })
+@SuiteClasses(IFTestCase.class)
public final class IntermediateFormatTestSuite {
}
* JUnit test suite for the intermediate format
*/
@RunWith(Suite.class)
-@SuiteClasses({ IFParserTestCase.class })
+@SuiteClasses(IFParserTestCase.class)
public final class LayoutIFTestSuite {
}
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.
*/
* JUnit test suit for running layout engine test under JUnit control.
*/
@RunWith(Suite.class)
-@SuiteClasses({ LayoutEngineTestCase.class })
+@SuiteClasses(LayoutEngineTestCase.class)
public class LayoutEngineTestSuite {
}
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.
*/
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;
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
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.
/**
* 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();
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);
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}.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* Tests the {@link FileIDGenerator} class.
*/
assertTrue(Arrays.equals(originalFileID, updatedFileID));
}
- private static interface TestGetter {
+ private interface TestGetter {
FileIDGenerator getSut() throws Exception;
}
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.apache.fop.pdf.xref.CompressedObjectReference;
public class ObjectStreamManagerTestCase {
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
public class ObjectStreamTestCase {
private static final String OBJECT_CONTENT = "<<\n /Foo True\n /Bar False\n>>\n";
}
@Test
- public void checkPDFA_1a() {
+ public void checkPDFA1a() {
new PDFAModeChecker(PDFAMode.PDFA_1A)
.isEnabled()
.isPart1()
}
@Test
- public void checkPDFA_1b() {
+ public void checkPDFA1b() {
new PDFAModeChecker(PDFAMode.PDFA_1B)
.isEnabled()
.isPart1()
}
@Test
- public void checkPDFA_2a() {
+ public void checkPDFA2a() {
new PDFAModeChecker(PDFAMode.PDFA_2A)
.isEnabled()
.isNotPart1()
}
@Test
- public void checkPDFA_2b() {
+ public void checkPDFA2b() {
new PDFAModeChecker(PDFAMode.PDFA_2B)
.isEnabled()
.isNotPart1()
}
@Test
- public void checkPDFA_2u() {
+ public void checkPDFA2u() {
new PDFAModeChecker(PDFAMode.PDFA_2U)
.isEnabled()
.isNotPart1()
package org.apache.fop.pdf;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Test case for {@link PDFArray}.
package org.apache.fop.pdf;
-import org.junit.Before;
-import org.junit.Test;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
/**
* Test case for {@link PDFDests}.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.apache.commons.io.output.CountingOutputStream;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import org.apache.commons.io.output.CountingOutputStream;
+
/**
* Test case for {@link PDFDictionary}.
import java.awt.Font;
import java.awt.Graphics2D;
-import junit.framework.Assert;
-
import org.junit.Test;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.fop.svg.PDFDocumentGraphics2D;
+import junit.framework.Assert;
+
/**
* Tests for {@link PDFDocumentGraphics2D}.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import org.junit.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import static org.junit.Assert.assertEquals;
/**
* Test case for {@link PDFDocument}
import org.junit.Test;
-import org.apache.fop.fonts.CodePointMapping;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import org.apache.fop.fonts.CodePointMapping;
+
public class PDFEncodingTestCase {
/**
package org.apache.fop.pdf;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
* Tests the {@link PDFEncryptionJCE} class.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertFalse;
-
import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+
public class PDFFilterListTestCase {
@Test
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.apache.commons.io.output.CountingOutputStream;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.fail;
+
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.commons.io.output.CountingOutputStream;
/**
* Test class for {@link PDFName}.
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import org.junit.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import static org.junit.Assert.assertEquals;
/**
* Test case for {@link PDFNull}.
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* This test tests PDFNumber's doubleOut() methods.
package org.apache.fop.pdf;
+import java.io.IOException;
+
import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
-
/**
* Test case for {@link PDFNumsArray}.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
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 static org.junit.Assert.fail;
+
/**
* Tests the PDFObject class.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
/**
* Test case for {@link PDFRectangle}.
*/
package org.apache.fop.pdf;
-import static org.junit.Assert.assertEquals;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import org.junit.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import static org.junit.Assert.assertEquals;
/**
* Test case for {@link PDFReference}.
package org.apache.fop.pdf;
-import static org.junit.Assert.assertArrayEquals;
-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 org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
public class PDFStreamTestCase {
private PDFStream stream;
}
private PDFDictionary scopeAttribute(Scope scope) {
- return argThat(new isScopeAttribute(scope));
+ return argThat(new IsScopeAttribute(scope));
}
- private static class isScopeAttribute extends ArgumentMatcher<PDFDictionary> {
+ private static class IsScopeAttribute extends ArgumentMatcher<PDFDictionary> {
private final Scope expectedScope;
- public isScopeAttribute(Scope expectedScope) {
+ public IsScopeAttribute(Scope expectedScope) {
this.expectedScope = expectedScope;
}
package org.apache.fop.pdf;
+import org.junit.Before;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Test;
-
/**
* A test class for {@link VersionController}.
package org.apache.fop.pdf;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
/**
* This is a test case for ({@link Version}.
*/
package org.apache.fop.pdf.xref;
-import static org.junit.Assert.assertArrayEquals;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+
public class CompressedObjectReferenceTestCase extends ObjectReferenceTest {
@Test
package org.apache.fop.pdf.xref;
-import static org.junit.Assert.assertArrayEquals;
-
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.junit.Before;
+import static org.junit.Assert.assertArrayEquals;
+
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFInfo;
import org.apache.fop.pdf.PDFPages;
package org.apache.fop.pdf.xref;
-import static org.junit.Assert.assertArrayEquals;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+
public class UncompressedObjectReferenceTestCase extends ObjectReferenceTest {
@Test
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
public final class RawPNGTestUtil {
- private static int NUM_ROWS = 32;
- private static int NUM_COLUMNS = 32;
- private static int DPI = 72;
+ private static final int NUM_ROWS = 32;
+ private static final int NUM_COLUMNS = 32;
+ private static final int DPI = 72;
private RawPNGTestUtil() {
}
/**
- *
+ *
* @return a default ImageSize
*/
public static ImageSize getImageSize() {
package org.apache.fop.render;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.io.File;
import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.apache.commons.io.output.NullOutputStream;
import org.apache.fop.apps.FOPException;
package org.apache.fop.render.afp;
-import static org.junit.Assert.assertTrue;
-
import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
import org.apache.fop.afp.AFPBorderPainter;
import org.apache.fop.afp.AFPLineDataInfo;
import org.apache.fop.afp.AFPPaintingState;
import org.apache.fop.afp.DataStream;
import org.apache.fop.afp.Factory;
import org.apache.fop.fo.Constants;
-import org.junit.Before;
-import org.junit.Test;
public class AFPBorderPainterTestCase {
private ByteArrayOutputStream outStream;
ds.endDocument();
assertTrue(line.getX1() == 4999 && line.getX2() == 8332);
}
-
+
class MyDataStream extends DataStream {
public MyDataStream(Factory factory, AFPPaintingState paintingState, OutputStream outputStream) {
super(factory, paintingState, outputStream);
}
-
+
public void createLine(AFPLineDataInfo lineDataInfo) {
line = lineDataInfo;
}
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.apache.fop.afp.AFPConstants;
import org.apache.fop.apps.AFPRendererConfBuilder;
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_COLOR;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
public class AFPRendererConfigParserTestCase
extends AbstractRendererConfigParserTester<AFPRendererConfBuilder, AFPRendererConfig> {
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.verify;
+
import org.apache.fop.afp.AFPResourceLevel;
import org.apache.fop.afp.AFPResourceLevel.ResourceType;
import org.apache.fop.afp.AFPResourceLevelDefaults;
import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser;
import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.verify;
-
public class AFPRendererConfiguratorTestCase extends
AbstractRendererConfiguratorTest<AFPRendererConfigurator, AFPRendererConfBuilder> {
package org.apache.fop.render.afp;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import org.apache.commons.io.IOUtils;
+
import org.apache.fop.afp.AFPConstants;
import org.apache.fop.afp.parser.MODCAParser;
import org.apache.fop.afp.parser.UnparsedStructuredField;
import org.apache.fop.apps.FOUserAgent;
-import org.junit.Test;
/**
* Tests generation of afp:no-operation (NOPs).
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 org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.BitmapRendererConfBuilder;
import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY;
import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
public class AbstractBitmapRendererConfigParserTester
extends AbstractRendererConfigParserTester<BitmapRendererConfBuilder, BitmapRendererConfig> {
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
import org.apache.fop.apps.AbstractRendererConfiguratorTest;
import org.apache.fop.apps.BitmapRendererConfBuilder;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA;
import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY;
import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
public abstract class AbstractBitmapRendererConfiguratorTest extends
AbstractRendererConfiguratorTest<BitmapRendererConfigurator, BitmapRendererConfBuilder> {
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.xmlgraphics.image.writer.Endianness;
import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.TIFFRendererConfBuilder;
import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
public class TIFFRendererConfigParserTestCase
extends AbstractBitmapRendererConfigParserTester {
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.xmlgraphics.image.writer.Endianness;
import org.apache.fop.apps.FopConfBuilder;
import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T4;
import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T6;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
public class TIFFRendererConfiguratorTestCase extends AbstractBitmapRendererConfiguratorTest {
package org.apache.fop.render.extensions.prepress;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
import java.awt.Dimension;
import java.awt.Rectangle;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
/**
* Tests for the fox:bleed, fox:crop-offset, fox:crop-box extension properties.
*/
package org.apache.fop.render.extensions.prepress;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
import java.awt.geom.Point2D;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
/**
* Tests for the fox:scale extension property.
*/
import org.junit.Test;
import org.w3c.dom.Document;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.traits.BorderProps;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
public class AbstractIFPainterTestCase {
private AbstractIFPainter<?> sut;
fail("Angle " + angle + " is in (0, " + Math.PI / 2 + ")");
}
}
-}
\ No newline at end of file
+}
}
-}
\ No newline at end of file
+}
package org.apache.fop.render.intermediate;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatcher;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.InternalElementMapping;
package org.apache.fop.render.intermediate;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
import org.apache.fop.render.intermediate.IFStructureTreeBuilder.SAXEventRecorder;
import org.apache.fop.util.XMLUtil;
import org.junit.Test;
-import org.apache.avalon.framework.configuration.Configuration;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.apache.fop.apps.AbstractRendererConfigParserTester;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.Java2DRendererConfBuilder;
import org.apache.fop.render.java2d.Java2DRendererConfig.Java2DRendererConfigParser;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
public class Java2DRendererConfigParserTestcase
extends AbstractRendererConfigParserTester<Java2DRendererConfBuilder, Java2DRendererConfig> {
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
-import static org.junit.Assert.assertEquals;
-
public class PCLRendererConfigParserTestCase
extends AbstractRendererConfigParserTester<PCLRendererConfBuilder, PCLRendererConfig> {
import org.junit.Test;
-import org.apache.fop.apps.AbstractRendererConfiguratorTest;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import org.apache.fop.apps.AbstractRendererConfiguratorTest;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
+
public class PCLRendererConfiguratorTestCase extends
AbstractRendererConfiguratorTest<PCLRendererConfigurator, PCLRendererConfBuilder> {
import org.junit.Test;
import org.xml.sax.SAXException;
+import static org.junit.Assert.fail;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.pdf.PDFConformanceException;
-import static org.junit.Assert.fail;
-
/**
* Tests PDF/A-1 functionality.
*/
package org.apache.fop.render.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
import java.util.Calendar;
import java.util.TimeZone;
-import org.apache.fop.pdf.PDFDocument;
-import org.apache.fop.pdf.PDFInfo;
-import org.apache.fop.pdf.PDFMetadata;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import org.apache.xmlgraphics.xmp.Metadata;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema;
import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema;
import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFAdapter;
import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFSchema;
-import org.junit.Test;
+
+import org.apache.fop.pdf.PDFDocument;
+import org.apache.fop.pdf.PDFInfo;
+import org.apache.fop.pdf.PDFMetadata;
/**
* Test case for PDF/A metadata handling.
package org.apache.fop.render.pdf;
-import static org.junit.Assert.assertEquals;
-
import java.io.StringWriter;
-import org.apache.fop.pdf.CMapBuilder;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.fop.pdf.CMapBuilder;
+
/** Simple sanity test of the PDFCmap class */
public class PDFCMapTestCase {
private static final String EOL = "\n";
+ "end" + EOL
+ "end" + EOL
+ "%%EndResource" + EOL
- + "%%EOF" + EOL
- ;
+ + "%%EOF" + EOL;
final StringWriter w = new StringWriter();
final CMapBuilder builder = new CMapBuilder(w, "test");
package org.apache.fop.render.pdf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.File;
import java.io.IOException;
import java.util.StringTokenizer;
import org.junit.Test;
import org.xml.sax.SAXException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.apache.fop.apps.FOUserAgent;
/** Test that characters are correctly encoded in a generated PDF file */
import org.junit.Before;
import org.junit.Test;
-import org.apache.fop.pdf.PDFNumber;
-
import static org.mockito.Matchers.endsWith;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import org.apache.fop.pdf.PDFNumber;
+
public class PDFGraphicsPainterTestCase {
private PDFGraphicsPainter sut;
import org.junit.Test;
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fo.Constants;
-import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.traits.BorderProps;
-
import static org.mockito.Matchers.endsWith;
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.apps.FOUserAgent;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.render.intermediate.IFContext;
+import org.apache.fop.traits.BorderProps;
+
public class PDFPainterTestCase {
@Test
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.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.PDFRendererConfBuilder;
import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.Version;
import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
public class PDFRendererConfigParserTestCase
extends AbstractRendererConfigParserTester<PDFRendererConfBuilder, PDFRendererConfig> {
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.PDFEncryptionParams;
import org.apache.fop.pdf.PDFXMode;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE;
import static org.apache.fop.render.pdf.PDFRendererOption.VERSION;
-import static org.junit.Assert.assertEquals;
public class PDFRendererOptionsConfigTestCase {
static {
final EnumMap<PDFRendererOption, Object> props
= new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class);
- for(PDFRendererOption option : PDFRendererOption.values()) {
+ for (PDFRendererOption option : PDFRendererOption.values()) {
props.put(option, option.getDefaultValue());
}
DEFAULT_OPTIONS = Collections.unmodifiableMap(props);
assertEncryptionParamsEquals(expectedEncryptionParams, actual.getEncryptionParameters());
}
- private static void assertEncryptionParamsEquals(PDFEncryptionParams expected,
+ private static void assertEncryptionParamsEquals(PDFEncryptionParams expected,
PDFEncryptionParams actual) {
assertEquals(expected == null, actual == null);
if (actual != null) {
package org.apache.fop.render.pdf;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import org.xml.sax.SAXException;
+import static org.junit.Assert.fail;
+
import org.apache.fop.apps.FOUserAgent;
/**
* A test suite for org.apache.fop.render.pdf.*
*/
@RunWith(Suite.class)
-@SuiteClasses({
- PDFRendererConfigParserTestCase.class
-})
+@SuiteClasses(PDFRendererConfigParserTestCase.class)
public final class RenderPDFTestSuite {
}
package org.apache.fop.render.ps;
-import static org.junit.Assert.assertEquals;
-
import java.io.File;
import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+
import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.DSCException;
import org.apache.xmlgraphics.ps.dsc.DSCParser;
import org.junit.Test;
-import org.apache.xmlgraphics.image.loader.ImageSize;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG;
-
-import org.apache.fop.render.RawPNGTestUtil;
-
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import org.apache.xmlgraphics.image.loader.ImageSize;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG;
+
+import org.apache.fop.render.RawPNGTestUtil;
+
public class ImageEncoderPNGTestCase {
@Test
/* $Id$ */
package org.apache.fop.render.ps;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.apache.commons.io.IOUtils;
import org.apache.xmlgraphics.ps.DSCConstants;
int y = 100000;
int letterSpacing = 0;
int wordSpacing = 0;
- int dp[][] = {{100, 100, 0, 0}, null, null, {200, 200, -100, -100}};
- double X = (x + dp[0][0]) / 1000.0;
- double Y = (y - dp[0][1]) / 1000.0;
- when(psGenerator.formatDouble(X)).thenReturn("100.100");
- when(psGenerator.formatDouble(Y)).thenReturn("99.900");
+ int[][] dp = {{100, 100, 0, 0}, null, null, {200, 200, -100, -100}};
+ double xAsDouble = (x + dp[0][0]) / 1000.0;
+ double yAsDouble = (y - dp[0][1]) / 1000.0;
+ when(psGenerator.formatDouble(xAsDouble)).thenReturn("100.100");
+ when(psGenerator.formatDouble(yAsDouble)).thenReturn("99.900");
String text = "Hello Mock!";
try {
psPainter.drawText(x, y, letterSpacing, wordSpacing, dp, text);
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.PSRendererConfBuilder;
import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser;
-import static org.junit.Assert.assertEquals;
-
public class PSRendererConfigParserTestCase
extends AbstractRendererConfigParserTester<PSRendererConfBuilder, PSRendererConfig> {
import org.junit.Test;
-import org.apache.fop.apps.AbstractRendererConfiguratorTest;
-import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.apps.PSRendererConfBuilder;
-import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import org.apache.fop.apps.AbstractRendererConfiguratorTest;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.PSRendererConfBuilder;
+import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser;
+
public class PSRendererConfiguratorTestCase extends
AbstractRendererConfiguratorTest<PSRendererConfigurator, PSRendererConfBuilder> {
private PSRenderingUtil psUtil;
import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
public class PSRenderingUtilTestCase {
private final String content = "<< /MyEntry 0 >> command";
package org.apache.fop.render.ps;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.apache.commons.io.IOUtils;
import org.apache.xmlgraphics.ps.DSCConstants;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.commons.io.FileUtils;
import org.apache.batik.ext.awt.RadialGradientPaint;
import org.apache.xmlgraphics.java2d.GraphicContext;
import org.apache.xmlgraphics.ps.PSGenerator;
-import static org.junit.Assert.assertEquals;
-
public class PSSVGGraphics2DTestCase {
float cx = 841.891f;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.commons.io.FileUtils;
import org.apache.batik.ext.awt.LinearGradientPaint;
import org.apache.xmlgraphics.java2d.GraphicContext;
import org.apache.xmlgraphics.ps.PSGenerator;
-import static org.junit.Assert.assertEquals;
-
public class PSSVGLinearGraphics2DTestCase {
float startX = 115f;
float endX = 15f;
float startY = 285f;
- float endY=15f;
+ float endY = 15f;
float[] fractions = {0.0f, 1.0f};
/**
import java.io.StringWriter;
+import org.junit.Test;
+
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
-import org.junit.Test;
/**
* Test for http://issues.apache.org/bugzilla/show_bug.cgi?id=39607
* Test suite for FOP's RTF library.
*/
@RunWith(Suite.class)
-@SuiteClasses({ Bug39607TestCase.class })
+@SuiteClasses(Bug39607TestCase.class)
public class RichTextFormatTestSuite {
}
package org.apache.fop.render.rtf.rtflib.testdocs;
+import java.io.IOException;
+
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink;
-
-import java.io.IOException;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/**
* Class <code>BasicLink</code> here.
- *
- * @author <a href="mailto:mks@ANDREAS">Andreas Putz</a>
*/
public class BasicLink extends TestDocument {
import java.io.File;
import java.io.IOException;
-//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
/** Create test RTF documents from classes found in this package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
- * @author Andreas Putz a.putz@skynamics.com
*/
public class CreateTestDocuments {
* to create documents without worrying about nested tables handling.
* Might need to be replaced by more complete version in some sample
* documents created by this package.
- *
- * @author bdelacretaz@codeconsult.ch
*/
class DummyTableColumnsInfo implements ITableColumnsInfo {
package org.apache.fop.render.rtf.rtflib.testdocs;
+import java.io.IOException;
+
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
-
-import java.io.IOException;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/**
* Generate a test document containing external graphics.
- *
- * @author <a href="mailto:a.putz@skynamics.com">Andreas Putz</a>
*/
class ExternalGraphic extends TestDocument {
private String file = "file:///tmp/jfor-images/logo.";
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
/** Generates a simple RTF test document for the jfor rtflib package.
*/
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
/** Generates an RTF test document containing merged table cells
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class MergedTableCells extends TestDocument {
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
/** Generates an RTF document to test nested tables with the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class NestedTable extends TestDocument {
package org.apache.fop.render.rtf.rtflib.testdocs;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
/** Generates a simple RTF test document for the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
public class ParagraphAlignment extends TestDocument {
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/** Generates a simple RTF test document for the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class SimpleDocument
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyleNumber;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/** Generates a simple RTF test document for the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class SimpleLists extends TestDocument {
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
/** Generates a simple RTF test document for the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class SimpleTable extends TestDocument {
/** generate the body of the test document */
package org.apache.fop.render.rtf.rtflib.testdocs;
-import java.util.Date;
import java.io.File;
-import java.io.IOException;
import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Date;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
-//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/** Base class for generating RTF documents used to test the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
abstract class TestDocument {
import java.io.IOException;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
/** Generates a simple RTF test document for the jfor rtflib package.
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class TextAttributes extends TestDocument {
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
/** Generates an RTF document to test the WhitespaceCollapser
- * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
*/
class Whitespace extends TestDocument {
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.TxtRendererConfBuilder;
-import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption;
import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigParser;
-
-import static org.junit.Assert.assertEquals;
+import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption;
public class TxtRendererConfigParserTestCase
extends AbstractRendererConfigParserTester<TxtRendererConfBuilder, TxtRendererConfig> {
package org.apache.fop.text.linebreak;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
/**
* JUnit test case for the LineBreakStatus class
package org.apache.fop.text.linebreak;
-import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* TODO add javadoc
*
}
}
- /** {@inheritDoc}
- * @throws URISyntaxException
+ /** {@inheritDoc}
+ * @throws URISyntaxException
* @throws SAXException */
public void process(Source src, Templates templates, OutputStream out)
throws java.io.IOException, URISyntaxException, SAXException {
/**
* Starter class for the multi-threading testbed.
*/
-public class Main {
+public final class Main {
+
+ private Main() {
+ }
private static void prompt() throws IOException {
BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in));
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace;
import org.apache.fop.fo.Constants;
import org.apache.fop.util.ColorUtil;
-import static org.junit.Assert.assertEquals;
-
/**
* Tests the BorderProps class.
*/
Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f);
//Normalize: Avoid false alarms due to color conversion (rounding)
col = ColorUtil.parseColorString(null, ColorUtil.colorToString(col));
- for(BorderProps.Mode mode : BorderProps.Mode.values()) {
+ for (BorderProps.Mode mode : BorderProps.Mode.values()) {
BorderProps sut = BorderProps.makeRectangular(Constants.EN_SOLID, 10, col, mode);
testSerialization(sut);
sut = new BorderProps(Constants.EN_SOLID, 10, 4, 3, col, mode);
package org.apache.fop.traits;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-
/**
* Tests the {@link MinOptMax} class.
*/
package org.apache.fop.util;
-import static org.junit.Assert.assertEquals;
-
import java.util.Map;
-import org.apache.fop.events.model.EventSeverity;
-import org.apache.fop.util.text.AdvancedMessageFormat;
import org.junit.Test;
import org.xml.sax.helpers.LocatorImpl;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.fop.events.model.EventSeverity;
+import org.apache.fop.util.text.AdvancedMessageFormat;
+
/**
* Tests for EventFormatter.
*/
package org.apache.fop.util;
-import static org.junit.Assert.assertEquals;
-
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.io.InputStream;
import java.io.StringWriter;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
import org.apache.commons.io.IOUtils;
-import org.apache.fop.util.bitmap.BitmapImageUtil;
-import org.apache.fop.util.bitmap.MonochromeBitmapConverter;
+
import org.apache.xmlgraphics.image.writer.ImageWriterUtil;
import org.apache.xmlgraphics.util.WriterOutputStream;
import org.apache.xmlgraphics.util.io.ASCIIHexOutputStream;
-import org.junit.Test;
+
+import org.apache.fop.util.bitmap.BitmapImageUtil;
+import org.apache.fop.util.bitmap.MonochromeBitmapConverter;
/**
* Tests {@link BitmapImageUtil}.
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.apache.xmlgraphics.java2d.color.ColorSpaces;
import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
import org.apache.xmlgraphics.java2d.color.NamedColorSpace;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.FopFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
/**
* Tests the ColorUtil class.
*/
super.endDocument();
}
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
public void startElement(
String url,
String localName,
package org.apache.fop.util;
+import java.util.LinkedList;
+
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import java.util.LinkedList;
-
import org.apache.fop.layoutmgr.ElementListUtils;
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.junit.Test;
/**
* Test class for ElementListUtils.
package org.apache.fop.util;
-import static org.junit.Assert.assertEquals;
-
import java.util.Locale;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* Tests {@link LanguageTags}.
*/
package org.apache.fop.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
/**
* Tests for XMLResourceBundle.
*/
import java.io.InputStream;
import java.net.URL;
+import org.apache.commons.io.IOUtils;
+
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.ext.awt.image.renderable.Filter;
import org.apache.batik.ext.awt.image.spi.ImageTagRegistry;
import org.apache.batik.util.ParsedURL;
-import org.apache.commons.io.IOUtils;
/**
* Helper class to visually compare two bitmap images.
* <p>
* TODO Move as utility class to XML Graphics Commons when possible
*/
-public class BitmapComparator {
+public final class BitmapComparator {
+
+
+ private BitmapComparator() {
+ }
/**
* Builds a new BufferedImage that is the difference between the two input images
int w = ref.getWidth();
int h = ref.getHeight();
- int y, i, val;
int [] refPix = null;
int [] genPix = null;
- for (y = 0; y < h; y++) {
- refPix = refWR.getPixels (0, y, w, 1, refPix);
- genPix = genWR.getPixels (0, y, w, 1, genPix);
- for (i = 0; i < refPix.length; i++) {
+ for (int y = 0; y < h; y++) {
+ refPix = refWR.getPixels(0, y, w, 1, refPix);
+ genPix = genWR.getPixels(0, y, w, 1, genPix);
+ for (int i = 0; i < refPix.length; i++) {
// val = ((genPix[i] - refPix[i]) * 5) + 128;
- val = ((refPix[i] - genPix[i]) * 10) + 128;
+ int val = ((refPix[i] - genPix[i]) * 10) + 128;
if ((val & 0xFFFFFF00) != 0) {
if ((val & 0x80000000) != 0) {
val = 0;
/**
* Utilities for converting files with external converters.
*/
-public class ConvertUtils {
+public final class ConvertUtils {
+
+ private ConvertUtils() {
+ }
/**
* Calls an external converter application (GhostScript, for example).