]> source.dussan.org Git - poi.git/commitdiff
Add unit test that seems to show bug #51461 working just fine
authorNick Burch <nick@apache.org>
Fri, 1 Jul 2011 15:16:09 +0000 (15:16 +0000)
committerNick Burch <nick@apache.org>
Fri, 1 Jul 2011 15:16:09 +0000 (15:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1141961 13f79535-47bb-0310-9956-ffa450edef68

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

index 8341f465a58377ae276cba3491811d20c537391d..0982441657b931f59df6e28dc9a7c7e46971a4b9 100644 (file)
@@ -25,6 +25,8 @@ import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
 import org.apache.poi.hssf.record.common.UnicodeString;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.formula.ptg.Area3DPtg;
 import org.apache.poi.ss.formula.ptg.DeletedArea3DPtg;
 import org.apache.poi.ss.formula.ptg.Ptg;
@@ -2123,4 +2125,20 @@ if(1==2) {
        wb = writeOutAndReadBack(wb);
        assertEquals(1, wb.getNumberOfSheets());
     }
+    
+    /**
+     * File with exactly 256 data blocks (+header block)
+     *  shouldn't break on POIFS loading 
+     */
+    public void test51461() throws Exception {
+       byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51461.xls");
+       
+       HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(
+             new ByteArrayInputStream(data)).getRoot(), false);
+       HSSFWorkbook wbNPOIFS = new HSSFWorkbook(new NPOIFSFileSystem(
+             new ByteArrayInputStream(data)).getRoot(), false);
+       
+       assertEquals(2, wbPOIFS.getNumberOfSheets());
+       assertEquals(2, wbNPOIFS.getNumberOfSheets());
+    }
 }
diff --git a/test-data/spreadsheet/51461.xls b/test-data/spreadsheet/51461.xls
new file mode 100644 (file)
index 0000000..0f6c1bd
Binary files /dev/null and b/test-data/spreadsheet/51461.xls differ