mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
[bug-62215] add test case for sxssf formulas - issue was already fixed
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cdbbbb6726
commit
700ecc461f
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -274,4 +274,43 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test62215() throws IOException {
|
||||
String sheetName = "1";
|
||||
int rowIndex = 0;
|
||||
int colIndex = 0;
|
||||
String formula = "1";
|
||||
String value = "yes";
|
||||
CellType valueType = CellType.STRING;
|
||||
|
||||
try (Workbook wb = new SXSSFWorkbook()) {
|
||||
Sheet sheet = wb.createSheet(sheetName);
|
||||
Row row = sheet.createRow(rowIndex);
|
||||
Cell cell = row.createCell(colIndex);
|
||||
|
||||
// this order ensures that value will not be overwritten by setting the formula
|
||||
cell.setCellFormula(formula);
|
||||
cell.setCellValue(value);
|
||||
|
||||
assertEquals(CellType.FORMULA, cell.getCellType());
|
||||
assertEquals(formula, cell.getCellFormula());
|
||||
assertEquals(valueType, cell.getCachedFormulaResultType());
|
||||
assertEquals(value, cell.getStringCellValue());
|
||||
// so far so good
|
||||
|
||||
try (UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()){
|
||||
wb.write(bos);
|
||||
|
||||
try (XSSFWorkbook testWb = new XSSFWorkbook(bos.toInputStream())) {
|
||||
Cell testCell = testWb.getSheet(sheetName).getRow(rowIndex).getCell(colIndex);
|
||||
assertEquals(CellType.FORMULA, testCell.getCellType());
|
||||
assertEquals(formula, testCell.getCellFormula());
|
||||
|
||||
assertEquals(CellType.STRING, testCell.getCachedFormulaResultType());
|
||||
assertEquals(value, testCell.getStringCellValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user