diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2013-12-13 23:41:13 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2013-12-13 23:41:13 +0000 |
commit | 5073488dbca84e0696834f30bb087a0f9c97d3a5 (patch) | |
tree | 8b1ff7ccd456363f89c634dd01b841679000b47f /test | |
parent | 8c0f881ee1b6aaae77c732bf66a1c1887a0e639f (diff) | |
parent | d495da253e1203c2df5288de89dbb49e26400aea (diff) | |
download | xmlgraphics-fop-5073488dbca84e0696834f30bb087a0f9c97d3a5.tar.gz xmlgraphics-fop-5073488dbca84e0696834f30bb087a0f9c97d3a5.zip |
Brought the branch in sync with rev. 1550844 of trunk
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_WhitespaceManagement@1550851 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
26 files changed, 735 insertions, 25 deletions
diff --git a/test/config/relative-uri/base_font.xconf b/test/config/relative-uri/base_font.xconf new file mode 100644 index 000000000..872c102e7 --- /dev/null +++ b/test/config/relative-uri/base_font.xconf @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fop version="1.0"> + <base>relative/</base> + <font-base>fonts/</font-base> +</fop> diff --git a/test/config/relative-uri/base_no-font.xconf b/test/config/relative-uri/base_no-font.xconf new file mode 100644 index 000000000..97d378511 --- /dev/null +++ b/test/config/relative-uri/base_no-font.xconf @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fop version="1.0"> + <base>relative/</base> +</fop> diff --git a/test/config/relative-uri/no-base_font.xconf b/test/config/relative-uri/no-base_font.xconf new file mode 100644 index 000000000..165cc1231 --- /dev/null +++ b/test/config/relative-uri/no-base_font.xconf @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fop version="1.0"> + <font-base>fonts/</font-base> +</fop> diff --git a/test/config/relative-uri/no-base_no-font.xconf b/test/config/relative-uri/no-base_no-font.xconf new file mode 100644 index 000000000..211d94212 --- /dev/null +++ b/test/config/relative-uri/no-base_no-font.xconf @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fop version="1.0"> +</fop> diff --git a/test/java/org/apache/fop/apps/FopConfParserTestCase.java b/test/java/org/apache/fop/apps/FopConfParserTestCase.java index 3c2930942..dc794fdb8 100644 --- a/test/java/org/apache/fop/apps/FopConfParserTestCase.java +++ b/test/java/org/apache/fop/apps/FopConfParserTestCase.java @@ -19,6 +19,7 @@ package org.apache.fop.apps; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -127,4 +128,41 @@ public class FopConfParserTestCase { builder.setPreferRenderer(true); assertTrue(buildFactory().getRendererFactory().isRendererPreferred()); } + + @Test + public void testRelativeURINoBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_no-font.xconf", + "", ""); + } + + @Test + public void testRelativeURINoBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_font.xconf", + "", "test/config/relative-uri/fonts/"); + } + + @Test + public void testRelativeURIBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_no-font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/relative/"); + } + + @Test + public void testRelativeURIBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/fonts/"); + } + + private void checkRelativeURIs(String conf, String expectedBase, String expectedFontBase) + throws SAXException, IOException { + File configFile = new File(conf); + URI currentDir = new File(".").getCanonicalFile().toURI(); + FopConfParser parser = new FopConfParser(configFile, currentDir); + FopFactoryBuilder fopFactoryBuilder = parser.getFopFactoryBuilder(); + assertEquals("base URI", currentDir.resolve(expectedBase), + fopFactoryBuilder.getBaseURI()); + assertEquals("font base", currentDir.resolve(expectedFontBase), + fopFactoryBuilder.getFontManager().getResourceResolver().getBaseURI()); + } + } diff --git a/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java b/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java index 726682ce0..6be0c1fa9 100644 --- a/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java +++ b/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; -// CSOFF: WhitespaceAfterCheck /* * !!! THIS IS A GENERATED FILE !!! diff --git a/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java b/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java index b3e080d50..c106e65c8 100644 --- a/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java +++ b/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java @@ -72,9 +72,7 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; -// CSOFF: InnerAssignmentCheck // CSOFF: LineLengthCheck -// CSOFF: NoWhitespaceAfterCheck /** * This class supports a subset of the <code>TTX</code> file as produced by the Adobe FLEX diff --git a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java index d156b908c..ee3498a03 100644 --- a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java +++ b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java @@ -35,6 +35,8 @@ import static org.junit.Assert.assertTrue; */ public class EmbedFontInfoTestCase { + public EmbedFontInfoTestCase() {} + private EmbedFontInfo sut; private final URI metricsURI = URI.create("test/resources/fonts/ttf/glb12.ttf.xml"); diff --git a/test/java/org/apache/fop/fonts/FontsTestSuite.java b/test/java/org/apache/fop/fonts/FontsTestSuite.java index ad48c46c4..1baba49df 100644 --- a/test/java/org/apache/fop/fonts/FontsTestSuite.java +++ b/test/java/org/apache/fop/fonts/FontsTestSuite.java @@ -29,7 +29,7 @@ import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ FontManagerConfiguratorTestCase.class, - EmbedFontInfo.class, + EmbedFontInfoTestCase.class, FontEventProcessingTestCase.class, FontManagerConfiguratorTestCase.class }) diff --git a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java index 08d841ede..49c1e6dab 100644 --- a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java @@ -32,7 +32,7 @@ import java.util.List; public class PDFDestsTestCase extends PDFObjectTestCase { private PDFDests dests = new PDFDests(); - private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>\n"; + private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>"; @Before public void setUp() { diff --git a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java index 3f84fac2e..00224e93e 100644 --- a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java @@ -47,7 +47,7 @@ public class PDFDictionaryTestCase extends PDFObjectTestCase { + " /array [1 (two) 20]\n" + " /number 20\n" + " /null null\n" - + ">>\n"; + + ">>"; @Before public void setUp() { diff --git a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java index e982bf246..a8be7ee74 100644 --- a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java @@ -37,11 +37,11 @@ public class PDFPageLabelsTestCase { int index = 0; StringBuilder expected = new StringBuilder(); expected.append("["); - expected.append(index + " << /S /r >>\n"); + expected.append(index + " << /S /r >>"); pageLabels.addPageLabel(index++, "i"); pageLabels.addPageLabel(index++, "ii"); pageLabels.addPageLabel(index++, "iii"); - expected.append(" " + index + " << /S /D >>\n"); + expected.append(" " + index + " << /S /D >>"); pageLabels.addPageLabel(index++, "1"); pageLabels.addPageLabel(index++, "2"); pageLabels.addPageLabel(index++, "3"); @@ -52,33 +52,33 @@ public class PDFPageLabelsTestCase { pageLabels.addPageLabel(index++, "8"); pageLabels.addPageLabel(index++, "9"); pageLabels.addPageLabel(index++, "10"); - expected.append(" " + index + " << /S /A >>\n"); + expected.append(" " + index + " << /S /A >>"); pageLabels.addPageLabel(index++, "A"); pageLabels.addPageLabel(index++, "B"); - expected.append(" " + index + " << /S /R /St 100 >>\n"); + expected.append(" " + index + " << /S /R /St 100 >>"); pageLabels.addPageLabel(index++, "C"); - expected.append(" " + index + " << /S /R /St 500 >>\n"); + expected.append(" " + index + " << /S /R /St 500 >>"); pageLabels.addPageLabel(index++, "D"); - expected.append(" " + index + " << /S /A /St 5 >>\n"); + expected.append(" " + index + " << /S /A /St 5 >>"); pageLabels.addPageLabel(index++, "E"); pageLabels.addPageLabel(index++, "F"); pageLabels.addPageLabel(index++, "G"); - expected.append(" " + index + " << /P (aa) >>\n"); + expected.append(" " + index + " << /P (aa) >>"); pageLabels.addPageLabel(index++, "aa"); - expected.append(" " + index + " << /P (ab) >>\n"); + expected.append(" " + index + " << /P (ab) >>"); pageLabels.addPageLabel(index++, "ab"); - expected.append(" " + index + " << /P (ac) >>\n"); + expected.append(" " + index + " << /P (ac) >>"); pageLabels.addPageLabel(index++, "ac"); - expected.append(" " + index + " << /S /a >>\n"); + expected.append(" " + index + " << /S /a >>"); pageLabels.addPageLabel(index++, "a"); pageLabels.addPageLabel(index++, "b"); - expected.append(" " + index + " << /S /R /St 2 >>\n"); + expected.append(" " + index + " << /S /R /St 2 >>"); pageLabels.addPageLabel(index++, "II"); - expected.append(" " + index + " << /S /R /St 12 >>\n"); + expected.append(" " + index + " << /S /R /St 12 >>"); pageLabels.addPageLabel(index++, "XII"); - expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>\n"); + expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>"); pageLabels.addPageLabel(index++, "009"); - expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>\n"); + expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>"); pageLabels.addPageLabel(index++, "010"); pageLabels.addPageLabel(index++, "011"); expected.append("]"); diff --git a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java index 93dcea511..20e38a600 100644 --- a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java @@ -118,7 +118,7 @@ public class PDFStreamTestCase { private byte[] createSampleStreamData() throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); - stream.write("stream\n".getBytes("US-ASCII")); + stream.write("\nstream\n".getBytes("US-ASCII")); stream.write(createSampleData()); stream.write("\nendstream".getBytes("US-ASCII")); return stream.toByteArray(); diff --git a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java index ceff96a91..12f6e3c1b 100644 --- a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java +++ b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java @@ -73,7 +73,7 @@ public class CrossReferenceTableTestCase extends CrossReferenceObjectTest { .append(" /Info 2 0 R\n") .append(" /ID [<0123456789ABCDEF> <0123456789ABCDEF>]\n") .append(" /Size ").append(Integer.toString(offsets.size() + 1)).append('\n') - .append(">>\n"); + .append(">>"); return getBytes(expected); } diff --git a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java index 592335648..be8b5d718 100644 --- a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java @@ -51,7 +51,7 @@ public class AbstractIFPainterTestCase { public void endViewport() throws IFException { } - public void startGroup(AffineTransform transform) throws IFException { + public void startGroup(AffineTransform transform, String layer) throws IFException { } public void endGroup() throws IFException { diff --git a/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java b/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java new file mode 100644 index 000000000..b48da4186 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java @@ -0,0 +1,71 @@ +/* + * 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.svg; + +import java.awt.Color; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.geom.Rectangle2D.Float; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import org.junit.Test; + +import org.apache.commons.io.FileUtils; + +import org.apache.batik.ext.awt.RadialGradientPaint; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.ps.PSGenerator; + +import static org.junit.Assert.assertEquals; + +public class PSSVGGraphics2DTestCase { + + float cx = 841.891f; + float cy = 178.583f; + float r = 16.4331f; + float[] fractions = {0.2f, 0.6012f, 0.8094f, 1.0f}; + + /** + * Tests a radial gradient generated pattern with certain inputs against + * an expected output. + * @throws IOException + */ + @Test + public void testApplyPaint() throws IOException { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PSGenerator gen = new PSGenerator(os); + PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, gen); + svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.setTransform(new AffineTransform()); + Color[] colors = {new Color(255, 255, 255), new Color(200, 200, 200), + new Color(170, 170, 170), new Color(140, 140, 140)}; + RadialGradientPaint paint = new RadialGradientPaint(cx, cy, r, fractions, colors); + Float s = new Rectangle2D.Float(7.0f, 3.0f, 841.891f, 178.583f); + svgGraphics2D.applyPaint(paint, true); + byte[] test = os.toByteArray(); + + byte[] expected = FileUtils.readFileToByteArray( + new File("test/java/org/apache/fop/render/ps/svg/expected.ps")); + assertEquals(new String(test), new String(expected)); + } +} diff --git a/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java b/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java new file mode 100644 index 000000000..283d3f4ad --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java @@ -0,0 +1,70 @@ + /* + * 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.svg; + +import java.awt.Color; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.geom.Rectangle2D.Float; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import org.junit.Test; + +import org.apache.commons.io.FileUtils; + +import org.apache.batik.ext.awt.LinearGradientPaint; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.ps.PSGenerator; + +import static org.junit.Assert.assertEquals; + +public class PSSVGLinearGraphics2DTestCase { + float startX = 115f; + float endX = 15f; + float startY = 285f; + float endY=15f; + float[] fractions = {0.0f, 1.0f}; + + /** + * Tests a linear gradient generated pattern with certain inputs against + * an expected output. + * @throws IOException + */ + @Test + public void testApplyPaint() throws IOException { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PSGenerator gen = new PSGenerator(os); + PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, gen); + svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.setTransform(new AffineTransform()); + Color[] colors = {new Color(255, 255, 0), new Color(255, 0, 0)}; + LinearGradientPaint paint = new LinearGradientPaint(startX, startY, endX, endY, fractions, colors); + Float s = new Rectangle2D.Float(115.0f, 15.0f, 170f, 110f); + svgGraphics2D.applyPaint(paint, true); + byte[] test = os.toByteArray(); + + byte[] expected = FileUtils.readFileToByteArray( + new File("test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat")); + assertEquals(new String(test), new String(expected)); + } +} diff --git a/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat b/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat new file mode 100644 index 000000000..fdf92cda5 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat @@ -0,0 +1,26 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 2 +/ColorSpace /DeviceRGB + /Coords [ 115 285 15 15 ] + /Domain [ 0 1 ] + /Extend [ true true ] + /Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 0 ] +/C1 [ 1 0 0 ] +/N 1 +>> ] +/Encode [ 0 1 ] +/Bounds [ ] +>> +>> +>> +matrix makepattern setcolor diff --git a/test/java/org/apache/fop/render/ps/svg/expected.ps b/test/java/org/apache/fop/render/ps/svg/expected.ps new file mode 100644 index 000000000..9977070c3 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/expected.ps @@ -0,0 +1,38 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 3 +/ColorSpace /DeviceRGB + /Coords [ 841.890991 178.582993 3.28662 841.890991 178.582993 16.4331 ] + /Domain [ 0 1 ] + /Extend [ true true ] + /Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 1 ] +/C1 [ 0.784314 0.784314 0.784314 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.784314 0.784314 0.784314 ] +/C1 [ 0.666667 0.666667 0.666667 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.666667 0.666667 0.666667 ] +/C1 [ 0.54902 0.54902 0.54902 ] +/N 1 +>> ] +/Encode [ 0 1 0 1 0 1 ] +/Bounds [ 0.6012 0.8094 ] +>> +>> +>> +matrix makepattern setcolor diff --git a/test/layoutengine/standard-testcases/footnote_jira1749.xml b/test/layoutengine/standard-testcases/footnote_jira1749.xml new file mode 100644 index 000000000..6e73d39fd --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote_jira1749.xml @@ -0,0 +1,56 @@ +<?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> + FOP-1749: footnotes with margin-top="..." that do not fit on the current + page, but would've fit without top margin cause FOP to hang (instead of + being pushed to the next page). Also, verify the top-offset for the + footnote is calculated properly with margin-top. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master page-height="50pt" page-width="240pt" master-name="Body"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="Body"> + <fo:flow flow-name="xsl-region-body" font-size="10pt"> + <fo:block>No footnote</fo:block> + <fo:block>Footnote call<fo:footnote> + <fo:inline>*</fo:inline> + <fo:footnote-body> + <fo:block margin-top="20pt">The footnote</fo:block> + </fo:footnote-body> + </fo:footnote> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- The block with footnote reference is on page 2 --> + <eval expected="Footnote call" xpath="//pageViewport[2]//mainReference//text"/> + <eval expected="The footnote" xpath="//pageViewport[2]//footnote//text"/> + <!-- And footnote's top-offset positions it on the page, not below --> + <eval expected="18000" xpath="//pageViewport[2]//footnote/@top-offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/footnote_jira2106.xml b/test/layoutengine/standard-testcases/footnote_jira2106.xml new file mode 100644 index 000000000..8acc91f35 --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote_jira2106.xml @@ -0,0 +1,52 @@ +<?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> + Test for FOP-2106: footnote must be positioned on the same page as the inline reference (not + on the page before). + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-size="10pt"> + <fo:layout-master-set> + <fo:simple-page-master master-name="body" page-width="100pt" page-height="35pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="body"> + <fo:flow flow-name="xsl-region-body"> + <fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Page 1 line 1</fo:block> + <fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Page 1 line 2</fo:block> + <fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Page 2 line 1</fo:block> + <fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Page 3 line + 1<fo:footnote><fo:inline>*</fo:inline><fo:footnote-body><fo:block + font-size="6pt">Footnote should be on page + 3</fo:block></fo:footnote-body></fo:footnote></fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- The block with footnote reference is on page 3 --> + <eval expected="Page 3 line 1" xpath="//pageViewport[3]//mainReference//text"/> + <!-- ... and so is the footnote itself --> + <eval expected="Footnote" xpath="//pageViewport[3]//footnote//word[1]"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/footnote_reset.xml b/test/layoutengine/standard-testcases/footnote_reset.xml new file mode 100644 index 000000000..e9015fef7 --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote_reset.xml @@ -0,0 +1,58 @@ +<?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 that footnote content is properly reset when the algorithm has to restart + page breaking after a too short/long node. + </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-height="55pt" page-width="200pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" font-size="8pt" line-height="10pt"> + <fo:block>Line 1</fo:block> + <fo:block>Line 2</fo:block> + <fo:block>Line 3<fo:footnote> + <fo:inline>*</fo:inline> + <fo:footnote-body> + <fo:block>Footnote line 1 of 3</fo:block> + <fo:block>Footnote line 2 of 3</fo:block> + <fo:block>Footnote line 3 of 3</fo:block> + </fo:footnote-body> + </fo:footnote></fo:block> + <fo:block>Line 4</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="2" xpath="count(//pageViewport[1]//footnote/block)"/> + <eval expected="Footnote line 1 of 3" xpath="//pageViewport[1]//footnote[1]/block[1]//text"/> + <eval expected="Footnote line 2 of 3" xpath="//pageViewport[1]//footnote[1]/block[2]//text"/> + <eval expected="1" xpath="count(//pageViewport[2]//footnote/block)"/> + <eval expected="Footnote line 3 of 3" xpath="//pageViewport[2]//footnote[1]/block[1]//text"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/fox_external-document_2.xml b/test/layoutengine/standard-testcases/fox_external-document_2.xml index b2f397580..29485ed72 100644 --- a/test/layoutengine/standard-testcases/fox_external-document_2.xml +++ b/test/layoutengine/standard-testcases/fox_external-document_2.xml @@ -71,8 +71,8 @@ <eval expected="0 0 597172 843913" xpath="//viewport[@prod-id = 'img4']/@pos"/> <eval expected="0 0 843913 597172" xpath="//pageViewport[@nr = '6']/page/regionViewport/@rect"/> - <eval expected="843913" xpath="//pageViewport[@nr = '6']/page/regionViewport/@ipd"/> - <eval expected="597172" xpath="//pageViewport[@nr = '6']/page/regionViewport/@bpd"/> + <eval expected="597172" xpath="//pageViewport[@nr = '6']/page/regionViewport/@ipd"/> + <eval expected="843913" xpath="//pageViewport[@nr = '6']/page/regionViewport/@bpd"/> <eval expected="597172" xpath="//pageViewport[@nr = '6']/page/regionViewport/regionBody/@ipd"/> <eval expected="843913" xpath="//pageViewport[@nr = '6']/page/regionViewport/regionBody/@bpd"/> <eval expected="[0.0 -1.0 1.0 0.0 0.0 597172.0]" xpath="//pageViewport[@nr = '6']/page/regionViewport/regionBody/@ctm"/> diff --git a/test/layoutengine/standard-testcases/pdf-dictionary-extension_1.xml b/test/layoutengine/standard-testcases/pdf-dictionary-extension_1.xml new file mode 100644 index 000000000..ecbf1bafd --- /dev/null +++ b/test/layoutengine/standard-testcases/pdf-dictionary-extension_1.xml @@ -0,0 +1,90 @@ +<?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 the PDF dictionary extensions. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple"> + <fo:region-body/> + <fo:region-before/> + <fo:region-after/> + <pdf:page page-numbers="*"> + <pdf:number key="Dur">5</pdf:number> + </pdf:page> + <pdf:page page-numbers="1"> + <pdf:dictionary key="Trans"> + <pdf:name key="Type">Trans</pdf:name> + <pdf:number key="D">1</pdf:number> + <pdf:name key="S">Glitter</pdf:name> + <pdf:number key="Di">0</pdf:number> + </pdf:dictionary> + </pdf:page> + <pdf:page page-numbers="2"> + <pdf:dictionary key="Trans"> + <pdf:name key="Type">Trans</pdf:name> + <pdf:number key="D">1</pdf:number> + <pdf:name key="S">Push</pdf:name> + <pdf:number key="Di">180</pdf:number> + </pdf:dictionary> + </pdf:page> + <pdf:page page-numbers="3"> + <pdf:dictionary key="Trans"> + <pdf:name key="Type">Trans</pdf:name> + <pdf:number key="D">1</pdf:number> + <pdf:name key="S">Cover</pdf:name> + <pdf:number key="Di">270</pdf:number> + </pdf:dictionary> + </pdf:page> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:declarations> + <pdf:catalog> + <pdf:name key="Foo">Bar</pdf:name> + </pdf:catalog> + </fo:declarations> + <fo:page-sequence master-reference="simple"> + <fo:flow flow-name="xsl-region-body"> + <fo:block page-break-before="always">SLIDE 1</fo:block> + <fo:block page-break-before="always">SLIDE 2</fo:block> + <fo:block page-break-before="always">SLIDE 3</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks xmlns:pdf="apache:fop:extensions:pdf"> + <eval expected="Foo" xpath="/areaTree/extension-attachments/pdf:catalog/pdf:name/@key"/> + <eval expected="Bar" xpath="/areaTree/extension-attachments/pdf:catalog/pdf:name"/> + <eval expected="Dur" xpath="/areaTree/pageSequence/pageViewport[@nr=1]/page/extension-attachments/pdf:page/pdf:number/@key"/> + <eval expected="5" xpath="/areaTree/pageSequence/pageViewport[@nr=1]/page/extension-attachments/pdf:page/pdf:number"/> + </checks> + <if-checks xmlns:if="http://xmlgraphics.apache.org/fop/intermediate" xmlns:pdf="apache:fop:extensions:pdf"> + <eval expected="Foo" xpath="/if:document/if:header/pdf:catalog/pdf:name/@key"/> + <eval expected="Bar" xpath="/if:document/if:header/pdf:catalog/pdf:name"/> + <eval expected="Dur" xpath="//if:page[@name=1]/if:page-header/pdf:page/pdf:number/@key"/> + <eval expected="5" xpath="//if:page[@name=1]/if:page-header/pdf:page/pdf:number"/> + <eval expected="2" xpath="count(//if:page[@name=1]/if:page-header/pdf:page)"/> + <eval expected="2" xpath="count(//if:page[@name=2]/if:page-header/pdf:page)"/> + <eval expected="2" xpath="count(//if:page[@name=3]/if:page-header/pdf:page)"/> + </if-checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml b/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml new file mode 100644 index 000000000..486b8601c --- /dev/null +++ b/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml @@ -0,0 +1,74 @@ +<?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 the PDF dictionary extensions related to optional content groups (layers). + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple"> + <fo:region-body/> + <fo:region-before/> + <fo:region-after/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:declarations> + <!-- Optional Content Group Layers --> + <pdf:layer id="layer1"> + <pdf:string key="Name">Bullet 1</pdf:string> + </pdf:layer> + <pdf:layer id="layer2"> + <pdf:string key="Name">Bullet 2</pdf:string> + </pdf:layer> + <!-- Document Catalog's Optional Content (Layers) Directory and Default State --> + <pdf:catalog> + <pdf:dictionary key="OCProperties"> + <!-- Directory of OCGs (layers) in Document --> + <pdf:array key="OCGs"> + <pdf:reference refid="layer1"/> + <pdf:reference refid="layer2"/> + </pdf:array> + <!-- Default State for OCGs --> + <pdf:dictionary key="D"> + <pdf:string key="Name">Default</pdf:string> + <pdf:name key="BaseState">OFF</pdf:name> + </pdf:dictionary> + </pdf:dictionary> + </pdf:catalog> + </fo:declarations> + <fo:page-sequence master-reference="simple"> + <fo:flow flow-name="xsl-region-body"> + <fo:block fox:layer="layer1"> + <fo:block>BULLET 1A</fo:block> + <fo:block>BULLET 1B</fo:block> + </fo:block> + <fo:block fox:layer="layer2">BULLET 2</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks xmlns:pdf="apache:fop:extensions:pdf"> + <eval expected="layer1" xpath="//flow/block[1]/@layer"/> + <eval expected="layer2" xpath="//flow/block[2]/@layer"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml b/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml new file mode 100644 index 000000000..ee5061497 --- /dev/null +++ b/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml @@ -0,0 +1,122 @@ +<?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 the PDF dictionary extensions related to optional content groups (layers), + including navigator and action dictionaries. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple"> + <fo:region-body/> + <fo:region-before/> + <fo:region-after/> + <!-- Initial Layers Navigation Node for Page 1 --> + <pdf:page page-numbers="1"> + <pdf:reference key="PresSteps" refid="navInitial"/> + </pdf:page> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:declarations> + <!-- Optional Content Group Layers --> + <pdf:layer id="layer1"> + <pdf:string key="Name">Bullet 1</pdf:string> + </pdf:layer> + <pdf:layer id="layer2"> + <pdf:string key="Name">Bullet 2</pdf:string> + </pdf:layer> + <!-- Navigator Actions --> + <pdf:action type="SetOCGState" id="setStateInitial"> + <pdf:array key="State"> + <pdf:name>OFF</pdf:name> + <pdf:reference refid="layer1"/> + <pdf:reference refid="layer2"/> + </pdf:array> + </pdf:action> + <pdf:action type="SetOCGState" id="setStateBullet1"> + <pdf:array key="State"> + <pdf:name>OFF</pdf:name> + <pdf:reference refid="layer2"/> + <pdf:name>ON</pdf:name> + <pdf:reference refid="layer1"/> + </pdf:array> + </pdf:action> + <pdf:action type="SetOCGState" id="setStateBullet2"> + <pdf:array key="State"> + <pdf:name>OFF</pdf:name> + <pdf:reference refid="layer1"/> + <pdf:name>ON</pdf:name> + <pdf:reference refid="layer2"/> + </pdf:array> + </pdf:action> + <!-- Navigators --> + <pdf:navigator id="navInitial"> + <pdf:reference key="NA" refid="setStateBullet1"/> + <pdf:reference key="Next" refid="navBullet1"/> + <pdf:reference key="PA" refid="setStateInitial"/> + <pdf:reference key="Prev" refid="navInitial"/> + </pdf:navigator> + <pdf:navigator id="navBullet1"> + <pdf:reference key="NA" refid="setStateBullet2"/> + <pdf:reference key="Next" refid="navBullet2"/> + <pdf:reference key="PA" refid="setStateInitial"/> + <pdf:reference key="Prev" refid="navInitial"/> + </pdf:navigator> + <pdf:navigator id="navBullet2"> + <pdf:reference key="NA" refid="setStateBullet2"/> + <pdf:reference key="Next" refid="navBullet2"/> + <pdf:reference key="PA" refid="setStateBullet1"/> + <pdf:reference key="Prev" refid="navBullet1"/> + </pdf:navigator> + <!-- Document Catalog's Optional Content (Layers) Directory and Default State --> + <pdf:catalog> + <pdf:dictionary key="OCProperties"> + <!-- Directory of OCGs (layers) in Document --> + <pdf:array key="OCGs"> + <pdf:reference refid="layer1"/> + <pdf:reference refid="layer2"/> + </pdf:array> + <!-- Default State for OCGs --> + <pdf:dictionary key="D"> + <pdf:string key="Name">Default</pdf:string> + <pdf:name key="BaseState">OFF</pdf:name> + </pdf:dictionary> + </pdf:dictionary> + </pdf:catalog> + </fo:declarations> + <fo:page-sequence master-reference="simple"> + <fo:flow flow-name="xsl-region-body"> + <fo:block fox:layer="layer1"> + <fo:block>BULLET 1A</fo:block> + <fo:block>BULLET 1B</fo:block> + </fo:block> + <fo:block fox:layer="layer2">BULLET 2</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks xmlns:pdf="apache:fop:extensions:pdf"> + <eval expected="layer1" xpath="//flow/block[1]/@layer"/> + <eval expected="layer2" xpath="//flow/block[2]/@layer"/> + </checks> +</testcase> |