diff options
author | Nick Burch <nick@apache.org> | 2010-09-15 17:38:50 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-09-15 17:38:50 +0000 |
commit | e0d6408917eedf3d3c3906ad59a935bb512c5171 (patch) | |
tree | da660c7aea444ef3a46d9c9aa27d127792affc73 /src | |
parent | 326486c891ee5d3c1e17e9680af0d769c55c5cc9 (diff) | |
download | poi-e0d6408917eedf3d3c3906ad59a935bb512c5171.tar.gz poi-e0d6408917eedf3d3c3906ad59a935bb512c5171.zip |
Add some more paragraph property documentation and tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@997413 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java | 4 | ||||
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java index c53daff04f..a6b12ec2da 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java @@ -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; } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java index df17b74ce3..34dfaf71f0 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java @@ -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); + } } } |