diff options
Diffstat (limited to 'test/layoutengine')
15 files changed, 717 insertions, 36 deletions
diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml index 1fb4f2926..6c61ca747 100644 --- a/test/layoutengine/disabled-testcases.xml +++ b/test/layoutengine/disabled-testcases.xml @@ -39,12 +39,6 @@ <description>Font-stretch is not implemented, yet.</description> </testcase> <testcase> - <name>Hyphenation with preserved linefeeds</name> - <file>block_hyphenation_linefeed_preserve.xml</file> - <description>When hyphenation is enabled and linefeeds are preserved, - the text is output multiple times.</description> - </testcase> - <testcase> <name>linefeed-treatment</name> <file>block_linefeed-treatment.xml</file> <description>Preserved linefeeds in a fo:character are not handled diff --git a/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml b/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml index d1231892f..ac13e9875 100644 --- a/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml +++ b/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml @@ -19,7 +19,11 @@ <testcase> <info> <p> - Check for bug: Duplicate content and linefeeds as "#". + Check for bug 38264: + <ul> + <li>duplication of content with linefeed-treatment="preserve" and hyphenate="true"</li> + <li>missing hyphens with white-space-treatment="preserve" and hyphenate="true"</li> + </ul> </p> </info> <fo> @@ -31,21 +35,39 @@ </fo:layout-master-set> <fo:page-sequence master-reference="simple"> <fo:flow flow-name="xsl-region-body"> - <fo:block line-height="10pt" background-color="orange" - white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas semper. Proin at.</fo:block> - <fo:block line-height="10pt" background-color="orange" - white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve"> + <fo:block white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve"> line1 line2 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas semper. Proin at1. -</fo:block> +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas semper. Proin at. + </fo:block> </fo:flow> </fo:page-sequence> </fo:root> </fo> <checks> - <!-- Dummy check. We don't want an NPE. --> - <eval expected="2" xpath="count(//*[contains(text(), 'adipiscing')])"/> + <!-- check number of lines and word fragments --> + <eval expected="13" xpath="count(//flow[1]/block/lineArea)" /> + <eval expected="17" xpath="count(//flow[1]/block/lineArea/text/word)" /> + <!-- check individual word fragments --> + <eval expected="line1" xpath="(//flow[1]/block/lineArea/text/word)[1]" /> + <eval expected="line2" xpath="(//flow[1]/block/lineArea/text/word)[2]" /> + <eval expected="Lorem" xpath="(//flow[1]/block/lineArea/text/word)[3]" /> + <eval expected="ip-" xpath="(//flow[1]/block/lineArea/text/word)[4]" /> + <eval expected="sum" xpath="(//flow[1]/block/lineArea/text/word)[5]" /> + <eval expected="dolor" xpath="(//flow[1]/block/lineArea/text/word)[6]" /> + <eval expected="sit" xpath="(//flow[1]/block/lineArea/text/word)[7]" /> + <eval expected="amet," xpath="(//flow[1]/block/lineArea/text/word)[8]" /> + <eval expected="con-" xpath="(//flow[1]/block/lineArea/text/word)[9]" /> + <eval expected="sectetuer" xpath="(//flow[1]/block/lineArea/text/word)[10]" /> + <eval expected="adipiscing" xpath="(//flow[1]/block/lineArea/text/word)[11]" /> + <eval expected="elit." xpath="(//flow[1]/block/lineArea/text/word)[12]" /> + <eval expected="Maece-" xpath="(//flow[1]/block/lineArea/text/word)[13]" /> + <eval expected="nas" xpath="(//flow[1]/block/lineArea/text/word)[14]" /> + <eval expected="semper." xpath="(//flow[1]/block/lineArea/text/word)[15]" /> + <eval expected="Proin" xpath="(//flow[1]/block/lineArea/text/word)[16]" /> + <eval expected="at." xpath="(//flow[1]/block/lineArea/text/word)[17]" /> + <!-- check preservation of spaces on the last line --> + <eval expected="10" xpath="count((//flow[1]/block/lineArea)[13]/text/space)" /> </checks> </testcase> diff --git a/test/layoutengine/hyphenation-testcases/hyphenation-pattern_fallback.xml b/test/layoutengine/hyphenation-testcases/hyphenation-pattern_fallback.xml new file mode 100644 index 000000000..3af71a3ea --- /dev/null +++ b/test/layoutengine/hyphenation-testcases/hyphenation-pattern_fallback.xml @@ -0,0 +1,137 @@ +<?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> + Checks fallback from hyphenation pattern for (lang,country) to hyphenation pattern for (lang) + </p> + </info> + <fo> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="7cm" + margin-right="3cm"> + <fo:region-body margin-top="1.5cm"/> + </fo:simple-page-master> + </fo:layout-master-set> + <!-- end: defines page layout --> + + + <fo:page-sequence master-reference="simple"> + + <fo:flow flow-name="xsl-region-body" + text-align="justify"> + + <fo:block font-size="12pt" + font-family="sans-serif" + background-color="blue" + color="white" + text-align="start"> + language="en",country="IN" + </fo:block> + <fo:block font-size="12pt" + font-family="sans-serif" + space-after="3pt" + language="en" + country="IN" + hyphenate="true" + hyphenation-ladder-count="no-limit" + > + This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a + W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from + another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its + widespread deployment. This enhances the functionality and interoperability of the Web. + </fo:block> + + <fo:block font-size="12pt" + font-family="sans-serif" + background-color="blue" + color="white" + text-align="start"> + language="em" + </fo:block> + <fo:block font-size="12pt" + font-family="sans-serif" + space-after="3pt" + language="em" + hyphenate="true" + hyphenation-ladder-count="no-limit" + > + This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a + W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from + another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its + widespread deployment. This enhances the functionality and interoperability of the Web. + </fo:block> + + <fo:block font-size="12pt" + font-family="sans-serif" + background-color="blue" + color="white" + text-align="start"> + language="em",country="IN" + </fo:block> + <fo:block font-size="12pt" + font-family="sans-serif" + space-after="3pt" + language="em" + country="IN" + hyphenate="true" + hyphenation-ladder-count="no-limit" + > + This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a + W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from + another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its + widespread deployment. This enhances the functionality and interoperability of the Web. + </fo:block> + + </fo:flow> + </fo:page-sequence> +</fo:root> + + </fo> + + <checks> + <eval expected="8" xpath="count(//pageViewport[1]//flow/block[2]/lineArea)"/> + <eval expected="Di-" xpath="//pageViewport[1]//flow/block[2]/lineArea[2]/text/word[10]"/> + <eval expected="norma-" xpath="//pageViewport[1]//flow/block[2]/lineArea[4]/text/word[12]"/> + <eval expected="mak-" xpath="//pageViewport[1]//flow/block[2]/lineArea[5]/text/word[9]"/> + <eval expected="specifi-" xpath="//pageViewport[1]//flow/block[2]/lineArea[6]/text/word[10]"/> + <eval expected="en-" xpath="//pageViewport[1]//flow/block[2]/lineArea[7]/text/word[9]"/> + + <eval expected="9" xpath="count(//pageViewport[1]//flow/block[4]/lineArea)"/> + <eval expected="by" xpath="//pageViewport[1]//flow/block[4]/lineArea[2]/text/word[9]"/> + <eval expected="cited" xpath="//pageViewport[1]//flow/block[4]/lineArea[4]/text/word[10]"/> + <eval expected="document." xpath="//pageViewport[1]//flow/block[4]/lineArea[5]/text/word[7]"/> + <eval expected="to" xpath="//pageViewport[1]//flow/block[4]/lineArea[6]/text/word[10]"/> + <eval expected="deployment." xpath="//pageViewport[1]//flow/block[4]/lineArea[7]/text/word[8]"/> + + <eval expected="9" xpath="count(//pageViewport[1]//flow/block[6]/lineArea)"/> + <eval expected="by" xpath="//pageViewport[1]//flow/block[6]/lineArea[2]/text/word[9]"/> + <eval expected="cited" xpath="//pageViewport[1]//flow/block[6]/lineArea[4]/text/word[10]"/> + <eval expected="document." xpath="//pageViewport[1]//flow/block[6]/lineArea[5]/text/word[7]"/> + <eval expected="to" xpath="//pageViewport[1]//flow/block[6]/lineArea[6]/text/word[10]"/> + <eval expected="deployment." xpath="//pageViewport[1]//flow/block[6]/lineArea[7]/text/word[8]"/> + </checks> +</testcase> diff --git a/test/layoutengine/hyphenation-testcases/inline_hyphenation_border.xml b/test/layoutengine/hyphenation-testcases/inline_hyphenation_border.xml new file mode 100644 index 000000000..f3c133e6e --- /dev/null +++ b/test/layoutengine/hyphenation-testcases/inline_hyphenation_border.xml @@ -0,0 +1,49 @@ +<?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 whether the border is properly rendered with + hyphenation. I effectively checks whether + InlineStackingLM.applyChanges rewraps the positions properly. + </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/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:block hyphenate="true" language="en"> + <fo:inline border-color="#000000" border-style="solid" border-width="1pt">Test</fo:inline> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="(solid,#000000,1000)" xpath="//flow/block[1]/lineArea/inlineparent/@border-start"/> + <eval expected="(solid,#000000,1000)" xpath="//flow/block[1]/lineArea/inlineparent/@border-end"/> + <eval expected="(solid,#000000,1000)" xpath="//flow/block[1]/lineArea/inlineparent/@border-before"/> + <eval expected="(solid,#000000,1000)" xpath="//flow/block[1]/lineArea/inlineparent/@border-after"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_for_toc.xml b/test/layoutengine/standard-testcases/basic-link_for_toc.xml new file mode 100644 index 000000000..9966c54b1 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_for_toc.xml @@ -0,0 +1,53 @@ +<?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 fo:basic-link in conjunction with text-align="justify" and an + fo:page-number-citation. + </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"> + <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 text-align="justify"> + You can read about Apache FOP in + <fo:basic-link external-destination="http://xmlgraphics.apache.org/fop/" + >chapter 1 on page <fo:page-number-citation ref-id="1"/></fo:basic-link>. + Apache FOP is open source, BTW. + </fo:block> + <fo:block id="1"/> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="http://xmlgraphics.apache.org/fop/" xpath="substring-after(//flow/block[1]/lineArea/inlineparent/@external-link,'dest=')"/> + <eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/> + <eval expected="104440" xpath="//flow/block[1]/lineArea/inlineparent/text[1]/@ipd"/> + <eval expected="6672" xpath="//flow/block[1]/lineArea/inlineparent/text[2]/@ipd"/> + <eval expected="111112" xpath="//flow/block[1]/lineArea/inlineparent/@ipd"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block-container_break.xml b/test/layoutengine/standard-testcases/block-container_break.xml new file mode 100644 index 000000000..352f755f0 --- /dev/null +++ b/test/layoutengine/standard-testcases/block-container_break.xml @@ -0,0 +1,47 @@ +<?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 a forced break on a child element of an fo:block-container is honored. + </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="420pt" page-width="320pt" 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-container> + <fo:block id="before-break" break-after="page">Before the break.</fo:block> + <fo:block id="after-break">After the break.</fo:block> + </fo:block-container> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="2" xpath="count(//pageViewport)"/> + <eval expected="After the break." xpath="//pageViewport[2]//flow/block/block/block//text"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/flow_changing-ipd_image.xml b/test/layoutengine/standard-testcases/flow_changing-ipd_image.xml new file mode 100644 index 000000000..37014f49a --- /dev/null +++ b/test/layoutengine/standard-testcases/flow_changing-ipd_image.xml @@ -0,0 +1,60 @@ +<?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 an image is properly positioned after a page break triggering changing + IPD. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="narrow" + page-height="220pt" page-width="320pt" margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="wide" + page-height="220pt" page-width="420pt" margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="pages"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference odd-or-even="odd" master-reference="narrow"/> + <fo:conditional-page-master-reference odd-or-even="even" master-reference="wide"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="pages" font-size="8pt" line-height="10pt"> + <fo:flow flow-name="xsl-region-body" text-align="justify"> + <fo:block space-after="180pt">First block</fo:block> + <fo:block id="before">Block before the page break.</fo:block> + <fo:block id="after">Block after the page break.</fo:block> + <fo:block id="image-block"><fo:external-graphic id="image" + src="../../resources/images/fop-logo-color-24bit.png"/></fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="Block before the page break." xpath="//pageViewport[1]//flow/block[2]//text"/> + <eval expected="Block after the page break." xpath="//pageViewport[2]//flow/block[1]//text"/> + <eval expected="0" xpath="//pageViewport[2]//flow/block[2]//viewport/@offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml b/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml index 956563e20..1b10d722c 100644 --- a/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml +++ b/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml @@ -56,13 +56,19 @@ <fo:table table-layout="fixed" width="100%"> <fo:table-body> <fo:table-row> - <fo:table-cell> - <fo:block>After the table 1</fo:block> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 1.2</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> - <fo:table-cell> - <fo:block>After the table 2</fo:block> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 2.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 2.2</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> @@ -74,7 +80,12 @@ <checks> <eval expected="Block before the page break." xpath="//pageViewport[1]//flow/block[2]//text"/> <eval expected="Block after the page break." xpath="//pageViewport[2]//flow/block[1]//text"/> - <eval expected="After the table 1" xpath="//pageViewport[2]//flow/block[2]/block[1]//text"/> - <eval expected="After the table 2" xpath="//pageViewport[2]//flow/block[2]/block[2]//text"/> + <eval expected="400000" xpath="//pageViewport[2]//flow/block[2]/@ipd"/> + <eval expected="199000" xpath="//pageViewport[2]//flow/block[2]/block[1]/@ipd"/> + <eval expected="Cell 1.1" xpath="//pageViewport[2]//flow/block[2]/block[1]//text"/> + <eval expected="199000" xpath="//pageViewport[2]//flow/block[2]/block[2]/@ipd"/> + <eval expected="Cell 1.2" xpath="//pageViewport[2]//flow/block[2]/block[2]//text"/> + <eval expected="Cell 2.1" xpath="//pageViewport[2]//flow/block[2]/block[3]//text"/> + <eval expected="Cell 2.2" xpath="//pageViewport[2]//flow/block[2]/block[4]//text"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/fox_widow-content-limit_bug48380.xml b/test/layoutengine/standard-testcases/fox_widow-content-limit_bug48380.xml new file mode 100644 index 000000000..83d5bd499 --- /dev/null +++ b/test/layoutengine/standard-testcases/fox_widow-content-limit_bug48380.xml @@ -0,0 +1,61 @@ +<?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> + Check for bug 48380: ClassCastException when using fox:widow-content-limit. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="210mm" page-height="297mm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal" white-space-collapse="true"> + <fo:flow flow-name="xsl-region-body"> + <fo:table fox:orphan-content-limit="4em" fox:widow-content-limit="4em" table-layout="fixed" width="100%"> + <fo:table-body> + <fo:table-row> + <fo:table-cell> + <fo:block> + <fo:list-block space-after="6pt"> + <fo:list-item> + <fo:list-item-label> + <fo:block>.</fo:block> + </fo:list-item-label> + <fo:list-item-body> + <fo:block start-indent="1cm">test</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Run only basic checks; should not throw a ClassCastException --> + </checks> +</testcase>
\ No newline at end of file diff --git a/test/layoutengine/standard-testcases/inline_keep-together.xml b/test/layoutengine/standard-testcases/inline_keep-together.xml index 6ec4ce603..0c6ae682a 100644 --- a/test/layoutengine/standard-testcases/inline_keep-together.xml +++ b/test/layoutengine/standard-testcases/inline_keep-together.xml @@ -38,6 +38,22 @@ <fo:block keep-together.within-line="always">This is Blah blah blah blah!</fo:block> <fo:block>This is <fo:inline keep-together.within-line="always">Blah blah blah blah!</fo:inline></fo:block> <fo:block>This is <fo:wrapper keep-together.within-line="always">Blah blah blah blah!</fo:wrapper></fo:block> + <fo:block> + <fo:inline keep-together.within-line="always"> + This<fo:inline> entire</fo:inline> sentence + <fo:inline>should be </fo:inline>kept + <fo:inline>together + <fo:inline>on + <fo:inline>one + <fo:inline>very, + <fo:inline>very,</fo:inline> + <fo:inline>very,</fo:inline> + <fo:inline>very,</fo:inline> + <fo:inline>long</fo:inline> + </fo:inline></fo:inline></fo:inline>line + </fo:inline> + </fo:inline> + </fo:block> </fo:block-container> </fo:flow> </fo:page-sequence> @@ -54,6 +70,9 @@ <!-- The layout engine should warn the user about the overflow in this case. --> <eval expected="This is" xpath="//flow/block[1]/block[1]/block[3]/lineArea[1]"/> <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[3]/lineArea[2]"/> + + <!-- check effect of nested inlines (see Bugzilla #49848) --> + <eval expected="1" xpath="count(//flow/block[1]/block[1]/block[4]/lineArea)" /> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/inline_letter-spacing_3.xml b/test/layoutengine/standard-testcases/inline_letter-spacing_3.xml index b86162ac1..39eac6d40 100644 --- a/test/layoutengine/standard-testcases/inline_letter-spacing_3.xml +++ b/test/layoutengine/standard-testcases/inline_letter-spacing_3.xml @@ -48,7 +48,7 @@ </fo:root> </fo> <checks> - <eval expected="105384" + <eval expected="117384" xpath="//flow/block[1]/lineArea[1]/inlineparent[1]/@ipd" desc="IPD of containing inline area"/> <eval expected="73368" diff --git a/test/layoutengine/standard-testcases/knuth_element-null_position.xml b/test/layoutengine/standard-testcases/knuth_element-null_position.xml new file mode 100644 index 000000000..cf964fdf5 --- /dev/null +++ b/test/layoutengine/standard-testcases/knuth_element-null_position.xml @@ -0,0 +1,44 @@ +<?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 check tests that Knuth elements with a null position do +not cause a NPE (in InlineStackingLM.applyChanges)</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" hyphenate="true" language="de"> + <fo:layout-master-set> + <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" margin="2cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-reference="A4"> + + <fo:flow flow-name="xsl-region-body"> + <fo:block><fo:inline padding-left="1cm"><fo:basic-link internal-destination="N1003F">Abluftanlage</fo:basic-link></fo:inline></fo:block> + <fo:block id="N1003F"/> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="Abluftanlage" xpath="//flow/block/lineArea/inlineparent/inlineparent/text/word"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/page-number-citation-last_complex.xml b/test/layoutengine/standard-testcases/page-number-citation-last_complex.xml index 38728606c..a3f9256dc 100644 --- a/test/layoutengine/standard-testcases/page-number-citation-last_complex.xml +++ b/test/layoutengine/standard-testcases/page-number-citation-last_complex.xml @@ -28,7 +28,7 @@ </p> </info> <fo> - <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" id="root"> <fo:layout-master-set> <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in" margin="20pt"> @@ -79,6 +79,7 @@ </fo:page-sequence> <fo:page-sequence master-reference="normal"> <fo:flow flow-name="xsl-region-body" font-size="8pt"> + <fo:block>root= <fo:page-number-citation-last ref-id="root"/></fo:block> <fo:block>page-sequence= <fo:page-number-citation-last ref-id="page-sequence1"/></fo:block> <fo:block>block= <fo:page-number-citation-last ref-id="block1"/></fo:block> <fo:block>list= <fo:page-number-citation-last ref-id="list1"/></fo:block> @@ -97,18 +98,19 @@ </fo:root> </fo> <checks> - <true fail-msg="no ID for page-sequence" xpath="'page-sequence= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]"/> - <true fail-msg="no ID for block" xpath="'block= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[2]"/> - <true fail-msg="no ID for list-block" xpath="'list= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[3]"/> - <true fail-msg="no ID for list-item" xpath="'item= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[4]"/> - <true fail-msg="no ID for list-item-label" xpath="'item-label= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[5]"/> - <true fail-msg="no ID for list-item-body" xpath="'item-body= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[6]"/> - <true fail-msg="no ID for table" xpath="'table= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[7]"/> - <!-- <true fail-msg="no ID for table-header" xpath="'table-header= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[8]"/> - <true fail-msg="no ID for table-footer" xpath="'table-footer= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[9]"/> - <true fail-msg="no ID for table-body" xpath="'table-body= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[10]"/> - <true fail-msg="no ID for table-row" xpath="'table-row= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[11]"/>--> - <true fail-msg="no ID for table-cell" xpath="'table-cell= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[12]"/> - <true fail-msg="no ID for block-container" xpath="'block-container= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[13]"/> + <true fail-msg="no ID for root" xpath="'root= 2' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]"/> + <true fail-msg="no ID for page-sequence" xpath="'page-sequence= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[2]"/> + <true fail-msg="no ID for block" xpath="'block= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[3]"/> + <true fail-msg="no ID for list-block" xpath="'list= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[4]"/> + <true fail-msg="no ID for list-item" xpath="'item= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[5]"/> + <true fail-msg="no ID for list-item-label" xpath="'item-label= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[6]"/> + <true fail-msg="no ID for list-item-body" xpath="'item-body= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[7]"/> + <true fail-msg="no ID for table" xpath="'table= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[8]"/> + <!-- <true fail-msg="no ID for table-header" xpath="'table-header= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[9]"/> + <true fail-msg="no ID for table-footer" xpath="'table-footer= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[10]"/> + <true fail-msg="no ID for table-body" xpath="'table-body= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[11]"/> + <true fail-msg="no ID for table-row" xpath="'table-row= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[12]"/>--> + <true fail-msg="no ID for table-cell" xpath="'table-cell= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[13]"/> + <true fail-msg="no ID for block-container" xpath="'block-container= 1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[14]"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/region-body_column-count_span_4.xml b/test/layoutengine/standard-testcases/region-body_column-count_span_4.xml new file mode 100644 index 000000000..8bc4652ce --- /dev/null +++ b/test/layoutengine/standard-testcases/region-body_column-count_span_4.xml @@ -0,0 +1,84 @@ +<?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 multi-column documents. Check that spanned section that are broken over + to multiple pages still respect the span setting. This particular test makes sure that pages with different region-body + height are handled properly. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="odd-page" page-height="3.5cm" page-width="4cm" margin="0.45cm"> + <fo:region-body margin-top="12pt * 1.2 * 2" column-count="2" background-color="yellow"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="even-page" page-height="3.5cm" page-width="4cm" margin="0.45cm"> + <fo:region-body column-count="2" background-color="orange"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="master"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-reference="odd-page" odd-or-even="odd" blank-or-not-blank="not-blank"/> + <fo:conditional-page-master-reference master-reference="even-page" odd-or-even="even" blank-or-not-blank="not-blank"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="master"> + <fo:flow flow-name="xsl-region-body"> + <fo:block span="all"> + <fo:block>Line 1</fo:block> + <fo:block>Line 2</fo:block> + <fo:block>Line 3</fo:block> + <fo:block>Line 4</fo:block> + <fo:block>Line 5</fo:block> + <fo:block>Line 6</fo:block> + <fo:block>Line 7</fo:block> + <fo:block>Line 8</fo:block> + <fo:block>Line 9</fo:block> + <fo:block>Line 10</fo:block> + <fo:block>Line 11</fo:block> + <fo:block>Line 12</fo:block> + <fo:block>Line 13</fo:block> + <fo:block>Line 14</fo:block> + <fo:block>Line 15</fo:block> + <fo:block>Line 16</fo:block> + <fo:block>Line 17</fo:block> + <fo:block>Line 18</fo:block> + <fo:block>Line 19</fo:block> + <fo:block>Line 20</fo:block> + <fo:block>Line 21</fo:block> + <fo:block>Line 22</fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="6" xpath="count(//pageViewport)"/> + + <eval expected="3" xpath="count(//pageViewport[@nr=1]//lineArea)"/> + <eval expected="5" xpath="count(//pageViewport[@nr=2]//lineArea)"/> + <eval expected="3" xpath="count(//pageViewport[@nr=3]//lineArea)"/> + <eval expected="5" xpath="count(//pageViewport[@nr=4]//lineArea)"/> + <eval expected="3" xpath="count(//pageViewport[@nr=5]//lineArea)"/> + <eval expected="3" xpath="count(//pageViewport[@nr=6]//lineArea)"/> + + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/word_lonely_shy.xml b/test/layoutengine/standard-testcases/word_lonely_shy.xml new file mode 100644 index 000000000..557ceea90 --- /dev/null +++ b/test/layoutengine/standard-testcases/word_lonely_shy.xml @@ -0,0 +1,98 @@ +<?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 a word consisting of one or more Soft Hyphens is rendered as an empty word. + </p> + </info> + <fo> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + +<fo:layout-master-set> + <fo:simple-page-master page-width="297mm" page-height="210mm" master-name="a4"><fo:region-body/></fo:simple-page-master> +</fo:layout-master-set> + + <fo:page-sequence initial-page-number="auto" master-reference="a4"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Name: hy (hyphen), Unicode: U+002D (45)</fo:block> + <fo:block>-</fo:block> + <fo:block>Name: shy (soft hyphen = discretionary hyphen), Unicode: U+00AD (173)</fo:block> + <fo:block> a b c d </fo:block> + </fo:flow> +</fo:page-sequence> + +</fo:root> + </fo> + <checks> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[1]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[2]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[3]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[4]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[5]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[6]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[7]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[8]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[9]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[10]"/> + <eval expected="a" xpath="//flow/block[4]/lineArea/text/*[11]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[12]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[13]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[14]"/> + <eval expected="b" xpath="//flow/block[4]/lineArea/text/*[15]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[16]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[17]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[18]"/> + <eval expected="c" xpath="//flow/block[4]/lineArea/text/*[19]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[20]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[21]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[22]"/> + <eval expected="d" xpath="//flow/block[4]/lineArea/text/*[23]"/> + <eval expected=" " xpath="//flow/block[4]/lineArea/text/*[24]"/> + <eval expected="" xpath="//flow/block[4]/lineArea/text/*[25]"/> +<!-- + <word offset="0"/> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0">a</word> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0">b</word> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0">c</word> + <space offset="0"> </space> + <word offset="0"/> + <space offset="0"> </space> + <word offset="0">d</word> + <space offset="0"> </space> + <word offset="0"/> +--> + </checks> +</testcase> + |