From 3d31c69d07334d99ea2a093e358b9d8e5bda623b Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sat, 26 Jul 2014 22:39:16 +0000 Subject: [PATCH] Unit test to show that bug #52111 (intersect formulas) was already solved git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613737 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/TestBugs.java | 20 ++++++++++++++++++ test-data/spreadsheet/Intersection-52111.xls | Bin 0 -> 13824 bytes 2 files changed, 20 insertions(+) create mode 100644 test-data/spreadsheet/Intersection-52111.xls diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index c2b4c67ba2..de12602e40 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -2702,4 +2702,24 @@ public final class TestBugs extends BaseTestBugzillaIssues { // Optimise HSSFOptimiser.optimiseCellStyles(workbook); } + + /** + * Intersection formula ranges, eg =(C2:D3 D3:E4) + */ + @Test + public void bug52111() throws Exception { + Workbook wb = openSample("Intersection-52111.xls"); + Sheet s = wb.getSheetAt(0); + + // Check we can read it correctly + Cell intF = s.getRow(2).getCell(0); + assertEquals(Cell.CELL_TYPE_FORMULA, intF.getCellType()); + assertEquals(Cell.CELL_TYPE_NUMERIC, intF.getCachedFormulaResultType()); + + assertEquals("(C2:D3 D3:E4)", intF.getCellFormula()); + + // Check we can evaluate it correctly + FormulaEvaluator eval = wb.getCreationHelper().createFormulaEvaluator(); + assertEquals("4.0", eval.evaluate(intF).formatAsString()); + } } diff --git a/test-data/spreadsheet/Intersection-52111.xls b/test-data/spreadsheet/Intersection-52111.xls new file mode 100644 index 0000000000000000000000000000000000000000..835130e8b716c5bf6f160b6d9d5211e825be7c6e GIT binary patch literal 13824 zcmeHOTWnNS6kT`bPCMn%PFr5`XeL7%phW^SDhWadBSbzL32Gz(Q`$1bhLK_!6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