diff options
author | Manuel Mall <manuel@apache.org> | 2006-04-08 07:17:59 +0000 |
---|---|---|
committer | Manuel Mall <manuel@apache.org> | 2006-04-08 07:17:59 +0000 |
commit | ed8109d21bf00f54b3aaee0a0c51f779be31c950 (patch) | |
tree | fa0a67aa81af30fd6801259785d0161fab24dde6 /test | |
parent | a2fb12dbc072c9a89848a0977e9859f8a374863e (diff) | |
download | xmlgraphics-fop-ed8109d21bf00f54b3aaee0a0c51f779be31c950.tar.gz xmlgraphics-fop-ed8109d21bf00f54b3aaee0a0c51f779be31c950.zip |
Fixed various white space (non)removal issues during line building. white-space-treatment is now supported properly especially for the "preserve" case.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@392488 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
7 files changed, 308 insertions, 62 deletions
diff --git a/test/fotree/testcases/white-space_shorthand-expansion.fo b/test/fotree/testcases/white-space_shorthand-expansion.fo index b7b094738..427d76637 100644 --- a/test/fotree/testcases/white-space_shorthand-expansion.fo +++ b/test/fotree/testcases/white-space_shorthand-expansion.fo @@ -37,7 +37,7 @@ <test:assert property="wrap-option" expected="NO_WRAP" /> Block 2: testing white-space="pre" </fo:block> - <fo:block white-space="no-wrap"> + <fo:block white-space="nowrap"> <test:assert property="linefeed-treatment" expected="TREAT_AS_SPACE" /> <test:assert property="white-space-treatment" expected="IGNORE_IF_SURROUNDING_LINEFEED" /> <test:assert property="white-space-collapse" expected="TRUE" /> diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml index 7bf010018..cd9b71f86 100644 --- a/test/layoutengine/disabled-testcases.xml +++ b/test/layoutengine/disabled-testcases.xml @@ -64,18 +64,6 @@ in case of text-align="justify".</description> </testcase> <testcase> - <name>block white-space-treatment 1</name> - <file>block_white-space-treatment_1.xml</file> - <description>White space around formatter generated linebreaks is - not removed correctly.</description> - </testcase> - <testcase> - <name>block white-space-treatment 2</name> - <file>block_white-space-treatment_2.xml</file> - <description>White space around formatter generated linebreaks is - not removed correctly.</description> - </testcase> - <testcase> <name>block word-spacing</name> <file>block_word-spacing.xml</file> <description>Word-spacing may not work as expected.</description> diff --git a/test/layoutengine/standard-testcases/block_text-align_3.xml b/test/layoutengine/standard-testcases/block_text-align_3.xml new file mode 100755 index 000000000..e79e1218b --- /dev/null +++ b/test/layoutengine/standard-testcases/block_text-align_3.xml @@ -0,0 +1,144 @@ +<?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 text-align and text-align-last with + white-space-collapse="false". + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" page-height="10in" page-width="5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="simple" white-space-collapse="false"> + <fo:flow flow-name="xsl-region-body"> + <fo:block> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="start" background-color="yellow"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="justify"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="center" background-color="yellow"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="end"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="justify" text-align-last="center" background-color="yellow"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + <fo:block text-align="justify" text-align-last="end"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi suscipit, risus ac congue suscipit, tortor nibh cursus mauris, quis feugiat nunc ante sit amet ante. </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- default settings for text-align --> + <true xpath="not(boolean(//flow/block[1]/lineArea[1]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[1]/lineArea[2]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[1]/lineArea[3]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[1]/lineArea[4]/@start-indent))"/> + <true xpath="//flow/block[1]/lineArea[1]/text/@ipd != //flow/block[1]/lineArea[2]/text/@ipd"/> + <true xpath="//flow/block[1]/lineArea[2]/text/@ipd != //flow/block[1]/lineArea[3]/text/@ipd"/> + <true xpath="//flow/block[1]/lineArea[3]/text/@ipd != //flow/block[1]/lineArea[4]/text/@ipd"/> + + <!-- text-align="start" --> + <true xpath="not(boolean(//flow/block[2]/lineArea[1]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[2]/lineArea[2]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[2]/lineArea[3]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[2]/lineArea[4]/@start-indent))"/> + <true xpath="//flow/block[2]/lineArea[1]/text/@ipd != //flow/block[2]/lineArea[2]/text/@ipd"/> + <true xpath="//flow/block[2]/lineArea[2]/text/@ipd != //flow/block[2]/lineArea[3]/text/@ipd"/> + <true xpath="//flow/block[2]/lineArea[3]/text/@ipd != //flow/block[2]/lineArea[4]/text/@ipd"/> + + <!-- block 1 and 2 must have the same result --> + <true xpath="//flow/block[1]/lineArea[1]/text/@ipd = //flow/block[2]/lineArea[1]/text/@ipd"/> + <true xpath="//flow/block[1]/lineArea[2]/text/@ipd = //flow/block[2]/lineArea[2]/text/@ipd"/> + <true xpath="//flow/block[1]/lineArea[3]/text/@ipd = //flow/block[2]/lineArea[3]/text/@ipd"/> + <true xpath="//flow/block[1]/lineArea[4]/text/@ipd = //flow/block[2]/lineArea[4]/text/@ipd"/> + + <!-- text-align="justify" --> + <true xpath="not(boolean(//flow/block[3]/lineArea[1]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[3]/lineArea[2]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[3]/lineArea[3]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[3]/lineArea[4]/@start-indent))"/> + <!-- Some tolerance seems to be necessary here. Why is that exactly? --> + <true xpath="(360000 - //flow/block[3]/lineArea[1]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[3]/lineArea[1]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[3]/lineArea[2]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[3]/lineArea[2]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[3]/lineArea[3]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[3]/lineArea[3]/text/@ipd) > -3000"/> + <true xpath="//flow/block[4]/lineArea[3]/text/@ipd < 350000"/> + + <!-- text-align="center" --> + <true xpath="//flow/block[4]/lineArea[1]/@start-indent > 10000"/> + <true xpath="//flow/block[4]/lineArea[2]/@start-indent > 10000"/> + <true xpath="//flow/block[4]/lineArea[3]/@start-indent > 10000"/> + <true xpath="//flow/block[4]/lineArea[4]/@start-indent > 10000"/> + <!-- Some tolerance seems to be necessary here. Why is that exactly? --> + <true xpath="(360000 - //flow/block[4]/lineArea[1]/text/@ipd - (2 * //flow/block[4]/lineArea[1]/@start-indent)) < 4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[1]/text/@ipd - (2 * //flow/block[4]/lineArea[1]/@start-indent)) > -4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[2]/text/@ipd - (2 * //flow/block[4]/lineArea[2]/@start-indent)) < 4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[2]/text/@ipd - (2 * //flow/block[4]/lineArea[2]/@start-indent)) > -4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[3]/text/@ipd - (2 * //flow/block[4]/lineArea[3]/@start-indent)) < 4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[3]/text/@ipd - (2 * //flow/block[4]/lineArea[3]/@start-indent)) > -4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[4]/text/@ipd - (2 * //flow/block[4]/lineArea[4]/@start-indent)) < 4000"/> + <true xpath="(360000 - //flow/block[4]/lineArea[4]/text/@ipd - (2 * //flow/block[4]/lineArea[4]/@start-indent)) > -4000"/> + + <!-- text-align="end" --> + <true xpath="//flow/block[5]/lineArea[1]/@start-indent > 10000"/> + <true xpath="//flow/block[5]/lineArea[2]/@start-indent > 10000"/> + <true xpath="//flow/block[5]/lineArea[3]/@start-indent > 10000"/> + <true xpath="//flow/block[5]/lineArea[4]/@start-indent > 10000"/> + <!-- Some tolerance seems to be necessary here. Why is that exactly? --> + <true xpath="(360000 - //flow/block[5]/lineArea[1]/text/@ipd - //flow/block[5]/lineArea[1]/@start-indent) < 4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[1]/text/@ipd - //flow/block[5]/lineArea[1]/@start-indent) > -4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[2]/text/@ipd - //flow/block[5]/lineArea[2]/@start-indent) < 4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[2]/text/@ipd - //flow/block[5]/lineArea[2]/@start-indent) > -4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[3]/text/@ipd - //flow/block[5]/lineArea[3]/@start-indent) < 4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[3]/text/@ipd - //flow/block[5]/lineArea[3]/@start-indent) > -4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[4]/text/@ipd - //flow/block[5]/lineArea[4]/@start-indent) < 4000"/> + <true xpath="(360000 - //flow/block[5]/lineArea[4]/text/@ipd - //flow/block[5]/lineArea[4]/@start-indent) > -4000"/> + + <!-- text-align="justify" text-align-last="center" --> + <true xpath="not(boolean(//flow/block[6]/lineArea[1]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[6]/lineArea[2]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[6]/lineArea[3]/@start-indent))"/> + <true xpath="//flow/block[6]/lineArea[4]/@start-indent > 10000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[1]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[1]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[2]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[2]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[3]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[3]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[4]/text/@ipd - (2 * //flow/block[6]/lineArea[4]/@start-indent)) < 4000"/> + <true xpath="(360000 - //flow/block[6]/lineArea[4]/text/@ipd - (2 * //flow/block[6]/lineArea[4]/@start-indent)) > -4000"/> + + <!-- text-align="justify" text-align-last="end" --> + <true xpath="not(boolean(//flow/block[7]/lineArea[1]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[7]/lineArea[2]/@start-indent))"/> + <true xpath="not(boolean(//flow/block[7]/lineArea[3]/@start-indent))"/> + <true xpath="//flow/block[7]/lineArea[4]/@start-indent > 10000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[1]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[1]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[2]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[2]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[3]/text/@ipd) < 3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[3]/text/@ipd) > -3000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[4]/text/@ipd - //flow/block[7]/lineArea[4]/@start-indent) < 4000"/> + <true xpath="(360000 - //flow/block[7]/lineArea[4]/text/@ipd - //flow/block[7]/lineArea[4]/@start-indent) > -4000"/> + + <!-- TODO Check element list --> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml b/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml index cf5f4cc0d..cf1bb7ac2 100644 --- a/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml +++ b/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-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. @@ -19,8 +19,6 @@ <info> <p> This test checks basic white space handling for white-space-collapse="false". - The test currently fails because white space around formatter generated - linebreaks is not removed correctly. </p> </info> <fo> @@ -101,7 +99,43 @@ </fo:root> </fo> <checks> - <!-- The tests are currently incomplete but enough to fail --> - <eval expected="60" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/> + <eval expected="5" xpath="count(//flow/block[1]/lineArea[1]/text[1]/word)"/> + <eval expected="60" xpath="count(//flow/block[1]/lineArea[1]/text[1]/space)"/> + <eval expected="1" xpath="count(//flow/block[1]/lineArea[2]/text[1]/word)"/> + <eval expected="2" xpath="count(//flow/block[1]/lineArea[2]/text[1]/space)"/> + + <eval expected="3" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/word)"/> + <eval expected="2" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/space)"/> + <eval expected="3" xpath="count(//flow/block[2]/block[2]/lineArea[1]/text/word)"/> + <eval expected="2" xpath="count(//flow/block[2]/block[2]/lineArea[1]/text/space)"/> + + <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[1]/text/word)"/> + <eval expected="16" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[1]/text/space)"/> + <eval expected="13" xpath="count(//flow/block[3]/lineArea[1]/text[1]/space)"/> + <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[2]/text/word)"/> + <eval expected="16" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[2]/text/space)"/> + + <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[1]/word)"/> + <eval expected="16" xpath="count(//flow/block[4]/lineArea[1]/text[1]/space)"/> + <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[1]/text/word)"/> + <eval expected="31" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[1]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[4]/lineArea[1]/text[2]/word)"/> + <eval expected="13" xpath="count(//flow/block[4]/lineArea[1]/text[2]/space)"/> + + <eval expected="2" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/text/word)"/> + <eval expected="18" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/text/space)"/> + <eval expected="3" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/> + <eval expected="17" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/> + + <eval expected="3" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/> + <eval expected="19" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/> + <eval expected="2" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/text/word)"/> + <eval expected="16" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/text/space)"/> + + <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/text[1]/word)"/> + <eval expected="14" xpath="count(//flow/block[7]/lineArea[1]/text[1]/space)"/> + <eval expected="15" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/text[1]/space)"/> + <eval expected="3" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/> + <eval expected="36" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/block_white-space-treatment_1.xml b/test/layoutengine/standard-testcases/block_white-space-treatment_1.xml index 9678d230a..ddc2bcadd 100644 --- a/test/layoutengine/standard-testcases/block_white-space-treatment_1.xml +++ b/test/layoutengine/standard-testcases/block_white-space-treatment_1.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-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. @@ -20,8 +20,6 @@ <p> This test checks white space handling for white-space-treatment with white-space-collapse="true". - The test currently fails because white space around formatter generated - linebreaks is not removed correctly. </p> </info> <fo> @@ -63,23 +61,20 @@ </fo:root> </fo> <checks> - <!-- The tests are currently incomplete but enough to fail --> <eval expected="3" xpath="count(//flow/block[1]/lineArea[1]/text/word)"/> <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/> <eval expected="1" xpath="count(//flow/block[2]/lineArea[1]/text/word)"/> <eval expected="0" xpath="count(//flow/block[2]/lineArea[1]/text/space)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[1]/text)"/> - <eval expected="1" xpath="count(//flow/block[3]/lineArea[2]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[2]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[3]/lineArea[3]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[3]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[3]/lineArea[4]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[4]/text/space)"/> + <eval expected="3" xpath="count(//flow/block[3]/lineArea[1]/text/word)"/> + <eval expected="4" xpath="count(//flow/block[3]/lineArea[1]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[4]/lineArea[1]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[4]/lineArea[1]/text/space)"/> + <eval expected="3" xpath="count(//flow/block[4]/lineArea[1]/text/word)"/> + <eval expected="3" xpath="count(//flow/block[4]/lineArea[1]/text/space)"/> + + <eval expected="3" xpath="count(//flow/block[5]/lineArea[1]/text/word)"/> + <eval expected="3" xpath="count(//flow/block[5]/lineArea[1]/text/space)"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/block_white-space-treatment_2.xml b/test/layoutengine/standard-testcases/block_white-space-treatment_2.xml index fbd993d5b..4efd89209 100644 --- a/test/layoutengine/standard-testcases/block_white-space-treatment_2.xml +++ b/test/layoutengine/standard-testcases/block_white-space-treatment_2.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-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. @@ -18,10 +18,8 @@ <testcase> <info> <p> - This test checks white space handling for white-space-treatment. - with white-spcae-collapse="false". - The test currently fails because white space around formatter generated - linebreaks is not removed correctly. + This test checks white space handling for white-space-treatment + with white-space-collapse="false". </p> </info> <fo> @@ -34,52 +32,64 @@ <fo:page-sequence master-reference="normal" white-space-collapse="false"> <fo:flow flow-name="xsl-region-body"> <fo:block white-space-treatment="ignore-if-surrounding-linefeed" background-color="silver" margin="1pt 0pt 1pt 0pt"> - ignore-if-surrounding-linefeed - all - spaces + ignore-if-surrounding-linefeed + all + spaces </fo:block> <fo:block white-space-treatment="ignore" background-color="silver" margin="1pt 0pt 1pt 0pt"> - ignore - all - spaces + ignore + all + spaces </fo:block> <fo:block white-space-treatment="preserve" background-color="silver" margin="1pt 0pt 1pt 0pt"> - preserve - all - spaces + preserve + all + spaces </fo:block> <fo:block white-space-treatment="ignore-if-before-linefeed" background-color="silver" margin="1pt 0pt 1pt 0pt"> - ignore-if-before-linefeed - all - spaces + ignore-if-before-linefeed + all + spaces </fo:block> <fo:block white-space-treatment="ignore-if-after-linefeed" background-color="silver" margin="1pt 0pt 1pt 0pt"> - ignore-if-after-linefeed - all - spaces + ignore-if-after-linefeed + all + spaces </fo:block> </fo:flow> </fo:page-sequence> </fo:root> </fo> <checks> - <!-- The tests are currently incomplete but enough to fail --> - <eval expected="3" xpath="count(//flow/block[1]/lineArea[1]/text/word)"/> - <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/> + <eval expected="2" xpath="count(//flow/block[1]/lineArea)"/> + <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text/word)"/> + <eval expected="50" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[1]/lineArea[2]/text/word)"/> + <eval expected="0" xpath="count(//flow/block[1]/lineArea[2]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[2]/lineArea)"/> <eval expected="1" xpath="count(//flow/block[2]/lineArea[1]/text/word)"/> <eval expected="0" xpath="count(//flow/block[2]/lineArea[1]/text/space)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[1]/text)"/> + <eval expected="3" xpath="count(//flow/block[3]/lineArea)"/> + <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/text/word)"/> + <eval expected="90" xpath="count(//flow/block[3]/lineArea[1]/text/space)"/> <eval expected="1" xpath="count(//flow/block[3]/lineArea[2]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[2]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[3]/lineArea[3]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[3]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[3]/lineArea[4]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[3]/lineArea[4]/text/space)"/> + <eval expected="96" xpath="count(//flow/block[3]/lineArea[2]/text/space)"/> + <eval expected="0" xpath="count(//flow/block[3]/lineArea[3]/text/word)"/> + <eval expected="38" xpath="count(//flow/block[3]/lineArea[3]/text/space)"/> - <eval expected="1" xpath="count(//flow/block[4]/lineArea[1]/text/word)"/> - <eval expected="0" xpath="count(//flow/block[4]/lineArea[1]/text/space)"/> + <eval expected="2" xpath="count(//flow/block[4]/lineArea)"/> + <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text/word)"/> + <eval expected="58" xpath="count(//flow/block[4]/lineArea[1]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[4]/lineArea[2]/text/word)"/> + <eval expected="77" xpath="count(//flow/block[4]/lineArea[2]/text/space)"/> + + <eval expected="2" xpath="count(//flow/block[5]/lineArea)"/> + <eval expected="2" xpath="count(//flow/block[5]/lineArea[1]/text/word)"/> + <eval expected="56" xpath="count(//flow/block[5]/lineArea[1]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[5]/lineArea[2]/text/word)"/> + <eval expected="72" xpath="count(//flow/block[5]/lineArea[2]/text/space)"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/block_white-space.xml b/test/layoutengine/standard-testcases/block_white-space.xml new file mode 100755 index 000000000..1bb435109 --- /dev/null +++ b/test/layoutengine/standard-testcases/block_white-space.xml @@ -0,0 +1,75 @@ +<?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 white space handling for white-space shorthand property. + </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"> + <fo:flow flow-name="xsl-region-body"> + <fo:block white-space="normal" background-color="silver" margin="1pt 0pt 1pt 0pt" text-decoration="underline"> + normal + whitespace + handling +</fo:block> + <fo:block white-space="pre" background-color="silver" margin="1pt 0pt 1pt 0pt" text-decoration="underline"> + preserve + whitespace + handling +</fo:block> + <fo:block white-space="nowrap" background-color="silver" margin="1pt 0pt 1pt 0pt" text-decoration="underline"> + nowrap + whitespace + handling + nowrap + whitespace + handling + nowrap + whitespace + handling +</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="3" xpath="count(//flow/block[1]/lineArea[1]/text/word)"/> + <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/> + + <eval expected="0" xpath="count(//flow/block[2]/lineArea[1]/text/word)"/> + <eval expected="0" xpath="count(//flow/block[2]/lineArea[1]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[2]/lineArea[2]/text/word)"/> + <eval expected="91" xpath="count(//flow/block[2]/lineArea[2]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[2]/lineArea[3]/text/word)"/> + <eval expected="89" xpath="count(//flow/block[2]/lineArea[3]/text/space)"/> + <eval expected="1" xpath="count(//flow/block[2]/lineArea[4]/text/word)"/> + <eval expected="91" xpath="count(//flow/block[2]/lineArea[4]/text/space)"/> + + <eval expected="9" xpath="count(//flow/block[3]/lineArea[1]/text/word)"/> + <eval expected="8" xpath="count(//flow/block[3]/lineArea[1]/text/space)"/> + + </checks> +</testcase> |