From: Nick Burch Date: Thu, 21 Jul 2011 13:56:20 +0000 (+0000) Subject: Add a disabled unit test for bug #51535 X-Git-Tag: REL_3_8_BETA4~104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=daf3612d16a2dd030f08e8d1cdc599f23ea1a971;p=poi.git Add a disabled unit test for bug #51535 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1149181 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 0982441657..25ad94e352 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -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 index 0000000000..ab73352b8a Binary files /dev/null and b/test-data/spreadsheet/51535.xls differ