Author: nick
Date: Fri Feb 16 11:47:24 2018
New Revision: 1824451
URL: http://svn.apache.org/viewvc?rev=1824451&view=rev
Log:
Unit test to try to reproduce bug #62108 (currenly works though...)
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1824451&r1=1824450&r2=1824451&view=diff
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
(original)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
Fri Feb 16 11:47:24 2018
@@ -3252,4 +3252,45 @@ public final class TestXSSFBugs extends
wb.close();
}
+
+ /**
+ * Auto column sizing failed when there were loads of fonts with
+ * errors like ArrayIndexOutOfBoundsException: -32765
+ * TODO Get this to actually reproduce the bug...
+ */
+ @Test
+ public void test62108() throws IOException {
+ XSSFWorkbook wb = new XSSFWorkbook();
+ XSSFSheet sheet = wb.createSheet();
+ XSSFRow row = sheet.createRow(0);
+
+ // Create lots of fonts
+ XSSFDataFormat formats = wb.createDataFormat();
+ XSSFFont[] fonts = new XSSFFont[50000];
+ for (int i=0; i<fonts.length; i++) {
+ XSSFFont font = wb.createFont();
+ font.setFontHeight(i);
+ }
+
+ // Create a moderate number of columns, which use
+ // fonts from the start and end of the font list
+ final int numCols = 125;
+ for (int i=0; i<numCols; i++) {
+ XSSFCellStyle cs = wb.createCellStyle();
+ cs.setDataFormat(formats.getFormat("'Test "+i+"' #,###"));
+
+ XSSFFont font = fonts[i];
+ if (i%2==1) { font = fonts[fonts.length-i]; }
+ cs.setFont(font);
+
+ XSSFCell c = row.createCell(i);
+ c.setCellValue(i);
+ c.setCellStyle(cs);
+ }
+
+ // Do the auto-size
+ for (int i=0; i<numCols; i++) {
+ sheet.autoSizeColumn(i);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]