]> source.dussan.org Git - poi.git/commitdiff
Add a disabled unit test for bug #51535
authorNick Burch <nick@apache.org>
Thu, 21 Jul 2011 13:56:20 +0000 (13:56 +0000)
committerNick Burch <nick@apache.org>
Thu, 21 Jul 2011 13:56:20 +0000 (13:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1149181 13f79535-47bb-0310-9956-ffa450edef68

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

index 0982441657b931f59df6e28dc9a7c7e46971a4b9..25ad94e3529c9d271871b139eba9b060edda3b43 100644 (file)
@@ -21,6 +21,7 @@ import junit.framework.AssertionFailedError;
 import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.OldExcelFormatException;
+import org.apache.poi.hssf.extractor.ExcelExtractor;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
@@ -2141,4 +2142,35 @@ if(1==2) {
        assertEquals(2, wbPOIFS.getNumberOfSheets());
        assertEquals(2, wbNPOIFS.getNumberOfSheets());
     }
+    
+    /**
+     * Large row numbers
+     */
+    public void DISABLEDtest51535() throws Exception {
+       byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51535.xls");
+       
+       HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(
+             new ByteArrayInputStream(data)).getRoot(), false);
+       HSSFWorkbook wbNPOIFS = new HSSFWorkbook(new NPOIFSFileSystem(
+             new ByteArrayInputStream(data)).getRoot(), false);
+       
+       for(HSSFWorkbook wb : new HSSFWorkbook[] {wbPOIFS, wbNPOIFS}) {
+          assertEquals(3, wb.getNumberOfSheets());
+          
+          // Check directly
+          HSSFSheet s = wb.getSheetAt(0);
+          assertEquals("Top Left Cell", s.getRow(0).getCell(0).getStringCellValue());
+          assertEquals("Top Right Cell", s.getRow(0).getCell(255).getStringCellValue());
+          assertEquals("Bottom Left Cell", s.getRow(65535).getCell(0).getStringCellValue());
+          assertEquals("Bottom Right Cell", s.getRow(65535).getCell(255).getStringCellValue());
+          
+          // Extract and check
+          ExcelExtractor ex = new ExcelExtractor(wb);
+          String text = ex.getText();
+          assertTrue(text.contains("Top Left Cell"));
+          assertTrue(text.contains("Top Right Cell"));
+          assertTrue(text.contains("Bottom Left Cell"));
+          assertTrue(text.contains("Bottom Right Cell"));
+       }
+    }
 }
diff --git a/test-data/spreadsheet/51535.xls b/test-data/spreadsheet/51535.xls
new file mode 100644 (file)
index 0000000..ab73352
Binary files /dev/null and b/test-data/spreadsheet/51535.xls differ