aboutsummaryrefslogtreecommitdiffstats
path: root/test/layoutengine
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2009-08-23 20:27:48 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2009-08-23 20:27:48 +0000
commita6b2b2e4b9c9d42fabe160a1f5682dfd5903f052 (patch)
tree85f3566090fe3eec137495609928f0e8229e0815 /test/layoutengine
parent6f8f64269426d81124876958b437536536b469f2 (diff)
downloadxmlgraphics-fop-a6b2b2e4b9c9d42fabe160a1f5682dfd5903f052.tar.gz
xmlgraphics-fop-a6b2b2e4b9c9d42fabe160a1f5682dfd5903f052.zip
Bugzilla 46905: Added basic implementation for column-level keeps.
Also added one disabled-testcase for a remaining issue with page-level keeps in multi-column layout. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@807014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/layoutengine')
-rw-r--r--test/layoutengine/disabled-testcases.xml6
-rw-r--r--test/layoutengine/standard-testcases/inline_block_nested_6.xml7
-rw-r--r--test/layoutengine/standard-testcases/keep_within-column_basic.xml155
-rw-r--r--test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml58
-rw-r--r--test/layoutengine/standard-testcases/table-row_keep-together.xml6
-rw-r--r--test/layoutengine/standard-testcases/table_keep-together.xml4
6 files changed, 228 insertions, 8 deletions
diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml
index ba985bf8d..1fb4f2926 100644
--- a/test/layoutengine/disabled-testcases.xml
+++ b/test/layoutengine/disabled-testcases.xml
@@ -216,4 +216,10 @@
<description>A soft hyphen should be a preferred as break compared to a
normal hyphenation point but is not.</description>
</testcase>
+ <testcase>
+ <name>Page-keep not respected in multi-column layout</name>
+ <file>keep_within-page_multi-column_overflow.xml</file>
+ <description>The block should cause overflow in the
+ last column on the page, rather than be broken.</description>
+ </testcase>
</disabled-testcases>
diff --git a/test/layoutengine/standard-testcases/inline_block_nested_6.xml b/test/layoutengine/standard-testcases/inline_block_nested_6.xml
index 9dc588074..86827047c 100644
--- a/test/layoutengine/standard-testcases/inline_block_nested_6.xml
+++ b/test/layoutengine/standard-testcases/inline_block_nested_6.xml
@@ -52,16 +52,15 @@
<skip>5</skip>
<!-- penalty between blocks b11 and b12, set by InlineLM in b1 -->
<penalty w="0" p="0"/>
- <skip>6</skip>
+ <skip>5</skip>
<!-- penalty between blocks b21 and b22, set by InlineLM in b2 -->
<!-- keep-together.within-page="always" -->
<penalty w="0" p="1000"/>
- <skip>6</skip>
+ <skip>3</skip>
<!-- penalty between blocks b31 and b32, set by InlineLM in b3 -->
<!-- keep-with-next.within-page="always" -->
<penalty w="0" p="1000"/>
- <skip>5</skip>
- <skip>3</skip>
+ <skip>14</skip>
</element-list>
</checks>
</testcase>
diff --git a/test/layoutengine/standard-testcases/keep_within-column_basic.xml b/test/layoutengine/standard-testcases/keep_within-column_basic.xml
new file mode 100644
index 000000000..001690521
--- /dev/null
+++ b/test/layoutengine/standard-testcases/keep_within-column_basic.xml
@@ -0,0 +1,155 @@
+<?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 keeps within-column are respected.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="page" page-width="400pt" page-height="70pt">
+ <fo:region-body column-count="5" />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="page" font-size="10pt">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block break-before="page">
+ <!-- simple test: keep the second block together within
+ one column, breaking the preceding block early
+ if necessary -->
+ <fo:block id="block-1">
+ [BOB-1] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-1]
+ </fo:block>
+ <fo:block id="block-2" keep-together.within-column="always">
+ [BOB-2] foo bar foo bar foo bar foo bar foo [EOB-2]
+ </fo:block>
+ </fo:block>
+ <fo:block break-before="page">
+ <!-- same as the first, but now a nested block
+ with a higher integer value, and some content
+ following -->
+ <fo:block id="block-3" keep-together.within-column="5">
+ [BOB-3] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ <fo:block font-weight="bold" id="block-3a" keep-together.within-column="always">
+ [BOB-3a] foo bar foo bar foo bar foo bar foo [EOB-3a]
+ </fo:block>
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-3]
+ </fo:block>
+ </fo:block>
+ <fo:block break-before="page">
+ <!-- nested block must be kept together within the same
+ page, while the outer block may be broken, if necessary -->
+ <fo:block font-style="italic" id="block-4" keep-together.within-column="5">
+ [BOB-4] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ <fo:block id="block-4a" keep-together.within-page="always">
+ [BOB-4a] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-4a]
+ </fo:block>
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-4]
+ </fo:block>
+ </fo:block>
+ <fo:block break-before="page">
+ <!-- test keep-with-next in conjunction with keep-together
+ respecting the default value for widows/orphans -->
+ <fo:block id="block-5">
+ <fo:block id="block-5a">
+ [BOB-5a] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-5a]
+ </fo:block>
+ <fo:block id="block-5b" keep-with-next.within-column="always">
+ [BOB-5b] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-5b]
+ </fo:block>
+ <fo:block id="block-5c" keep-together.within-column="always">
+ [BOB-5c] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-5c]
+ </fo:block>
+ </fo:block>
+ </fo:block>
+ <fo:block break-before="page">
+ <!-- test keep-together in conjunction with keep-with-previous -->
+ <fo:block id="block-6">
+ <fo:block id="block-6a">
+ [BOB-6a] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-6a]
+ </fo:block>
+ <fo:block id="block-6b" keep-together.within-column="always">
+ [BOB-6b] foo bar foo bar foo bar foo bar foo bar [EOB-6b]
+ </fo:block>
+ <fo:block id="block-6c" keep-with-previous.within-column="always">
+ [BOB-6c] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-6c]
+ </fo:block>
+ </fo:block>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- check total page-count -->
+ <eval expected="10" xpath="count(//page)" />
+ <!-- block-2 should end up in its own column, column 4 -->
+ <eval expected="1" xpath="count(//block[@prod-id='block-2']/ancestor::flow)" />
+ <eval expected="3" xpath="count(//block[@prod-id='block-2']/ancestor::flow/preceding-sibling::flow)" />
+ <!-- block-3a should end up in its own column, column 5 -->
+ <eval expected="1" xpath="count(//block[@prod-id='block-3a']/ancestor::flow)" />
+ <eval expected="4" xpath="count(//block[@prod-id='block-3a']/ancestor::flow/preceding-sibling::flow)" />
+ <!-- block-4a should end up in its own page -->
+ <eval expected="1" xpath="count(//block[@prod-id='block-4a']/ancestor::page)" />
+ <!-- block 5c should end up in its own column, with two preceding lines from block 5b -->
+ <eval expected="1" xpath="count(//block[@prod-id='block-5c']/ancestor::flow)" />
+ <eval expected="2" xpath="count(//block[@prod-id='block-5c']/preceding-sibling::block/lineArea)" />
+ <!-- block 6b should end up in its own column, with two following lines from block 6c -->
+ <eval expected="1" xpath="count(//block[@prod-id='block-6b']/ancestor::flow)" />
+ <eval expected="2" xpath="count(//block[@prod-id='block-6b']/following-sibling::block/lineArea)" />
+ </checks>
+</testcase>
+
diff --git a/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml b/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
new file mode 100644
index 000000000..f7fac57b0
--- /dev/null
+++ b/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.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 for a remaining issue after adding support
+ for keep-*.within column (see Bugzilla 46905).
+ keep-together.within-page does not work as expected in multi-column
+ layout. If the part does not fit into one page, it will ultimately
+ still be broken.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="page" page-width="400pt" page-height="70pt">
+ <fo:region-body column-count="5" />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="page" font-size="10pt">
+ <fo:flow flow-name="xsl-region-body">
+ <!-- block must be kept together within the same page -->
+ <fo:block id="block-4a" keep-together.within-page="always">
+ [BOB-4a] foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar [EOB-4a]
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="1" xpath="count(//pageViewport)" />
+ </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/table-row_keep-together.xml b/test/layoutengine/standard-testcases/table-row_keep-together.xml
index 067c4daf6..73da10fb8 100644
--- a/test/layoutengine/standard-testcases/table-row_keep-together.xml
+++ b/test/layoutengine/standard-testcases/table-row_keep-together.xml
@@ -64,10 +64,10 @@
<element-list category="breaker" index="0">
<box w="14400"/>
<penalty w="0" p="0"/>
- <box w="28800"/>
- <penalty w="0" p="0"/>
<box w="14400"/>
- <skip>3</skip>
+ <penalty w="0" p="INF"/>
+ <box w="14400"/>
+ <skip>5</skip>
</element-list>
</checks>
</testcase>
diff --git a/test/layoutengine/standard-testcases/table_keep-together.xml b/test/layoutengine/standard-testcases/table_keep-together.xml
index 227f5ede4..a904a144a 100644
--- a/test/layoutengine/standard-testcases/table_keep-together.xml
+++ b/test/layoutengine/standard-testcases/table_keep-together.xml
@@ -101,7 +101,9 @@
<element-list category="breaker" index="0">
<box w="14400"/>
<penalty w="0" p="0"/>
- <box w="28800"/>
+ <box w="14400"/>
+ <penalty w="0" p="INF"/>
+ <box w="14400"/>
<penalty w="0" p="INF"/>
<box w="14400"/>
<penalty w="0" p="0"/>