]> source.dussan.org Git - poi.git/commitdiff
More disabled unit tests relating to external workbook formula references
authorNick Burch <nick@apache.org>
Tue, 4 Nov 2014 16:03:25 +0000 (16:03 +0000)
committerNick Burch <nick@apache.org>
Tue, 4 Nov 2014 16:03:25 +0000 (16:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1636626 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java

index b0aac98b19896c1f3115f171ade32d72adf6d3e8..508844fdd11aead60b1042937e369d55ca479470 100644 (file)
@@ -168,12 +168,12 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator {
         assertEquals("142.0",   evaluator.evaluate(cXSL_gNR).formatAsString());
         
 /**        
-        // Now add a formula that refers to a different workbook again
+        // Now add a formula that refers to yet another (different) workbook
         Cell cXSLX_nw_cell = rXSLX.createCell(42);
-        cXSLX_nw_cell.setCellFormula("[alt.xslx]Sheet1!$A$1");
+        cXSLX_nw_cell.setCellFormula("[alt.xlsx]Sheet1!$A$1");
         
         // Check it - TODO Is this correct? Or should it become [2]Sheet1!$A$1 ?
-        assertEquals("[alt.xslx]Sheet1!$A$1", cXSLX_nw_cell.getCellFormula());
+        assertEquals("[alt.xlsx]Sheet1!$A$1", cXSLX_nw_cell.getCellFormula());
         
         // Evaluate it, without a link to that workbook
         try {
@@ -184,7 +184,7 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator {
         // Add a link, check it does
         Workbook alt = new XSSFWorkbook();
         alt.createSheet().createRow(0).createCell(0).setCellValue("In another workbook");
-        evaluators.put("alt.xslx", alt.getCreationHelper().createFormulaEvaluator());
+        evaluators.put("alt.xlsx", alt.getCreationHelper().createFormulaEvaluator());
         evaluator.setupReferencedWorkbooks(evaluators);
         
         evaluator.evaluate(cXSLX_nw_cell);
index 2388f88aed425d9d8ef998bdec89499a6f1d38b5..22e7ca5493ecbad5afc2df9f1e72a88d96b9d997 100644 (file)
@@ -230,6 +230,36 @@ public final class TestHSSFFormulaEvaluator extends BaseTestFormulaEvaluator {
       assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
       assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType());
       assertEquals(36.90, cell.getNumericCellValue(), 0.0001);
+      
+/*      
+      // Now add a formula that refers to yet another (different) workbook
+      cell = wb.getSheetAt(0).getRow(1).createCell(42);
+      cell.setCellFormula("[alt.xls]Sheet1!$A$1");
+      
+      // Check it - TODO Is this correct? Or should it become [2]Sheet1!$A$1 ?
+      assertEquals("[alt.xls]Sheet1!$A$1", cell.getCellFormula());
+      
+      // Evaluate it, without a link to that workbook
+      try {
+          eval.evaluate(cell);
+          fail("No cached value and no link to workbook, shouldn't evaluate");
+      } catch(Exception e) {}
+      
+      // Add a link, check it does
+      HSSFWorkbook alt = new HSSFWorkbook();
+      alt.createSheet().createRow(0).createCell(0).setCellValue("In another workbook");
+      HSSFFormulaEvaluator.setupEnvironment(
+              new String[] { "XRefCalc.xls", "XRefCalcData.xls", "alt.xls" },
+              new HSSFFormulaEvaluator[] {
+                    eval,
+                    new HSSFFormulaEvaluator(wbData),
+                    new HSSFFormulaEvaluator(alt)
+              }
+      );
+      
+      eval.evaluate(cell);
+      assertEquals("In another workbook", cell.getStringCellValue());
+*/      
    }
 
     public void testSharedFormulas(){