You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/01/05 15:39:52 UTC
svn commit: r1649536 -
/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
Author: centic
Date: Mon Jan 5 14:39:51 2015
New Revision: 1649536
URL: http://svn.apache.org/r1649536
Log:
Add reproducing testcase for Bug 57294
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java?rev=1649536&r1=1649535&r2=1649536&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java Mon Jan 5 14:39:51 2015
@@ -29,6 +29,7 @@ import org.apache.poi.hssf.HSSFTestDataS
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -211,4 +212,32 @@ public final class TestUnfixedBugs exten
wb.removeSheetAt(sn);
}
}
+
+ // When this is fixed, the test case should go to BaseTestXCell with
+ // adjustments to use _testDataProvider to also verify this for XSSF
+ public void testBug57294() throws IOException {
+ Workbook wb = SXSSFITestDataProvider.instance.createWorkbook();
+
+ Sheet sheet = wb.createSheet();
+ Row row = sheet.createRow(0);
+ Cell cell = row.createCell(0);
+
+ RichTextString str = new XSSFRichTextString("Test rich text string");
+ str.applyFont(2, 4, (short)0);
+ assertEquals(3, str.numFormattingRuns());
+ cell.setCellValue(str);
+
+ Workbook wbBack = SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+ wb.close();
+
+ // re-read after serializing and reading back
+ Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(0);
+ assertNotNull(cellBack);
+ RichTextString strBack = cellBack.getRichStringCellValue();
+ assertNotNull(strBack);
+ assertEquals(3, strBack.numFormattingRuns());
+ assertEquals(0, strBack.getIndexOfFormattingRun(0));
+ assertEquals(2, strBack.getIndexOfFormattingRun(1));
+ assertEquals(4, strBack.getIndexOfFormattingRun(2));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org