poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1653814 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java test-data/spreadsheet/57482-OnlyNumeric.xlsx
Date Thu, 22 Jan 2015 11:45:40 GMT
Author: nick
Date: Thu Jan 22 11:45:40 2015
New Revision: 1653814

URL: http://svn.apache.org/r1653814
Log:
Unit test from Isao Kadowaki from bug #57482

Added:
    poi/trunk/test-data/spreadsheet/57482-OnlyNumeric.xlsx   (with props)
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1653814&r1=1653813&r2=1653814&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Thu Jan
22 11:45:40 2015
@@ -18,7 +18,13 @@
 package org.apache.poi.xssf.usermodel;
 
 import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -38,6 +44,7 @@ import org.apache.poi.hssf.HSSFTestDataS
 import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
@@ -47,7 +54,26 @@ import org.apache.poi.ss.formula.eval.Er
 import org.apache.poi.ss.formula.eval.NumberEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
 import org.apache.poi.ss.formula.functions.Function;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.Comment;
+import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Drawing;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.FormulaError;
+import org.apache.poi.ss.usermodel.FormulaEvaluator;
+import org.apache.poi.ss.usermodel.Hyperlink;
+import org.apache.poi.ss.usermodel.IndexedColors;
+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.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.apache.poi.ss.util.AreaReference;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellReference;
@@ -2052,4 +2078,32 @@ public final class TestXSSFBugs extends
             wb.close();
         }
     }
+    
+    /**
+     * A .xlsx file with no Shared Strings table should open fine
+     *  in read-only mode
+     */
+    @Ignore
+    @Test
+    public void bug57482() throws Exception {
+        for (PackageAccess access : new PackageAccess[] {
+                PackageAccess.READ_WRITE, PackageAccess.READ
+        }) {
+            File file = HSSFTestDataSamples.getSampleFile("57482-OnlyNumeric.xlsx");
+            OPCPackage pkg = OPCPackage.open(file, access);
+            try {
+                XSSFWorkbook wb = new XSSFWorkbook(pkg);
+                assertNotNull(wb.getSharedStringSource());
+                assertEquals(0, wb.getSharedStringSource().getCount());
+                
+                DataFormatter fmt = new DataFormatter();
+                XSSFSheet s = wb.getSheetAt(0);
+                assertEquals("1",  fmt.formatCellValue(s.getRow(0).getCell(0)));
+                assertEquals("11", fmt.formatCellValue(s.getRow(0).getCell(1)));
+                assertEquals("5",  fmt.formatCellValue(s.getRow(4).getCell(0)));
+            } finally {
+                pkg.close();
+            }
+        }
+    }
 }

Added: poi/trunk/test-data/spreadsheet/57482-OnlyNumeric.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/57482-OnlyNumeric.xlsx?rev=1653814&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/57482-OnlyNumeric.xlsx
------------------------------------------------------------------------------
    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


Mime
View raw message