]> source.dussan.org Git - poi.git/commitdiff
Tweak rich text handling
authorNick Burch <nick@apache.org>
Fri, 16 Jun 2006 16:32:07 +0000 (16:32 +0000)
committerNick Burch <nick@apache.org>
Fri, 16 Jun 2006 16:32:07 +0000 (16:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@414857 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java

index 0a9144fd907eba702701d94718dd8188dd8d7e22..8ff24cd68296a93b0f3acb45c7d94ae79f480b9d 100644 (file)
@@ -88,7 +88,7 @@ public class TextRun
                LinkedList cStyles = new LinkedList();
                if(_styleAtom != null) {
                        // Get the style atom to grok itself
-                       _styleAtom.setParentTextSize(runRawText.length()+1);
+                       _styleAtom.setParentTextSize(runRawText.length());
                        pStyles = _styleAtom.getParagraphStyles();
                        cStyles = _styleAtom.getCharacterStyles();
                }
index fce7e82642ff90a4ab16ead04b435139126953f0..599f39d4aa654f1a23bc5cf6816a0b6d3e9553ae 100644 (file)
@@ -182,6 +182,11 @@ public class TestRichTextRun extends TestCase {
                        rtr.setFontSize(18);
                        rtr.setFontName("Courier");
                        
+                       // Check it took those
+                       assertEquals(true, rtr.isBold());
+                       assertEquals(18, rtr.getFontSize());
+                       assertEquals("Courier", rtr.getFontName());
+                       
                        // Write out and back in
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        h[i].write(baos);
@@ -195,8 +200,14 @@ public class TestRichTextRun extends TestCase {
                        rtr.setFontSize(17);
                        rtr.setFontName("CourierZZ");
                        
+                       // Check it took those changes
+                       assertEquals(false, rtr.isBold());
+                       assertEquals(17, rtr.getFontSize());
+                       assertEquals("CourierZZ", rtr.getFontName());
+
                        
-                       // Check written out/back ing one contains modifications
+                       // Now, look at the one we changed, wrote out, and read back in
+                       // Ensure it does contain our original modifications
                        Slide slideOneRR = readS.getSlides()[0];
                        TextRun[] textRunsRR = slideOneRR.getTextRuns();
                        RichTextRun rtrRRa = textRunsRR[0].getRichTextRuns()[0];