]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: display-align did not work if the first object in a page was a table.
authorLuca Furini <lfurini@apache.org>
Thu, 23 Mar 2006 12:42:03 +0000 (12:42 +0000)
committerLuca Furini <lfurini@apache.org>
Thu, 23 Mar 2006 12:42:03 +0000 (12:42 +0000)
Testcase added, now all seems ok.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@388157 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
test/layoutengine/standard-testcases/region_display-align_table.xml [new file with mode: 0644]

index 9aea85080924c20372ac531b62e8dc51a20b12ff..83ac2a937f21a3713c4d86e7bbaa92da2e90fdf9 100644 (file)
@@ -331,6 +331,11 @@ public class TableLayoutManager extends BlockStackingLayoutManager
         getParentArea(null);
         getPSLM().addIDToPage(getTable().getId());
 
+        // add space before, in order to implement display-align = "center" or "after"
+        if (layoutContext.getSpaceBefore() != 0) {
+            addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
+        }
+
         int startXOffset = getTable().getCommonMarginBlock().startIndent.getValue(this);
         
         // add column, body then row areas
diff --git a/test/layoutengine/standard-testcases/region_display-align_table.xml b/test/layoutengine/standard-testcases/region_display-align_table.xml
new file mode 100644 (file)
index 0000000..27119f6
--- /dev/null
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+  Copyright 2005 The Apache Software Foundation\r
+\r
+  Licensed under the Apache License, Version 2.0 (the "License");\r
+  you may not use this file except in compliance with the License.\r
+  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+-->\r
+<!-- $Id$ -->\r
+<testcase>\r
+  <info>\r
+    <p>\r
+      This test checks the implementation of display-align in all regions.\r
+    </p>\r
+  </info>\r
+  <fo>\r
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">\r
+      <fo:layout-master-set>\r
+        <fo:simple-page-master master-name="before" page-width="5in" page-height="5in" margin="10pt">\r
+          <fo:region-body background-color="rgb(100%, 100%, 80%)" margin="30pt" display-align="before"/>\r
+          <fo:region-before background-color="rgb(100%, 80%, 80%)" extent="30pt" display-align="before"/>\r
+          <fo:region-after background-color="rgb(80%, 80%, 80%)" extent="30pt" display-align="before"/>\r
+          <fo:region-start background-color="rgb(80%, 100%, 80%)" extent="30pt" display-align="before"/>\r
+          <fo:region-end background-color="rgb(80%, 80%, 100%)" extent="30pt" display-align="before"/>\r
+        </fo:simple-page-master>\r
+        <fo:simple-page-master master-name="center" page-width="5in" page-height="5in" margin="10pt">\r
+          <fo:region-body background-color="rgb(100%, 100%, 80%)" margin="30pt" display-align="center"/>\r
+          <fo:region-before background-color="rgb(100%, 80%, 80%)" extent="30pt" display-align="center"/>\r
+          <fo:region-after background-color="rgb(80%, 80%, 80%)" extent="30pt" display-align="center"/>\r
+          <fo:region-start background-color="rgb(80%, 100%, 80%)" extent="30pt" display-align="center"/>\r
+          <fo:region-end background-color="rgb(80%, 80%, 100%)" extent="30pt" display-align="center"/>\r
+        </fo:simple-page-master>\r
+        <fo:simple-page-master master-name="after" page-width="5in" page-height="5in" margin="10pt">\r
+          <fo:region-body background-color="rgb(100%, 100%, 80%)" margin="30pt" display-align="after"/>\r
+          <fo:region-before background-color="rgb(100%, 80%, 80%)" extent="30pt" display-align="after"/>\r
+          <fo:region-after background-color="rgb(80%, 80%, 80%)" extent="30pt" display-align="after"/>\r
+          <fo:region-start background-color="rgb(80%, 100%, 80%)" extent="30pt" display-align="after"/>\r
+          <fo:region-end background-color="rgb(80%, 80%, 100%)" extent="30pt" display-align="after"/>\r
+        </fo:simple-page-master>\r
+      </fo:layout-master-set>\r
+      \r
+      <fo:page-sequence master-reference="before">\r
+        <fo:static-content flow-name="xsl-region-before">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-after">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table> \r
+       </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-start">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-end">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+               <fo:flow flow-name="xsl-region-body">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:flow>\r
+      </fo:page-sequence>\r
+\r
+      <fo:page-sequence master-reference="center">\r
+        <fo:static-content flow-name="xsl-region-before">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-after">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+       </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-start">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-end">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+               <fo:flow flow-name="xsl-region-body">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:flow>\r
+      </fo:page-sequence>\r
+\r
+      <fo:page-sequence master-reference="after">\r
+        <fo:static-content flow-name="xsl-region-before">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-after">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-start">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+        <fo:static-content flow-name="xsl-region-end">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:static-content>\r
+               <fo:flow flow-name="xsl-region-body">\r
+          <fo:table width="20pt" table-layout="fixed" border="1pt solid red">\r
+                         <fo:table-column column-number="1" width="100%"/>\r
+                         <fo:table-body>\r
+                                 <fo:table-row>\r
+                                         <fo:table-cell column-number="1">\r
+                                                 <fo:block>X</fo:block>\r
+                                         </fo:table-cell>\r
+                                 </fo:table-row>\r
+                         </fo:table-body>\r
+          </fo:table>\r
+        </fo:flow>\r
+      </fo:page-sequence>\r
+    </fo:root>\r
+  </fo>\r
+  <checks>\r
+    <eval expected="0 0 360000 360000" xpath="//pageViewport[1]/@bounds"/>\r
+    <!-- display-align="center" -->\r
+    <eval expected="6800" xpath="//pageViewport[@nr='2']//regionBefore/block[1]/@bpd"/>\r
+    <eval expected="161800" xpath="//pageViewport[@nr='2']//regionStart/block[1]/@bpd"/>\r
+    <eval expected="161800" xpath="//pageViewport[@nr='2']//regionEnd/block[1]/@bpd"/>\r
+    <eval expected="6800" xpath="//pageViewport[@nr='2']//regionAfter/block[1]/@bpd"/>\r
+    <eval expected="131800" xpath="//pageViewport[@nr='2']//regionBody//block[1]/@bpd"/>\r
+    <!-- display-align="after" -->\r
+    <eval expected="13600" xpath="//pageViewport[@nr='3']//regionBefore/block[1]/@bpd"/>\r
+    <eval expected="323600" xpath="//pageViewport[@nr='3']//regionStart/block[1]/@bpd"/>\r
+    <eval expected="323600" xpath="//pageViewport[@nr='3']//regionEnd/block[1]/@bpd"/>\r
+    <eval expected="13600" xpath="//pageViewport[@nr='3']//regionAfter/block[1]/@bpd"/>\r
+    <eval expected="263600" xpath="//pageViewport[@nr='3']//regionBody//block[1]/@bpd"/>\r
+  </checks>\r
+</testcase>\r