<?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 floats.
    </p>
  </info>
  <fo>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master margin="50pt" master-name="page" page-height="800pt" page-width="600pt">
      <fo:region-body background-color="yellow" />
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="page">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>
        Put some content before the float but enough to make the float go to the third line of this block. Just enought content to place the float in the second line is not desirable. <fo:inline color="red">This is the last content before the float and the float is right now.</fo:inline>
        <fo:float float="start">
          <fo:block border="1pt solid red" padding="10pt" color="blue" end-indent="0pt" start-indent="0pt">
            <fo:block-container inline-progression-dimension="110pt">
              <fo:block background-color="green">
                This is a normal block that is confined to the block container inside a side float. The background is green.
              </fo:block>
            </fo:block-container>
            <fo:block>This line is not constrained by a width. xxx xxx xxx xxx xxx</fo:block>
          </fo:block>
        </fo:float>
        <fo:inline color="blue">This is the first content after the float.</fo:inline> This paragraph contains a side float and the content of the paragraph needs to be wrapped around the float... this is very complicated but the current implementation can handle the simpler cases.
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
  </fo>
  <checks>
    <!-- first float -->
    <eval expected="11000" xpath="//pageViewport[1]/page/regionViewport[1]//flow[1]/block[2]/@left-offset" />
    <eval expected="green." xpath="//pageViewport[1]/page/regionViewport[1]//flow[1]/block[2]/block[1]/block[1]/block[1]/block[1]/lineArea[7]" />
    <eval expected="331432" xpath="//pageViewport[1]/page/regionViewport[1]//flow[1]/block[3]/@left-offset" />
    <eval expected="last content before the float" xpath="//pageViewport[1]/page/regionViewport[1]//flow[1]/block[3]/lineArea[1]" />
    <eval expected="handle the simpler cases." xpath="//pageViewport[1]/page/regionViewport[1]//flow[1]/block[3]/lineArea[10]" />
  </checks>
</testcase>
