You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2014/07/27 00:39:17 UTC

svn commit: r1613737 - in /poi/trunk: src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java test-data/spreadsheet/Intersection-52111.xls

Author: nick
Date: Sat Jul 26 22:39:16 2014
New Revision: 1613737

URL: http://svn.apache.org/r1613737
Log:
Unit test to show that bug #52111 (intersect formulas) was already solved

Added:
    poi/trunk/test-data/spreadsheet/Intersection-52111.xls   (with props)
Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1613737&r1=1613736&r2=1613737&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Sat Jul 26 22:39:16 2014
@@ -2702,4 +2702,24 @@ public final class TestBugs extends Base
         // 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());
+    }
 }

Added: poi/trunk/test-data/spreadsheet/Intersection-52111.xls
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/Intersection-52111.xls?rev=1613737&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/Intersection-52111.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org