]> source.dussan.org Git - poi.git/commitdiff
Disabled unit tests for bug #48703
authorNick Burch <nick@apache.org>
Fri, 10 Feb 2012 15:03:03 +0000 (15:03 +0000)
committerNick Burch <nick@apache.org>
Fri, 10 Feb 2012 15:03:03 +0000 (15:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1242807 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
test-data/spreadsheet/48703.xls [new file with mode: 0644]
test-data/spreadsheet/48703.xlsx [new file with mode: 0644]

index d163221d529b701d9d6d4fb3aa8e308bbad85acd..0a781748f99091dfb30672f35a4630b3202494d4 100644 (file)
@@ -1255,4 +1255,34 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
        assertEquals(1, ref.getLastCell().getRow());
        assertEquals(0, ref.getLastCell().getCol());
     }
+    
+    /**
+     * Sum across multiple workbooks
+     *  eg =SUM($Sheet1.C1:$Sheet4.C1)
+     * DISABLED As we can't currently evaluate these
+     */
+    public void DISABLEDtest48703() throws Exception {
+       XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("48703.xlsx");
+       XSSFSheet sheet = wb.getSheetAt(0);
+       
+       // Contains two forms, one with a range and one a list
+       XSSFRow r1 = sheet.getRow(0);
+       XSSFRow r2 = sheet.getRow(1);
+       XSSFCell c1 = r1.getCell(1);
+       XSSFCell c2 = r2.getCell(1);
+       
+       assertEquals(20.0, c1.getNumericCellValue());
+       assertEquals("SUM(Sheet1!C1,Sheet2!C1,Sheet3!C1,Sheet4!C1)", c1.getCellFormula());
+       
+       assertEquals(20.0, c2.getNumericCellValue());
+       assertEquals("SUM(Sheet1:Sheet4!C1)", c2.getCellFormula());
+       
+       // Try evaluating both
+       XSSFFormulaEvaluator eval = new XSSFFormulaEvaluator(wb);
+       eval.evaluateFormulaCell(c1);
+       eval.evaluateFormulaCell(c2);
+       
+       assertEquals(20.0, c1.getNumericCellValue());
+       assertEquals(20.0, c2.getNumericCellValue());
+    }
 }
index 63ae641a8adfb05d0bd74bb323934b493cf2fc7c..5499af4a3f94254f58146a8eb58042e5ce4bd550 100644 (file)
@@ -2180,6 +2180,29 @@ if(1==2) {
         HSSFWorkbook wb = openSample("51670.xls");
         writeOutAndReadBack(wb);
     }
+    
+    /**
+     * Sum across multiple workbooks
+     *  eg =SUM($Sheet2.A1:$Sheet3.A1)
+     * DISABLED - We currently get the formula wrong, and mis-evaluate
+     */
+    public void DISABLEDtest48703() {
+        HSSFWorkbook wb = openSample("48703.xls");
+        assertEquals(3, wb.getNumberOfSheets());
+        
+        // Check reading the formula
+        Sheet sheet = wb.getSheetAt(0);
+        Row r = sheet.getRow(0);
+        Cell c = r.getCell(0);
+        
+        assertEquals("SUM(Sheet2!A1:Sheet3!A1)", c.getCellFormula());
+        assertEquals(4.0, c.getNumericCellValue());
+        
+        // Check the evaluated result
+        HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(wb);
+        eval.evaluateFormulaCell(c);
+        assertEquals(4.0, c.getNumericCellValue());
+    }
 
     /**
      * Normally encrypted files have BOF then FILEPASS, but
diff --git a/test-data/spreadsheet/48703.xls b/test-data/spreadsheet/48703.xls
new file mode 100644 (file)
index 0000000..95f19eb
Binary files /dev/null and b/test-data/spreadsheet/48703.xls differ
diff --git a/test-data/spreadsheet/48703.xlsx b/test-data/spreadsheet/48703.xlsx
new file mode 100644 (file)
index 0000000..2589953
Binary files /dev/null and b/test-data/spreadsheet/48703.xlsx differ