From 54d297afea37ddc051cc43d26b919e2a95fbc815 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Fri, 30 Dec 2005 00:18:57 +0000 Subject: [PATCH] Tweak page-break-* shorthands; keeps now working properly git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@359939 13f79535-47bb-0310-9956-ffa450edef68 --- .../properties/PageBreakShorthandParser.java | 12 +++---- .../page-break_shorthand-expansion.fo | 36 +++++++++---------- .../fop/fotreetest/ext/AssertElement.java | 5 +++ 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java b/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java index f139b2999..24d1f0f59 100644 --- a/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.properties.KeepProperty; /** * Shorthand parser for page-break-before, page-break-after and page-break-inside. @@ -41,9 +42,8 @@ public class PageBreakShorthandParser implements ShorthandParser { || propId == Constants.PR_KEEP_WITH_NEXT || propId == Constants.PR_KEEP_TOGETHER) { if (property.getEnum() == Constants.EN_AVOID) { - return new EnumProperty(Constants.EN_ALWAYS, "ALWAYS"); - } else { - return new EnumProperty(Constants.EN_AUTO, "AUTO"); + return maker.make(null, Constants.CP_WITHIN_PAGE, + propertyList, "always", propertyList.getFObj()); } } else if (propId == Constants.PR_BREAK_BEFORE || propId == Constants.PR_BREAK_AFTER) { @@ -51,12 +51,12 @@ public class PageBreakShorthandParser implements ShorthandParser { case Constants.EN_ALWAYS: return new EnumProperty(Constants.EN_PAGE, "PAGE"); case Constants.EN_LEFT: - return new EnumProperty(Constants.EN_EVEN_PAGE, "EVEN-PAGE"); + return new EnumProperty(Constants.EN_EVEN_PAGE, "EVEN_PAGE"); case Constants.EN_RIGHT: - return new EnumProperty(Constants.EN_ODD_PAGE, "ODD-PAGE"); + return new EnumProperty(Constants.EN_ODD_PAGE, "ODD_PAGE"); case Constants.EN_AVOID: default: - return new EnumProperty(Constants.EN_AUTO, "AUTO"); + //nop; } } return null; diff --git a/test/fotree/testcases/page-break_shorthand-expansion.fo b/test/fotree/testcases/page-break_shorthand-expansion.fo index 5643e6bd8..71743c208 100644 --- a/test/fotree/testcases/page-break_shorthand-expansion.fo +++ b/test/fotree/testcases/page-break_shorthand-expansion.fo @@ -25,55 +25,55 @@ - + Block 1: testing page-break-before="avoid" - + Block 2: testing page-break-before="always" - - + + Block 3: testing page-break-before="left" - - + + Block 4: testing page-break-before="right" - + Block 5: testing page-break-after="avoid" - + Block 6: testing page-break-after="always" - - + + Block 7: testing page-break-after="left" - - + + Block 8: testing page-break-after="right" - + Block 9: testing page-break-inside="avoid" - - - - - + + + + + Block 10: testing page-break-before="left", page-break-inside="avoid" and page-break-after="right" diff --git a/test/java/org/apache/fop/fotreetest/ext/AssertElement.java b/test/java/org/apache/fop/fotreetest/ext/AssertElement.java index 0dfb4d41b..0a40b7604 100644 --- a/test/java/org/apache/fop/fotreetest/ext/AssertElement.java +++ b/test/java/org/apache/fop/fotreetest/ext/AssertElement.java @@ -23,6 +23,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOPropertyMapping; import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.LengthPairProperty; import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.fo.properties.Property; @@ -79,6 +80,10 @@ public class AssertElement extends TestObj { if (lrp != null) { prop = lrp.getComponent(FOPropertyMapping.getSubPropertyId(component)); } + KeepProperty kp = mainProp.getKeep(); + if (kp != null) { + prop = kp.getComponent(FOPropertyMapping.getSubPropertyId(component)); + } } String s = String.valueOf(prop); String expected = attlist.getValue("expected"); -- 2.39.5