diff options
6 files changed, 261 insertions, 412 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 422ebecf6..dfe2e7fa3 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -37,6 +37,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FormattingResults; +import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.extensions.ExtensionAttachment; import org.apache.fop.fo.pagination.PageSequence; @@ -265,15 +266,21 @@ public class AreaTreeHandler extends FOEventHandler { } } - /** @see org.apache.fop.fo.FOEventHandler */ - public void startPageSequence(PageSequence pageSequence) { - rootFObj = pageSequence.getRoot(); - // finish the previous pageSequence (handle force-page-count) + /** + * finish the previous pageSequence + */ + private void finishPrevPageSequence(Numeric initialPageNumber) { if (prevPageSeqLM != null) { - prevPageSeqLM.doForcePageCount(pageSequence.getInitialPageNumber()); + prevPageSeqLM.doForcePageCount(initialPageNumber); prevPageSeqLM.finishPageSequence(); prevPageSeqLM = null; } + } + + /** @see org.apache.fop.fo.FOEventHandler */ + public void startPageSequence(PageSequence pageSequence) { + rootFObj = pageSequence.getRoot(); + finishPrevPageSequence(pageSequence.getInitialPageNumber()); pageSequence.initPageNumber(); //extension attachments from fo:root wrapAndAddExtensionAttachments(rootFObj.getExtensionAttachments()); @@ -339,11 +346,7 @@ public class AreaTreeHandler extends FOEventHandler { */ public void endDocument() throws SAXException { - // finish the last pageSequence - if (prevPageSeqLM != null) { - prevPageSeqLM.finishPageSequence(); - prevPageSeqLM = null; - } + finishPrevPageSequence(null); // process fo:bookmark-tree BookmarkTree bookmarkTree = rootFObj.getBookmarkTree(); if (bookmarkTree != null) { diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index a7c6c7b6a..71b319f7e 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -893,8 +893,10 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { } - /* - * check if the page-number of the last page suits to the force-page-count property + /** + * Act upon the force-page-count trait, + * in relation to the initial-page-number trait of the following page-sequence. + * @param nextPageSeqInitialPageNumber initial-page-number trait of next page-sequence */ public void doForcePageCount(Numeric nextPageSeqInitialPageNumber) { @@ -913,7 +915,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { // if force-page-count is auto then set the value of forcePageCount // depending on the initial-page-number of the next page-sequence - if (forcePageCount == Constants.EN_AUTO) { + if (nextPageSeqInitialPageNumber != null && forcePageCount == Constants.EN_AUTO) { if (nextPageSeqInitialPageNumber.getEnum() != 0) { // auto | auto-odd | auto-even int nextPageSeqPageNumberType = nextPageSeqInitialPageNumber.getEnum(); diff --git a/status.xml b/status.xml index 0befa8487..3a5574b41 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ <changes> <release version="FOP Trunk"> + <action context="Code" dev="SP" type="update" fixes-bug="38087" + due-to="Gerhard Oettl"> + Implement force-page-count property of page-sequence. + </action> <action context="Code" dev="JM" type="fix" fixes-bug="38054"> Bugfix: Spans that end up with a negative height don't get swallowed anymore. </action> diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml deleted file mode 100644 index dea51ad4b..000000000 --- a/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml +++ /dev/null @@ -1,399 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright 2006 The Apache Software Foundation - - Licensed 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 the force-page-count property. See bug 38087. - </p> - </info> - <fo> - <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> - <fo:layout-master-set> - - <fo:simple-page-master master-name="defaultpage" - page-height="29.7cm" page-width="21cm"> - <fo:region-body region-name="text" - margin-top="3cm" margin-bottom="3cm" - margin-left="3cm" margin-right="3cm"/> - <fo:region-before region-name="header" - extent="2.5cm" display-align="after"/> - <fo:region-after region-name="footer" - extent="2.5cm" display-align="after"/> - <fo:region-start extent="3cm"/> - <fo:region-end extent="2cm"/> - </fo:simple-page-master> - <fo:simple-page-master master-name="emptypage" - page-height="29.7cm" page-width="21cm"> - <fo:region-body region-name="text" - margin-top="3cm" margin-bottom="3cm" - margin-left="3cm" margin-right="3cm"/> - </fo:simple-page-master> - <fo:page-sequence-master master-name="defaultsequence"> - <fo:repeatable-page-master-alternatives> - <fo:conditional-page-master-reference - blank-or-not-blank="blank" master-reference="defaultpage"/> - <fo:conditional-page-master-reference - blank-or-not-blank="not-blank" master-reference="defaultpage"/> - </fo:repeatable-page-master-alternatives> - </fo:page-sequence-master> - </fo:layout-master-set> - - <fo:page-sequence master-reference="defaultsequence"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 1. Pageseq: ends odd, [#] / auto / next is auto-even -> nothing - </fo:block> - <fo:block> - expl: ends on {odd|even}, {odd,even} number of pages # / force-page-count / initial-page-number -> action - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 2. Pageseq: ends even, [#] / auto / next is auto-even -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 3. Pageseq: ends even, [#] / auto / next is auto-odd -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 4. Pageseq: ends odd, [#] / auto / next is auto-odd -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 5. Pageseq: ends odd, [#] / auto / next is auto-even -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 6. Pageseq: ends even, [#] / auto / next is numeric even -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="20"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 5. Pageseq: ends even, [#] / auto / next is numeric even -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="24"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 6. Pageseq: ends even, [#] / auto / next is numeric odd -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="31"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 7. Pageseq: ends odd, [#] / auto / next is numeric odd -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="35" - force-page-count="end-on-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 101. Pageseq: ends odd, [#] / end-on-even/ [next is auto] -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="end-on-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 102a. Pageseq: see next page - </fo:block> - <fo:block break-before="page"> - 102b. Pageseq: ends even, [#] / end-on-even/ [next is auto] -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="end-on-odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 103. Pageseq: ends odd, [#] / end-on-odd/ [next is auto] -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="end-on-odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 104. Pageseq: ends even, [#] / end-on-odd/ [next is auto] -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 201. Pageseq: [ends], odd # / even / [next is auto] -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 202a. Pageseq: see next page - </fo:block> - <fo:block break-before="page"> - 13b. Pageseq: [ends], even # / even / [next is auto] -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 203. Pageseq: [ends], odd # / odd / [next is auto] -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="odd"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 204a. Pageseq: see next page - </fo:block> - <fo:block break-before="page"> - 204b. Pageseq: [ends], even # / odd / [next is auto] -> addpage - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - force-page-count="no-force"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 301. Pageseq: ends even, [#] / no-force / next is auto-even -> nothing - </fo:block> - <fo:block> - Only to show the possibility of missing pagenumbers for - force-page-count="no-force". - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence" - initial-page-number="auto-even"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 302. Pageseq: dont matter, dont matter # / auto / next is auto -> nothing - </fo:block> - </fo:flow> - </fo:page-sequence> - - <fo:page-sequence master-reference="defaultsequence"> - <fo:static-content flow-name="header"> - <fo:block text-align-last="end"> - <fo:page-number/> - </fo:block> - </fo:static-content> - <fo:flow flow-name="text" font-family="Times Roman" font-size="12pt"> - <fo:block> - 999. Pageseq: dont matter, auto / no next - </fo:block> - </fo:flow> - </fo:page-sequence> - - </fo:root> - </fo> - <checks> - <eval expected="1" xpath="//pageSequence[1]/pageViewport[1]/@nr"/> - <eval expected="2" xpath="//pageSequence[2]/pageViewport[1]/@nr"/> - <eval expected="3" xpath="//pageSequence[2]/pageViewport[2]/@nr"/> - <eval expected="4" xpath="//pageSequence[3]/pageViewport[1]/@nr"/> - <eval expected="5" xpath="//pageSequence[4]/pageViewport[1]/@nr"/> - <eval expected="6" xpath="//pageSequence[4]/pageViewport[2]/@nr"/> - <eval expected="7" xpath="//pageSequence[5]/pageViewport[1]/@nr"/> - <eval expected="8" xpath="//pageSequence[6]/pageViewport[1]/@nr"/> - <eval expected="9" xpath="//pageSequence[6]/pageViewport[2]/@nr"/> - <eval expected="20" xpath="//pageSequence[7]/pageViewport[1]/@nr"/> - <eval expected="21" xpath="//pageSequence[7]/pageViewport[2]/@nr"/> - <eval expected="24" xpath="//pageSequence[8]/pageViewport[1]/@nr"/> - <eval expected="31" xpath="//pageSequence[9]/pageViewport[1]/@nr"/> - <eval expected="32" xpath="//pageSequence[9]/pageViewport[2]/@nr"/> - <eval expected="35" xpath="//pageSequence[10]/pageViewport[1]/@nr"/> - <eval expected="36" xpath="//pageSequence[10]/pageViewport[2]/@nr"/> - <eval expected="37" xpath="//pageSequence[11]/pageViewport[1]/@nr"/> - <eval expected="38" xpath="//pageSequence[11]/pageViewport[2]/@nr"/> - <eval expected="39" xpath="//pageSequence[12]/pageViewport[1]/@nr"/> - <eval expected="40" xpath="//pageSequence[13]/pageViewport[1]/@nr"/> - <eval expected="41" xpath="//pageSequence[13]/pageViewport[2]/@nr"/> - <eval expected="42" xpath="//pageSequence[14]/pageViewport[1]/@nr"/> - <eval expected="43" xpath="//pageSequence[14]/pageViewport[2]/@nr"/> - <eval expected="44" xpath="//pageSequence[15]/pageViewport[1]/@nr"/> - <eval expected="45" xpath="//pageSequence[15]/pageViewport[2]/@nr"/> - <eval expected="46" xpath="//pageSequence[16]/pageViewport[1]/@nr"/> - <eval expected="47" xpath="//pageSequence[17]/pageViewport[1]/@nr"/> - <eval expected="48" xpath="//pageSequence[17]/pageViewport[2]/@nr"/> - <eval expected="49" xpath="//pageSequence[17]/pageViewport[3]/@nr"/> - <eval expected="50" xpath="//pageSequence[18]/pageViewport[1]/@nr"/> - <eval expected="52" xpath="//pageSequence[19]/pageViewport[1]/@nr"/> - <eval expected="53" xpath="//pageSequence[20]/pageViewport[1]/@nr"/> - <!-- blank pages, only the folio --> - <eval expected="3" xpath="//pageSequence[2]/pageViewport[2]"/> - <eval expected="6" xpath="//pageSequence[4]/pageViewport[2]"/> - <eval expected="9" xpath="//pageSequence[6]/pageViewport[2]"/> - <eval expected="21" xpath="//pageSequence[7]/pageViewport[2]"/> - <eval expected="32" xpath="//pageSequence[9]/pageViewport[2]"/> - <eval expected="36" xpath="//pageSequence[10]/pageViewport[2]"/> - <eval expected="41" xpath="//pageSequence[13]/pageViewport[2]"/> - <eval expected="43" xpath="//pageSequence[14]/pageViewport[2]"/> - <eval expected="49" xpath="//pageSequence[17]/pageViewport[3]"/> - <!-- formatting results --> - <result expected="32" property="pagecount"/> - </checks> -</testcase> diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml new file mode 100644 index 000000000..4673fa97c --- /dev/null +++ b/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2006 The Apache Software Foundation + + Licensed 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 the behaviour of the force-page-count property + when set to auto and it depends therefore on the value of + initial-page-number of the following page-sequence. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <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"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage001</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="auto-even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage002</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="auto-even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage004</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="auto-odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage005</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="auto-odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage007</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="100"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage100</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="104"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage104</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="111"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage111</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="115"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage115</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'onpage001')]/ancestor::pageViewport/@nr"/> + <eval expected="2" xpath="//lineArea[starts-with(., 'onpage002')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=3])"/> + <eval expected="4" xpath="//lineArea[starts-with(., 'onpage004')]/ancestor::pageViewport/@nr"/> + <eval expected="5" xpath="//lineArea[starts-with(., 'onpage005')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=6]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=6])"/> + <eval expected="7" xpath="//lineArea[starts-with(., 'onpage007')]/ancestor::pageViewport/@nr"/> + <eval expected="100" xpath="//lineArea[starts-with(., 'onpage100')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=101]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=101])"/> + <eval expected="104" xpath="//lineArea[starts-with(., 'onpage104')]/ancestor::pageViewport/@nr"/> + <eval expected="111" xpath="//lineArea[starts-with(., 'onpage111')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=112]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=112])"/> + <eval expected="115" xpath="//lineArea[starts-with(., 'onpage115')]/ancestor::pageViewport/@nr"/> + <eval expected="13" xpath="count(//pageViewport)"/> + <result expected="13" property="pagecount"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml new file mode 100644 index 000000000..9476c7d6f --- /dev/null +++ b/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2006 The Apache Software Foundation + + Licensed 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 the force-page-count property for nonauto + values (end-on-even, end-on-odd, even, odd, no-force) and + shows the ignoring on the last page-sequence. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <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" + initial-page-number="201" + force-page-count="end-on-even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage201</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="end-on-even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage203</fo:block> + <fo:block break-before="page">onpage204</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="end-on-odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage205</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="end-on-odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage206</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage208</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage210</fo:block> + <fo:block break-before="page">onpage211</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage212</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="odd"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage213</fo:block> + <fo:block break-before="page">onpage214</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + force-page-count="no-force"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage216</fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal" + initial-page-number="auto-even" force-page-count="even"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>onpage218</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="201" xpath="//lineArea[starts-with(., 'onpage201')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=202]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=202])"/> + <eval expected="203" xpath="//lineArea[starts-with(., 'onpage203')]/ancestor::pageViewport/@nr"/> + <eval expected="204" xpath="//lineArea[starts-with(., 'onpage204')]/ancestor::pageViewport/@nr"/> + <eval expected="205" xpath="//lineArea[starts-with(., 'onpage205')]/ancestor::pageViewport/@nr"/> + <eval expected="206" xpath="//lineArea[starts-with(., 'onpage206')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=207]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=207])"/> + <eval expected="208" xpath="//lineArea[starts-with(., 'onpage208')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=209]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=209])"/> + <eval expected="210" xpath="//lineArea[starts-with(., 'onpage210')]/ancestor::pageViewport/@nr"/> + <eval expected="211" xpath="//lineArea[starts-with(., 'onpage211')]/ancestor::pageViewport/@nr"/> + <eval expected="212" xpath="//lineArea[starts-with(., 'onpage212')]/ancestor::pageViewport/@nr"/> + <eval expected="213" xpath="//lineArea[starts-with(., 'onpage213')]/ancestor::pageViewport/@nr"/> + <eval expected="214" xpath="//lineArea[starts-with(., 'onpage214')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=215]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=215])"/> + <eval expected="216" xpath="//lineArea[starts-with(., 'onpage216')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="count(//pageViewport[@nr=217])"/> + <eval expected="218" xpath="//lineArea[starts-with(., 'onpage218')]/ancestor::pageViewport/@nr"/> + <eval expected="0" xpath="sum(//pageViewport[@nr=219]/page/regionViewport/regionBody/mainReference/span/flow/block/@bpda)"/> + <eval expected="1" xpath="count(//pageViewport[@nr=219])"/> + <eval expected="18" xpath="count(//pageViewport)"/> + <result expected="18" property="pagecount"/> + </checks> +</testcase> |