diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-17 16:30:02 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-17 16:30:02 +0000 |
commit | c1293d0e53b566b1c7fc0cddef997785aabb73bd (patch) | |
tree | 09eff81e2a92ba69cb5a669f93647bcd806c9470 /test/java/org | |
parent | 72e6f108465cc95fc96d82e9f519bc8b9c7709c3 (diff) | |
download | xmlgraphics-fop-c1293d0e53b566b1c7fc0cddef997785aabb73bd.tar.gz xmlgraphics-fop-c1293d0e53b566b1c7fc0cddef997785aabb73bd.zip |
Merged revisions 648985,649012,649091,649119,649146,649149,649160 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r648985 | jeremias | 2008-04-17 08:01:19 +0100 (Thu, 17 Apr 2008) | 1 line
HeadURL was missing in the properties.
........
r649012 | jeremias | 2008-04-17 09:59:48 +0100 (Thu, 17 Apr 2008) | 2 lines
Bugfix: Avoid stopping early when no EmbedFontInfos are found during font detection.
Submitted by: Raphael Parree <rparree.at.gmail.com>
........
r649091 | jeremias | 2008-04-17 14:33:07 +0100 (Thu, 17 Apr 2008) | 7 lines
Bugzilla #44678:
Added ability to pass in the PrinterJob instance through the renderer options.
Submitted by: Antti Karanta <Antti.Karanta.at.napa.fi>
Modifications/Additions to patch:
- Don't remove the contructor with the PrinterJob parameter, just deprecate it.
- Adjust old-style print example to use renderer options
........
r649119 | vhennebert | 2008-04-17 15:10:04 +0100 (Thu, 17 Apr 2008) | 2 lines
Fixed minor typo
........
r649146 | jeremias | 2008-04-17 16:12:23 +0100 (Thu, 17 Apr 2008) | 2 lines
Bugzilla #41687:
Restored ability to specify from/to and odd/even pages as well as the number of copies for printing from the command-line. Note that this is no longer done via system properties but through the renderer options. Syntax is slightly different. See "fop -print help".
........
r649149 | jeremias | 2008-04-17 16:14:26 +0100 (Thu, 17 Apr 2008) | 2 lines
Bugzilla #43383:
Made sure the pages don't appear out of order in AWT preview.
........
r649160 | jeremias | 2008-04-17 17:01:41 +0100 (Thu, 17 Apr 2008) | 3 lines
Now tunneling all events through a special event listener in tests. This serves two purposes:
- Better readability of the test output.
- Identification of messages that are not sent through the event subsystem, yet.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@649175 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org')
8 files changed, 119 insertions, 31 deletions
diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java index 04752064f..aa9af4226 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java @@ -35,6 +35,7 @@ import org.apache.commons.io.filefilter.NameFileFilter; import org.apache.commons.io.filefilter.PrefixFileFilter; import org.apache.commons.io.filefilter.SuffixFileFilter; import org.apache.commons.io.filefilter.TrueFileFilter; + import org.apache.fop.DebugHelper; import org.apache.fop.fo.flow.table.CollapsedConditionalBorderTestCase; import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase; @@ -104,9 +105,14 @@ public final class FOTreeTestSuite { final FOTreeTester tester, final File f) { suite.addTest(new FOTreeTestCase(f.getName()) { public void runTest() throws Exception { - org.apache.commons.logging.LogFactory.getLog(this.getClass()).info("Starting " + f.getName()); - prepare(tester, f); - testMain(); + try { + prepare(tester, f); + testMain(); + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog(this.getClass()).info( + "Error on " + f.getName()); + throw e; + } } }); } diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTester.java b/test/java/org/apache/fop/fotreetest/FOTreeTester.java index 9c2a260bc..6ffad6989 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeTester.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeTester.java @@ -25,14 +25,15 @@ import java.util.List; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLFilterImpl; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; - import org.apache.fop.fotreetest.ext.TestElementMapping; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLFilterImpl; +import org.apache.fop.util.ConsoleEventListenerForTests; /** * Test driver class for FO tree tests. @@ -66,6 +67,8 @@ public class FOTreeTester { FOUserAgent ua = fopFactory.newFOUserAgent(); ua.setBaseURL(testFile.getParentFile().toURL().toString()); ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua)); + ua.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName())); //Used to set values in the user agent through processing instructions reader = new PIListener(reader, ua); diff --git a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java index e19547345..a7fa11950 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java @@ -26,11 +26,13 @@ import javax.xml.parsers.SAXParserFactory; import junit.framework.TestCase; +import org.xml.sax.XMLReader; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.fo.FOEventHandler; -import org.xml.sax.XMLReader; +import org.apache.fop.util.ConsoleEventListenerForTests; /** @@ -82,6 +84,8 @@ public abstract class FOTreeUnitTester extends TestCase { public void setUp(String filename, FOEventHandlerFactory factory) throws Exception { FOUserAgent ua = fopFactory.newFOUserAgent(); ua.setFOEventHandlerOverride(factory.createFOEventHandler(ua)); + ua.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(filename)); Fop fop = fopFactory.newFop(ua); diff --git a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java index ced81932b..96aa89bc3 100644 --- a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java +++ b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java @@ -50,6 +50,7 @@ import org.apache.fop.area.RenderPagesModel; import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.Renderer; import org.apache.fop.render.xml.XMLRenderer; +import org.apache.fop.util.ConsoleEventListenerForTests; //XML Unit 1.0: See http://xmlunit.sourceforge.net (BSD-style License) import org.custommonkey.xmlunit.XMLTestCase; @@ -170,6 +171,8 @@ public class AreaTreeParserTestCase extends XMLTestCase { FOUserAgent userAgent = fopFactory.newFOUserAgent(); try { userAgent.setBaseURL(testDir.toURL().toExternalForm()); + userAgent.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName())); } catch (MalformedURLException e) { //ignore, won't happen } diff --git a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java index f72b2da87..68c81da81 100644 --- a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java +++ b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java @@ -56,10 +56,14 @@ public class IntermediateFormatTestSuite { final File f) { suite.addTest(new AreaTreeParserTestCase(f) { public void runTest() throws Exception { - org.apache.commons.logging.LogFactory.getLog( - this.getClass()).info("Starting " + f.getName()); - testParserToAT(); - testParserToPDF(); + try { + testParserToAT(); + testParserToPDF(); + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog( + this.getClass()).error("Error on " + f.getName()); + throw e; + } } }); } diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java index 99a63f2b7..0597e0e91 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -34,6 +34,14 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.AndFileFilter; import org.apache.commons.io.filefilter.IOFileFilter; @@ -42,15 +50,8 @@ import org.apache.commons.io.filefilter.NotFileFilter; import org.apache.commons.io.filefilter.PrefixFileFilter; import org.apache.commons.io.filefilter.SuffixFileFilter; import org.apache.commons.io.filefilter.TrueFileFilter; -import org.apache.fop.DebugHelper; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; +import org.apache.fop.DebugHelper; /** * JUnit test suit for running layout engine test under JUnit control. @@ -187,10 +188,14 @@ public class LayoutEngineTestSuite { final LayoutEngineTester tester, final File f) { suite.addTest(new LayoutEngineTestCase(f.getName()) { public void runTest() throws Exception { - org.apache.commons.logging.LogFactory.getLog( - this.getClass()).info("Starting " + f.getName()); - prepare(tester, f); - testMain(); + try { + prepare(tester, f); + testMain(); + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog( + this.getClass()).error("Error on " + f.getName()); + throw e; + } } }); } diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java index a10bfa0e3..bcd5f1db4 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java @@ -43,19 +43,23 @@ import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import org.xml.sax.SAXException; + +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.FormattingResults; import org.apache.fop.layoutmgr.ElementListObserver; import org.apache.fop.render.xml.XMLRenderer; -import org.apache.xpath.XPathAPI; -import org.apache.xpath.objects.XObject; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; +import org.apache.fop.util.ConsoleEventListenerForTests; /** * Class for testing the FOP's layout engine using testcases specified in XML @@ -154,6 +158,9 @@ public class LayoutEngineTester { //Setup FOP for area tree rendering FOUserAgent ua = effFactory.newFOUserAgent(); ua.setBaseURL(testFile.getParentFile().toURL().toString()); + ua.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName())); + XMLRenderer atrenderer = new XMLRenderer(); atrenderer.setUserAgent(ua); atrenderer.setContentHandler(athandler); diff --git a/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java b/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java new file mode 100644 index 000000000..9e8a57285 --- /dev/null +++ b/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** A simple event listener that writes the events to stdout and sterr. */ +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) { + System.out.println("Test: " + this.name); + this.name = null; + } + String msg = EventFormatter.format(event); + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.INFO) { + System.out.println(" [INFO ] " + msg); + } else if (severity == EventSeverity.WARN) { + System.out.println(" [WARN ] " + msg); + } else if (severity == EventSeverity.ERROR) { + System.out.println(" [ERROR] " + msg); + } else if (severity == EventSeverity.FATAL) { + System.out.println(" [FATAL] " + msg); + } else { + assert false; + } + } +}
\ No newline at end of file |