diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2007-04-30 16:30:49 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2007-04-30 16:30:49 +0000 |
commit | 6309a4f57e2dd731c1db0844d2f8f4ff4a059468 (patch) | |
tree | 3ce3cca0034651aeebb3f0650fbf7a44198168ac /test/layoutengine/standard-testcases | |
parent | 361470baa8019e77f2942c0c0997f1f00c5f08b7 (diff) | |
download | xmlgraphics-fop-6309a4f57e2dd731c1db0844d2f8f4ff4a059468.tar.gz xmlgraphics-fop-6309a4f57e2dd731c1db0844d2f8f4ff4a059468.zip |
Bugfixes:
- NPE when break-before is set on the first row of a table with headers
- NPE when break-after is set on the last row of a table with headers or footers
- Invalid break class exception when break-after is set on the last block of a cell in the last row of a table
- double page break when break-before is set both on a table and its first row
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@533789 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/layoutengine/standard-testcases')
5 files changed, 364 insertions, 0 deletions
diff --git a/test/layoutengine/standard-testcases/table-cell_break-after_last-block.xml b/test/layoutengine/standard-testcases/table-cell_break-after_last-block.xml new file mode 100644 index 000000000..d48321813 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-cell_break-after_last-block.xml @@ -0,0 +1,66 @@ +<?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 that break-after on the last block child of a cell in the last row of a table + without headers nor footers works properly. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" + margin-top="1cm" margin-bottom="0" margin-left="1cm" margin-right="1cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table width="100%" table-layout="fixed" border-collapse="collapse" border="4pt solid black"> + <fo:table-column number-columns-repeated="2" column-width="proportional-column-width(1)"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.2 Line 1</fo:block> + <fo:block break-after="page">Cell 1.2 Line 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the table</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Two pages --> + <eval expected="2" xpath="count(//pageViewport)"/> + <!-- Line "Before the table" + table on the first page --> + <eval expected="2" xpath="count(//pageViewport[@nr=1]//flow/block)"/> + <eval expected="Before the table" xpath="//pageViewport[@nr=1]//flow/block[1]/lineArea/text[1]"/> + <!-- Line "After the table" on the second page --> + <eval expected="1" xpath="count(//pageViewport[@nr=2]//flow/block)"/> + <eval expected="After the table" xpath="//pageViewport[@nr=2]//flow/block[1]/lineArea/text[1]"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table-row_break-after_last-row-footer.xml b/test/layoutengine/standard-testcases/table-row_break-after_last-row-footer.xml new file mode 100644 index 000000000..41e7369df --- /dev/null +++ b/test/layoutengine/standard-testcases/table-row_break-after_last-row-footer.xml @@ -0,0 +1,74 @@ +<?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 that break-after on the last row of a table with footers works properly. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" + margin-top="1cm" margin-bottom="0" margin-left="1cm" margin-right="1cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table width="100%" table-layout="fixed" border-collapse="collapse" border="4pt solid black"> + <fo:table-column number-columns-repeated="2" column-width="proportional-column-width(1)"/> + <fo:table-footer> + <fo:table-row> + <fo:table-cell border="2pt solid blue"> + <fo:block>Footer 1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid blue"> + <fo:block>Footer 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-footer> + <fo:table-body> + <fo:table-row break-after="page"> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the table</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Two pages --> + <eval expected="2" xpath="count(//pageViewport)"/> + <!-- Line "Before the table" + table on the first page --> + <eval expected="2" xpath="count(//pageViewport[@nr=1]//flow/block)"/> + <eval expected="Before the table" xpath="//pageViewport[@nr=1]//flow/block[1]/lineArea/text[1]"/> + <!-- Line "After the table" on the second page --> + <eval expected="1" xpath="count(//pageViewport[@nr=2]//flow/block)"/> + <eval expected="After the table" xpath="//pageViewport[@nr=2]//flow/block[1]/lineArea/text[1]"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table-row_break-after_last-row-header.xml b/test/layoutengine/standard-testcases/table-row_break-after_last-row-header.xml new file mode 100644 index 000000000..b23ec7292 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-row_break-after_last-row-header.xml @@ -0,0 +1,74 @@ +<?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 that break-after on the last row of a table with headers works properly. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" + margin-top="1cm" margin-bottom="0" margin-left="1cm" margin-right="1cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table width="100%" table-layout="fixed" border-collapse="collapse" border="4pt solid black"> + <fo:table-column number-columns-repeated="2" column-width="proportional-column-width(1)"/> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row break-after="page"> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the table</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Two pages --> + <eval expected="2" xpath="count(//pageViewport)"/> + <!-- Line "Before the table" + table on the first page --> + <eval expected="2" xpath="count(//pageViewport[@nr=1]//flow/block)"/> + <eval expected="Before the table" xpath="//pageViewport[@nr=1]//flow/block[1]/lineArea/text[1]"/> + <!-- Line "After the table" on the second page --> + <eval expected="1" xpath="count(//pageViewport[@nr=2]//flow/block)"/> + <eval expected="After the table" xpath="//pageViewport[@nr=2]//flow/block[1]/lineArea/text[1]"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table-row_break-before_first-row-header.xml b/test/layoutengine/standard-testcases/table-row_break-before_first-row-header.xml new file mode 100644 index 000000000..f05f0096d --- /dev/null +++ b/test/layoutengine/standard-testcases/table-row_break-before_first-row-header.xml @@ -0,0 +1,74 @@ +<?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 that break-before on the first row of a table with headers works properly. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" + margin-top="1cm" margin-bottom="0" margin-left="1cm" margin-right="1cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table width="100%" table-layout="fixed" border-collapse="collapse" border="4pt solid black" table-omit-header-at-break="true"> + <fo:table-column number-columns-repeated="2" column-width="proportional-column-width(1)"/> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row break-before="page"> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the table</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Two pages --> + <eval expected="2" xpath="count(//pageViewport)"/> + <!-- Only one line on the first page --> + <eval expected="1" xpath="count(//pageViewport[@nr=1]//flow/block)"/> + <eval expected="Before the table" xpath="//pageViewport[@nr=1]//flow/block[1]/lineArea/text[1]"/> + <!-- Table plus line "After the table" on the second page --> + <eval expected="2" xpath="count(//pageViewport[@nr=2]//flow/block)"/> + <eval expected="After the table" xpath="//pageViewport[@nr=2]//flow/block[2]/lineArea/text[1]"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table_table-row_break-before.xml b/test/layoutengine/standard-testcases/table_table-row_break-before.xml new file mode 100644 index 000000000..e77ec4f65 --- /dev/null +++ b/test/layoutengine/standard-testcases/table_table-row_break-before.xml @@ -0,0 +1,76 @@ +<?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 that there is only one page break when break-before is specified both on a + table and its first row. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" + margin-top="1cm" margin-bottom="0" margin-left="1cm" margin-right="1cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table width="100%" table-layout="fixed" border-collapse="collapse" border="4pt solid black" + break-before="page"> + <fo:table-column number-columns-repeated="2" column-width="proportional-column-width(1)"/> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid blue"> + <fo:block>Header 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row break-before="page"> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="2pt solid black"> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the table</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- Two pages --> + <eval expected="2" xpath="count(//pageViewport)"/> + <!-- Only one line on the first page --> + <eval expected="1" xpath="count(//pageViewport[@nr=1]//flow/block)"/> + <eval expected="Before the table" xpath="//pageViewport[@nr=1]//flow/block[1]/lineArea/text[1]"/> + <!-- Table plus line "After the table" on the second page --> + <eval expected="2" xpath="count(//pageViewport[@nr=2]//flow/block)"/> + <eval expected="After the table" xpath="//pageViewport[@nr=2]//flow/block[2]/lineArea/text[1]"/> + </checks> +</testcase> |