]> source.dussan.org Git - poi.git/commitdiff
Add some more paragraph property documentation and tests
authorNick Burch <nick@apache.org>
Wed, 15 Sep 2010 17:38:50 +0000 (17:38 +0000)
committerNick Burch <nick@apache.org>
Wed, 15 Sep 2010 17:38:50 +0000 (17:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@997413 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java

index c53daff04fc69e86a19e2368d855f7d6edd49a9d..a6b12ec2dace0ed3d2ee78d457be8cb0bc61d2d6 100644 (file)
@@ -115,6 +115,7 @@ public final class ParagraphSprmUncompressor
         }
         break;
       case 0x3:
+        // Physical justification of the paragraph
         newPAP.setJc ((byte) sprm.getOperand());
         break;
       case 0x4:
@@ -384,6 +385,9 @@ public final class ParagraphSprmUncompressor
       case 0x4c:
         newPAP.setFTtpEmbedded((byte)sprm.getOperand());
         break;
+      case 0x61:
+        // Logicial justification of the paragraph, eg left, centre, right
+        break;
       default:
         break;
     }
index df17b74ce39c7abece22f427da8290b423aa19da..34dfaf71f01f655d8920deefeb28890dee93dcd2 100644 (file)
@@ -29,8 +29,6 @@ import junit.framework.TestCase;
  * Tests to ensure that our ranges end up with
  *  the right text in them, and the right font/styling
  *  properties applied to them.
- *
- * TODO - re-enable me when unicode paragraph stuff is fixed!
  */
 public final class TestRangeProperties extends TestCase {
        private static final char page_break = (char)12;
@@ -146,6 +144,16 @@ public final class TestRangeProperties extends TestCase {
                assertEquals("Arial Black", c7.getFontName());
                assertEquals(22, c1.getFontSize());
                assertEquals(32, c7.getFontSize());
+               
+               // This document has 15 styles
+               assertEquals(15, a.getStyleSheet().numStyles());
+               
+               // Ensure none of the paragraphs refer to one that isn't there,
+               //  and none of their character runs either
+               for(int i=0; i<a.getRange().numParagraphs(); i++) {
+                  Paragraph p = a.getRange().getParagraph(i);
+                  assertTrue(p.getStyleIndex() < 15);
+               }
        }
 
        /**
@@ -360,5 +368,15 @@ public final class TestRangeProperties extends TestCase {
                                p1_parts[6].length() + 1,
                                c7b.getEndOffset()
                );
+      
+      // This document has 15 styles
+      assertEquals(15, a.getStyleSheet().numStyles());
+      
+      // Ensure none of the paragraphs refer to one that isn't there,
+      //  and none of their character runs either
+      for(int i=0; i<a.getRange().numParagraphs(); i++) {
+         Paragraph p = a.getRange().getParagraph(i);
+         assertTrue(p.getStyleIndex() < 15);
+      }
        }
 }