diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-16 08:21:34 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-16 08:21:34 +0000 |
commit | 592835167ab8951f61d1590197f646984588d070 (patch) | |
tree | d198bcce1ac27b7413448c765761e879191e52c0 /test/layoutengine | |
parent | 2bcd566ece9ea8fd6ff996cdb0969d4db5c345a6 (diff) | |
download | xmlgraphics-fop-592835167ab8951f61d1590197f646984588d070.tar.gz xmlgraphics-fop-592835167ab8951f61d1590197f646984588d070.zip |
Merged revisions 648381 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r648381 | jeremias | 2008-04-15 20:18:46 +0100 (Tue, 15 Apr 2008) | 1 line
First part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-together.within-column for all block-level FOs.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@648611 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/layoutengine')
6 files changed, 430 insertions, 22 deletions
diff --git a/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml b/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml new file mode 100644 index 000000000..24a779303 --- /dev/null +++ b/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml @@ -0,0 +1,95 @@ +<?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 keep-together with integer values. + </p> + <p> + Widows and Orphans are disabled in this test to avoid side-effects. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="12 * 14.4pt"> + <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-container keep-together.within-column="1" background-color="rgb(230,230,255)"> + <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block-container keep-together.within-column="3" background-color="rgb(170,170,255)"> + <fo:block>block1</fo:block> + <fo:block>block2</fo:block> + </fo:block-container> + <fo:block-container keep-together.within-column="always" background-color="rgb(0,0,255)" color="white"> + <fo:block>block3</fo:block> + <fo:block>block4</fo:block> + </fo:block-container> + </fo:block-container> + <fo:block-container keep-together.within-column="always" background-color="rgb(0,0,255)" color="white"> + <fo:block>block5</fo:block> + <fo:block>block6</fo:block> + </fo:block-container> + <fo:block-container keep-together.within-column="3" background-color="rgb(170,170,255)"> + <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block>block7</fo:block> + <fo:block>block8</fo:block> + </fo:block-container> + </fo:block-container> + <fo:block-container keep-together.within-column="always" background-color="rgb(170,170,255)"> + <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block>block9</fo:block> + <fo:block>blockA</fo:block> + </fo:block-container> + </fo:block-container> + </fo:block-container> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <element-list category="breaker"> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 3/4 --> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 5/6 --> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 9/A --> + <box/> + + <skip>3</skip> + </element-list> + + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml b/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml new file mode 100644 index 000000000..f6027bf01 --- /dev/null +++ b/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml @@ -0,0 +1,100 @@ +<?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 keep-together with integer values. + </p> + <p> + Widows and Orphans are disabled in this test to avoid side-effects. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt"> + <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>block1</fo:block> + <fo:block>block2</fo:block> + <fo:block keep-together.within-column="3">block3 + <fo:inline font-style="italic"> + The quick brown fox jumps over the lazy dog. + The quick brown fox jumps over the lazy dog. + The quick brown fox jumps over the lazy dog. + </fo:inline> + </fo:block> + <fo:block keep-together.within-column="1"> + <fo:block>block4</fo:block> + <fo:block>block5</fo:block> + <fo:block keep-together.within-page="always" color="red"> + <fo:block>block6</fo:block> + <fo:block>block7</fo:block> + <fo:block>block8</fo:block> + <fo:block>block9</fo:block> + </fo:block> + <fo:block>block10</fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'block1')]/ancestor::pageViewport/@nr"/> + <eval expected="1" xpath="//lineArea[starts-with(., 'block2')]/ancestor::pageViewport/@nr"/> + <eval expected="2" xpath="//lineArea[starts-with(., 'block3')]/ancestor::pageViewport/@nr"/> + <eval expected="3" xpath="//lineArea[starts-with(., 'block4')]/ancestor::pageViewport/@nr"/> + <eval expected="3" xpath="//lineArea[starts-with(., 'block5')]/ancestor::pageViewport/@nr"/> + <eval expected="4" xpath="//lineArea[starts-with(., 'block6')]/ancestor::pageViewport/@nr"/> + <eval expected="4" xpath="//lineArea[starts-with(., 'block7')]/ancestor::pageViewport/@nr"/> + <eval expected="4" xpath="//lineArea[starts-with(., 'block8')]/ancestor::pageViewport/@nr"/> + <eval expected="4" xpath="//lineArea[starts-with(., 'block9')]/ancestor::pageViewport/@nr"/> + <eval expected="5" xpath="//lineArea[starts-with(., 'block10')]/ancestor::pageViewport/@nr"/> + + <element-list category="breaker"> + <box/> + <penalty w="0" p="0"/> + <box/> + <penalty w="0" p="0"/> + <box/> <!-- block 3 --> + <box/> + <box/> + <penalty w="0" p="0"/> + <box/> <!-- block4 --> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> <!-- block6 --> + <penalty w="0" p="INF"/> + <box/> + <penalty w="0" p="INF"/> + <box/> + <penalty w="0" p="INF"/> + <box/> <!-- block9 --> + <penalty w="0" p="999"/> + <box/> + + <skip>3</skip> + </element-list> + + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml b/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml new file mode 100644 index 000000000..f07c28fbe --- /dev/null +++ b/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml @@ -0,0 +1,95 @@ +<?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 keep-together with integer values. + </p> + <p> + Widows and Orphans are disabled in this test to avoid side-effects. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="12 * 14.4pt"> + <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 keep-together.within-column="1" background-color="rgb(230,230,255)"> + <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block keep-together.within-column="3" background-color="rgb(170,170,255)"> + <fo:block>block1</fo:block> + <fo:block>block2</fo:block> + </fo:block> + <fo:block keep-together.within-column="always" background-color="rgb(0,0,255)" color="white"> + <fo:block>block3</fo:block> + <fo:block>block4</fo:block> + </fo:block> + </fo:block> + <fo:block keep-together.within-column="always" background-color="rgb(0,0,255)" color="white"> + <fo:block>block5</fo:block> + <fo:block>block6</fo:block> + </fo:block> + <fo:block keep-together.within-column="3" background-color="rgb(170,170,255)"> + <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block>block7</fo:block> + <fo:block>block8</fo:block> + </fo:block> + </fo:block> + <fo:block keep-together.within-column="always" background-color="rgb(170,170,255)"> + <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)"> + <fo:block>block9</fo:block> + <fo:block>blockA</fo:block> + </fo:block> + </fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <element-list category="breaker"> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 3/4 --> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 5/6 --> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="999"/> + <box/> + <penalty w="0" p="INF"/> <!-- 9/A --> + <box/> + + <skip>3</skip> + </element-list> + + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml b/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml index a4a2de62c..b940ad837 100644 --- a/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml +++ b/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml @@ -44,7 +44,7 @@ <fo:flow flow-name="xsl-region-body"> <fo:block>block1</fo:block> <fo:block>block2</fo:block> - <fo:block keep-together.within-page="10" color="blue"> + <fo:block keep-together.within-page="always" color="blue"> <fo:block>block3</fo:block> <fo:block>block4</fo:block> <fo:block>block5</fo:block> @@ -53,7 +53,7 @@ </fo:block> <fo:block>block8</fo:block> <fo:block>block9</fo:block> - <fo:block keep-together.within-page="10" color="green"> + <fo:block keep-together.within-page="always" color="green"> <fo:block>block10</fo:block> <fo:block>block11</fo:block> <fo:block>block12</fo:block> diff --git a/test/layoutengine/standard-testcases/list-block_keep-together.xml b/test/layoutengine/standard-testcases/list-block_keep-together.xml index bd11d2b23..757b02539 100644 --- a/test/layoutengine/standard-testcases/list-block_keep-together.xml +++ b/test/layoutengine/standard-testcases/list-block_keep-together.xml @@ -25,14 +25,15 @@ <fo> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" white-space-collapse="true" widows="0" orphans="0"> <fo:layout-master-set> - <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt"> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="20 * 14.4pt"> <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>block1</fo:block> - <fo:list-block + <!-- Keeps on list-block level --> + <fo:list-block background-color="rgb(150,150,255)" provisional-distance-between-starts="25mm" provisional-label-separation="5mm" keep-together.within-page="always"> @@ -54,16 +55,16 @@ </fo:list-item> </fo:list-block> <fo:block>block2</fo:block> - <fo:list-block - provisional-distance-between-starts="25mm" - provisional-label-separation="5mm"> - <fo:list-item keep-together.within-page="always"> + <fo:list-block background-color="rgb(230,230,255)" + provisional-distance-between-starts="25mm" + provisional-label-separation="5mm" + keep-together.within-column="1"> + <fo:list-item> <fo:list-item-label end-indent="label-end()"> <fo:block>label1</fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block>item1</fo:block> - <fo:block>item1</fo:block> </fo:list-item-body> </fo:list-item> <fo:list-item> @@ -76,11 +77,44 @@ </fo:list-item> </fo:list-block> <fo:block>block3</fo:block> + <!-- Keeps on list-item level --> <fo:list-block provisional-distance-between-starts="25mm" provisional-label-separation="5mm"> + <fo:list-item keep-together.within-page="always" background-color="rgb(150,150,255)"> + <fo:list-item-label end-indent="label-end()"> + <fo:block>label1</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>item1</fo:block> + <fo:block>item1</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item keep-together.within-column="1" background-color="rgb(230,230,255)"> + <fo:list-item-label end-indent="label-end()"> + <fo:block>label1</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>item1</fo:block> + <fo:block>item1</fo:block> + </fo:list-item-body> + </fo:list-item> <fo:list-item> <fo:list-item-label end-indent="label-end()"> + <fo:block>label3</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>item3</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + <fo:block>block4</fo:block> + <!-- Keeps on list-item-body level --> + <fo:list-block + provisional-distance-between-starts="25mm" + provisional-label-separation="5mm"> + <fo:list-item background-color="rgb(150,150,255)"> + <fo:list-item-label end-indent="label-end()"> <fo:block>label1</fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()" keep-together.within-page="always"> @@ -88,47 +122,80 @@ <fo:block>item1</fo:block> </fo:list-item-body> </fo:list-item> - <fo:list-item> + <fo:list-item background-color="rgb(230,230,255)"> <fo:list-item-label end-indent="label-end()"> <fo:block>label2</fo:block> </fo:list-item-label> - <fo:list-item-body start-indent="body-start()"> + <fo:list-item-body start-indent="body-start()" keep-together.within-column="1"> + <fo:block>item2</fo:block> <fo:block>item2</fo:block> </fo:list-item-body> </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>label3</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>item3</fo:block> + </fo:list-item-body> + </fo:list-item> </fo:list-block> - <fo:block>block4</fo:block> + <fo:block>block5</fo:block> </fo:flow> </fo:page-sequence> </fo:root> </fo> <checks> <element-list category="breaker"> - <box w="14400"/> + <box/> <!-- block1 --> <penalty w="0" p="0"/> + <!-- list 1 starts --> <box w="14400"/> <penalty w="0" p="INF"/> <box w="14400"/> <!-- list 1 end --> + <penalty w="0" p="0"/> - <box w="14400"/> + <box/> <!-- block2 --> <penalty w="0" p="0"/> + <!-- list 2 starts --> - <box w="28800"/> - <penalty w="0" p="0"/> + <box w="14400"/> + <penalty w="0" p="999"/> <box w="14400"/> <!-- list 2 end --> + <penalty w="0" p="0"/> - <box w="14400"/> + <box/> <!-- block3 --> <penalty w="0" p="0"/> + <!-- list 3 starts --> <box w="28800"/> <penalty w="0" p="0"/> <box w="14400"/> + <penalty w="0" p="999"/> + <box w="14400"/> + <penalty w="0" p="0"/> + <box w="14400"/> <!-- list 3 end --> + <penalty w="0" p="0"/> + <box/> <!-- block4 --> + <penalty w="0" p="0"/> + + <!-- list 4 starts --> + <box w="28800"/> + <penalty w="0" p="0"/> + <box w="14400"/> + <penalty w="0" p="999"/> <box w="14400"/> + <penalty w="0" p="0"/> + <box w="14400"/> + <!-- list 4 end --> + + <penalty w="0" p="0"/> + <box/> <!-- block5 --> <skip>3</skip> </element-list> </checks> diff --git a/test/layoutengine/standard-testcases/table_keep-together.xml b/test/layoutengine/standard-testcases/table_keep-together.xml index dc3a6f0c0..227f5ede4 100644 --- a/test/layoutengine/standard-testcases/table_keep-together.xml +++ b/test/layoutengine/standard-testcases/table_keep-together.xml @@ -25,16 +25,16 @@ <fo> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" white-space-collapse="true" widows="0" orphans="0"> <fo:layout-master-set> - <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt"> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5 * 14.4pt"> <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>block1</fo:block> - <fo:table table-layout="fixed" keep-together.within-page="always"> - <fo:table-column/> - <fo:table-column/> + <fo:table table-layout="fixed" width="100%" keep-together.within-page="always"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> <fo:table-body> <fo:table-row> <fo:table-cell id="cell1"> @@ -58,6 +58,35 @@ <fo:block>block2</fo:block> </fo:flow> </fo:page-sequence> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>block1b</fo:block> + <fo:table table-layout="fixed" width="100%" keep-together.within-column="1"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell id="cell1b"> + <fo:block>line1</fo:block> + <fo:block>line2</fo:block> + </fo:table-cell> + <fo:table-cell id="cell2b"> + <fo:block>line1</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell id="cell3b"> + <fo:block>line1</fo:block> + </fo:table-cell> + <fo:table-cell id="cell4b"> + <fo:block>line1</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>block2b</fo:block> + </fo:flow> + </fo:page-sequence> </fo:root> </fo> <checks> @@ -69,7 +98,7 @@ <element-list category="table-cell" id="cell2"> <box w="14400"/> </element-list> - <element-list category="breaker"> + <element-list category="breaker" index="0"> <box w="14400"/> <penalty w="0" p="0"/> <box w="28800"/> @@ -79,5 +108,27 @@ <box w="14400"/> <skip>3</skip> </element-list> + + <!-- the same again but this time with keep="1" --> + <element-list category="table-cell" id="cell1b"> + <box w="14400"/> + <penalty w="0" p="999"/> + <box w="14400"/> + </element-list> + <element-list category="table-cell" id="cell2b"> + <box w="14400"/> + </element-list> + <element-list category="breaker" index="1"> + <box w="14400"/> + <penalty w="0" p="0"/> + <box w="14400"/> + <penalty w="0" p="999"/> + <box w="14400"/> + <penalty w="0" p="999"/> + <box w="14400"/> + <penalty w="0" p="0"/> + <box w="14400"/> + <skip>3</skip> + </element-list> </checks> </testcase> |