Index: test/layoutengine/disabled-testcases.xml
===================================================================
--- test/layoutengine/disabled-testcases.xml	(révision 425766)
+++ test/layoutengine/disabled-testcases.xml	(copie de travail)
@@ -355,4 +355,24 @@
     <description>Long text cause an IndexOutOfBounds exception</description>
     <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=39414</reference>
   </testcase>
-</disabled-testcases>
\ No newline at end of file
+  <testcase>
+    <name>fo:float float="none" should be split</name>
+    <file>float_float_none_2.xml</file>
+    <description>When float="none", it should be possible to split an fo:float
+      element on several pages.</description>
+  </testcase>
+  <testcase>
+    <name>Before-floats when no stretch available</name>
+    <file>before-float_not-deferred_no-stretch_2.xml</file>
+    <description>Whereas there is room for placing the before-float on the same
+      page as its citation, the algorithm prefers to defer it to the following
+      page.</description>
+  </testcase>
+  <testcase>
+    <name>Before-floats deferred when no stretch available</name>
+    <file>before-float_deferred_no-stretch.xml</file>
+    <description>Instead of deferring a before-float on the following page, an
+    underfull page is created so that the citation be on the same page as the
+    float.</description>
+  </testcase>
+</disabled-testcases>
Index: test/layoutengine/standard-testcases/before-float_deferred_stretch.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_deferred_stretch.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_deferred_stretch.xml	(révision 0)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+      Test for before-floats. On a two-page document, when some stretching is
+      allowed between blocks, when the float citation is on the first page and
+      there is not enough room for the float, it should be placed on the top of
+      the second page.
+    </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="normal" page-width="5in" page-height="3in">
+          <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:block space-after.minimum="2pt"
+		    space-after.optimum="6pt"
+		    space-after.maximum="16pt"
+		    orphans="1"
+		    widows="1">
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      The float anchor is just behind this <fo:inline
+		color="blue">word</fo:inline><fo:float float="before"
+		color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content. This is the float content.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- first page -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- main area -->
+    <eval expected="4"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block)"/>
+    <!-- only one line in the last block -->
+    <eval expected="1"
+          xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block[4]/lineArea)"/>
+    <!-- second page -->
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- one block in the normal content -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block)"/>
+    <!-- three remaining lines in the normal content -->
+    <eval expected="3"
+          xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block[1]/lineArea)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_deferred_no-stretch.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_deferred_no-stretch.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_deferred_no-stretch.xml	(révision 0)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+      Test for before-floats. On a two-page document, when no stretching is
+      allowed between blocks, when the float citation is on the first page and
+      there is not enough room for the float, it should be placed on the top of
+      the second page.
+    </p>
+    <p>
+      When no stretching is available, only "too short" nodes are created. When
+      there is not enough room to place the float, a too short node is created
+      with added demerits for the deferred float. This results in higher
+      demerits than for previous too short nodes, which then are preferred
+      whereas they create underfull pages.
+    </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="normal" page-width="5in" page-height="3.1in">
+          <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:block orphans="1" widows="1">
+	    <fo:block>
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block>
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block>
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block>
+	      This is a block with a float. This is a block with a float.
+	      The float anchor is just behind this <fo:inline
+		color="blue">word</fo:inline><fo:float float="before"
+		color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content. This is the float content.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float. This is a block with a float.
+	    </fo:block>
+	    <fo:block>
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- first page -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- main area -->
+    <eval expected="4"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block)"/>
+    <!-- four lines in the last block -->
+    <eval expected="4"
+          xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block[4]/lineArea)"/>
+    <!-- second page -->
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- one block in the normal content -->
+    <eval expected="2"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block)"/>
+    <!-- one remaining line in the first block -->
+    <eval expected="1"
+          xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block[1]/lineArea)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_not-deferred_stretch.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_not-deferred_stretch.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_not-deferred_stretch.xml	(révision 0)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+      Test for before-floats. On a two-page document, when some stretching is
+      allowed between blocks, when the float citation is on the first page and
+      there is enough room for the float, it should be placed on the top of the
+      first page.
+    </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="normal" page-width="5in" page-height="3in">
+          <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:block space-after.minimum="6pt"
+		    space-after.optimum="10pt"
+		    space-after.maximum="16pt"
+		    orphans="1"
+		    widows="1">
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      The float anchor is just behind this <fo:inline
+		color="blue">word</fo:inline><fo:float float="before"
+		color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content. This is the float content.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float. This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- first page -->
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- main area -->
+    <eval expected="3"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block)"/>
+    <!-- only two lines in the last block -->
+    <eval expected="2"
+          xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block/block[3]/lineArea)"/>
+    <!-- second page -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/float_float_none_1.xml
===================================================================
--- test/layoutengine/standard-testcases/float_float_none_1.xml	(révision 0)
+++ test/layoutengine/standard-testcases/float_float_none_1.xml	(révision 0)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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 fo:float objects with a "float" property of
+      "none" are typeset in the normal flow of elements.
+    </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="normal" page-width="5in" page-height="3in">
+          <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:block space-after.minimum="6pt" space-after.optimum="10pt"
+	    space-after.maximum="12pt">
+	    <fo:block space-after="inherit">
+	      This is a block containing no before-float. This is a block
+	      containing no before-float. This is a block containing no
+	      before-float. This is a block containing no before-float. This is
+	      a block containing no before-float. This is a block containing no
+	      before-float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block containing a before-float with "float" set to
+	      "none". The float anchor is just behind this <fo:inline
+		color="blue">word</fo:inline><fo:float float="none" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content.
+		</fo:block>
+	      </fo:float>
+	      This is the end of the block containing the float. This is the
+	      end of the block containing the float. This is the end of the
+	      block containing the float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block containing no before-float. This is a block
+	      containing no before-float. This is a block containing no
+	      before-float. This is a block containing no before-float. This is
+	      a block containing no before-float. This is a block containing no
+	      before-float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- block with footnote -->
+    <eval expected='This is a block containing a before-float with "float" set to "none".'
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/lineArea[1]/text[1]"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/lineArea[1]/text[1]"/>
+    <eval expected="43200"
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/@bpd"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_1.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_1.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_1.xml	(révision 0)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+      Test for before-floats. On a two-page document, when no stretching is
+      allowed between blocks, when the float citation is on the first page and
+      there is enough room for the float, it should be placed on the top of the
+      first page.
+    </p>
+    <p>
+      When no stretching is available, only "too short" nodes are created. There
+      is no feasible break. The result regarding floats should be the same,
+      however.
+    </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="normal" page-width="5in" page-height="3.1in">
+          <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:block>
+	    This is a block with a float. This is a block with a float.
+	    The float anchor is just behind this <fo:inline
+	      color="blue">word</fo:inline><fo:float float="before"
+	      color="red">
+	      <fo:block>
+		This is the float content. This is the float content. This is
+		the float content. This is the float content. This is the float
+		content. This is the float content. This is the float content.
+		This is the float content.
+	      </fo:block>
+	    </fo:float>.
+	    This is a block with a float. This is a block with a float.
+	    This is a block with a float. This is a block with a float.
+	  </fo:block>
+	  <fo:block>
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- first page -->
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- main area -->
+    <eval expected="2"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+    <!-- only eight lines in the last block -->
+    <eval expected="8"
+          xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea)"/>
+    <!-- second page -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- four remaining lines from the previous last block -->
+    <eval expected="4"
+          xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/lineArea)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/float_float_none_2.xml
===================================================================
--- test/layoutengine/standard-testcases/float_float_none_2.xml	(révision 0)
+++ test/layoutengine/standard-testcases/float_float_none_2.xml	(révision 0)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+    <!-- don't work, not implemented, TODO -->
+    <p>
+      This test checks that fo:float objects with a "float" property of
+      "none" are typeset in the normal flow of elements, and normally broken
+      across pages.
+    </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="normal" page-width="5in" page-height="2in">
+          <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:block space-after.minimum="6pt" space-after.optimum="10pt"
+	    space-after.maximum="12pt">
+	    <fo:block space-after="inherit">
+	      This is a block containing no fo:float. This is a block
+	      containing no fo:float. This is a block containing no fo:float.
+	      This is a block containing no fo:float. This is a block
+	      containing no fo:float. This is a block containing no fo:float.
+	      This is a block containing no fo:float. This is a block
+	      containing no fo:float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block containing an fo:float with "float" set to
+	      "none", which will be split on two pages. The float anchor is
+	      just behind this <fo:inline
+		color="blue">word</fo:inline><fo:float float="none" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content.
+		</fo:block>
+	      </fo:float>
+	      This is the end of the block containing the float. This is the
+	      end of the block containing the float. This is the end of the
+	      block containing the float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block containing no fo:float. This is a block
+	      containing no fo:float. This is a block containing no fo:float.
+	      This is a block containing no fo:float. This is a block
+	      containing no fo:float. This is a block containing no fo:float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <eval expected='This is a block containing a before-float with "float" set to "none".'
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/lineArea[1]/text[1]"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/lineArea[1]/text[1]"/>
+    <eval expected="43200"
+      xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/@bpd"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_2.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_2.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_not-deferred_no-stretch_2.xml	(révision 0)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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 does not work. There is a before-float and a block of normal
+      text with no stretching. Normally the float should be on the first page.
+    </p>
+    <p>
+      Without the before-float, the normal content would fit on one page. With
+      the float, two pages are necessary. As there is no available stretching
+      the algorithm can only create "too short" nodes. In such a case it prefers
+      to defer the float on the last page, instead of putting it on the first
+      page and splitting the normal content on two pages. This should be
+      corrected eventually.
+    </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="normal" page-width="5in" page-height="3.1in">
+          <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:block>
+	    This is a block with a float. This is a block with a float.
+	    The float anchor is just behind this <fo:inline
+	      color="blue">word</fo:inline><fo:float float="before"
+	      color="red">
+	      <fo:block>
+		This is the float content. This is the float content. This is
+		the float content. This is the float content. This is the float
+		content. This is the float content. This is the float content.
+		This is the float content.
+	      </fo:block>
+	    </fo:float>.
+	    This is a block with a float. This is a block with a float.
+	    This is a block with a float. This is a block with a float.
+	  </fo:block>
+	  <fo:block>
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <!-- first page -->
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- main area -->
+    <eval expected="2"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+    <!-- second page -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- three remaining lines on the second page -->
+    <eval expected="3"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/lineArea)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_complex.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_complex.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_complex.xml	(révision 0)
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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>
+      Test for before-floats. This a complex documents with several floats; some
+      may be put on the same page as their citation, others not.
+    </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="normal" page-width="5in" page-height="3in">
+          <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:block space-after.minimum="2pt"
+		    space-after.optimum="6pt"
+		    space-after.maximum="12pt"
+		    orphans="1"
+		    widows="1">
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      This float has the number <fo:inline
+		color="blue">1</fo:inline><fo:float float="before" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This was the float number 1.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      This float has the number <fo:inline
+		color="blue">2</fo:inline><fo:float float="before" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This was the float number 2.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      This float has the number <fo:inline
+		color="blue">3</fo:inline><fo:float float="before" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This was the float number 3.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      This float has the number <fo:inline
+		color="blue">4</fo:inline><fo:float float="before" color="red">
+		<fo:block>
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This was the float number 4.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block with a float. This is a block with a float.
+	      This float has the number <fo:inline
+		color="blue">5</fo:inline><fo:float float="before" color="red">
+		<fo:block>
+		  This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content. This is the float content. This is the float content.
+		  This is the float content. This is the float content. This is
+		  the float content. This is the float content. This is the
+		  float content. This is the float content. This is the float
+		  content. This is the float content. This is the float content.
+		  This was the float number 5.
+		</fo:block>
+	      </fo:float>.
+	      This is a block with a float. This is a block with a float.
+	      This is a block with a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	    <fo:block space-after="inherit">
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	      This is a block without a float. This is a block without a float.
+	    </fo:block>
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="5" xpath="count(//pageViewport)"/>
+    <!-- page 1 -->
+    <eval expected="2"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- float number 1 -->
+    <eval expected="the float number 1."
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block[1]/lineArea[3]/text"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block[1]/@bpd"/>
+    <!-- float number 2 -->
+    <eval expected="the float number 2."
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block[2]/lineArea[3]/text"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block[2]/@bpd"/>
+    <!-- page 2 -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- float number 3 -->
+    <eval expected="the float number 3."
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/lineArea[3]/text"/>
+    <eval expected="43200"
+          xpath="//pageViewport[2]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- page 3 -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[3]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- float number 4 -->
+    <eval expected="the float number 4."
+          xpath="//pageViewport[3]/page/regionViewport/regionBody/beforeFloat/block/lineArea[3]/text"/>
+    <eval expected="43200"
+          xpath="//pageViewport[3]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- page 4 -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[4]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <!-- float number 5 -->
+    <eval expected="This is the float content. This was the float number 5."
+          xpath="//pageViewport[4]/page/regionViewport/regionBody/beforeFloat/block/lineArea[7]/text"/>
+    <eval expected="100800"
+          xpath="//pageViewport[4]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- page 5 -->
+    <eval expected="0"
+	  xpath="count(//pageViewport[5]/page/regionViewport/regionBody/beforeFloat/block)"/>
+  </checks>
+</testcase>
Index: test/layoutengine/standard-testcases/before-float_basic.xml
===================================================================
--- test/layoutengine/standard-testcases/before-float_basic.xml	(révision 0)
+++ test/layoutengine/standard-testcases/before-float_basic.xml	(révision 0)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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 a before-float on a simple one-page document is
+      rightly placed on the top of the page.
+    </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="normal" page-width="5in" page-height="3in">
+          <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:block>
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	  </fo:block>
+	  <fo:block>
+	    This is a block with a float. This is a block with a float.
+	    The float anchor is just behind this <fo:inline
+	      color="blue">word</fo:inline><fo:float float="before"
+	      color="red">
+	      <fo:block>
+		This is the float content. This is the float content. This is
+		the float content. This is the float content. This is the float
+		content. This is the float content. This is the float content.
+		This is the float content.
+	      </fo:block>
+	    </fo:float>.
+	    This is a block with a float. This is a block with a float.
+	    This is a block with a float. This is a block with a float.
+	  </fo:block>
+	  <fo:block>
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	    This is a block without a float. This is a block without a float.
+	  </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="1" xpath="count(//pageViewport)"/>
+    <!-- before-float block -->
+    <eval expected="1"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block)"/>
+    <eval expected="This is the float content. This is the float content. This is the float"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/lineArea/text[1]"/>
+    <eval expected="43200"
+          xpath="//pageViewport[1]/page/regionViewport/regionBody/beforeFloat/block/@bpd"/>
+    <!-- main area -->
+    <eval expected="3"
+	  xpath="count(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+  </checks>
+</testcase>
