You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2008/07/24 11:37:16 UTC
svn commit: r679326 [33/33] - in /xmlgraphics/fop/trunk:
examples/embedding/java/embedding/ examples/embedding/java/embedding/events/
examples/embedding/java/embedding/intermediate/
examples/embedding/java/embedding/model/ examples/embedding/java/embed...
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java Thu Jul 24 02:35:34 2008
@@ -39,16 +39,16 @@
public void testSerialization() throws Exception {
Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f);
String s = ColorUtil.colorToString(col);
-
- //This is what the old color spit out. Now it is 80 due to rounding
+
+ //This is what the old color spit out. Now it is 80 due to rounding
//assertEquals("#ffff7f", s);
assertEquals("#ffff80", s);
-
+
col = new Color(1.0f, 0.0f, 0.0f, 0.8f);
s = ColorUtil.colorToString(col);
assertEquals("#ff0000cc", s);
}
-
+
/**
* Test deserialization from String.
* @throws Exception if an error occurs
@@ -66,7 +66,7 @@
assertEquals(0, col.getBlue());
assertEquals(204, col.getAlpha());
}
-
+
/**
* Test equals().
* @throws Exception if an error occurs
@@ -76,7 +76,7 @@
Color col2 = ColorUtil.parseColorString(null, "#ff0000cc");
assertEquals(col1, col2);
}
-
+
/**
* Tests the rgb() function.
* @throws Exception if an error occurs
@@ -85,7 +85,7 @@
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent ua = fopFactory.newFOUserAgent();
Color colActual;
-
+
colActual = ColorUtil.parseColorString(ua, "rgb(255, 40, 0)");
assertEquals(255, colActual.getRed());
assertEquals(40, colActual.getGreen());
@@ -93,7 +93,7 @@
assertEquals(255, colActual.getAlpha());
assertEquals(ColorSpace.getInstance(ColorSpace.CS_sRGB), colActual.getColorSpace());
}
-
+
/**
* Tests the fop-rgb-icc() function.
* @throws Exception if an error occurs
@@ -103,11 +103,11 @@
ColorSpace cs = fopFactory.getColorSpace(null,
"src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm");
assertNotNull(cs);
-
-
+
+
FOUserAgent ua = fopFactory.newFOUserAgent();
ColorExt colActual;
-
+
//fop-rgb-icc() is used instead of rgb-icc() inside FOP!
String colSpec = "fop-rgb-icc(1.0,0.0,0.0,sRGBAlt,"
+ "\"src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm\",1.0,0.0,0.0)";
@@ -125,7 +125,7 @@
assertEquals(1f, comps[0], 0);
assertEquals(0f, comps[1], 0);
assertEquals(0f, comps[2], 0);
-
+
assertEquals(colSpec, ColorUtil.colorToString(colActual));
colSpec = "fop-rgb-icc(1.0,0.5,0.0,blah,"
@@ -133,7 +133,7 @@
Color colFallback = ColorUtil.parseColorString(ua, colSpec);
assertEquals(new Color(1.0f, 0.5f, 0.0f), colFallback);
}
-
+
/**
* Tests the cmyk() function.
* @throws Exception if an error occurs
@@ -141,7 +141,7 @@
public void testCMYK() throws Exception {
ColorExt colActual;
String colSpec;
-
+
colSpec = "cmyk(0.0, 0.0, 1.0, 0.0)";
colActual = (ColorExt)ColorUtil.parseColorString(null, colSpec);
assertEquals(255, colActual.getRed());
@@ -155,7 +155,7 @@
assertEquals(1f, comps[2], 0);
assertEquals(0f, comps[3], 0);
assertEquals("cmyk(0.0,0.0,1.0,0.0)", ColorUtil.colorToString(colActual));
-
+
colSpec = "cmyk(0.0274, 0.2196, 0.3216, 0.0)";
colActual = (ColorExt)ColorUtil.parseColorString(null, colSpec);
assertEquals(248, colActual.getRed());
@@ -169,5 +169,5 @@
assertEquals(0f, comps[3], 0);
assertEquals("cmyk(0.0274,0.2196,0.3216,0.0)", ColorUtil.colorToString(colActual));
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java Thu Jul 24 02:35:34 2008
@@ -28,11 +28,11 @@
public class ConsoleEventListenerForTests implements EventListener {
private String name;
-
+
public ConsoleEventListenerForTests(String name) {
this.name = name;
}
-
+
/** {@inheritDoc} */
public void processEvent(Event event) {
if (this.name != null) {
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DataURIResolverTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DataURIResolverTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DataURIResolverTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DataURIResolverTestCase.java Thu Jul 24 02:35:34 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@
public class DataURIResolverTestCase extends TestCase {
private static final byte[] TESTDATA = new byte[] {0, 1, 2, 3, 4, 5};
-
+
/**
* Tests DataURLUtil.
* @throws Exception if an error occurs
@@ -56,14 +56,14 @@
public void testNonMatchingContract() throws Exception {
URIResolver resolver = new DataURIResolver();
Source src;
-
+
src = resolver.resolve("http://xmlgraphics.apache.org/fop/index.html", null);
assertNull(src);
src = resolver.resolve("index.html", "http://xmlgraphics.apache.org/fop/");
assertNull(src);
}
-
+
private static boolean byteCmp(byte[] src, int srcOffset, byte[] cmp) {
for (int i = 0, c = cmp.length; i < c; i++) {
if (src[srcOffset + i] != cmp[i]) {
@@ -80,7 +80,7 @@
public void testDataURLHandling() throws Exception {
URIResolver resolver = new DataURIResolver();
Source src;
-
+
src = resolver.resolve("data:;base64,AAECAwQF", null);
assertNotNull(src);
StreamSource streamSource = (StreamSource)src;
@@ -112,5 +112,5 @@
assertEquals("A brief note", text);
*/
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DigestFilter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DigestFilter.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DigestFilter.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/DigestFilter.java Thu Jul 24 02:35:34 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@
* If the filter is namespace aware, the URI and local name for
* each element is digested, otherwise the QName. Attributes are
* sorted before the name-value pairs are digested.
- *
+ *
*/
public class DigestFilter extends XMLFilterImpl {
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java Thu Jul 24 02:35:34 2008
@@ -50,16 +50,16 @@
lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
-
+
boolean res = ElementListUtils.removeLegalBreaks(lst, 9000);
-
+
assertFalse(res);
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getP());
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getP());
assertEquals(0, ((KnuthPenalty)lst.get(5)).getP());
}
-
+
/**
* Tests ElementListUtils.removeLegalBreaks().
* @throws Exception if the test fails
@@ -76,11 +76,11 @@
lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
-
+
boolean res = ElementListUtils.removeLegalBreaks(lst, 9000);
-
+
assertFalse(res);
-
+
//Must insert an INFINITE penalty
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getP());
assertEquals(0, ((KnuthGlue)lst.get(2)).getW());
@@ -88,7 +88,7 @@
assertEquals(0, ((KnuthGlue)lst.get(5)).getW());
assertEquals(0, ((KnuthGlue)lst.get(7)).getW());
}
-
+
/**
* Tests ElementListUtils.removeLegalBreaksFromEnd().
* @throws Exception if the test fails
@@ -105,16 +105,16 @@
lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
-
+
boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000);
-
+
assertFalse(res);
assertEquals(0, ((KnuthPenalty)lst.get(1)).getP());
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getP());
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getP());
}
-
+
/**
* Tests ElementListUtils.removeLegalBreaksFromEnd().
* @throws Exception if the test fails
@@ -131,9 +131,9 @@
lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
-
+
boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000);
-
+
assertFalse(res);
//Must insert an INFINITE penalty
@@ -142,6 +142,6 @@
assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getP());
assertEquals(0, ((KnuthGlue)lst.get(6)).getW());
}
-
-
+
+
}
\ No newline at end of file
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/PDFNumberTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/PDFNumberTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/PDFNumberTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/PDFNumberTestCase.java Thu Jul 24 02:35:34 2008
@@ -39,14 +39,14 @@
assertEquals("0.1", PDFNumber.doubleOut(0.1f));
assertEquals("100", PDFNumber.doubleOut(100.0f));
assertEquals("100", PDFNumber.doubleOut(99.99999999999999999999999f));
-
- //You'd expect 100.123456 here but DecimalFormat uses the BigDecimal.ROUND_HALF_EVEN
+
+ //You'd expect 100.123456 here but DecimalFormat uses the BigDecimal.ROUND_HALF_EVEN
//strategy. I don't know if that's a problem. The strange thing testDoubleOut2
//seems to return the normally expected value. Weird.
assertEquals("100.123459", PDFNumber.doubleOut(100.12345611111111f));
assertEquals("-100.123459", PDFNumber.doubleOut(-100.12345611111111f));
}
-
+
/**
* Tests PDFNumber.doubleOut().
* @throws Exception if the test fails
@@ -61,7 +61,7 @@
assertEquals("100.1234", PDFNumber.doubleOut(100.12341111111111f, 4));
assertEquals("-100.1234", PDFNumber.doubleOut(-100.12341111111111f, 4));
}
-
+
/**
* Tests PDFNumber.doubleOut().
* @throws Exception if the test fails
@@ -74,7 +74,7 @@
assertEquals("100", PDFNumber.doubleOut(100.1234f, 0));
assertEquals("-100", PDFNumber.doubleOut(-100.1234f, 0));
}
-
+
/**
* Tests PDFNumber.doubleOut(). Special cases (former bugs).
* @throws Exception if the test fails
@@ -85,7 +85,7 @@
assertEquals("0", PDFNumber.doubleOut(d, 4));
assertEquals("0.00000572", PDFNumber.doubleOut(d, 8));
}
-
+
/**
* Tests PDFNumber.doubleOut(). Tests for wrong parameters.
* @throws Exception if the test fails
@@ -110,5 +110,5 @@
//we want that
}
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/UnitConvTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/UnitConvTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/UnitConvTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/UnitConvTestCase.java Thu Jul 24 02:35:34 2008
@@ -38,9 +38,9 @@
assertEquals("pt2mm", 297, UnitConv.pt2mm(841.890), 0.0001);
assertEquals("in2mpt", 792000, UnitConv.in2mpt(11.0), 1.0 / 2); //height of a letter page
assertEquals("mpt2in", 11.0, UnitConv.mpt2in(792000), 0.01 / 2); //height of a letter page
-
+
assertEquals("mm2px/72dpi", 841.8897764234434, UnitConv.mm2px(297.0, 72), 0);
assertEquals("mm2px/300dpi", 3507.8740684310146, UnitConv.mm2px(297.0, 300), 0);
}
-
+
}
\ No newline at end of file
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java Thu Jul 24 02:35:34 2008
@@ -35,7 +35,7 @@
getClass().getName(), Locale.ENGLISH, getClass().getClassLoader());
ResourceBundle bundleDE = XMLResourceBundle.getXMLBundle(
getClass().getName(), Locale.GERMAN, getClass().getClassLoader());
-
+
assertEquals("", bundle.getLocale().getLanguage());
assertEquals("de", bundleDE.getLocale().getLanguage());
@@ -46,7 +46,7 @@
assertEquals("Untranslatable", bundle.getString("untranslatable"));
assertEquals("Untranslatable", bundleDE.getString("untranslatable"));
}
-
+
public void testWithInvalidFile() throws Exception {
try {
ResourceBundle bundle = XMLResourceBundle.getXMLBundle(
@@ -56,5 +56,5 @@
//expected
}
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractBitmapProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractBitmapProducer.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractBitmapProducer.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractBitmapProducer.java Thu Jul 24 02:35:34 2008
@@ -32,14 +32,14 @@
/** Logger */
protected static Log log = LogFactory.getLog(AbstractBitmapProducer.class);
-
+
/**
* Returns a new JAXP Transformer based on information in the ProducerContext.
* @param context context information for the process
* @return a new Transformer instance (identity or set up with a stylesheet)
* @throws TransformerConfigurationException in case creating the Transformer fails.
*/
- protected Transformer getTransformer(ProducerContext context)
+ protected Transformer getTransformer(ProducerContext context)
throws TransformerConfigurationException {
if (context.getTemplates() != null) {
return context.getTemplates().newTransformer();
@@ -47,5 +47,5 @@
return context.getTransformerFactory().newTransformer();
}
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java Thu Jul 24 02:35:34 2008
@@ -40,7 +40,7 @@
import org.apache.fop.apps.FopFactory;
/**
- * BitmapProducer implementation that uses the PS or PDF renderer and an external converter
+ * BitmapProducer implementation that uses the PS or PDF renderer and an external converter
* to create bitmaps.
* <p>
* Here's what the configuration element looks like for the class:
@@ -52,7 +52,7 @@
* </producer>
* </pre>
* <p>
- * You will notice the three parameters in curly braces (java.util.MessageFormat style) to the
+ * You will notice the three parameters in curly braces (java.util.MessageFormat style) to the
* converter call:
* <ul>
* <li>0: the input file
@@ -62,15 +62,15 @@
* <p>
* The "delete-temp-files" element is optional and defaults to true.
*/
-public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer
+public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer
implements Configurable {
// configure fopFactory as desired
private FopFactory fopFactory = FopFactory.newInstance();
-
+
private String converter;
private boolean deleteTempFiles;
-
+
/** @see org.apache.avalon.framework.configuration.Configurable */
public void configure(Configuration cfg) throws ConfigurationException {
this.converter = cfg.getChild("converter").getValue();
@@ -86,9 +86,9 @@
*/
public void convert(File inFile, File outFile, ProducerContext context) throws IOException {
outFile.delete();
-
+
//Build command-line
- String cmd = MessageFormat.format(converter,
+ String cmd = MessageFormat.format(converter,
new Object[] {inFile.toString(), outFile.toString(),
Integer.toString(context.getTargetResolution())});
ConvertUtils.convert(cmd, null, null, log);
@@ -97,17 +97,17 @@
throw new IOException("The target file has not been generated");
}
}
-
+
/**
- * @return the native extension generated by the output format, ex. "ps" or "pdf".
+ * @return the native extension generated by the output format, ex. "ps" or "pdf".
*/
protected abstract String getTargetExtension();
-
+
/**
* @return the output format for the FOP renderer, i.e. a MIME type.
*/
protected abstract String getTargetFormat();
-
+
/** @see org.apache.fop.visual.BitmapProducer */
public BufferedImage produce(File src, ProducerContext context) {
try {
@@ -115,9 +115,9 @@
userAgent.setTargetResolution(context.getTargetResolution());
userAgent.setBaseURL(src.getParentFile().toURL().toString());
- File tempOut = new File(context.getTargetDir(),
+ File tempOut = new File(context.getTargetDir(),
src.getName() + "." + getTargetExtension());
- File tempPNG = new File(context.getTargetDir(),
+ File tempPNG = new File(context.getTargetDir(),
src.getName() + "." + getTargetExtension() + ".png");
try {
OutputStream out = new FileOutputStream(tempOut);
@@ -125,13 +125,13 @@
try {
Fop fop = fopFactory.newFop(getTargetFormat(), userAgent, out);
SAXResult res = new SAXResult(fop.getDefaultHandler());
-
+
Transformer transformer = getTransformer(context);
transformer.transform(new StreamSource(src), res);
} finally {
IOUtils.closeQuietly(out);
}
-
+
convert(tempOut, tempPNG, context);
BufferedImage img = BitmapComparator.getImage(tempPNG);
return img;
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java Thu Jul 24 02:35:34 2008
@@ -23,7 +23,7 @@
* Abstract base implementation for a RedirectorLineHandler which provides empty notifyStart()
* and notifyEnd() methods.
*/
-public abstract class AbstractRedirectorLineHandler
+public abstract class AbstractRedirectorLineHandler
implements RedirectorLineHandler {
/** @see org.apache.fop.visual.RedirectorLineHandler#notifyStart() */
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BatchDiffer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BatchDiffer.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BatchDiffer.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BatchDiffer.java Thu Jul 24 02:35:34 2008
@@ -89,7 +89,7 @@
* source files with. Default: no stylesheet, identity transform.
* <p>
* The "producers" element contains a list of producer implementations with configuration.
- * The "classname" attribute specifies the fully qualified class name for the implementation.
+ * The "classname" attribute specifies the fully qualified class name for the implementation.
*/
public class BatchDiffer {
@@ -114,7 +114,7 @@
* @throws SAXException In case of a problem during SAX processing
* @throws IOException In case of a I/O problem
*/
- public void runBatch(File cfgFile)
+ public void runBatch(File cfgFile)
throws ConfigurationException, SAXException, IOException {
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(cfgFile);
@@ -141,7 +141,7 @@
}
}
BitmapProducer[] producers = getProducers(cfg.getChild("producers"));
-
+
//Set up directories
File srcDir = new File(cfg.getChild("source-directory").getValue());
if (!srcDir.exists()) {
@@ -153,12 +153,12 @@
throw new RuntimeException("target-directory is invalid: " + targetDir);
}
context.setTargetDir(targetDir);
-
+
boolean stopOnException = cfg.getChild("stop-on-exception").getValueAsBoolean(true);
final boolean createDiffs = cfg.getChild("create-diffs").getValueAsBoolean(true);
-
+
//RUN!
-
+
IOFileFilter filter = new SuffixFileFilter(new String[] {".xml", ".fo"});
//Same filtering as in layout engine tests
if (cfg.getChild("filter-disabled").getValueAsBoolean(true)) {
@@ -191,10 +191,10 @@
}
//Create combined image
if (bitmaps[0] == null) {
- throw new RuntimeException("First producer didn't return a bitmap for "
+ throw new RuntimeException("First producer didn't return a bitmap for "
+ f + ". Cannot continue.");
}
-
+
Runnable runnable = new Runnable() {
public void run() {
try {
@@ -226,11 +226,11 @@
throw new RuntimeException("Error while configuring BatchDiffer: " + e.getMessage());
}
}
-
+
private void saveBitmaps(File targetDir, File srcFile, boolean createDiffs,
BufferedImage[] bitmaps) throws IOException {
BufferedImage combined = BitmapComparator.buildCompareImage(bitmaps);
-
+
//Save combined bitmap as PNG file
File outputFile = new File(targetDir, srcFile.getName() + "._combined.png");
ImageWriterUtil.saveAsPNG(combined, outputFile);
@@ -244,7 +244,7 @@
}
}
}
-
+
private BitmapProducer[] getProducers(Configuration cfg) {
Configuration[] children = cfg.getChildren("producer");
BitmapProducer[] producers = new BitmapProducer[children.length];
@@ -260,7 +260,7 @@
}
return producers;
}
-
+
/**
* Main method.
* @param args command-line arguments
@@ -278,16 +278,16 @@
printUsage();
System.exit(-1);
}
-
+
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
BatchDiffer differ = new BatchDiffer();
differ.runBatch(cfgFile);
-
+
System.out.println("Regular exit...");
} catch (Exception e) {
System.out.println("Exception caught...");
e.printStackTrace();
}
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapComparator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapComparator.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapComparator.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapComparator.java Thu Jul 24 02:35:34 2008
@@ -39,8 +39,8 @@
/**
* Helper class to visually compare two bitmap images.
* <p>
- * This class was created by extracting reusable code from
- * org.apache.batik.test.util.ImageCompareText (Apache Batik)
+ * This class was created by extracting reusable code from
+ * org.apache.batik.test.util.ImageCompareText (Apache Batik)
* into this separate class.
* <p>
* TODO Move as utility class to XML Graphics Commons when possible
@@ -51,7 +51,7 @@
* Builds a new BufferedImage that is the difference between the two input images
* @param ref the reference bitmap
* @param gen the newly generated bitmap
- * @return the diff bitmap
+ * @return the diff bitmap
*/
public static BufferedImage buildDiffImage(BufferedImage ref,
BufferedImage gen) {
@@ -104,7 +104,7 @@
ColorModel cm = gen.getColorModel();
cm = GraphicsUtil.coerceData(genWR, cm, false);
}
-
+
if (!refPre) {
ColorModel cm = ref.getColorModel();
cm = GraphicsUtil.coerceData(refWR, cm, false);
@@ -114,14 +114,14 @@
}
/**
- * Builds a combined image that places a number of images next to each other for
- * manual, visual comparison.
+ * Builds a combined image that places a number of images next to each other for
+ * manual, visual comparison.
* @param images the array of bitmaps
* @return the combined image
*/
public static BufferedImage buildCompareImage(BufferedImage[] images) {
BufferedImage cmp = new BufferedImage(
- images[0].getWidth() * images.length,
+ images[0].getWidth() * images.length,
images[0].getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = cmp.createGraphics();
@@ -145,8 +145,8 @@
}
/**
- * Builds a combined image that places two images next to each other for
- * manual, visual comparison.
+ * Builds a combined image that places two images next to each other for
+ * manual, visual comparison.
* @param ref the reference image
* @param gen the actual image
* @return the combined image
@@ -155,7 +155,7 @@
BufferedImage gen) {
return buildCompareImage(new BufferedImage[] {ref, gen});
}
-
+
/**
* Loads an image from a URL
* @param url the URL to the image
@@ -173,7 +173,7 @@
if (red == null) {
return null;
}
-
+
BufferedImage img = new BufferedImage(red.getWidth(),
red.getHeight(),
BufferedImage.TYPE_INT_ARGB);
@@ -192,7 +192,7 @@
InputStream in = new java.io.FileInputStream(bitmapFile);
try {
in = new java.io.BufferedInputStream(in);
-
+
ImageTagRegistry reg = ImageTagRegistry.getRegistry();
Filter filt = reg.readStream(in);
if (filt == null) {
@@ -203,7 +203,7 @@
if (red == null) {
return null;
}
-
+
BufferedImage img = new BufferedImage(red.getWidth(),
red.getHeight(),
BufferedImage.TYPE_INT_ARGB);
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducer.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducer.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducer.java Thu Jul 24 02:35:34 2008
@@ -35,5 +35,5 @@
* @return the generated BufferedImage
*/
BufferedImage produce(File src, ProducerContext context);
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerJava2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerJava2D.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerJava2D.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerJava2D.java Thu Jul 24 02:35:34 2008
@@ -55,7 +55,7 @@
// configure fopFactory as desired
private FopFactory fopFactory = FopFactory.newInstance();
-
+
private boolean deleteTempFiles;
/** @see org.apache.avalon.framework.configuration.Configurable */
@@ -69,20 +69,20 @@
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setTargetResolution(context.getTargetResolution());
userAgent.setBaseURL(src.getParentFile().toURL().toString());
-
+
File outputFile = new File(context.getTargetDir(), src.getName() + ".java2d.png");
OutputStream out = new FileOutputStream(outputFile);
out = new BufferedOutputStream(out);
try {
Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, userAgent, out);
SAXResult res = new SAXResult(fop.getDefaultHandler());
-
+
Transformer transformer = getTransformer(context);
transformer.transform(new StreamSource(src), res);
} finally {
IOUtils.closeQuietly(out);
}
-
+
BufferedImage img = BitmapComparator.getImage(outputFile);
if (deleteTempFiles) {
if (!outputFile.delete()) {
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPDF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPDF.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPDF.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPDF.java Thu Jul 24 02:35:34 2008
@@ -22,7 +22,7 @@
import org.apache.fop.apps.MimeConstants;
/**
- * BitmapProducer implementation that uses the PDFRenderer and an external converter
+ * BitmapProducer implementation that uses the PDFRenderer and an external converter
* to create bitmaps.
* <p>
* See the superclass' javadoc for info on the configuration format.
@@ -33,10 +33,10 @@
protected String getTargetExtension() {
return "pdf";
}
-
+
/** @see org.apache.fop.visual.AbstractPSPDFBitmapProducer#getTargetFormat() */
protected String getTargetFormat() {
return MimeConstants.MIME_PDF;
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPS.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPS.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPS.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/BitmapProducerPS.java Thu Jul 24 02:35:34 2008
@@ -22,7 +22,7 @@
import org.apache.fop.apps.MimeConstants;
/**
- * BitmapProducer implementation that uses the PSRenderer and an external converter
+ * BitmapProducer implementation that uses the PSRenderer and an external converter
* to create bitmaps.
* <p>
* See the superclass' javadoc for info on the configuration format.
@@ -33,11 +33,11 @@
protected String getTargetExtension() {
return "ps";
}
-
+
/** @see org.apache.fop.visual.AbstractPSPDFBitmapProducer#getTargetFormat() */
protected String getTargetFormat() {
return MimeConstants.MIME_POSTSCRIPT;
}
-
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ConvertUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ConvertUtils.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ConvertUtils.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ConvertUtils.java Thu Jul 24 02:35:34 2008
@@ -32,14 +32,14 @@
/**
* Calls an external converter application (GhostScript, for example).
* @param cmd the full command
- * @param envp array of strings, each element of which has environment variable settings
+ * @param envp array of strings, each element of which has environment variable settings
* in format name=value.
- * @param workDir the working directory of the subprocess, or null if the subprocess should
+ * @param workDir the working directory of the subprocess, or null if the subprocess should
* inherit the working directory of the current process.
* @param log the logger to log output by the external application to
* @throws IOException in case the external call fails
*/
- public static void convert(String cmd, String[] envp, File workDir, final Log log)
+ public static void convert(String cmd, String[] envp, File workDir, final Log log)
throws IOException {
log.debug(cmd);
@@ -53,7 +53,7 @@
log.error("ERR> " + line);
}
};
- StreamRedirector errorRedirector
+ StreamRedirector errorRedirector
= new StreamRedirector(process.getErrorStream(), errorHandler);
//Redirect stdout output
@@ -62,11 +62,11 @@
log.debug("OUT> " + line);
}
};
- StreamRedirector outputRedirector
+ StreamRedirector outputRedirector
= new StreamRedirector(process.getInputStream(), outputHandler);
new Thread(errorRedirector).start();
new Thread(outputRedirector).start();
-
+
process.waitFor();
} catch (java.lang.InterruptedException ie) {
throw new IOException("The call to the external converter failed: " + ie.getMessage());
@@ -76,11 +76,11 @@
int exitValue = process.exitValue();
if (exitValue != 0) {
- throw new IOException("The call to the external converter failed. Result: "
+ throw new IOException("The call to the external converter failed. Result: "
+ exitValue);
}
}
-
-
+
+
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ProducerContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ProducerContext.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ProducerContext.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ProducerContext.java Thu Jul 24 02:35:34 2008
@@ -33,7 +33,7 @@
private Templates templates;
private int targetResolution;
private File targetDir;
-
+
/**
* @return the TransformerFactory to be used.
*/
@@ -43,7 +43,7 @@
}
return tFactory;
}
-
+
/**
* @return the requested bitmap resolution in dpi for all bitmaps.
*/
@@ -73,14 +73,14 @@
public void setTemplates(Templates templates) {
this.templates = templates;
}
-
+
/**
* @return the target directory for all produced bitmaps
*/
public File getTargetDir() {
return targetDir;
}
-
+
/**
* Sets the target directory for all produced bitmaps.
* @param targetDir the target directory
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/RedirectorLineHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/RedirectorLineHandler.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/RedirectorLineHandler.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/RedirectorLineHandler.java Thu Jul 24 02:35:34 2008
@@ -34,7 +34,7 @@
* @param line a line of application output
*/
void handleLine(String line);
-
+
/**
* Called after the last handleLine() call.
*/
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java Thu Jul 24 02:35:34 2008
@@ -41,7 +41,7 @@
public class ReferenceBitmapLoader extends AbstractBitmapProducer implements Configurable {
private File bitmapDirectory;
-
+
/** @see org.apache.avalon.framework.configuration.Configurable */
public void configure(Configuration cfg) throws ConfigurationException {
this.bitmapDirectory = new File(cfg.getChild("directory").getValue(null));
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/StreamRedirector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/StreamRedirector.java?rev=679326&r1=679325&r2=679326&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/StreamRedirector.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/StreamRedirector.java Thu Jul 24 02:35:34 2008
@@ -42,14 +42,14 @@
this.in = in;
this.handler = handler;
}
-
+
/**
* @return true if the run() method was terminated by an exception.
*/
public boolean hasFailed() {
return (this.exception != null);
}
-
+
/**
* @return the exception if the run() method was terminated by an exception, or null
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org