Add test for bug 59098 which shows that this is fixed in 3.14.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734686 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-03-12 11:36:43 +00:00
parent 299fdcccf8
commit 8c508d89b0

View File

@ -28,6 +28,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.StylesTable; import org.apache.poi.xssf.model.StylesTable;
import org.junit.Test; 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.CTRPrElt;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXstring; import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXstring;
@ -516,4 +517,20 @@ public final class TestXSSFRichTextString extends TestCase {
rt = new XSSFRichTextString(); rt = new XSSFRichTextString();
assertNull(rt.toString()); 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());
}
} }