package org.apache.fop.accessibility.fo;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.custommonkey.xmlunit.Diff;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.apache.fop.accessibility.StructureTree2SAXEventAdapter;
import org.apache.fop.accessibility.StructureTreeEventHandler;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.fo.FODocumentParser;
import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.LoadingException;
import org.apache.fop.fotreetest.DummyFOEventHandler;
+import org.apache.fop.render.intermediate.IFContext;
+import org.apache.fop.render.pdf.PDFDocumentHandler;
public class FO2StructureTreeConverterTestCase {
return FO2StructureTreeConverterTestCase.class.getResourceAsStream(name);
}
+ @Test
+ public void testPDFA() throws Exception {
+ FOUserAgent userAgent = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent();
+ userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
+ userAgent.setAccessibility(true);
+ PDFDocumentHandler d = new PDFDocumentHandler(new IFContext(userAgent));
+ OutputStream writer = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(writer);
+ d.setResult(result);
+ d.getStructureTreeEventHandler();
+ d.startDocument();
+ assertNull(d.getStructureTreeEventHandler().startNode("table-body", null, null));
+ }
+
private void testConverter(String foResourceName) throws Exception {
foLoader = new FOLoader(foResourceName);
DOMResult expectedStructureTree = loadExpectedStructureTree();