]> source.dussan.org Git - poi.git/commitdiff
Try to reproduce bug 57798 but it seems to be fixed in the meantime
authorDominik Stadler <centic@apache.org>
Thu, 2 Jun 2016 20:09:35 +0000 (20:09 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 2 Jun 2016 20:09:35 +0000 (20:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1746624 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
test-data/spreadsheet/57798.xls [new file with mode: 0644]
test-data/spreadsheet/57798.xlsx [new file with mode: 0644]

index f131195c10fb8ad9f393a96d41a3a612e3f35871..9ce771b06bece4e1a2d747cbce40b2170b951bac 100644 (file)
@@ -40,7 +40,8 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
     @Override @Ignore("Evaluation is not fully supported") @Test public void bug47815() { /* Evaluation is not supported */ }
     @Override @Ignore("Evaluation is not fully supported") @Test public void test58113() { /* Evaluation is not supported */ }
     @Override @Ignore("Evaluation is not fully supported") @Test public void bug46729_testMaxFunctionArguments() { /* Evaluation is not supported */ }
-    
+    @Override @Ignore("Reading data is not supported") @Test public void bug57798() { /* Reading data is not supported */ }
+
     /**
      * Setting repeating rows and columns shouldn't break
      *  any print settings that were there before
index e84c391cef27257be3a428b8afe9b578cb5f936f..71d561758261df305e551fbc083d16807cb6890e 100644 (file)
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
 import java.awt.font.FontRenderContext;
 import java.awt.font.TextAttribute;
 import java.awt.font.TextLayout;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.text.AttributedString;
 import java.util.HashMap;
@@ -35,6 +36,7 @@ import java.awt.geom.Rectangle2D;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.PaneInformation;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.ITestDataProvider;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -1540,4 +1542,45 @@ public abstract class BaseTestBugzillaIssues {
         
         wb.close();
     }
+
+
+    @Test
+    public void bug57798() throws Exception {
+        String fileName = "57798." + _testDataProvider.getStandardFileNameExtension();
+        Workbook workbook = _testDataProvider.openSampleWorkbook(fileName);
+
+        Sheet sheet = workbook.getSheet("Sheet1");
+
+        // *******************************
+        // First cell of array formula, OK
+        int rowId = 0;
+        int cellId = 1;
+        System.out.println("Reading row " + rowId + ", col " + cellId);
+
+        Row row = sheet.getRow(rowId);
+        Cell cell = row.getCell(cellId);
+
+        System.out.println("Formula:" + cell.getCellFormula());
+        if (Cell.CELL_TYPE_FORMULA == cell.getCellType()) {
+            int formulaResultType = cell.getCachedFormulaResultType();
+            System.out.println("Formual Result Type:" + formulaResultType);
+        }
+
+        // *******************************
+        // Second cell of array formula, NOT OK for xlsx files
+        rowId = 1;
+        cellId = 1;
+        System.out.println("Reading row " + rowId + ", col " + cellId);
+
+        row = sheet.getRow(rowId);
+        cell = row.getCell(cellId);
+        System.out.println("Formula:" + cell.getCellFormula());
+
+        if (Cell.CELL_TYPE_FORMULA == cell.getCellType()) {
+            int formulaResultType = cell.getCachedFormulaResultType();
+            System.out.println("Formual Result Type:" + formulaResultType);
+        }
+
+        workbook.close();
+    }
 }
diff --git a/test-data/spreadsheet/57798.xls b/test-data/spreadsheet/57798.xls
new file mode 100644 (file)
index 0000000..6f66799
Binary files /dev/null and b/test-data/spreadsheet/57798.xls differ
diff --git a/test-data/spreadsheet/57798.xlsx b/test-data/spreadsheet/57798.xlsx
new file mode 100644 (file)
index 0000000..415e450
Binary files /dev/null and b/test-data/spreadsheet/57798.xlsx differ