diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-12-10 13:51:19 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-12-10 13:51:19 +0000 |
commit | 4b84986671b2da550ba0674e8b38d234d4ee650f (patch) | |
tree | c355b5681f4a8e8003e4839e258ef37a79991431 | |
parent | f662657db1b2f34c56437b51a5af9ddfc49851b7 (diff) | |
download | poi-4b84986671b2da550ba0674e8b38d234d4ee650f.tar.gz poi-4b84986671b2da550ba0674e8b38d234d4ee650f.zip |
[bug-68305] extend test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914512 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java index 220190d453..902164e6eb 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java @@ -24,19 +24,15 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; -import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.ss.usermodel.BaseTestFormulaEvaluator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellValue; -import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -124,8 +120,20 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator { XSSFCell xssfCell = sheet1.createRow(0).createCell(0); xssfCell.setCellFormula("'(2) 4-Tension Bolt MC''s'!A1"); XSSFFormulaEvaluator xssfFormulaEvaluator = new XSSFFormulaEvaluator(wb); - xssfFormulaEvaluator.evaluateInCell(xssfCell); + xssfFormulaEvaluator.evaluateAll(); assertEquals(1.0, xssfCell.getNumericCellValue()); + + try (UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get()) { + wb.write(bos); + try (XSSFWorkbook wb2 = new XSSFWorkbook()) { + XSSFSheet sheet1Wb2 = wb.getSheet("Sheet1"); + assertNotNull(sheet1Wb2, "Sheet1 found?"); + XSSFFormulaEvaluator xssfFormulaEvaluator2 = new XSSFFormulaEvaluator(wb2); + xssfFormulaEvaluator2.evaluateAll(); + XSSFCell cell2 = sheet1Wb2.getRow(0).getCell(0); + assertEquals(1.0, cell2.getNumericCellValue()); + } + } } } |