From: Nick Burch Date: Fri, 18 Feb 2011 18:02:47 +0000 (+0000) Subject: Add a unit test that shows bug #48079 no longer applies, and we can resize columns... X-Git-Tag: REL_3_8_BETA1~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7cb74c7778a35b456bbe757d7fb8d79135c53903;p=poi.git 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 --- diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java index 5adc9ee78a..d4b68a0c8c 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java @@ -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); + } } \ No newline at end of file