aboutsummaryrefslogtreecommitdiffstats
path: root/test/java/org/apache/fop/events
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2012-08-09 19:02:34 +0000
committerVincent Hennebert <vhennebert@apache.org>2012-08-09 19:02:34 +0000
commit6c9c875c0d1429d392cd7e4e810bb146c063ea27 (patch)
treebca3e73ad9e324ff6bd0330df643d3dcf5d3db44 /test/java/org/apache/fop/events
parent2c2c292121674e5e67fc2f5762be66e1528d5161 (diff)
downloadxmlgraphics-fop-6c9c875c0d1429d392cd7e4e810bb146c063ea27.tar.gz
xmlgraphics-fop-6c9c875c0d1429d392cd7e4e810bb146c063ea27.zip
Bugzilla #53688: Wrong page number reported when a column overflows the region-body in a multi-column document
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1371386 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/events')
-rw-r--r--test/java/org/apache/fop/events/EventChecker.java11
-rw-r--r--test/java/org/apache/fop/events/EventProcessingTestCase.java31
2 files changed, 38 insertions, 4 deletions
diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java
index dac67a8cc..3f0eef6bb 100644
--- a/test/java/org/apache/fop/events/EventChecker.java
+++ b/test/java/org/apache/fop/events/EventChecker.java
@@ -19,6 +19,9 @@
package org.apache.fop.events;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
@@ -28,10 +31,13 @@ class EventChecker implements EventListener {
private final String expectedEventID;
+ private final Map<String, Object> expectedParams;
+
private boolean eventReceived;
- EventChecker(String expectedEventID) {
+ EventChecker(String expectedEventID, Map<String, Object> expectedParams) {
this.expectedEventID = expectedEventID;
+ this.expectedParams = expectedParams;
}
public void processEvent(Event event) {
@@ -39,6 +45,9 @@ class EventChecker implements EventListener {
String id = event.getEventID();
if (id.equals(expectedEventID)) {
eventReceived = true;
+ for (Map.Entry<String, Object> param : expectedParams.entrySet()) {
+ assertEquals(event.getParam(param.getKey()), param.getValue());
+ }
}
}
diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java
index 9338fc01a..fb17c9c0c 100644
--- a/test/java/org/apache/fop/events/EventProcessingTestCase.java
+++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java
@@ -22,6 +22,9 @@ package org.apache.fop.events;
import java.io.File;
import java.io.InputStream;
import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
@@ -62,9 +65,10 @@ public class EventProcessingTestCase {
CONFIG_BASE_DIR = base.resolve("test/config/");
}
- public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType)
- throws Exception {
- EventChecker eventChecker = new EventChecker(expectedEventID);
+
+ public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType,
+ Map<String, Object> expectedParams) throws Exception {
+ EventChecker eventChecker = new EventChecker(expectedEventID, expectedParams);
FopFactory fopFactory;
if (fopConf != null) {
fopFactory = FopFactory.newInstance(new File(fopConf));
@@ -81,6 +85,19 @@ public class EventProcessingTestCase {
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
eventChecker.end();
+
+ }
+
+ public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType)
+ throws Exception {
+ Map<String, Object> noParams = Collections.emptyMap();
+ doTest(inStream, fopConf, expectedEventID, mimeType, noParams);
+ }
+
+ public void doTest(String filename, String expectedEventID, Map<String, Object> expectedParams)
+ throws Exception {
+ doTest(BASE_DIR.resolve(filename).toURL().openStream(), null, expectedEventID,
+ MimeConstants.MIME_PDF, expectedParams);
}
public void doTest(String filename, String expectedEventID) throws Exception {
@@ -133,4 +150,12 @@ public class EventProcessingTestCase {
public void testViewportBPDOverflow() throws Exception {
doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow");
}
+
+ @Test
+ public void testPageOverflow() throws Exception {
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("page", "1");
+ doTest("region-body_overflow.fo", BlockLevelEventProducer.class.getName() + ".regionOverflow",
+ params);
+ }
}