Add a unit test that shows bug #48079 no longer applies, and we can resize columns when there are more than 32767 rows

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1072093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-02-18 18:02:47 +00:00
parent 39a3b1c35a
commit bc819d4a20

View File

@ -252,4 +252,43 @@ public abstract class BaseTestSheetAutosizeColumn extends TestCase {
assertTrue(sheet.getColumnWidth(0) > defaulWidth);
}
/**
* Auto-Sizing a column needs to work when we have rows
* passed the 32767 boundary. See bug #48079
*/
public void testLargeRowNumbers() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
Row r0 = sheet.createRow(0);
r0.createCell(0).setCellValue("I am ROW 0");
Row r200 = sheet.createRow(200);
r200.createCell(0).setCellValue("I am ROW 200");
// This should work fine
sheet.autoSizeColumn(0);
// Get close to 32767
Row r32765 = sheet.createRow(32765);
r32765.createCell(0).setCellValue("Nearly there...");
sheet.autoSizeColumn(0);
// To it
Row r32767 = sheet.createRow(32767);
r32767.createCell(0).setCellValue("At the boundary");
sheet.autoSizeColumn(0);
// And passed it
Row r32768 = sheet.createRow(32768);
r32768.createCell(0).setCellValue("Passed");
Row r32769 = sheet.createRow(32769);
r32769.createCell(0).setCellValue("More Passed");
sheet.autoSizeColumn(0);
// Long way passed
Row r60708 = sheet.createRow(60708);
r60708.createCell(0).setCellValue("Near the end");
sheet.autoSizeColumn(0);
}
}