From: Jeremias Maerki Date: Tue, 2 Aug 2005 15:38:43 +0000 (+0000) Subject: Allow "<0" and ">0" expressions for the "p" part on a penalty. X-Git-Tag: fop-0_90-alpha1~443 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=953bce4d360e67698e8980df16f6b8637abef520;p=xmlgraphics-fop.git Allow "<0" and ">0" expressions for the "p" part on a penalty. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@227027 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/java/org/apache/fop/layoutengine/ElementListCheck.java b/test/java/org/apache/fop/layoutengine/ElementListCheck.java index 4c28a0dd9..3dba23ff0 100644 --- a/test/java/org/apache/fop/layoutengine/ElementListCheck.java +++ b/test/java/org/apache/fop/layoutengine/ElementListCheck.java @@ -104,22 +104,36 @@ public class ElementListCheck implements LayoutEngineCheck { } } if (domEl.getAttribute("p").length() > 0) { - int p; - if ("INF".equalsIgnoreCase(domEl.getAttribute("p"))) { - p = KnuthPenalty.INFINITE; - } else if ("INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { - p = KnuthPenalty.INFINITE; - } else if ("-INF".equalsIgnoreCase(domEl.getAttribute("p"))) { - p = -KnuthPenalty.INFINITE; - } else if ("-INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { - p = -KnuthPenalty.INFINITE; + if ("<0".equals(domEl.getAttribute("p"))) { + if (knuthEl.getP() >= 0) { + fail("Expected p<0" + + " at position " + pos + + " but got: " + knuthEl.getP()); + } + } else if (">0".equals(domEl.getAttribute("p"))) { + if (knuthEl.getP() <= 0) { + fail("Expected p>0" + + " at position " + pos + + " but got: " + knuthEl.getP()); + } } else { - p = Integer.parseInt(domEl.getAttribute("p")); - } - if (p != knuthEl.getP()) { - fail("Expected p=" + p - + " at position " + pos - + " but got: " + knuthEl.getP()); + int p; + if ("INF".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = KnuthPenalty.INFINITE; + } else if ("INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = KnuthPenalty.INFINITE; + } else if ("-INF".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = -KnuthPenalty.INFINITE; + } else if ("-INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = -KnuthPenalty.INFINITE; + } else { + p = Integer.parseInt(domEl.getAttribute("p")); + } + if (p != knuthEl.getP()) { + fail("Expected p=" + p + + " at position " + pos + + " but got: " + knuthEl.getP()); + } } } if ("true".equals(domEl.getAttribute("flagged"))) {