Browse Source

Add reproducing testcase for Bug 57294

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1649536 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_12_BETA1
Dominik Stadler 9 years ago
parent
commit
c7d0c19328

+ 29
- 0
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java View File

@@ -29,6 +29,7 @@ import org.apache.poi.hssf.HSSFTestDataSamples;
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 extends TestCase {
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));
}
}

Loading…
Cancel
Save