<?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 balancing with multiple tables with headers / footers
    </p>
  </info>
  <fo>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" >
        <fo:layout-master-set>
            <fo:simple-page-master master-name="simple" page-height="5in" page-width="5in">
                <fo:region-body region-name="PageBody" column-count="3"/>
            </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="simple">
            <fo:flow flow-name="PageBody">
                <fo:block>
            <fo:table table-layout="fixed" >
              <fo:table-header font-weight="bold">
                  <fo:table-cell>
                      <fo:block>T1 H1</fo:block>
                  </fo:table-cell>
                  <fo:table-cell>
                      <fo:block>T1 H2</fo:block>
                  </fo:table-cell>
              </fo:table-header>
              <fo:table-body>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T1 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T1 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>
            <fo:table table-layout="fixed" >
              <fo:table-header font-weight="bold">
                  <fo:table-cell>
                      <fo:block>T2 H1</fo:block>
                  </fo:table-cell>
                  <fo:table-cell>
                      <fo:block>T2 H2</fo:block>
                  </fo:table-cell>
              </fo:table-header>
              <fo:table-footer font-weight="bold">
                  <fo:table-cell>
                      <fo:block>T2 F1</fo:block>
                  </fo:table-cell>
                  <fo:table-cell>
                      <fo:block>T2 F2</fo:block>
                  </fo:table-cell>
              </fo:table-footer>
              <fo:table-body>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T2 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T2 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>
            <fo:table table-layout="fixed" >
              <fo:table-header font-weight="bold">
                  <fo:table-cell>
                      <fo:block>T3 H1</fo:block>
                  </fo:table-cell>
                  <fo:table-cell>
                      <fo:block>T3 H2</fo:block>
                  </fo:table-cell>
              </fo:table-header>
              <fo:table-body>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T3 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T3 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block>T3 C1</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>T3 C2</fo:block>
                    </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>
                </fo:block>
                <fo:block span="all">SUMMARY</fo:block>
            </fo:flow>
        </fo:page-sequence>
     </fo:root>
  </fo>
  <checks>
    <eval expected="86400" xpath="//flow[1]/@bpd"/>
    <eval expected="86400" xpath="//flow[2]/@bpd"/>
    <eval expected="43200" xpath="//flow[3]/@bpd"/>
  </checks>
</testcase>
