diff options
author | Simon Steiner <ssteiner@apache.org> | 2015-06-05 14:13:45 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2015-06-05 14:13:45 +0000 |
commit | 399d10251b199159a1c109902b1eefec5f0fd976 (patch) | |
tree | 750c417c8bd993d1d745984cbbcb7f7f02ba4a0c /test | |
parent | 49fbce154ae3d10cf838e29f9b881a3253f285fe (diff) | |
download | xmlgraphics-fop-399d10251b199159a1c109902b1eefec5f0fd976.tar.gz xmlgraphics-fop-399d10251b199159a1c109902b1eefec5f0fd976.zip |
FOP-2475: Tagged PDF footnote separator incorrect order
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1683760 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java b/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java new file mode 100644 index 000000000..1da88b2eb --- /dev/null +++ b/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import org.xml.sax.helpers.AttributesImpl; +import static org.junit.Assert.assertEquals; + +import org.apache.fop.pdf.PDFArray; +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFFactory; +import org.apache.fop.pdf.PDFParentTree; +import org.apache.fop.pdf.PDFStructElem; +import org.apache.fop.pdf.PDFStructTreeRoot; +import org.apache.fop.render.pdf.PDFStructureTreeBuilder; + +public class FootnoteSeparatorTestCase { + + @Test + public void testFootNoteSeparatorText() throws IOException { + PDFParentTree tree = new PDFParentTree(); + AttributesImpl attributes = new AttributesImpl(); + attributes.addAttribute("", "role", "role", "CDATA", null); + PDFDocument doc = new PDFDocument(""); + PDFStructTreeRoot strucRoot = doc.makeStructTreeRoot(tree); + PDFFactory factory = new PDFFactory(doc); + PDFStructElem part = PDFStructureTreeBuilder.createStructureElement("page-sequence", strucRoot, attributes, + factory, null); + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "flow-name", "flow-name", "CDATA", "xsl-footnote-separator"); + PDFStructElem staticSection = PDFStructureTreeBuilder.createStructureElement("static-content", part, att, + factory, null); + PDFStructElem block = PDFStructureTreeBuilder.createStructureElement("block", part, new AttributesImpl(), + factory, null); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + part.output(bos); + PDFArray array = (PDFArray)part.get("K"); + PDFStructElem elem1 = (PDFStructElem)array.get(0); + String test = elem1.getStructureType().getName().getName(); + String expected = "P"; + assertEquals(test, expected); + PDFStructElem elem2 = (PDFStructElem)array.get(1); + test = elem2.getStructureType().getName().getName(); + expected = "Sect"; + assertEquals(test, expected); + } +} |