diff options
author | Nick Burch <nick@apache.org> | 2015-07-31 23:53:54 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2015-07-31 23:53:54 +0000 |
commit | 044151f658d7c1f5dec9087e6acd2a7e47452390 (patch) | |
tree | 8eae35ef17715d8a7e00092e5ae3c47800a955aa /src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java | |
parent | 7e345b81867b57440a551ee729eb0e13a966888b (diff) | |
download | poi-044151f658d7c1f5dec9087e6acd2a7e47452390.tar.gz poi-044151f658d7c1f5dec9087e6acd2a7e47452390.zip |
Unit test for #55747
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1693674 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index c1b66a3a8f..9161b0a98f 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -1120,4 +1120,35 @@ public abstract class BaseTestBugzillaIssues { assertTrue("HSSF will currently return empty string, XSSF/SXSSF will return null, but had: " + value, value == null || value.length() == 0); } + + /** + * Formulas with Nested Ifs, or If with text functions like + * Mid in it, can give #VALUE in Excel + */ + @Test + public void bug55747() { + Workbook wb = _testDataProvider.createWorkbook(); + FormulaEvaluator ev = wb.getCreationHelper().createFormulaEvaluator(); + Sheet s = wb.createSheet(); + + Row row = s.createRow(0); + row.createCell(0).setCellValue("abc"); + row.createCell(1).setCellValue(""); + row.createCell(2).setCellValue(3); + + Cell cell = row.createCell(5); + cell.setCellFormula("IF(A1<>\"\",MID(A1,1,2),\" \")"); + ev.evaluateAll(); + assertEquals("ab", cell.getStringCellValue()); + + cell = row.createCell(6); + cell.setCellFormula("IF(B1<>\"\",MID(A1,1,2),\"empty\")"); + ev.evaluateAll(); + assertEquals("empty", cell.getStringCellValue()); + + cell = row.createCell(7); + cell.setCellFormula("IF(A1<>\"\",IF(C1<>\"\",MID(A1,1,2),\"c1\"),\"c2\")"); + ev.evaluateAll(); + assertEquals("ab", cell.getStringCellValue()); + } } |