]> source.dussan.org Git - poi.git/commitdiff
Add test for bug 59098 which shows that this is fixed in 3.14.
authorDominik Stadler <centic@apache.org>
Sat, 12 Mar 2016 11:36:43 +0000 (11:36 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 12 Mar 2016 11:36:43 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734686 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java

index ea11d273da847a704ef018efdd4e52231d02b544..7d45351fbd126c859e82efe463a8a7e108df2e99 100644 (file)
@@ -28,6 +28,7 @@ import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.apache.poi.xssf.model.StylesTable;
 import org.junit.Test;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXstring;
@@ -516,4 +517,20 @@ public final class TestXSSFRichTextString extends TestCase {
         rt = new XSSFRichTextString();
         assertNull(rt.toString());
     }
+
+    public void test59008Font() {
+        XSSFFont font = new XSSFFont(CTFont.Factory.newInstance());
+
+        XSSFRichTextString rts = new XSSFRichTextString();
+        rts.append("This is correct ");
+        int s1 = rts.length();
+        rts.append("This is Bold Red", font);
+        int s2 = rts.length();
+        rts.append(" This uses the default font rather than the cell style font");
+        int s3 = rts.length();
+
+        assertEquals("<xml-fragment/>", rts.getFontAtIndex(s1-1).toString());
+        assertEquals(font, rts.getFontAtIndex(s2-1));
+        assertEquals("<xml-fragment/>", rts.getFontAtIndex(s3-1).toString());
+    }
 }