diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-08-24 14:10:39 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-08-24 14:10:39 +0000 |
commit | 69beec0c8ff0bb191c459184bc61b6a243ba693b (patch) | |
tree | bd14b44cd8fed471d3aa2d7c8aaf80fb40196c3b /test | |
parent | d6994df393ced4dd88e5edd5fdfdca38df0d875a (diff) | |
download | xmlgraphics-fop-69beec0c8ff0bb191c459184bc61b6a243ba693b.tar.gz xmlgraphics-fop-69beec0c8ff0bb191c459184bc61b6a243ba693b.zip |
Bugzilla 53778: When PDF accessibility is enabled, the contents for the different regions must appear in the proper order in the structure tree.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1376923 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java | 63 | ||||
-rw-r--r-- | test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl | 29 | ||||
-rw-r--r-- | test/java/org/apache/fop/accessibility/fo/wrapCompleteDocumentInTableFooter.xsl | 66 | ||||
-rw-r--r-- | test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java | 95 | ||||
-rw-r--r-- | test/java/org/apache/fop/fo/pagination/side-regions.fo | 181 | ||||
-rw-r--r-- | test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java | 3 | ||||
-rw-r--r-- | test/pdf/accessibility/pdf/role.pdf | bin | 18600 -> 18600 bytes | |||
-rw-r--r-- | test/pdf/accessibility/pdf/role_non-standard.pdf | bin | 18291 -> 18291 bytes | |||
-rw-r--r-- | test/pdf/accessibility/pdf/side-regions.pdf | bin | 0 -> 26963 bytes | |||
-rw-r--r-- | test/pdf/accessibility/side-regions.fo | 181 |
10 files changed, 497 insertions, 121 deletions
diff --git a/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java index 863bfe797..6092912f9 100644 --- a/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java +++ b/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.accessibility.fo; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -34,7 +32,6 @@ 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; @@ -57,9 +54,17 @@ import org.apache.fop.fotreetest.DummyFOEventHandler; public class FO2StructureTreeConverterTestCase { - private interface FOLoader { + private static class FOLoader { - InputStream getFoInputStream(); + private final String resourceName; + + FOLoader(String resourceName) { + this.resourceName = resourceName; + } + + public InputStream getFoInputStream() { + return getResource(resourceName); + } } private static final String STRUCTURE_TREE_SEQUENCE_NAME = "structure-tree-sequence"; @@ -68,62 +73,30 @@ public class FO2StructureTreeConverterTestCase { @Test public void testCompleteDocument() throws Exception { - foLoader = new FOLoader() { - public InputStream getFoInputStream() { - return getResource("/org/apache/fop/fo/complete_document.fo"); - } - }; - testConverter(); + testConverter("/org/apache/fop/fo/complete_document.fo"); } @Test public void testTableFooters() throws Exception { - foLoader = new FOLoader() { - public InputStream getFoInputStream() { - return getResource("table-footers.fo"); - } - }; - testConverter(); - } - - @Test - public void testCompleteContentWrappedInTableFooter() throws Exception { - Source xslt = new StreamSource(getResource("wrapCompleteDocumentInTableFooter.xsl")); - Transformer transformer = createTransformer(xslt); - InputStream originalFO = getResource("/org/apache/fop/fo/complete_document.fo"); - ByteArrayOutputStream transformedFoOutput = new ByteArrayOutputStream(); - transformer.transform(new StreamSource(originalFO), new StreamResult(transformedFoOutput)); - final byte[] transformedFoOutputBytes = transformedFoOutput.toByteArray(); - foLoader = new FOLoader() { - public InputStream getFoInputStream() { - return new ByteArrayInputStream(transformedFoOutputBytes); - } - }; - testConverter(); + testConverter("table-footers.fo"); } @Test public void testArtifact() throws Exception { - foLoader = new FOLoader() { - - public InputStream getFoInputStream() { - return getResource("artifact.fo"); - } - }; - testConverter(); + testConverter("artifact.fo"); } - private Transformer createTransformer(Source xslt) throws TransformerFactoryConfigurationError, - TransformerConfigurationException { - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - return transformerFactory.newTransformer(xslt); + @Test + public void testSideRegions() throws Exception { + testConverter("/org/apache/fop/fo/pagination/side-regions.fo"); } private static InputStream getResource(String name) { return FO2StructureTreeConverterTestCase.class.getResourceAsStream(name); } - private void testConverter() throws Exception { + private void testConverter(String foResourceName) throws Exception { + foLoader = new FOLoader(foResourceName); DOMResult expectedStructureTree = loadExpectedStructureTree(); DOMResult actualStructureTree = buildActualStructureTree(); final Diff diff = createDiff(expectedStructureTree, actualStructureTree); diff --git a/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl b/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl index db0dffb14..c739462e4 100644 --- a/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl +++ b/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl @@ -50,6 +50,25 @@ <xsl:call-template name="copy"/> </xsl:template> + <xsl:template match="fo:static-content/@flow-name|fo:flow/@flow-name"> + <xsl:choose> + <xsl:when test=". = 'xsl-region-body' or + . = 'xsl-region-before' or + . = 'xsl-region-after' or + . = 'xsl-region-start' or + . = 'xsl-region-end' or + . = 'xsl-before-float-separator' or + . = 'xsl-footnote-separator'"> + <xsl:copy/> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="concat('xsl-', local-name(//*[@region-name = current()]))"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- Block-level Formatting Objects --> <xsl:template match="fo:block|fo:block-container"> <xsl:call-template name="copy"/> @@ -73,15 +92,7 @@ <xsl:call-template name="copy"/> </xsl:template> - <xsl:template match="fo:table"> - <xsl:copy> - <xsl:apply-templates select="@*"/> - <xsl:apply-templates select="*[name() != 'fo:table-footer']"/> - <xsl:apply-templates select="fo:table-footer"/> - </xsl:copy> - </xsl:template> - - <xsl:template match="fo:table-header|fo:table-footer|fo:table-body|fo:table-row|fo:table-cell"> + <xsl:template match="fo:table|fo:table-header|fo:table-footer|fo:table-body|fo:table-row|fo:table-cell"> <xsl:call-template name="copy"/> </xsl:template> diff --git a/test/java/org/apache/fop/accessibility/fo/wrapCompleteDocumentInTableFooter.xsl b/test/java/org/apache/fop/accessibility/fo/wrapCompleteDocumentInTableFooter.xsl deleted file mode 100644 index 9608b2fb9..000000000 --- a/test/java/org/apache/fop/accessibility/fo/wrapCompleteDocumentInTableFooter.xsl +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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$ --> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:fo="http://www.w3.org/1999/XSL/Format"> - - <xsl:template match="@*|node()" name="copy"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> - - - <xsl:template match="/"> - <fo:root> - <fo:layout-master-set> - <fo:simple-page-master master-name="page" - page-height="500pt" page-width="300pt" margin="20pt"> - <fo:region-body margin-top="20pt"/> - </fo:simple-page-master> - </fo:layout-master-set> - <xsl:apply-templates select="//fo:page-sequence"/> - </fo:root> - </xsl:template> - - <xsl:template match="fo:page-sequence"> - <fo:page-sequence master-reference="page"> - <xsl:apply-templates select="fo:flow"/> - </fo:page-sequence> - </xsl:template> - - <xsl:template match="fo:flow"> - <xsl:copy> - <xsl:apply-templates select="@*[not(starts-with(name(), 'space-before'))]"/> - <fo:table width="100%" table-layout="fixed"> - <fo:table-footer> - <fo:table-cell background-color="#F0F0F0"> - <xsl:apply-templates select="@*[starts-with(name(), 'space-before')]"/> - <xsl:apply-templates select="*"/> - </fo:table-cell> - </fo:table-footer> - <fo:table-body> - <fo:table-cell> - <fo:block>The content below is in the table footer.</fo:block> - </fo:table-cell> - </fo:table-body> - </fo:table> - </xsl:copy> - </xsl:template> - -</xsl:stylesheet> diff --git a/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java b/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java new file mode 100644 index 000000000..cfe71f529 --- /dev/null +++ b/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java @@ -0,0 +1,95 @@ +/* + * 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.fo.pagination; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FODocumentParser; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; + +public class LayoutMasterSetTestCase { + + private static class FlowMappingTester extends FOEventHandler { + + private static final String[][] FLOW_MAPPINGS = { + + {"first-page-before", "xsl-region-before"}, + {"first-page-after", "xsl-region-after"}, + {"first-page-start", "xsl-region-start"}, + {"first-page-end", "xsl-region-end"}, + + {"odd-page-before", "xsl-region-before"}, + {"odd-page-after", "xsl-region-after"}, + {"odd-page-start", "xsl-region-start"}, + {"odd-page-end", "xsl-region-end"}, + + {"odd-page-before", "xsl-region-before"}, + {"odd-page-after", "xsl-region-after"}, + {"odd-page-start", "xsl-region-start"}, + {"odd-page-end", "xsl-region-end"}, + + {"blank-page-before", "xsl-region-before"}, + {"blank-page-after", "xsl-region-after"}, + {"blank-page-start", "xsl-region-start"}, + {"blank-page-end", "xsl-region-end"}, + + {"last-page-before", "xsl-region-before"}, + {"last-page-after", "xsl-region-after"}, + {"last-page-start", "xsl-region-start"}, + {"last-page-end", "xsl-region-end"}, + + {"xsl-footnote-separator", "xsl-footnote-separator"} + + }; + + FlowMappingTester(FOUserAgent userAgent) { + super(userAgent); + } + + @Override + public void startPageSequence(PageSequence pageSeq) { + super.startPageSequence(pageSeq); + LayoutMasterSet layoutMasterSet = pageSeq.getRoot().getLayoutMasterSet(); + for (String[] mapping : FLOW_MAPPINGS) { + assertEquals(mapping[1], layoutMasterSet.getDefaultRegionNameFor(mapping[0])); + } + } + + } + + /** + * Tests the {@link LayoutMasterSet#getDefaultRegionNameFor(String)} method. + */ + @Test + public void testFlowMapping() throws Exception { + FODocumentParser foDocumentParser = FODocumentParser.newInstance(new FOEventHandlerFactory() { + + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + return new FlowMappingTester(foUserAgent); + } + }); + foDocumentParser.parse(getClass().getResourceAsStream("side-regions.fo")); + } + +} diff --git a/test/java/org/apache/fop/fo/pagination/side-regions.fo b/test/java/org/apache/fop/fo/pagination/side-regions.fo new file mode 100644 index 000000000..8a0fba2ec --- /dev/null +++ b/test/java/org/apache/fop/fo/pagination/side-regions.fo @@ -0,0 +1,181 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFF0F0"/> + <fo:region-before region-name="first-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="first-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="first-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="first-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="odd-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFFFF0"/> + <fo:region-before region-name="odd-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="odd-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="odd-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="odd-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="even-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0FFF0"/> + <fo:region-before region-name="even-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="even-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="even-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="even-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="blank-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0F0F0"/> + <fo:region-before region-name="blank-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="blank-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="blank-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="blank-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="last-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="45pt 12pt" display-align="center" background-color="#F0F0FF"/> + <fo:region-before region-name="last-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="last-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="last-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="last-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="pages"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference page-position="first" master-reference="first-page"/> + <fo:conditional-page-master-reference page-position="last" master-reference="last-page"/> + <fo:conditional-page-master-reference blank-or-not-blank="blank" + master-reference="blank-page"/> + <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-page"/> + <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-page"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="pages" force-page-count="even" font-size="4pt" + text-align="center"> + + <fo:static-content flow-name="first-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid red" + padding-top="0.5pt">First Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="odd-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid orange" + padding-top="0.5pt">Odd Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="even-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid green" + padding-top="0.5pt">Even Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="blank-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid black" + padding-top="0.5pt">Blank Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="last-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid blue" + padding-top="0.5pt">Last Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Start.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="xsl-footnote-separator"> + <fo:block> + <fo:leader leader-pattern="rule" leader-length="40%" rule-thickness="0.5pt"/> + </fo:block> + </fo:static-content> + + <fo:flow flow-name="xsl-region-body" font-size="8pt" line-height="10pt"> + <fo:block>Apache™ FOP (Formatting Objects Processor) is a print formatter driven by XSL + formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is an application<fo:footnote><fo:inline>*</fo:inline> + <fo:footnote-body><fo:block font-size="80%">* written in + Java</fo:block></fo:footnote-body></fo:footnote> that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + <fo:block break-before="page">Apache™ FOP (Formatting Objects Processor) is a print formatter + driven by XSL formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is a Java application that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java index 89682628d..a1d581402 100644 --- a/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java +++ b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java @@ -52,7 +52,8 @@ public class TableHeaderScopeTestCase { VersionController controller = mock(VersionController.class); PDFDocument document = new PDFDocument("Test", controller); document.makeStructTreeRoot(null); - document.makeStructureElement(Table.TH, null, scope); + PDFStructElem th = new PDFStructElem(null, Table.TH); + document.registerStructureElement(th, scope); verify(controller).addTableHeaderScopeAttribute(any(PDFStructElem.class), eq(scope)); } diff --git a/test/pdf/accessibility/pdf/role.pdf b/test/pdf/accessibility/pdf/role.pdf Binary files differindex 4dfb686c9..8fb665b79 100644 --- a/test/pdf/accessibility/pdf/role.pdf +++ b/test/pdf/accessibility/pdf/role.pdf diff --git a/test/pdf/accessibility/pdf/role_non-standard.pdf b/test/pdf/accessibility/pdf/role_non-standard.pdf Binary files differindex 6f1edea19..9effef793 100644 --- a/test/pdf/accessibility/pdf/role_non-standard.pdf +++ b/test/pdf/accessibility/pdf/role_non-standard.pdf diff --git a/test/pdf/accessibility/pdf/side-regions.pdf b/test/pdf/accessibility/pdf/side-regions.pdf Binary files differnew file mode 100644 index 000000000..6e5da9393 --- /dev/null +++ b/test/pdf/accessibility/pdf/side-regions.pdf diff --git a/test/pdf/accessibility/side-regions.fo b/test/pdf/accessibility/side-regions.fo new file mode 100644 index 000000000..8a0fba2ec --- /dev/null +++ b/test/pdf/accessibility/side-regions.fo @@ -0,0 +1,181 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFF0F0"/> + <fo:region-before region-name="first-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="first-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="first-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="first-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="odd-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFFFF0"/> + <fo:region-before region-name="odd-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="odd-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="odd-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="odd-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="even-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0FFF0"/> + <fo:region-before region-name="even-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="even-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="even-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="even-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="blank-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0F0F0"/> + <fo:region-before region-name="blank-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="blank-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="blank-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="blank-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="last-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="45pt 12pt" display-align="center" background-color="#F0F0FF"/> + <fo:region-before region-name="last-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="last-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="last-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="last-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="pages"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference page-position="first" master-reference="first-page"/> + <fo:conditional-page-master-reference page-position="last" master-reference="last-page"/> + <fo:conditional-page-master-reference blank-or-not-blank="blank" + master-reference="blank-page"/> + <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-page"/> + <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-page"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="pages" force-page-count="even" font-size="4pt" + text-align="center"> + + <fo:static-content flow-name="first-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid red" + padding-top="0.5pt">First Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="odd-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid orange" + padding-top="0.5pt">Odd Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="even-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid green" + padding-top="0.5pt">Even Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="blank-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid black" + padding-top="0.5pt">Blank Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="last-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid blue" + padding-top="0.5pt">Last Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Start.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="xsl-footnote-separator"> + <fo:block> + <fo:leader leader-pattern="rule" leader-length="40%" rule-thickness="0.5pt"/> + </fo:block> + </fo:static-content> + + <fo:flow flow-name="xsl-region-body" font-size="8pt" line-height="10pt"> + <fo:block>Apache™ FOP (Formatting Objects Processor) is a print formatter driven by XSL + formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is an application<fo:footnote><fo:inline>*</fo:inline> + <fo:footnote-body><fo:block font-size="80%">* written in + Java</fo:block></fo:footnote-body></fo:footnote> that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + <fo:block break-before="page">Apache™ FOP (Formatting Objects Processor) is a print formatter + driven by XSL formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is a Java application that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> |