diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java index a86b5b2b2..6cd620870 100644 --- a/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java +++ b/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java @@ -19,8 +19,11 @@ 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; @@ -32,6 +35,7 @@ import javax.xml.transform.TransformerFactoryConfigurationError; 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; @@ -40,17 +44,21 @@ import org.w3c.dom.Document; 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 { @@ -105,6 +113,20 @@ 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(); |