From 5cae15e0accf7bb753111394ba9870f5b815ab29 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Fri, 4 Apr 2014 15:52:30 +0000 Subject: FOP-2363: Better error message when PDF/A enabled and SVG contains bitmap with transparency git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1584765 13f79535-47bb-0310-9956-ffa450edef68 --- test/java/org/apache/fop/events/EventChecker.java | 2 +- .../fop/render/pdf/PDFAConformanceTestCase.java | 24 +++++++++++++++++----- test/xml/pdf-a/svg-with-transparent-image.fo | 24 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 test/xml/pdf-a/svg-with-transparent-image.fo (limited to 'test') diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java index 506658467..c2d5fcfd6 100644 --- a/test/java/org/apache/fop/events/EventChecker.java +++ b/test/java/org/apache/fop/events/EventChecker.java @@ -46,7 +46,7 @@ public class EventChecker implements EventListener { if (id.equals(expectedEventID)) { eventReceived = true; for (Map.Entry param : expectedParams.entrySet()) { - assertEquals(event.getParam(param.getKey()), param.getValue()); + assertEquals(param.getValue(), event.getParam(param.getKey())); } } } diff --git a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java index b2b77e842..752d666c5 100644 --- a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java @@ -115,15 +115,29 @@ public class PDFAConformanceTestCase extends BasePDFTest { @Test public void svgTransparency() throws Exception { - Map params = new HashMap(); - params.put("pdfProfile", PDFAMode.PDFA_1B); - EventChecker eventChecker = new EventChecker(SVGEventProducer.class.getName() - + ".transparencyIgnored", params); FOUserAgent ua = getUserAgent(); - ua.getEventBroadcaster().addEventListener(eventChecker); + EventChecker eventChecker = setupEventChecker(ua, "transparencyIgnored"); File foFile = new File(foBaseDir, "svg-transparency.fo"); convertFO(foFile, ua, dumpPDF); eventChecker.end(); } + @Test + public void svgContainingBitmapWithTransparency() throws Exception { + FOUserAgent ua = getUserAgent(); + EventChecker eventChecker = setupEventChecker(ua, "bitmapWithTransparency"); + File foFile = new File(foBaseDir, "svg-with-transparent-image.fo"); + convertFO(foFile, ua, dumpPDF); + eventChecker.end(); + } + + private EventChecker setupEventChecker(FOUserAgent ua, String expectedEvent) { + Map params = new HashMap(); + params.put("pdfProfile", PDFAMode.PDFA_1B); + EventChecker eventChecker = new EventChecker(SVGEventProducer.class.getName() + + "." + expectedEvent, params); + ua.getEventBroadcaster().addEventListener(eventChecker); + return eventChecker; + } + } diff --git a/test/xml/pdf-a/svg-with-transparent-image.fo b/test/xml/pdf-a/svg-with-transparent-image.fo new file mode 100644 index 000000000..503872224 --- /dev/null +++ b/test/xml/pdf-a/svg-with-transparent-image.fo @@ -0,0 +1,24 @@ + + + + + + + + + + SVG + referencing a bitmap image that has transparency + + + + + + + + + -- cgit v1.2.3