diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-05-28 16:16:23 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-05-28 16:16:23 +0000 |
commit | b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0 (patch) | |
tree | 2786a2fbe4e86197f6ebfa06261cbf8672b967a8 /test | |
parent | 340025483a07776d56b655bbee3b402ba589a5b4 (diff) | |
parent | d48e0e1f467c58a22c4d1b19591d4fa9d22aa8c6 (diff) | |
download | xmlgraphics-fop-b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0.tar.gz xmlgraphics-fop-b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0.zip |
Merged changes from trunk up to revision 1343133
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@1343310 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
43 files changed, 925 insertions, 28 deletions
diff --git a/test/events/inline-level.fo b/test/events/inline-level.fo index 26a00acff..e415891ac 100644 --- a/test/events/inline-level.fo +++ b/test/events/inline-level.fo @@ -2,16 +2,14 @@ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="page" - page-height="420pt" page-width="320pt" margin="10pt"> + page-height="420pt" page-width="100pt" margin="10pt"> <fo:region-body background-color="#F0F0F0"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="page"> <fo:flow flow-name="xsl-region-body"> <fo:block>The following line overflows its container:</fo:block> - <fo:block-container width="100pt" height="100pt" border="1pt solid black"> - <fo:block>ThisLineOverflowsItsContainer</fo:block> - </fo:block-container> + <fo:block border="1pt solid black">ThisLineOverflowsItsContainer</fo:block> </fo:flow> </fo:page-sequence> </fo:root> diff --git a/test/events/viewport-overflow.fo b/test/events/viewport-overflow.fo new file mode 100644 index 000000000..ac9dc76bb --- /dev/null +++ b/test/events/viewport-overflow.fo @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master page-width="10.0cm" page-height="10.0cm" master-name="testpage"> + <fo:region-body /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="testpage"> + <fo:flow flow-name="xsl-region-body"> + <fo:block-container overflow="error-if-overflow" position="absolute" height="20pt" width="40pt" left="30pt" top="20pt"> + <fo:block>abcdefghijklmnopqrstuvwxyz</fo:block> + </fo:block-container> + <fo:block-container overflow="error-if-overflow" position="absolute" height="65pt" width="40pt" left="90pt" top="20pt"> + <fo:block>abc def ghi jkl mno pqr stu vwx yz</fo:block> + </fo:block-container> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java b/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java new file mode 100644 index 000000000..7b261d482 --- /dev/null +++ b/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java @@ -0,0 +1,57 @@ +/* + * 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.afp; + +import java.awt.BasicStroke; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.afp.modca.GraphicsObject; +import org.apache.fop.fonts.FontInfo; + +public class AFPGraphics2DTestCase { + + private final float lineWidth = 1.0f; + private final float correction = 2.5f; + private final BasicStroke stroke = mock(BasicStroke.class); + private final GraphicsObject gObject = mock(GraphicsObject.class); + private final AFPPaintingState paintingState = mock(AFPPaintingState.class); + private final AFPResourceManager resourceManager = mock(AFPResourceManager.class); + private final AFPResourceInfo resourceInfo = mock(AFPResourceInfo.class); + private final FontInfo fontInfo = mock(FontInfo.class); + private AFPGraphics2D graphics2D = new AFPGraphics2D(false, paintingState, resourceManager, resourceInfo, + fontInfo); + + @Test + public void testApplyStroke() { + // note: this only tests the setLineWidth in the GraphicsObject + float correctedLineWidth = lineWidth * correction; + when(stroke.getLineWidth()).thenReturn(lineWidth); + when(paintingState.getLineWidthCorrection()).thenReturn(correction); + graphics2D.setGraphicsObject(gObject); + graphics2D.applyStroke(stroke); + verify(gObject).setLineWidth(correctedLineWidth); + } + +} diff --git a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java index dd776e41c..6d0daa2be 100644 --- a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java +++ b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java @@ -19,10 +19,6 @@ package org.apache.fop.afp.fonts; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.CharacterCodingException; @@ -30,6 +26,10 @@ import java.nio.charset.CharacterCodingException; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** * Test {@link CharactersetEncoder} */ @@ -39,8 +39,9 @@ public class CharactersetEncoderTestCase { @Before public void setUp() { - singlebyteEncoder = CharactersetEncoder.newInstance("cp500", false); - doublebyteEncoder = CharactersetEncoder.newInstance("cp937", true); + singlebyteEncoder = CharactersetEncoder.newInstance("cp500", CharacterSetType.SINGLE_BYTE); + doublebyteEncoder = CharactersetEncoder.newInstance("cp937", + CharacterSetType.DOUBLE_BYTE_LINE_DATA); } // This is just an arbitrary CJK string @@ -95,7 +96,7 @@ public class CharactersetEncoderTestCase { @Test public void testEncode() throws CharacterCodingException, IOException { - CharactersetEncoder.EncodedChars encChars;// = doublebyteEncoder.encode(testCJKText); + CharactersetEncoder.EncodedChars encChars; // = doublebyteEncoder.encode(testCJKText); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); // JAVA 1.5 has a bug in the JVM in which these err for some reason... JAVA 1.6 no issues /*encChars.writeTo(bOut, 0, encChars.getLength()); diff --git a/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java b/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java new file mode 100644 index 000000000..f34275de0 --- /dev/null +++ b/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.afp.goca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class GraphicsSetFractionalLineWidthTestCase { + + private final float multiplier = 5.25f; + private final GraphicsSetFractionalLineWidth gsflw = new GraphicsSetFractionalLineWidth(multiplier); + + @Test + public void testGetDataLength() { + assertEquals(4, gsflw.getDataLength()); + } + + @Test + public void testWriteToStream() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + gsflw.writeToStream(baos); + baos.close(); + // note: 0.25 = 64/256 and 64 = 4*16, so 0x40 + // expected: 0x11 (order code), 0x02 (2 bytes next), 0x05 (integral multiplier), 0x40 (fractional + // multiplier) + byte[] expected = new byte[] {0x11, 0x02, 0x05, 0x40}; + assertTrue(Arrays.equals(expected, baos.toByteArray())); + } + + @Test + public void testToString() { + // lets make sure we keep good coverage... + assertEquals("GraphicsSetFractionalLineWidth{multiplier=" + multiplier + "}", gsflw.toString()); + } + +} diff --git a/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java b/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java new file mode 100644 index 000000000..c0a18a551 --- /dev/null +++ b/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java @@ -0,0 +1,57 @@ +/* + * 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.afp.goca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class GraphicsSetLineWidthTestCase { + + private final int multiplier = 5; + private final GraphicsSetLineWidth gslw = new GraphicsSetLineWidth(multiplier); + + @Test + public void testGetDataLength() { + assertEquals(2, gslw.getDataLength()); + } + + @Test + public void testWriteToStream() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + gslw.writeToStream(baos); + baos.close(); + // expected: 0x19 (order code), 0x05 (integral multiplier) + byte[] expected = new byte[] {0x19, 0x05}; + assertTrue(Arrays.equals(expected, baos.toByteArray())); + } + + @Test + public void testToString() { + // lets make sure we keep good coverage... + assertEquals("GraphicsSetLineWidth{multiplier=" + multiplier + "}", gslw.toString()); + } + +} diff --git a/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java new file mode 100644 index 000000000..338c5e6f4 --- /dev/null +++ b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.afp.ptoca; + +import java.io.IOException; +import java.io.OutputStream; + +import org.junit.Test; + +import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; +import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; + +import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class TransparentDataControlSequenceTestCase { + + private EncodedChars encodedChars; + private final OutputStream outStream = mock(OutputStream.class); + + @Test + public void testSingleByteCharacterSet() throws IOException { + testTRNs(false); + } + + @Test + public void testDoubleByteCharacterSets() throws IOException { + testTRNs(true); + } + + public void testTRNs(boolean isDBCS) throws IOException { + for (int length = 100; length < 10000; length += 1000) { + createTRNControlSequence(isDBCS, length); + int maxTRNSize = TRANSPARENT_DATA_MAX_SIZE - (isDBCS ? 1 : 0); + int numberOfTRNs = length / maxTRNSize; + for (int i = 0; i < numberOfTRNs; i++) { + verify(encodedChars, times(1)).writeTo(outStream, i * maxTRNSize, maxTRNSize); + } + int lastOffset = numberOfTRNs * maxTRNSize; + verify(encodedChars, times(1)).writeTo(outStream, numberOfTRNs * maxTRNSize, + length - lastOffset); + } + } + + private void createTRNControlSequence(boolean isDBCS, int length) throws IOException { + encodedChars = mock(EncodedChars.class); + when(encodedChars.isDBCS()).thenReturn(isDBCS); + when(encodedChars.getLength()).thenReturn(length); + for (TransparentData trn : new TransparentDataControlSequence(encodedChars)) { + trn.writeTo(outStream); + } + } +} diff --git a/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java new file mode 100644 index 000000000..9a80fd964 --- /dev/null +++ b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java @@ -0,0 +1,72 @@ +/* + * 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: CommandLineOptions.java 1293736 2012-02-26 02:29:01Z gadams $ */ + +package org.apache.fop.cli; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.apache.fop.apps.FOPException; +import org.junit.Before; +import org.junit.Test; + +public class CommandLineOptionsTestCase { + + private final CommandLineOptions clo = new CommandLineOptions(); + private final String commandLine = "-fo examples/fo/basic/simple.fo -print"; + private String[] cmd; + private boolean parsed; + + @Before + public void setUp() throws Exception { + cmd = commandLine.split(" "); + parsed = clo.parse(cmd); + } + + @Test + public void testParse() { + assertTrue(parsed); + } + + @Test + public void testGetOutputFormat() throws FOPException { + assertEquals(clo.getOutputFormat(), "application/X-fop-print"); + } + + @Test + public void testVandVersionSwitchs() throws FOPException, IOException { + // test -v + String cl1 = "-v"; + String[] cmd1 = cl1.split(" "); + CommandLineOptions clo1 = new CommandLineOptions(); + assertTrue(!clo1.parse(cmd1)); + // test -version + String cl2 = "-version"; + String[] cmd2 = cl2.split(" "); + CommandLineOptions clo2 = new CommandLineOptions(); + assertTrue(!clo2.parse(cmd2)); + // test -v + more switches + String cl3 = "-v " + commandLine; + String[] cmd3 = cl3.split(" "); + CommandLineOptions clo3 = new CommandLineOptions(); + assertTrue(clo3.parse(cmd3)); + } +} diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java index 8219fa71e..1d38d4ccb 100644 --- a/test/java/org/apache/fop/events/EventProcessingTestCase.java +++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -124,4 +124,16 @@ public class EventProcessingTestCase { doTest("inline-level.fo", InlineLevelEventProducer.class.getName() + ".lineOverflows"); } + + @Test + public void testViewportIPDOverflow() throws FOPException, TransformerException, IOException, + SAXException { + doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportIPDOverflow"); + } + + @Test + public void testViewportBPDOverflow() throws FOPException, TransformerException, IOException, + SAXException { + doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow"); + } } diff --git a/test/java/org/apache/fop/fo/properties/PropertyListMocks.java b/test/java/org/apache/fop/fo/properties/PropertyListMocks.java index 380f6e5a8..f364c9034 100644 --- a/test/java/org/apache/fop/fo/properties/PropertyListMocks.java +++ b/test/java/org/apache/fop/fo/properties/PropertyListMocks.java @@ -69,6 +69,10 @@ public final class PropertyListMocks { final Property borderCollapseProperty = mock(Property.class); when(borderCollapseProperty.getEnum()).thenReturn(Constants.EN_SEPARATE); when(mockPList.get(Constants.PR_BORDER_COLLAPSE)).thenReturn(borderCollapseProperty); + + final Property writingModeProperty = mock(Property.class); + when(writingModeProperty.getEnum()).thenReturn(Constants.EN_LR_TB); + when(mockPList.get(Constants.PR_WRITING_MODE)).thenReturn(writingModeProperty); } catch (PropertyException e) { throw new RuntimeException(e); } diff --git a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java index 65c6b25a6..6819fed79 100644 --- a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java @@ -61,7 +61,7 @@ public class IFStructureTreeBuilderTestCase { // Expected } - sut.startPageSequence(null); + sut.startPageSequence(null, null); sut.endPageSequence(); sut.replayEventsForPageSequence(handler, 0); @@ -89,7 +89,7 @@ public class IFStructureTreeBuilderTestCase { final String nodeName = "block"; final ContentHandler handler = mock(ContentHandler.class); - sut.startPageSequence(null); + sut.startPageSequence(null, null); sut.startNode(nodeName, createSimpleAttributes(attributes)); sut.endPageSequence(); @@ -105,7 +105,7 @@ public class IFStructureTreeBuilderTestCase { final String nodeName = "block"; final ContentHandler handler = mock(ContentHandler.class); - sut.startPageSequence(null); + sut.startPageSequence(null, null); sut.endNode(nodeName); sut.endPageSequence(); diff --git a/test/java/org/apache/fop/render/ps/PSPainterTestCase.java b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java new file mode 100644 index 000000000..4e50f09c9 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java @@ -0,0 +1,69 @@ +/* + * 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. + */ +package org.apache.fop.render.ps; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.verification.VerificationMode; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.render.intermediate.IFState; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +public class PSPainterTestCase { + + private PSDocumentHandler docHandler; + private PSPainter psPainter; + private PSGenerator gen; + private IFState state; + + @Before + public void setup() { + docHandler = new PSDocumentHandler(); + gen = mock(PSGenerator.class); + docHandler.gen = gen; + state = IFState.create(); + psPainter = new PSPainter(docHandler, state); + } + + @Test + public void testNonZeroFontSize() throws IOException { + testFontSize(6, times(1)); + } + + @Test + public void testZeroFontSize() throws IOException { + testFontSize(0, never()); + } + + private void testFontSize(int fontSize, VerificationMode test) throws IOException { + state.setFontSize(fontSize); + try { + psPainter.drawText(10, 10, 2, 2, null, "Test"); + } catch (Exception ex) { + //Expected + } + verify(gen, test).useColor(state.getTextColor()); + } +} diff --git a/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java new file mode 100644 index 000000000..3f1088fe1 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java @@ -0,0 +1,45 @@ +/* + * 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.render.ps; + +import java.io.IOException; + +import org.junit.Test; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class PSRenderingUtilTestCase { + + private final String content = "<< /MyEntry 0 >> command"; + private final PSPageTrailerCodeBefore ptcb = new PSPageTrailerCodeBefore(content); + private final PSGenerator gen = mock(PSGenerator.class); + + @Test + public void testWriteEnclosedExtensionAttachment() throws IOException { + PSRenderingUtil.writeEnclosedExtensionAttachment(gen, ptcb); + verify(gen).writeln(content); + } + +} diff --git a/test/layoutengine/standard-testcases/basic-link_padding_bug50196.xml b/test/layoutengine/standard-testcases/basic-link_padding_bug50196.xml new file mode 100644 index 000000000..e7039bc02 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_padding_bug50196.xml @@ -0,0 +1,45 @@ +<?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$ --> +<testcase> + <info> + <p> + Bugzilla #50196: padding-start on basic-link causes exception + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="210mm" page-height="297mm"> + <fo:region-body margin="2cm"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:block> + <fo:basic-link padding-left="20pt" internal-destination="dest1"><fo:inline>test</fo:inline></fo:basic-link> + </fo:block> + <fo:block id="dest1"></fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="20000" xpath="//lineArea/inlineparent[@internal-link='(P1,dest1)']/@padding-start"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/bidi_propagation_1.xml b/test/layoutengine/standard-testcases/bidi_propagation_1.xml index 947d9dac5..587bc6d2f 100644 --- a/test/layoutengine/standard-testcases/bidi_propagation_1.xml +++ b/test/layoutengine/standard-testcases/bidi_propagation_1.xml @@ -66,7 +66,7 @@ <fo:table-cell margin-left="0" text-align="right"> <fo:block> <fo:inline> - <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">X</fo:bidi-override></fo:inline> + <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">XY</fo:bidi-override></fo:inline> </fo:inline> </fo:block> </fo:table-cell> @@ -93,7 +93,7 @@ <fo:table-cell margin-left="0" text-align="right"> <fo:block> <fo:inline> - <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">X</fo:bidi-override></fo:inline> + <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">XY</fo:bidi-override></fo:inline> </fo:inline> </fo:block> </fo:table-cell> diff --git a/test/layoutengine/standard-testcases/block-break-inline-break-before.xml b/test/layoutengine/standard-testcases/block-break-inline-break-before.xml new file mode 100644 index 000000000..627862aa1 --- /dev/null +++ b/test/layoutengine/standard-testcases/block-break-inline-break-before.xml @@ -0,0 +1,38 @@ +<?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$ --> +<testcase> + <info> + <p>This tests that two breaks across an inline are treated as one.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-width="220pt" page-height="220pt" + margin="10pt"> + <fo:region-body /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>one</fo:block> + <fo:block break-before="page"> + <fo:inline> + <fo:block break-before="page">two</fo:block> + </fo:inline> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'one')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., 'two')]/ancestor::pageViewport/@nr" /> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block-inline-break-before.xml b/test/layoutengine/standard-testcases/block-inline-break-before.xml new file mode 100644 index 000000000..64b3694a1 --- /dev/null +++ b/test/layoutengine/standard-testcases/block-inline-break-before.xml @@ -0,0 +1,40 @@ +<?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$ --> +<testcase> + <info> + <p>This test checks basic breaks.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in" + margin="0.5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>one</fo:block> + <fo:block> + <fo:inline> + <fo:block break-before="page">two</fo:block> + <fo:block break-before="page">three</fo:block> + </fo:inline> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'one')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., 'two')]/ancestor::pageViewport/@nr" /> + <eval expected="3" xpath="//lineArea[starts-with(., 'three')]/ancestor::pageViewport/@nr" /> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block-inline-inline-break-before.xml b/test/layoutengine/standard-testcases/block-inline-inline-break-before.xml new file mode 100644 index 000000000..a44118b51 --- /dev/null +++ b/test/layoutengine/standard-testcases/block-inline-inline-break-before.xml @@ -0,0 +1,40 @@ +<?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$ --> +<testcase> + <info> + <p>This tests a break inside nested inlines.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in" + margin="0.5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>one</fo:block> + <fo:block> + <fo:inline> + <fo:inline> + <fo:block break-before="page">two</fo:block> + </fo:inline> + </fo:inline> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'one')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., 'two')]/ancestor::pageViewport/@nr" /> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/character_writing-mode_rl.xml b/test/layoutengine/standard-testcases/character_writing-mode_rl.xml index adc126ec8..db65238c0 100644 --- a/test/layoutengine/standard-testcases/character_writing-mode_rl.xml +++ b/test/layoutengine/standard-testcases/character_writing-mode_rl.xml @@ -59,18 +59,18 @@ <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/@ipd"/> <eval expected="4" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]"/> <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@level"/> - <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed)"/> + <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed"/> <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/@ipd"/> <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]"/> - <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@level"/> - <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed)"/> + <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]/@level"/> + <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]/@reversed"/> <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/@ipd"/> <eval expected="2" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]"/> <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@level"/> - <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@reversed)"/> + <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@reversed"/> <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/@ipd"/> <eval expected="1" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]"/> <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@level"/> - <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@reversed)"/> + <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@reversed"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/table-column_column-progression-rl.xml b/test/layoutengine/standard-testcases/table-column_column-progression-rl_1.xml index 4f6b3d53a..79db99a45 100644 --- a/test/layoutengine/standard-testcases/table-column_column-progression-rl.xml +++ b/test/layoutengine/standard-testcases/table-column_column-progression-rl_1.xml @@ -19,9 +19,10 @@ <testcase> <info> <p> - This test checks table column progression with right-to-left writing mode. The first column - should be to the right of the second column; the second column should be to the right of the - third column. The columns should be colored red, yellow, orange from right to left. + This test checks table column progression with right-to-left writing mode when writing-mode + is specified on fo:page-sequence. The first column should be to the right of the second column; the + second column should be to the right of the third column. The columns should be colored red, + yellow, orange from right to left. </p> </info> <fo> diff --git a/test/layoutengine/standard-testcases/table-column_column-progression-rl_2.xml b/test/layoutengine/standard-testcases/table-column_column-progression-rl_2.xml new file mode 100644 index 000000000..e7230a574 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-column_column-progression-rl_2.xml @@ -0,0 +1,83 @@ +<?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$ --> +<testcase> + <info> + <p> + This test checks table column progression with right-to-left writing mode when writing-mode + is specified on fo:table. The first column should be to the right of the second column; the + second column should be to the right of the third column. The columns should be colored red, + yellow, orange from right to left. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in" margin="0.5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:table table-layout="fixed" width="100%" writing-mode="rl"> + <fo:table-column column-width="1in" background-color="red"/> + <fo:table-column column-width="1in" background-color="yellow"/> + <fo:table-column column-width="2in" background-color="orange"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell> + <fo:block>cell1</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>cell2</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>cell3</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- cell 1 background --> + <eval expected="#ff0000" xpath="//flow/block[1]/block[1]/@bkg-color"/> + <!-- cell 1 --> + <eval expected="cell1" xpath="//flow/block[1]/block[2]/block[1]/lineArea/text"/> + <eval expected="72000" xpath="//flow/block[1]/block[2]/@ipd"/> + <eval expected="216000" xpath="//flow/block[1]/block[2]/@left-offset"/> + <!-- cell 2 background --> + <eval expected="#ffff00" xpath="//flow/block[1]/block[3]/@bkg-color"/> + <!-- cell 2 --> + <eval expected="cell2" xpath="//flow/block[1]/block[4]/block[1]/lineArea/text"/> + <eval expected="72000" xpath="//flow/block[1]/block[4]/@ipd"/> + <eval expected="144000" xpath="//flow/block[1]/block[4]/@left-offset"/> + <!-- cell 3 background --> + <eval expected="#ffa500" xpath="//flow/block[1]/block[5]/@bkg-color"/> + <!-- cell 3 --> + <eval expected="cell3" xpath="//flow/block[1]/block[6]/block[1]/lineArea/text"/> + <eval expected="144000" xpath="//flow/block[1]/block[6]/@ipd"/> + <true xpath="not(boolean(//flow/block[1]/block[6]/@left-offset))"/> + <!-- right-to-left offset invariant - cell 2 to the left of cell 1 --> + <true xpath="//flow/block[1]/block[4]/@left-offset < //flow/block[1]/block[2]/@left-offset"/> + <!-- right-to-left offset invariant - cell 3 to left right of cell 2 --> + <true xpath="//flow/block[1]/block[4]/@left-offset > 0"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml b/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml new file mode 100644 index 000000000..0b39606f7 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml @@ -0,0 +1,89 @@ +<?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$ --> +<testcase> + <info> + <p> + This test checks table column progression with right-to-left writing mode when using multiple + column spans. See also bugzilla #53103. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="1cm" margin-right="1cm"> + <fo:region-body margin-top="3cm"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="first"> + <fo:flow flow-name="xsl-region-body"> + <fo:table table-layout="fixed" width="125mm" writing-mode="rl-tb"> + <fo:table-header> + <fo:table-row> + <fo:table-cell number-columns-spanned="2" border="solid 1px black"> + <fo:block>header-R1;C1-span2</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block>header-R1;C2</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block>header-R1;C3</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="solid 1px black"> + <fo:block>body-R2;C1</fo:block> + </fo:table-cell> + <fo:table-cell number-columns-spanned="2" border="solid 1px black"> + <fo:block>body-R2;C2</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block>body-R2;C3</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell number-columns-spanned="3" border="solid 1px black"> + <fo:block>body-R3;C1-span3</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block>body-R3;C2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- row 1 (header), column 1, span 2 --> + <eval expected="header-R1;C1-span2" xpath="//flow/block[1]/block[3]//lineArea"/> + <eval expected="177664" xpath="//flow/block[1]/block[3]/@left-offset"/> + <eval expected="176164" xpath="//flow/block[1]/block[3]/@ipd"/> + <!-- row 2 (body), column 2, span 1 --> + <eval expected="body-R2;C2" xpath="//flow/block[1]/block[9]//lineArea"/> + <eval expected="89082" xpath="//flow/block[1]/block[9]/@left-offset"/> + <eval expected="176164" xpath="//flow/block[1]/block[9]/@ipd"/> + <!-- row 3 (body), column 1, span 3 --> + <eval expected="body-R3;C1-span3" xpath="//flow/block[1]/block[14]//lineArea"/> + <eval expected="89082" xpath="//flow/block[1]/block[14]/@left-offset"/> + <eval expected="264746" xpath="//flow/block[1]/block[14]/@ipd"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table_writing-mode_rl.xml b/test/layoutengine/standard-testcases/table_writing-mode_rl.xml new file mode 100644 index 000000000..65927ec48 --- /dev/null +++ b/test/layoutengine/standard-testcases/table_writing-mode_rl.xml @@ -0,0 +1,91 @@ +<?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$ --> +<testcase> + <info> + <p> + This test checks table header, footer, and body cells all respect writing-mode="rl" specified on table. See also Bugzilla #53086. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm"> + <fo:region-body margin-top="3cm"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="first"> + <fo:flow flow-name="xsl-region-body"> + <fo:block-container writing-mode="rl-tb"> + <fo:table table-layout="fixed" width="100%" border-collapse="collapse"> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="solid 1px black"> + <fo:block>HEADER ROW</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">ABC</fo:bidi-override></fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">DEF</fo:bidi-override></fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-footer> + <fo:table-row> + <fo:table-cell border="solid 1px black"> + <fo:block>FOOTER ROW</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">ABC</fo:bidi-override></fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">DEF</fo:bidi-override></fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-footer> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="solid 1px black"> + <fo:block>BODY ROW</fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">ABC</fo:bidi-override></fo:block> + </fo:table-cell> + <fo:table-cell border="solid 1px black"> + <fo:block><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">DEF</fo:bidi-override></fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:block-container> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="9" xpath="count(//lineArea)"/> + <eval expected="HEADER ROWCBAFEDBODY ROWCBAFEDFOOTER ROWCBAFED" xpath="/"/> + <eval expected="HEADER ROW" xpath="//flow/block/block/block/block[1]//lineArea"/> + <eval expected="1" xpath="//flow/block/block/block/block[1]//lineArea/@level"/> + <eval expected="BODY ROW" xpath="//flow/block/block/block/block[4]//lineArea"/> + <eval expected="1" xpath="//flow/block/block/block/block[4]//lineArea/@level"/> + <eval expected="FOOTER ROW" xpath="//flow/block/block/block/block[7]//lineArea"/> + <eval expected="1" xpath="//flow/block/block/block/block[7]//lineArea/@level"/> + </checks> +</testcase> diff --git a/test/pdf/1.5/test.pdf b/test/pdf/1.5/test.pdf Binary files differindex 4c25c0847..6175a270f 100644 --- a/test/pdf/1.5/test.pdf +++ b/test/pdf/1.5/test.pdf diff --git a/test/pdf/accessibility/pdf/background-image_jpg_repeat.pdf b/test/pdf/accessibility/pdf/background-image_jpg_repeat.pdf Binary files differindex 9b4a7fc20..bf3cdccad 100644 --- a/test/pdf/accessibility/pdf/background-image_jpg_repeat.pdf +++ b/test/pdf/accessibility/pdf/background-image_jpg_repeat.pdf diff --git a/test/pdf/accessibility/pdf/background-image_jpg_single.pdf b/test/pdf/accessibility/pdf/background-image_jpg_single.pdf Binary files differindex d1d0ecb1b..4d40ebc7a 100644 --- a/test/pdf/accessibility/pdf/background-image_jpg_single.pdf +++ b/test/pdf/accessibility/pdf/background-image_jpg_single.pdf diff --git a/test/pdf/accessibility/pdf/background-image_png_repeat.pdf b/test/pdf/accessibility/pdf/background-image_png_repeat.pdf Binary files differindex ccb2cf089..7847bcedd 100644 --- a/test/pdf/accessibility/pdf/background-image_png_repeat.pdf +++ b/test/pdf/accessibility/pdf/background-image_png_repeat.pdf diff --git a/test/pdf/accessibility/pdf/background-image_png_single.pdf b/test/pdf/accessibility/pdf/background-image_png_single.pdf Binary files differindex 902520b95..9458b54f8 100644 --- a/test/pdf/accessibility/pdf/background-image_png_single.pdf +++ b/test/pdf/accessibility/pdf/background-image_png_single.pdf diff --git a/test/pdf/accessibility/pdf/background-image_svg_repeat.pdf b/test/pdf/accessibility/pdf/background-image_svg_repeat.pdf Binary files differindex a720a5b9a..41c2ee500 100644 --- a/test/pdf/accessibility/pdf/background-image_svg_repeat.pdf +++ b/test/pdf/accessibility/pdf/background-image_svg_repeat.pdf diff --git a/test/pdf/accessibility/pdf/background-image_svg_single.pdf b/test/pdf/accessibility/pdf/background-image_svg_single.pdf Binary files differindex 7e6e3e9d4..8c2dc1006 100644 --- a/test/pdf/accessibility/pdf/background-image_svg_single.pdf +++ b/test/pdf/accessibility/pdf/background-image_svg_single.pdf diff --git a/test/pdf/accessibility/pdf/complete.pdf b/test/pdf/accessibility/pdf/complete.pdf Binary files differindex f1dc10559..3aada8c00 100644 --- a/test/pdf/accessibility/pdf/complete.pdf +++ b/test/pdf/accessibility/pdf/complete.pdf diff --git a/test/pdf/accessibility/pdf/image_jpg.pdf b/test/pdf/accessibility/pdf/image_jpg.pdf Binary files differindex e943c83e5..21bae3826 100644 --- a/test/pdf/accessibility/pdf/image_jpg.pdf +++ b/test/pdf/accessibility/pdf/image_jpg.pdf diff --git a/test/pdf/accessibility/pdf/image_png.pdf b/test/pdf/accessibility/pdf/image_png.pdf Binary files differindex 5ea44673b..5bd99a623 100644 --- a/test/pdf/accessibility/pdf/image_png.pdf +++ b/test/pdf/accessibility/pdf/image_png.pdf diff --git a/test/pdf/accessibility/pdf/image_svg.pdf b/test/pdf/accessibility/pdf/image_svg.pdf Binary files differindex db1e061cf..a9428fd3f 100644 --- a/test/pdf/accessibility/pdf/image_svg.pdf +++ b/test/pdf/accessibility/pdf/image_svg.pdf diff --git a/test/pdf/accessibility/pdf/image_wmf.pdf b/test/pdf/accessibility/pdf/image_wmf.pdf Binary files differindex 65c46d12a..c15a05223 100644 --- a/test/pdf/accessibility/pdf/image_wmf.pdf +++ b/test/pdf/accessibility/pdf/image_wmf.pdf diff --git a/test/pdf/accessibility/pdf/leader.pdf b/test/pdf/accessibility/pdf/leader.pdf Binary files differindex d270c25a1..4b91dfe8e 100644 --- a/test/pdf/accessibility/pdf/leader.pdf +++ b/test/pdf/accessibility/pdf/leader.pdf diff --git a/test/pdf/accessibility/pdf/links.pdf b/test/pdf/accessibility/pdf/links.pdf Binary files differindex b2a5a4209..d2ff84ea4 100644 --- a/test/pdf/accessibility/pdf/links.pdf +++ b/test/pdf/accessibility/pdf/links.pdf diff --git a/test/pdf/accessibility/pdf/role.pdf b/test/pdf/accessibility/pdf/role.pdf Binary files differindex 329925bcd..38fcf1bde 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 84daea788..6f1edea19 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/text_1.pdf b/test/pdf/accessibility/pdf/text_1.pdf Binary files differindex 13f01711d..bacd7a9d0 100644 --- a/test/pdf/accessibility/pdf/text_1.pdf +++ b/test/pdf/accessibility/pdf/text_1.pdf diff --git a/test/pdf/accessibility/pdf/text_2.pdf b/test/pdf/accessibility/pdf/text_2.pdf Binary files differindex 943263994..0283764cd 100644 --- a/test/pdf/accessibility/pdf/text_2.pdf +++ b/test/pdf/accessibility/pdf/text_2.pdf diff --git a/test/pdf/accessibility/pdf/text_font-embedding.pdf b/test/pdf/accessibility/pdf/text_font-embedding.pdf Binary files differindex 7ffb40af8..d1e4c6e28 100644 --- a/test/pdf/accessibility/pdf/text_font-embedding.pdf +++ b/test/pdf/accessibility/pdf/text_font-embedding.pdf diff --git a/test/pdf/accessibility/role.fo b/test/pdf/accessibility/role.fo index ced8a4d44..885638592 100644 --- a/test/pdf/accessibility/role.fo +++ b/test/pdf/accessibility/role.fo @@ -19,12 +19,17 @@ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" language="en" country="GB"> <fo:layout-master-set> <fo:simple-page-master master-name="page" - page-height="220pt" page-width="320pt" margin="10pt"> - <fo:region-body/> + page-height="240pt" page-width="320pt" margin="10pt" margin-bottom="8pt"> + <fo:region-body margin-bottom="20pt"/> + <fo:region-after extent="10pt"/> </fo:simple-page-master> </fo:layout-master-set> - <fo:page-sequence master-reference="page"> - <fo:flow flow-name="xsl-region-body" hyphenate="true" font-family="sans-serif"> + <fo:page-sequence master-reference="page" role="Art"> + <fo:static-content flow-name="xsl-region-after" role="NonStruct" font-size="8pt"> + <fo:block text-align="center"><fo:page-number/></fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body" role="NonStruct" hyphenate="true" + font-family="sans-serif"> <fo:block role="H1" font-weight="bold" font-size="150%" space-before.minimum="1.5em" space-before.optimum="2em" |