unstick r1873909

Revision 1873909

Date:
2020/02/11 13:41:06
Author:
ssteiner
Revision Log:
FOP-2911: Add endpage event for FO to IF
Files:

Legend:

 
Added
 
Removed
 
Modified
  • xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java

     
    40 40 import org.apache.xmlgraphics.util.XMLizable;
    41 41
    42 42 import org.apache.fop.accessibility.StructureTreeEventHandler;
    43 import org.apache.fop.apps.FOUserAgent;
    43 44 import org.apache.fop.fo.extensions.InternalElementMapping;
    44 45 import org.apache.fop.fonts.FontInfo;
    45 46 import org.apache.fop.render.DefaultRendererConfigurator;
    47 import org.apache.fop.render.RendererEventProducer;
    46 48 import org.apache.fop.render.RenderingContext;
    47 49 import org.apache.fop.render.intermediate.IFRendererConfig.IFRendererConfigParser;
    48 50 import org.apache.fop.render.intermediate.IFStructureTreeBuilder.IFStructureTreeElement;
     
    85 87 private String currentID = "";
    86 88
    87 89 private IFStructureTreeBuilder structureTreeBuilder;
    90 private int pageNumberEnded;
    88 91
    89 92 public IFSerializer(IFContext context) {
    90 93 super(context);
     
    384 387 } catch (SAXException e) {
    385 388 throw new IFException("SAX error in endPage()", e);
    386 389 }
    390 if (mimicHandler != null) {
    391 pageNumberEnded++;
    392 FOUserAgent userAgent = mimicHandler.getContext().getUserAgent();
    393 RendererEventProducer.Provider.get(userAgent.getEventBroadcaster()).endPage(this, pageNumberEnded);
    394 }
    387 395 }
    388 396
    389 397 //---=== IFPainter ===---
  • xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/intermediate/IFSerializerTestCase.java

     
    20 20 package org.apache.fop.render.intermediate;
    21 21
    22 22 import java.awt.Rectangle;
    23 import java.io.File;
    24 import java.util.HashMap;
    25 import java.util.Map;
    23 26
    24 27 import javax.xml.transform.sax.SAXResult;
    25 28
     
    38 41 import org.apache.xmlgraphics.image.loader.ImageSessionContext;
    39 42
    40 43 import org.apache.fop.apps.FOUserAgent;
    44 import org.apache.fop.apps.FopFactory;
    45 import org.apache.fop.events.EventChecker;
    46 import org.apache.fop.render.afp.AFPDocumentHandler;
    41 47
    42 48 public class IFSerializerTestCase {
    43 49
     
    90 96 verify(imageManager).closeImage(eq(IMAGE), any(ImageSessionContext.class));
    91 97 }
    92 98
    99 @Test
    100 public void testPageEvent() throws IFException {
    101 FOUserAgent userAgent = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent();
    102 Map<String, Object> params = new HashMap<String, Object>();
    103 params.put("number", 1);
    104 EventChecker eventChecker = new EventChecker("org.apache.fop.render.RendererEventProducer.endPage", params);
    105 userAgent.getEventBroadcaster().addEventListener(eventChecker);
    106 sut.mimicDocumentHandler(new AFPDocumentHandler(new IFContext(userAgent)));
    107 sut.setResult(new SAXResult(new DefaultHandler()));
    108 sut.endPage();
    109 eventChecker.end();
    110 }
    93 111 }