]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Allow "<0" and ">0" expressions for the "p" part on a penalty.
authorJeremias Maerki <jeremias@apache.org>
Tue, 2 Aug 2005 15:38:43 +0000 (15:38 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 2 Aug 2005 15:38:43 +0000 (15:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@227027 13f79535-47bb-0310-9956-ffa450edef68

test/java/org/apache/fop/layoutengine/ElementListCheck.java

index 4c28a0dd94e86441d4465ab460f808f2da5e641a..3dba23ff00add6c613ac5598387c2b998b7e6782 100644 (file)
@@ -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"))) {