<?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: table_border-collapse_separate_border-spacing_2.xml 627324 2008-02-13 09:35:01Z maxberger $ -->
<testcase>
  <info>
    <p>
      This test checks tables, especially table-cells. This test: simple borders with border-collapse="separate", 
      this time with vertical border-separation.block-progression-direction.
    </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="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% - (2 * 5pt) - (2 * 2.5pt)" border-collapse="separate" 
                border-separation.inline-progression-direction="5pt" border-separation.block-progression-direction="5pt"
                margin="0pt" border="solid 5pt" padding="2.5pt">
            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
            <fo:table-body start-indent="0pt" end-indent="0pt" line-height="10pt" font-size="10pt">
              <fo:table-row>
                <fo:table-cell background-color="yellow" number-rows-spanned="2" id="c1A">
                  <fo:block>cell1</fo:block>
                  <fo:block>cell1</fo:block>
                  <fo:block>cell1</fo:block>
                </fo:table-cell>
                <fo:table-cell background-color="orange" id="c2A">
                  <fo:block>cell2</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row>
                <fo:table-cell background-color="yellow" number-rows-spanned="2" id="c3A">
                  <fo:block>cell3</fo:block>
                  <fo:block>cell3</fo:block>
                  <fo:block>cell3</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row>
                <fo:table-cell background-color="orange" id="c4A">
                  <fo:block>cell4</fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
          <fo:table table-layout="fixed" width="100% - (2 * 5pt) - (2 * 2.5pt)" border-collapse="separate"
                margin="0pt" border="solid 5pt" padding="2.5pt">
            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
            <fo:table-body start-indent="0pt" end-indent="0pt" line-height="10pt" font-size="10pt">
              <fo:table-row>
                <fo:table-cell background-color="yellow" number-rows-spanned="2" border="solid 2.5pt" id="c1B">
                  <fo:block>cell1</fo:block>
                  <fo:block>cell1</fo:block>
                  <fo:block>cell1</fo:block>
                </fo:table-cell>
                <fo:table-cell background-color="orange" border="solid 2.5pt" id="c2B">
                  <fo:block>cell2</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row>
                <fo:table-cell background-color="yellow" number-rows-spanned="2" border="solid 2.5pt" id="c3B">
                  <fo:block>cell3</fo:block>
                  <fo:block>cell3</fo:block>
                  <fo:block>cell3</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row>
                <fo:table-cell background-color="orange" border="solid 2.5pt" id="c4B">
                  <fo:block>cell4</fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks>
    <!-- First table -->
    <eval expected="50000" xpath="//flow/block[1]/@bpd"/>
    <eval expected="65000" xpath="//flow/block[1]/@bpda"/>

    <eval expected="2500" xpath="//block[@prod-id='c1A']/@top-offset"/>
    <eval expected="2500" xpath="//block[@prod-id='c2A']/@top-offset"/>
    <eval expected="17500" xpath="//block[@prod-id='c3A']/@top-offset"/>
    <eval expected="37500" xpath="//block[@prod-id='c4A']/@top-offset"/>

    <eval expected="30000" xpath="//block[@prod-id='c1A']/@bpd"/>
    <eval expected="30000" xpath="//block[@prod-id='c1A']/@bpda"/>
    <eval expected="10000" xpath="//block[@prod-id='c2A']/@bpd"/>
    <eval expected="10000" xpath="//block[@prod-id='c2A']/@bpda"/>
    <eval expected="30000" xpath="//block[@prod-id='c3A']/@bpd"/>
    <eval expected="30000" xpath="//block[@prod-id='c3A']/@bpda"/>
    <eval expected="10000" xpath="//block[@prod-id='c4A']/@bpd"/>
    <eval expected="10000" xpath="//block[@prod-id='c4A']/@bpda"/>

    <!-- Second table -->
    <eval expected="50000" xpath="//flow/block[2]/@bpd"/>
    <eval expected="65000" xpath="//flow/block[2]/@bpda"/>

    <true xpath="not(boolean(//block[@prod-id='c1B']/@top-offset))"/>
    <true xpath="not(boolean(//block[@prod-id='c2B']/@top-offset))"/>
    <eval expected="15000" xpath="//block[@prod-id='c3B']/@top-offset"/>
    <eval expected="35000" xpath="//block[@prod-id='c4B']/@top-offset"/>

    <eval expected="30000" xpath="//block[@prod-id='c1B']/@bpd"/>
    <eval expected="35000" xpath="//block[@prod-id='c1B']/@bpda"/>
    <eval expected="10000" xpath="//block[@prod-id='c2B']/@bpd"/>
    <eval expected="15000" xpath="//block[@prod-id='c2B']/@bpda"/>
    <eval expected="30000" xpath="//block[@prod-id='c3B']/@bpd"/>
    <eval expected="35000" xpath="//block[@prod-id='c3B']/@bpda"/>
    <eval expected="10000" xpath="//block[@prod-id='c4B']/@bpd"/>
    <eval expected="15000" xpath="//block[@prod-id='c4B']/@bpda"/>
    
    <element-list category="breaker">
      <box w="0"/>
      <penalty w="0" p="INF"/>
      <glue w="7500"/>
      <box w="12500"/>
      <penalty w="2500" p="0"/>
      <box w="2500"/>
      <penalty w="7500" p="0"/>
      <box w="7500"/>
      <penalty w="5000" p="0"/>
      <box w="5000"/>
      <penalty w="7500"/>
      <box w="7500"/>
      <penalty w="2500"/>
      <box w="15000"/>
      <penalty w="0" p="INF"/>
      <glue w="7500"/>

      <penalty w="0" p="0"/>

      <!-- almost the same thing once again -->
      <box w="0"/>
      <penalty w="0" p="INF"/>
      <glue w="7500"/>
      <box w="12500"/>
      <penalty w="2500" p="0"/>
      <box w="2500"/>
      <penalty w="7500" p="0"/>
      <box w="7500"/>
      <penalty w="5000" p="0"/>
      <box w="5000"/>
      <penalty w="7500"/>
      <box w="7500"/>
      <penalty w="2500"/>
      <box w="15000"/>
      <box w="0"/> <!-- with SpaceHandlingPosition -->
      <penalty w="0" p="INF"/>
      <glue w="7500"/>

      <box w="0"/> <!-- helper box -->
      
      <skip>3</skip>
    </element-list>
  </checks>
</testcase>
