<?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 leaders with leader-pattern="use-content"
    </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:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content">x</fo:leader>
               Content is "x"
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content"><fo:inline background-color="yellow">=></fo:inline></fo:leader>
               Content is "=>" with background
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:inline background-color="orange">~</fo:inline></fo:leader>
               Content is "~" with leader-pattern-width="12pt"
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:inline border="solid 1pt red" background-color="yellow">*</fo:inline></fo:leader>
               Content is "*" with leader-pattern-width="12pt" and border
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:inline border="solid 1pt red" font-size="6pt" alignment-baseline="middle" background-color="yellow">++</fo:inline></fo:leader>
               Content is "++" with l-p-w="12pt" and border small font
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:instream-foreign-object>
                <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10">
                <rect x="0" y="0" width="5" height="5" style="fill:red"/>
                <rect x="5" y="5" width="5" height="5" style="fill:black"/>
                </svg>
              </fo:instream-foreign-object></fo:leader>
              Content is svg 10 x 10
          </fo:block>
          <fo:block>
            <fo:leader leader-pattern="use-content"><fo:instream-foreign-object>
                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="10">
                <rect x="0" y="0" width="10" height="5" style="fill:red"/>
                <rect x="10" y="5" width="10" height="5" style="fill:black"/>
                </svg>
                </fo:instream-foreign-object></fo:leader>
              Content is svg 20 x 10 which is wider than the leader-length
          </fo:block>
          <fo:block>
            <fo:leader leader-length="36pt" leader-pattern="use-content"> </fo:leader>
            Content is " "
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks>
    <eval expected="11100" xpath="//flow/block[1]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[1]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[2]/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[3]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[3]/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[4]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[4]/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[5]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[5]/@offset"/>
    <eval expected="6000" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[6]/@ipd"/>
    <eval expected="0" xpath="//flow/block[1]/lineArea/inlineparent/inlineparent[6]/@offset"/>
    
    <eval expected="11100" xpath="//flow/block[2]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[2]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[2]/lineArea/inlineparent/@offset"/>
    <eval expected="14016" xpath="//flow/block[2]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[2]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="14016" xpath="//flow/block[2]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[2]/lineArea/inlineparent/inlineparent[2]/@offset"/>
 
    <eval expected="11100" xpath="//flow/block[3]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[3]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[3]/lineArea/inlineparent/@offset"/>
    <eval expected="4992" xpath="//flow/block[3]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="7008" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="4992" xpath="//flow/block[3]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="7008" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[2]/@offset"/>
    <eval expected="4992" xpath="//flow/block[3]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="7008" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[3]/@ipd"/>
    <eval expected="0" xpath="//flow/block[3]/lineArea/inlineparent/inlineparent[3]/@offset"/>
 
    <eval expected="11100" xpath="//flow/block[4]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[4]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[4]/lineArea/inlineparent/@offset"/>
    <eval expected="5332" xpath="//flow/block[4]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="6668" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[1]/inlineparent/@bap"/>
    <eval expected="5332" xpath="//flow/block[4]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="6668" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[2]/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[2]/inlineparent/@bap"/>
    <eval expected="5332" xpath="//flow/block[4]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="6668" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[3]/@ipd"/>
    <eval expected="0" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[3]/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[4]/lineArea/inlineparent/inlineparent[3]/inlineparent/@bap"/>
 
    <eval expected="11100" xpath="//flow/block[5]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[5]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/@offset"/>
    <eval expected="2992" xpath="//flow/block[5]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="9008" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="2739" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[1]/inlineparent/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[1]/inlineparent/@bap"/>
    <eval expected="2992" xpath="//flow/block[5]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="9008" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[2]/@offset"/>
    <eval expected="2739" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[2]/inlineparent/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[2]/inlineparent/@bap"/>
    <eval expected="2992" xpath="//flow/block[5]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="9008" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/@ipd"/>
    <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/@offset"/>
    <eval expected="2739" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/inlineparent/@offset"/>
    <eval expected="1000 1000 1000 1000" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/inlineparent/@bap"/>
 
    <eval expected="11100" xpath="//flow/block[6]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[6]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/@offset"/>
    <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/>
    <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/viewport/@bap"/>
    <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/@ipd"/>
    <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/@offset"/>
    <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/viewport/@offset"/>
    <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/viewport/@bap"/>
    <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/>
    <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/@ipd"/>
    <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/@offset"/>
    <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/viewport/@offset"/>
    <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/viewport/@bap"/>
 
    <eval expected="11100" xpath="//flow/block[7]/lineArea/@bpd"/>
    <eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/@ipd"/>
    <eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/@offset"/>
    <eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@offset"/>
    <eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@ipd"/>
    <eval expected="-1384" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/>

    <eval expected="11100" xpath="//flow/block[8]/lineArea/@bpd"/>
    <eval expected="36000" xpath="//flow/block[8]/lineArea/space[1]/@ipd"/>
    <eval expected="0" xpath="//flow/block[8]/lineArea/space[1]/@offset"/>
  </checks>
</testcase>
