From: Dominik Stadler Date: Fri, 17 Jul 2015 08:42:10 +0000 (+0000) Subject: One more try to find out why autosize fails on the freebsd CI machine X-Git-Tag: REL_3_13_FINAL~239 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6e05e13ca7be29ab8630d96950f5f54c2e9749bc;p=poi.git 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 --- diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index e1b1a0b68c..69cf0523ef 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -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