You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/09/15 19:38:50 UTC

svn commit: r997413 - in /poi/trunk/src/scratchpad: src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java

Author: nick
Date: Wed Sep 15 17:38:50 2010
New Revision: 997413

URL: http://svn.apache.org/viewvc?rev=997413&view=rev
Log:
Add some more paragraph property documentation and tests

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

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java?rev=997413&r1=997412&r2=997413&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java Wed Sep 15 17:38:50 2010
@@ -115,6 +115,7 @@ public final class ParagraphSprmUncompre
         }
         break;
       case 0x3:
+        // Physical justification of the paragraph
         newPAP.setJc ((byte) sprm.getOperand());
         break;
       case 0x4:
@@ -384,6 +385,9 @@ public final class ParagraphSprmUncompre
       case 0x4c:
         newPAP.setFTtpEmbedded((byte)sprm.getOperand());
         break;
+      case 0x61:
+        // Logicial justification of the paragraph, eg left, centre, right
+        break;
       default:
         break;
     }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java?rev=997413&r1=997412&r2=997413&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java Wed Sep 15 17:38:50 2010
@@ -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 e
 		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 e
 				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);
+      }
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org