<?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.
-->
<testcase>
  <info>
    <p>
      Dynamic content in the middle of a page: the first variant is selected.
    </p>
  </info>
  <fo>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="page" page-height="70pt" page-width="120pt" 
          margin="10pt">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="page">
        <fo:flow flow-name="xsl-region-body" font-size="8pt" line-height="10pt">
          <fo:block>Before the multi-switch</fo:block>
          <fo:multi-switch fox:auto-toggle="select-first-fitting">
            <fo:multi-case>
              <fo:block>First variant</fo:block>
            </fo:multi-case>
            <fo:multi-case>
              <fo:block>Second variant</fo:block>
              <fo:block>Second variant</fo:block>
            </fo:multi-case>
          </fo:multi-switch>
          <fo:block>After the multi-switch</fo:block>
          <fo:block>Filler 1</fo:block>
          <fo:block>Filler 2</fo:block>
          <fo:block>This should be on page 2.</fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks>
    <eval expected="2"                   xpath="count(//pageViewport)"/>
    <eval expected="5"                   xpath="count(//pageViewport[1]//flow/block)"/>
    <eval expected="Before the multi-switch"   xpath="//pageViewport[1]//flow/block[1]"/>
    <eval expected="First variant"             xpath="//pageViewport[1]//flow/block[2]"/>
    <eval expected="After the multi-switch"    xpath="//pageViewport[1]//flow/block[3]"/>
    <eval expected="Filler 1"                  xpath="//pageViewport[1]//flow/block[4]"/>
    <eval expected="Filler 2"                  xpath="//pageViewport[1]//flow/block[5]"/>
    <eval expected="1"                   xpath="count(//pageViewport[2]//flow/block)"/>
    <eval expected="This should be on page 2." xpath="//pageViewport[2]//flow/block[1]"/>
  </checks>
</testcase>
