You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2007/03/23 15:37:20 UTC

svn commit: r521744 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/table/GridUnit.java src/java/org/apache/fop/layoutmgr/table/RowPainter.java test/layoutengine/standard-testcases/table-cell_span-combinations.xml

Author: jeremias
Date: Fri Mar 23 07:37:19 2007
New Revision: 521744

URL: http://svn.apache.org/viewvc?view=rev&rev=521744
Log:
Some more comments for RowPainter.
Additional test that checks that no cell paints more than one area in that case. Because if you remove one or more of the checks now newly commented, you get multiple areas.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java?view=diff&rev=521744&r1=521743&r2=521744
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java Fri Mar 23 07:37:19 2007
@@ -345,11 +345,24 @@
         buffer.append("GridUnit:");
         if (colSpanIndex > 0) {
             buffer.append(" colSpan=").append(colSpanIndex);
+            if (isLastGridUnitColSpan()) {
+                buffer.append("(last)");
+            }
         }
         if (rowSpanIndex > 0) {
             buffer.append(" rowSpan=").append(rowSpanIndex);
+            if (isLastGridUnitRowSpan()) {
+                buffer.append("(last)");
+            }
         }
         buffer.append(" startCol=").append(startCol);
+        if (!isPrimary() && getPrimary() != null) {
+            buffer.append(" primary=").append(getPrimary().getStartRow());
+            buffer.append("/").append(getPrimary().getStartCol());
+            if (getPrimary().getCell() != null) {
+                buffer.append(" id=" + getPrimary().getCell().getId());
+            }
+        }
         buffer.append(" flags=").append(Integer.toBinaryString(flags));
         return buffer.toString();
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?view=diff&rev=521744&r1=521743&r2=521744
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Fri Mar 23 07:37:19 2007
@@ -266,11 +266,15 @@
                 PrimaryGridUnit gu = primaryGridUnits[i];
                 if (gu == null
                         && !currentGU.isEmpty()
-                        && currentGU.getColSpanIndex() == 0
+                        && currentGU.getColSpanIndex() == 0 
                         && currentGU.isLastGridUnitColSpan()
                         && (forcedFlush || currentGU.isLastGridUnitRowSpan())) {
+                    //Grid unit to be painted is not the primary
+                    //the checks above make sure no cell is painted more than once
                     gu = currentGU.getPrimary();
                 }
+                
+                //gu can still be null if we're talking about an EmptyGridUnit, for example
                 if (gu != null) {
                     addAreasForCell(gu, start[i], end[i],
                             lastRow,

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml?view=auto&rev=521744
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml Fri Mar 23 07:37:19 2007
@@ -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 spanned cells (especially that no cell generates more than one area).
+    </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" white-space-collapse="true">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:table table-layout="fixed" width="100%" border-collapse="separate">
+            <fo:table-column column-width="proportional-column-width(1)"/>
+            <fo:table-column column-width="proportional-column-width(1)"/>
+            <fo:table-column column-width="proportional-column-width(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="cell1" number-columns-spanned="4" border="solid 0.5pt">
+                  <fo:block>cell1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell id="cell2" number-rows-spanned="3" display-align="center" border="solid 0.5pt">
+                  <fo:block text-align="center">cell2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell id="cell3" number-rows-spanned="3" border="solid 0.5pt">
+                  <fo:block>cell3</fo:block>
+                </fo:table-cell>
+                <fo:table-cell id="cell4" number-columns-spanned="2" number-rows-spanned="2" border="solid 0.5pt"  background-color="lightgray">
+                  <fo:block>cell4</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell id="cell5" border="solid 0.5pt">
+                  <fo:block>cell5</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell id="cell6" number-columns-spanned="4" border="solid 0.5pt">
+                  <fo:block text-align="end">cell6</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="1" xpath="count(//pageViewport)"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell1'])"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell2'])"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell3'])"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell4'])"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell5'])"/>
+    <eval expected="1" xpath="count(//block[@prod-id = 'cell6'])"/>
+    <eval expected="45200" xpath="//block[@prod-id = 'cell2']/@bpd"/>
+    <eval expected="29800" xpath="//block[@prod-id = 'cell4']/@bpd"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_span-combinations.xml
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org