aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Mall <manuel@apache.org>2006-04-08 07:17:59 +0000
committerManuel Mall <manuel@apache.org>2006-04-08 07:17:59 +0000
commited8109d21bf00f54b3aaee0a0c51f779be31c950 (patch)
treefa0a67aa81af30fd6801259785d0161fab24dde6
parenta2fb12dbc072c9a89848a0977e9859f8a374863e (diff)
downloadxmlgraphics-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
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java2
-rw-r--r--src/java/org/apache/fop/fo/FOText.java11
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java53
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java158
-rw-r--r--status.xml8
-rw-r--r--test/fotree/testcases/white-space_shorthand-expansion.fo2
-rw-r--r--test/layoutengine/disabled-testcases.xml12
-rwxr-xr-xtest/layoutengine/standard-testcases/block_text-align_3.xml144
-rw-r--r--test/layoutengine/standard-testcases/block_white-space-collapse_2.xml44
-rw-r--r--test/layoutengine/standard-testcases/block_white-space-treatment_1.xml21
-rw-r--r--test/layoutengine/standard-testcases/block_white-space-treatment_2.xml72
-rwxr-xr-xtest/layoutengine/standard-testcases/block_white-space.xml75
12 files changed, 497 insertions, 105 deletions
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 06d83a37f..9597c69c8 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -2823,7 +2823,7 @@ public class FOPropertyMapping implements Constants {
m.setInherited(true);
m.addEnum("normal", getEnumProperty(EN_NORMAL, "NORMAL"));
m.addEnum("pre", getEnumProperty(EN_PRE, "PRE"));
- m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
+ m.addEnum("nowrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
m.setDefault("normal");
m.setDatatypeParser(new WhiteSpaceShorthandParser());
addPropertyMaker("white-space", m);
diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java
index 7a75f68da..d4bd5f24b 100644
--- a/src/java/org/apache/fop/fo/FOText.java
+++ b/src/java/org/apache/fop/fo/FOText.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-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.
@@ -80,6 +80,7 @@ public class FOText extends FONode {
private ColorType color;
private Property letterSpacing;
private SpaceProperty lineHeight;
+ private int whiteSpaceTreatment;
private int whiteSpaceCollapse;
private int textTransform;
private Property wordSpacing;
@@ -159,6 +160,7 @@ public class FOText extends FONode {
lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace();
letterSpacing = pList.get(Constants.PR_LETTER_SPACING);
whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum();
+ whiteSpaceTreatment = pList.get(Constants.PR_WHITE_SPACE_TREATMENT).getEnum();
textTransform = pList.get(Constants.PR_TEXT_TRANSFORM).getEnum();
wordSpacing = pList.get(Constants.PR_WORD_SPACING);
wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum();
@@ -578,6 +580,13 @@ public class FOText extends FONode {
}
/**
+ * @return the "white-space-treatment" property
+ */
+ public int getWhitespaceTreatment() {
+ return whiteSpaceTreatment;
+ }
+
+ /**
* @return the "word-spacing" property.
*/
public Property getWordSpacing() {
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index ef84d1c73..ab1079fbc 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -85,6 +85,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
hyphenationProperties = fobj.getCommonHyphenation();
hyphenationLadderCount = fobj.getHyphenationLadderCount();
wrapOption = fobj.getWrapOption();
+ whiteSpaceTreament = fobj.getWhitespaceTreatment();
//
effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast);
isFirstInBlock = (this == getParent().getChildLMs().get(0));
@@ -149,6 +150,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
private CommonHyphenation hyphenationProperties;
private Numeric hyphenationLadderCount;
private int wrapOption = EN_WRAP;
+ private int whiteSpaceTreament;
//private LayoutProps layoutProps;
private Length lineHeight;
@@ -1639,32 +1641,41 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
}
- // ignore the last element in the line if it is a KnuthGlue object
- seqIterator = seq.listIterator(iEndElement);
- tempElement = (KnuthElement) seqIterator.next();
- if (tempElement.isGlue()) {
- iEndElement--;
- // this returns the same KnuthElement
- seqIterator.previous();
- if (seqIterator.hasPrevious()) {
- tempElement = (KnuthElement) seqIterator.previous();
- } else {
- tempElement = null;
+ // Remove trailing spaces if allowed so
+ if (whiteSpaceTreament == EN_IGNORE_IF_SURROUNDING_LINEFEED
+ || whiteSpaceTreament == EN_IGNORE
+ || whiteSpaceTreament == EN_IGNORE_IF_BEFORE_LINEFEED) {
+ // ignore the last element in the line if it is a KnuthGlue object
+ seqIterator = seq.listIterator(iEndElement);
+ tempElement = (KnuthElement) seqIterator.next();
+ if (tempElement.isGlue()) {
+ iEndElement--;
+ // this returns the same KnuthElement
+ seqIterator.previous();
+ if (seqIterator.hasPrevious()) {
+ tempElement = (KnuthElement) seqIterator.previous();
+ } else {
+ tempElement = null;
+ }
+ }
+ if (tempElement != null) {
+ lastLM = tempElement.getLayoutManager();
}
- }
- if (tempElement != null) {
- lastLM = tempElement.getLayoutManager();
}
- // ignore KnuthGlue and KnuthPenalty objects
- // at the beginning of the line
- seqIterator = seq.listIterator(iStartElement);
- tempElement = (KnuthElement) seqIterator.next();
- while (!tempElement.isBox() && seqIterator.hasNext()) {
+ // Remove leading spaces if allowed so
+ if (whiteSpaceTreament == EN_IGNORE_IF_SURROUNDING_LINEFEED
+ || whiteSpaceTreament == EN_IGNORE
+ || whiteSpaceTreament == EN_IGNORE_IF_AFTER_LINEFEED) {
+ // ignore KnuthGlue and KnuthPenalty objects
+ // at the beginning of the line
+ seqIterator = seq.listIterator(iStartElement);
tempElement = (KnuthElement) seqIterator.next();
- iStartElement++;
+ while (!tempElement.isBox() && seqIterator.hasNext()) {
+ tempElement = (KnuthElement) seqIterator.next();
+ iStartElement++;
+ }
}
-
// Add the inline areas to lineArea
PositionIterator inlinePosIter
= new KnuthPossPosIter(seq, iStartElement, iEndElement + 1);
diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index e7190797c..1582ea30d 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -25,6 +25,7 @@ import java.util.ListIterator;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fonts.Font;
@@ -438,11 +439,13 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
for (int i = firstIndex; i <= lastIndex; i++) {
areaInfo = (AreaInfo) vecAreaInfo.get(i);
if (areaInfo.isSpace) {
- // areaInfo stores information about a space
- // add a space to the TextArea
- char spaceChar = textArray[areaInfo.iStartIndex];
- textArea.addSpace(spaceChar, 0,
- CharUtilities.isAdjustableSpace(spaceChar));
+ // areaInfo stores information about spaces
+ // add the spaces to the TextArea
+ for (int j = areaInfo.iStartIndex; j < areaInfo.iBreakIndex; j++) {
+ char spaceChar = textArray[j];
+ textArea.addSpace(spaceChar, 0,
+ CharUtilities.isAdjustableSpace(spaceChar));
+ }
} else {
// areaInfo stores information about a word fragment
if (wordStartIndex == -1) {
@@ -529,9 +532,29 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
while (iNextStart < textArray.length) {
char ch = textArray[iNextStart];
- if (ch == CharUtilities.SPACE
- || ch == CharUtilities.NBSPACE) {
- // normal space or non-breaking space:
+ if (ch == CharUtilities.SPACE
+ && foText.getWhitespaceTreatment() != Constants.EN_PRESERVE) {
+ // normal non preserved space - collect them all
+ // advance to the next character
+ iThisStart = iNextStart;
+ iNextStart++;
+ while (iNextStart < textArray.length
+ && textArray[iNextStart] == CharUtilities.SPACE) {
+ iNextStart++;
+ }
+ // create the AreaInfo object
+ ai = new AreaInfo(iThisStart, (short) (iNextStart),
+ (short) (iNextStart - iThisStart), (short) 0,
+ MinOptMax.multiply(wordSpaceIPD, iNextStart - iThisStart),
+ false, true);
+ vecAreaInfo.add(ai);
+
+ // create the elements
+ sequence.addAll
+ (createElementsForASpace(alignment, ai, vecAreaInfo.size() - 1));
+
+ } else if (ch == CharUtilities.SPACE || ch == CharUtilities.NBSPACE) {
+ // preserved space or non-breaking space:
// create the AreaInfo object
ai = new AreaInfo(iNextStart, (short) (iNextStart + 1),
(short) 1, (short) 0,
@@ -867,8 +890,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
spaceElements.add(new KnuthInlineBox(ai.ipdArea.opt, null,
mainPosition, true));
}
- } else {
- // a breaking space
+ } else if (textArray[ai.iStartIndex] == CharUtilities.SPACE
+ && foText.getWhitespaceTreatment() == Constants.EN_PRESERVE) {
+ // a breaking space that needs to be preserved
switch (alignment) {
case EN_CENTER:
// centered text:
@@ -885,6 +909,97 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
? KnuthElement.INFINITE
: 0), false,
new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthGlue(
+ - (lineStartBAP + lineEndBAP), -6
+ * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthInlineBox(0, null,
+ notifyPos(new LeafPosition(this, -1)), false));
+ spaceElements.add(new KnuthPenalty(0, KnuthElement.INFINITE,
+ false, new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthGlue(ai.ipdArea.opt + lineStartBAP,
+ 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
+ mainPosition, false));
+ break;
+
+ case EN_START: // fall through
+ case EN_END:
+ // left- or right-aligned text:
+ // if the second element is chosen as a line break these elements
+ // add a constant amount of stretch at the end of a line, otherwise
+ // they don't add any stretch
+ spaceElements.add(new KnuthGlue(lineEndBAP,
+ 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthPenalty(0, 0, false,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthGlue(
+ - (lineStartBAP + lineEndBAP), -3
+ * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthInlineBox(0, null,
+ notifyPos(new LeafPosition(this, -1)), false));
+ spaceElements.add(new KnuthPenalty(0,
+ KnuthElement.INFINITE, false, new LeafPosition(
+ this, -1), false));
+ spaceElements.add(new KnuthGlue(ai.ipdArea.opt + lineStartBAP, 0, 0,
+ mainPosition, false));
+ break;
+
+ case EN_JUSTIFY:
+ // justified text:
+ // the stretch and shrink depends on the space width
+ spaceElements.add(new KnuthGlue(lineEndBAP, 0, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthPenalty(0, 0, false,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthGlue(
+ - (lineStartBAP + lineEndBAP), ai.ipdArea.max
+ - ai.ipdArea.opt, ai.ipdArea.opt - ai.ipdArea.min,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthInlineBox(0, null,
+ notifyPos(new LeafPosition(this, -1)), false));
+ spaceElements.add(new KnuthPenalty(0,
+ KnuthElement.INFINITE, false, new LeafPosition(
+ this, -1), false));
+ spaceElements.add(new KnuthGlue(lineStartBAP + ai.ipdArea.opt, 0, 0,
+ mainPosition, false));
+ break;
+
+ default:
+ // last line justified, the other lines unjustified:
+ // use only the space stretch
+ spaceElements.add(new KnuthGlue(lineEndBAP, 0, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthPenalty(0, 0, false,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthGlue(
+ - (lineStartBAP + lineEndBAP), ai.ipdArea.max
+ - ai.ipdArea.opt, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements.add(new KnuthInlineBox(0, null,
+ notifyPos(new LeafPosition(this, -1)), false));
+ spaceElements.add(new KnuthPenalty(0,
+ KnuthElement.INFINITE, false, new LeafPosition(
+ this, -1), false));
+ spaceElements.add(new KnuthGlue(lineStartBAP + ai.ipdArea.opt, 0, 0,
+ mainPosition, false));
+ }
+ } else {
+ // a (possible block) of breaking spaces
+ switch (alignment) {
+ case EN_CENTER:
+ // centered text:
+ // if the second element is chosen as a line break these elements
+ // add a constant amount of stretch at the end of a line and at the
+ // beginning of the next one, otherwise they don't add any stretch
+ spaceElements.add(new KnuthGlue(lineEndBAP,
+ 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
+ new LeafPosition(this, -1), false));
+ spaceElements
+ .add(new KnuthPenalty(
+ 0, 0, false,
+ new LeafPosition(this, -1), false));
spaceElements.add(new KnuthGlue(ai.ipdArea.opt
- (lineStartBAP + lineEndBAP), -6
* LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
@@ -941,9 +1056,10 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
new LeafPosition(this, -1), false));
spaceElements.add(new KnuthPenalty(0, 0, false,
new LeafPosition(this, -1), false));
- spaceElements.add(new KnuthGlue(ai.ipdArea.opt
- - (lineStartBAP + lineEndBAP), ai.ipdArea.max
- - ai.ipdArea.opt, ai.ipdArea.opt - ai.ipdArea.min,
+ spaceElements.add(new KnuthGlue(
+ ai.ipdArea.opt - (lineStartBAP + lineEndBAP),
+ ai.ipdArea.max - ai.ipdArea.opt,
+ ai.ipdArea.opt - ai.ipdArea.min,
mainPosition, false));
spaceElements.add(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), false));
@@ -954,8 +1070,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
new LeafPosition(this, -1), false));
} else {
spaceElements.add(new KnuthGlue(ai.ipdArea.opt,
- ai.ipdArea.max - ai.ipdArea.opt, ai.ipdArea.opt
- - ai.ipdArea.min, mainPosition, false));
+ ai.ipdArea.max - ai.ipdArea.opt,
+ ai.ipdArea.opt - ai.ipdArea.min,
+ mainPosition, false));
}
break;
@@ -967,9 +1084,10 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
new LeafPosition(this, -1), false));
spaceElements.add(new KnuthPenalty(0, 0, false,
new LeafPosition(this, -1), false));
- spaceElements.add(new KnuthGlue(ai.ipdArea.opt
- - (lineStartBAP + lineEndBAP), ai.ipdArea.max
- - ai.ipdArea.opt, 0, mainPosition, false));
+ spaceElements.add(new KnuthGlue(
+ ai.ipdArea.opt - (lineStartBAP + lineEndBAP),
+ ai.ipdArea.max - ai.ipdArea.opt,
+ 0, mainPosition, false));
spaceElements.add(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), false));
spaceElements.add(new KnuthPenalty(0,
@@ -979,8 +1097,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
new LeafPosition(this, -1), false));
} else {
spaceElements.add(new KnuthGlue(ai.ipdArea.opt,
- ai.ipdArea.max - ai.ipdArea.opt, 0, mainPosition,
- false));
+ ai.ipdArea.max - ai.ipdArea.opt, 0,
+ mainPosition, false));
}
}
}
diff --git a/status.xml b/status.xml
index a21b75e3d..8ac56de76 100644
--- a/status.xml
+++ b/status.xml
@@ -27,6 +27,14 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="MM" type="fix">
+ Bugfix: Corrected enumerated property value for white-space property
+ from "no-wrap" to "nowrap".
+ </action>
+ <action context="Code" dev="MM" type="fix" fixes-bug="38547">
+ Bugfix: Added support for white-space-treatment="preserve" in particular to
+ support the white-space="pre" short hand property.
+ </action>
<action context="Code" dev="JM" type="fix">
Corrected expectation and behaviour for the text-indent property to only apply
to the first line area generated by a block.
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) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[3]/lineArea[1]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[3]/lineArea[2]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[3]/lineArea[2]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[3]/lineArea[3]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[3]/lineArea[3]/text/@ipd) &gt; -3000"/>
+ <true xpath="//flow/block[4]/lineArea[3]/text/@ipd &lt; 350000"/>
+
+ <!-- text-align="center" -->
+ <true xpath="//flow/block[4]/lineArea[1]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[4]/lineArea[2]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[4]/lineArea[3]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[4]/lineArea[4]/@start-indent &gt; 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)) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[1]/text/@ipd - (2 * //flow/block[4]/lineArea[1]/@start-indent)) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[2]/text/@ipd - (2 * //flow/block[4]/lineArea[2]/@start-indent)) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[2]/text/@ipd - (2 * //flow/block[4]/lineArea[2]/@start-indent)) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[3]/text/@ipd - (2 * //flow/block[4]/lineArea[3]/@start-indent)) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[3]/text/@ipd - (2 * //flow/block[4]/lineArea[3]/@start-indent)) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[4]/text/@ipd - (2 * //flow/block[4]/lineArea[4]/@start-indent)) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[4]/lineArea[4]/text/@ipd - (2 * //flow/block[4]/lineArea[4]/@start-indent)) &gt; -4000"/>
+
+ <!-- text-align="end" -->
+ <true xpath="//flow/block[5]/lineArea[1]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[5]/lineArea[2]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[5]/lineArea[3]/@start-indent &gt; 10000"/>
+ <true xpath="//flow/block[5]/lineArea[4]/@start-indent &gt; 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) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[1]/text/@ipd - //flow/block[5]/lineArea[1]/@start-indent) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[2]/text/@ipd - //flow/block[5]/lineArea[2]/@start-indent) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[2]/text/@ipd - //flow/block[5]/lineArea[2]/@start-indent) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[3]/text/@ipd - //flow/block[5]/lineArea[3]/@start-indent) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[3]/text/@ipd - //flow/block[5]/lineArea[3]/@start-indent) &gt; -4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[4]/text/@ipd - //flow/block[5]/lineArea[4]/@start-indent) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[5]/lineArea[4]/text/@ipd - //flow/block[5]/lineArea[4]/@start-indent) &gt; -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 &gt; 10000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[1]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[1]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[2]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[2]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[3]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[3]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[4]/text/@ipd - (2 * //flow/block[6]/lineArea[4]/@start-indent)) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[6]/lineArea[4]/text/@ipd - (2 * //flow/block[6]/lineArea[4]/@start-indent)) &gt; -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 &gt; 10000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[1]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[1]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[2]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[2]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[3]/text/@ipd) &lt; 3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[3]/text/@ipd) &gt; -3000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[4]/text/@ipd - //flow/block[7]/lineArea[4]/@start-indent) &lt; 4000"/>
+ <true xpath="(360000 - //flow/block[7]/lineArea[4]/text/@ipd - //flow/block[7]/lineArea[4]/@start-indent) &gt; -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>