add data-formatter test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895706 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-12-08 19:27:09 +00:00
parent ea9883af55
commit a24820e629
2 changed files with 13 additions and 0 deletions

View File

@ -107,4 +107,17 @@ public final class TestXSSFDataFormat extends BaseTestDataFormat {
assertEquals("1000", formatter.formatCellValue(cell, evaluator));
}
}
@Test
void testSetUseCachedValuesForFormulaCells() throws Exception {
try (XSSFWorkbook wb = openSampleWorkbook("formula-eval.xlsx")) {
final DataFormatter formatter = new DataFormatter();
XSSFSheet sheet = wb.getSheetAt(0);
XSSFRow row = sheet.getRow(0);
XSSFCell d1 = row.getCell(3);
assertEquals("SUM(A1:C1)", formatter.formatCellValue(d1));
formatter.setUseCachedValuesForFormulaCells(true);
assertEquals("6.75", formatter.formatCellValue(d1));
}
}
}

Binary file not shown.