diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-05-29 11:13:02 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-05-29 11:13:02 +0000 |
commit | dcb82fefaae13675bb901602d93e085ef0300edf (patch) | |
tree | d303e4f96e496fa54ced0c446e6d5334dac55aab /test/java/org | |
parent | b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0 (diff) | |
parent | 9e1c3f381c661eff5ebb45f3d442b0dc871dd865 (diff) | |
download | xmlgraphics-fop-dcb82fefaae13675bb901602d93e085ef0300edf.tar.gz xmlgraphics-fop-dcb82fefaae13675bb901602d93e085ef0300edf.zip |
Merged changes from trunk up to revision 1343632
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@1343668 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org')
3 files changed, 112 insertions, 2 deletions
diff --git a/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java index 9c53bdde3..863bfe797 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 static org.junit.Assert.assertTrue; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -45,6 +43,8 @@ import org.w3c.dom.Document; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; +import static org.junit.Assert.assertTrue; + import org.apache.fop.accessibility.StructureTree2SAXEventAdapter; import org.apache.fop.accessibility.StructureTreeEventHandler; import org.apache.fop.apps.FOPException; @@ -102,6 +102,17 @@ public class FO2StructureTreeConverterTestCase { testConverter(); } + @Test + public void testArtifact() throws Exception { + foLoader = new FOLoader() { + + public InputStream getFoInputStream() { + return getResource("artifact.fo"); + } + }; + testConverter(); + } + private Transformer createTransformer(Source xslt) throws TransformerFactoryConfigurationError, TransformerConfigurationException { TransformerFactory transformerFactory = TransformerFactory.newInstance(); diff --git a/test/java/org/apache/fop/accessibility/fo/artifact.fo b/test/java/org/apache/fop/accessibility/fo/artifact.fo new file mode 100644 index 000000000..c3d5fadf3 --- /dev/null +++ b/test/java/org/apache/fop/accessibility/fo/artifact.fo @@ -0,0 +1,97 @@ +<?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="page" + page-height="500pt" page-width="300pt" margin="20pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" text-align="justify"> + + <fo:block>This piece of text is normal content that should be read out loud by a screen + reader.</fo:block> + + <fo:block space-before="10pt">The following content will be treated as artifact:</fo:block> + + <fo:wrapper role="artifact"> + <fo:block-container border="1pt solid black" padding="5pt" background-color="#F0F0F0" + space-before="10pt" start-indent="6pt" end-indent="6pt" color="#606060"> + <fo:block start-indent="0" end-indent="0"> + <fo:block>A block as artifact.</fo:block> + <fo:table space-before="5pt" width="100%" table-layout="fixed"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(2)"/> + <fo:table-header> + <fo:table-cell border="1pt solid #606060"><fo:block>Header 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Header 1.2</fo:block></fo:table-cell> + </fo:table-header> + <fo:table-footer> + <fo:table-cell border="1pt solid #606060"><fo:block>Footer 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Footer 1.2</fo:block></fo:table-cell> + </fo:table-footer> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 1.2</fo:block></fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 2.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 2.2</fo:block></fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:list-block space-before="7pt" provisional-distance-between-starts="8pt" + provisional-label-separation="5pt"> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 1.</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 2.</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 3.</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + <fo:wrapper> + <fo:block>A block in a nested wrapper.</fo:block> + </fo:wrapper> + <fo:wrapper role="artifact"> + <fo:block>A block in a nested artifact wrapper.</fo:block> + </fo:wrapper> + <fo:wrapper> + <fo:block>Inside a nested wrapper. + <fo:wrapper role="artifact">An artifact wrapper inside the nested wrapper. + <fo:inline><fo:wrapper>Inside a wrapper inside the artifact wrapper that is inside + the nested wrapper.</fo:wrapper> Outside the wrapper inside the artifact + wrapper that is inside the nested wrapper.</fo:inline> + </fo:wrapper> Outside the artifact wrapper.</fo:block> + </fo:wrapper> + </fo:block> + </fo:block-container> + </fo:wrapper> + + <fo:block space-before="10pt">Now we are back to normal content that is part of the logical + structure, should appear in the structure tree and should be read out loud by the screen + reader.</fo:block> + + </fo:flow> + </fo:page-sequence> + +</fo:root> diff --git a/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl b/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl index ce326f3b1..db0dffb14 100644 --- a/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl +++ b/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl @@ -105,6 +105,8 @@ <xsl:call-template name="copy"/> </xsl:template> + <xsl:template match="fo:wrapper[translate(normalize-space(@role), 'ARTIFCT', 'artifct') = 'artifact']"/> + <!-- Discard descendants of fo:leader --> <xsl:template match="fo:leader"/> |