One more try to find out why autosize fails on the freebsd CI machine

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-07-17 08:42:10 +00:00
parent 5590c5bcad
commit 6e05e13ca7
1 changed files with 14 additions and 4 deletions

View File

@ -354,15 +354,25 @@ public abstract class BaseTestBugzillaIssues {
cell0.setCellValue(longValue);
sheet.autoSizeColumn(0);
// autoSize will fail if required fonts are not installed, skip this test then
Font font = wb.getFontAt(cell0.getCellStyle().getFontIndex());
Assume.assumeTrue("Cannot verify auoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
SheetUtil.canComputeColumnWidht(font));
double width = SheetUtil.getCellWidth(cell0, 8, null, false);
assertTrue("Expected to have cell width > 0 after auto-size, but had " + width, width > 0);
assertEquals("Expecting no indentation in this test",
0, cell0.getCellStyle().getIndention());
double width = SheetUtil.getColumnWidth(sheet, 0, false);
assertTrue("Expected to have column width > 0 BEFORE auto-size, but had " + width, width > 0);
width = SheetUtil.getCellWidth(cell0, 8, null, false);
assertTrue("Expected to have cell width > 0 BEFORE auto-size, but had " + width, width > 0);
sheet.autoSizeColumn(0);
width = SheetUtil.getColumnWidth(sheet, 0, false);
assertTrue("Expected to have column width > 0 AFTER auto-size, but had " + width, width > 0);
width = SheetUtil.getCellWidth(cell0, 8, null, false);
assertTrue("Expected to have cell width > 0 AFTER auto-size, but had " + width, width > 0);
assertEquals(255*256, sheet.getColumnWidth(0)); // maximum column width is 255 characters
sheet.setColumnWidth(0, sheet.getColumnWidth(0)); // Bug 506819 reports exception at this point