]> source.dussan.org Git - poi.git/commitdiff
Add a unit test that shows bug #48079 no longer applies, and we can resize columns...
authorNick Burch <nick@apache.org>
Fri, 18 Feb 2011 18:02:47 +0000 (18:02 +0000)
committerNick Burch <nick@apache.org>
Fri, 18 Feb 2011 18:02:47 +0000 (18:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1072093 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java

index 5adc9ee78aea2aee8d96268e5952f86ef8bfa206..d4b68a0c8ceac771679ab535cdbb9571b8082215 100644 (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);
+    }
 }
\ No newline at end of file