]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: keep-together on a table containing row-spanning cells was not honored
authorVincent Hennebert <vhennebert@apache.org>
Mon, 21 Mar 2011 16:46:53 +0000 (16:46 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Mon, 21 Mar 2011 16:46:53 +0000 (16:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1083863 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableStepper.java
status.xml
test/layoutengine/standard-testcases/table_keep-together_row-span.xml [new file with mode: 0644]

index 92e8ba5dd9cca8ad6afc6451abf3ba39ca676513..7e37eeb59f2ee64f99120cef1de2c23c67ff4bc2 100644 (file)
@@ -239,7 +239,7 @@ public class TableStepper {
                 }
             }
 
-            Keep keep = Keep.KEEP_AUTO;
+            Keep keep = getTableLM().getKeepTogether();
             int stepPenalty = 0;
             for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
                 ActiveCell activeCell = (ActiveCell) iter.next();
@@ -248,8 +248,6 @@ public class TableStepper {
             }
             if (!rowFinished) {
                 keep = keep.compare(rowGroup[activeRowIndex].getKeepTogether());
-                //The above call doesn't take the penalty from the table into account, so...
-                keep = keep.compare(getTableLM().getKeepTogether());
             } else if (activeRowIndex < rowGroup.length - 1) {
                 keep = keep.compare(rowGroup[activeRowIndex].getKeepWithNext());
                 keep = keep.compare(rowGroup[activeRowIndex + 1].getKeepWithPrevious());
index 73e6f6c0df888cd4759a9c2070dce3e8ec6081a1..337164b3100c476261dd5c30918f22469149e13d 100644 (file)
@@ -59,6 +59,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Layout" dev="VH" type="fix">
+        Bugfix: keep-together on a table containing row-spanning cells was not honored.
+      </action>
       <action context="Layout" dev="VH" type="fix" fixes-bug="50196" due-to="Matthias Reischenbacher">
         Bugzilla #50196: padding-start ignored when table-header/footer is repeated.
       </action>
diff --git a/test/layoutengine/standard-testcases/table_keep-together_row-span.xml b/test/layoutengine/standard-testcases/table_keep-together_row-span.xml
new file mode 100644 (file)
index 0000000..b751fca
--- /dev/null
@@ -0,0 +1,69 @@
+<?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 keep-together works on tables that have a cell spanning several rows.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="320pt" page-width="420pt" margin="10pt">
+          <fo:region-body background-color="#F0F0F0"/>
+        </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>Block</fo:block>
+          <fo:block space-before="245pt">Before the table</fo:block>
+          <fo:table table-layout="fixed" width="100%" id="table" keep-together.within-page="always">
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell id="Cell 1.1" border="1pt solid black" number-rows-spanned="2">
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell id="Cell 1.2" border="1pt solid black">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell id="Cell 2.2" border="1pt solid black">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="0"     xpath="count(//pageViewport[1]//block[@prod-id='table'])"/>
+    <eval expected="62000" xpath="//pageViewport[2]//block[@prod-id='table']/@bpd"/>
+    <eval expected="61000" xpath="//pageViewport[2]//block[@prod-id='Cell 1.1']/@bpd"/>
+    <eval expected="30000" xpath="//pageViewport[2]//block[@prod-id='Cell 1.2']/@bpd"/>
+    <eval expected="30000" xpath="//pageViewport[2]//block[@prod-id='Cell 2.2']/@bpd"/>
+  </checks>
+</testcase>