<?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 painting of borders and border-style.
    </p>
	</info>
	<fo>
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<fo:simple-page-master master-name="a4" page-width="210mm" page-height="297mm">
					<fo:region-body margin-top="100mm" margin-bottom="100mm"/>
				</fo:simple-page-master>
			</fo:layout-master-set>
			<fo:page-sequence master-reference="a4">
				<fo:flow flow-name="xsl-region-body">
					<fo:block>
						<fo:block>Following Table has border-width.conditionality="discard"</fo:block>
						<fo:table border-style="solid" border-width="1pt" border-color="black" border-collapse="separate" border-before-width.conditionality="discard" border-after-width.conditionality="discard">
							<fo:table-column column-width="50%"/>
							<fo:table-column column-width="50%"/>
							<fo:table-body>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>1-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>1-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>2-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>2-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>3-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>3-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>4-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>4-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>5-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>5-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>6-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>6-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>7-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>7-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>8-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>8-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</fo:table-body>
						</fo:table>
						<fo:block>Next Table has border.conditionality="retain"</fo:block>
						<fo:table border-style="solid" border-width="1pt" border-color="black" border-collapse="separate" border-before-width.conditionality="retain" border-after-width.conditionality="retain">
							<fo:table-column column-width="50%"/>
							<fo:table-column column-width="50%"/>
							<fo:table-body>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>1-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>1-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>2-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>2-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>3-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>3-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>4-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>4-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>5-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>5-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>6-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>6-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>7-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>7-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
								<fo:table-row height="20mm">
									<fo:table-cell>
										<fo:block>8-1</fo:block>
									</fo:table-cell>
									<fo:table-cell>
										<fo:block>8-2</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</fo:table-body>
						</fo:table>
					</fo:block>
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</fo>
	<checks>
		<!-- page1 test: table should have before border but not after border-->
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/@border-before"/>
		<eval expected="(none,#000000,0)" xpath="//pageSequence/pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/@border-after"/>
		<!-- page2 test: table should have after but not before -->
		<eval expected="(none,#000000,0)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-before"/>
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-after"/>	
		<!-- page3 test: table should have both before and after border -->
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-before"/>
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-after"/>	
		<!-- page4 test: table should have both before and after border -->			
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-before"/>
		<eval expected="(solid,#000000,1000)" xpath="//pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/@border-after"/>			
	</checks>
</testcase>
