]> source.dussan.org Git - poi.git/commitdiff
Add disabled unit test for bug #48539, which is currently still broken
authorNick Burch <nick@apache.org>
Wed, 26 May 2010 15:22:04 +0000 (15:22 +0000)
committerNick Burch <nick@apache.org>
Wed, 26 May 2010 15:22:04 +0000 (15:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@948477 13f79535-47bb-0310-9956-ffa450edef68

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

index ea2c8fd59fbc0742832f502e78262eceb5befc3f..a5f19b3dbc08ec02b9f42f4ee3cb68054365dfea 100644 (file)
@@ -17,6 +17,7 @@
 
 package org.apache.poi.xssf.usermodel;
 
+import java.awt.peer.SystemTrayPeer;
 import java.util.List;
 
 import org.apache.poi.POIXMLDocumentPart;
@@ -24,7 +25,10 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
+import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Name;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.xssf.XSSFITestDataProvider;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
@@ -193,4 +197,31 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
        assertEquals("Sheet1", test.getSheetName());
        assertEquals(-1, test.getSheetIndex());
     }
+    
+    /**
+     * Problem with evaluation formulas due to
+     *  NameXPtgs.
+     * Blows up on:
+     *   IF(B6= (ROUNDUP(B6,0) + ROUNDDOWN(B6,0))/2, MROUND(B6,2),ROUND(B6,0))
+     */
+    public void DISABLEDtest48539() throws Exception {
+       XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("48539.xlsx");
+       assertEquals(3, wb.getNumberOfSheets());
+       
+       // Try each cell individually
+       XSSFFormulaEvaluator eval = new XSSFFormulaEvaluator(wb);
+       for(int i=0; i<wb.getNumberOfSheets(); i++) {
+          Sheet s = wb.getSheetAt(i);
+          for(Row r : s) {
+             for(Cell c : r) {
+                if(c.getCellType() == Cell.CELL_TYPE_FORMULA) {
+                   eval.evaluate(c);
+                }
+             }
+          }
+       }
+       
+       // Now all of them
+       XSSFFormulaEvaluator.evaluateAllFormulaCells(wb);
+    }
 }
diff --git a/test-data/spreadsheet/48539.xlsx b/test-data/spreadsheet/48539.xlsx
new file mode 100644 (file)
index 0000000..848382d
Binary files /dev/null and b/test-data/spreadsheet/48539.xlsx differ