aboutsummaryrefslogtreecommitdiffstats
path: root/test/layoutengine
diff options
context:
space:
mode:
Diffstat (limited to 'test/layoutengine')
-rw-r--r--test/layoutengine/standard-testcases/footnote_jira1749.xml56
-rw-r--r--test/layoutengine/standard-testcases/footnote_reset.xml58
-rw-r--r--test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml74
-rw-r--r--test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml122
4 files changed, 310 insertions, 0 deletions
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_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/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>