Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB6AB17670 for ; Wed, 22 Jul 2015 20:30:25 +0000 (UTC) Received: (qmail 21674 invoked by uid 500); 22 Jul 2015 20:30:25 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 21639 invoked by uid 500); 22 Jul 2015 20:30:25 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 21630 invoked by uid 99); 22 Jul 2015 20:30:25 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2015 20:30:25 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 51DF8AC0233 for ; Wed, 22 Jul 2015 20:30:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1692326 - /poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Date: Wed, 22 Jul 2015 20:30:24 -0000 To: commits@poi.apache.org From: centic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150722203025.51DF8AC0233@hades.apache.org> Author: centic Date: Wed Jul 22 20:30:24 2015 New Revision: 1692326 URL: http://svn.apache.org/r1692326 Log: Yet another adjustment to the test as it seems that small values can be computed, only larger ones fail, let's find out at which point it fails Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java?rev=1692326&r1=1692325&r2=1692326&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java (original) +++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Wed Jul 22 20:30:24 2015 @@ -37,6 +37,7 @@ import org.apache.poi.ss.ITestDataProvid import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.SheetUtil; +import org.apache.poi.util.StringUtil; import org.junit.Assume; import org.junit.Ignore; import org.junit.Test; @@ -368,18 +369,24 @@ public abstract class BaseTestBugzillaIs assertEquals("Expecting no rotation in this test", 0, cell0.getCellStyle().getRotation()); + // check computing size up to a large size + StringBuilder b = new StringBuilder(); + for(int i = 0;i < longValue.length()*5;i++) { + b.append("w"); + assertTrue("Had zero length starting at length " + i, computeCellWidthFixed(font, b.toString()) > 0); + } double widthManual = computeCellWidthManually(cell0, font); double widthBeforeCell = SheetUtil.getCellWidth(cell0, 8, null, false); double widthBeforeCol = SheetUtil.getColumnWidth(sheet, 0, false); assertTrue("Expected to have cell width > 0 when computing manually, but had " + widthManual + "/" + widthBeforeCell + "/" + widthBeforeCol + "/" + - SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(cell0, font, "1") + "/" + computeCellWidthFixed(cell0, font, "0000") + "/" + computeCellWidthFixed(cell0, font, longValue), + SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(font, "1") + "/" + computeCellWidthFixed(font, "0000") + "/" + computeCellWidthFixed(font, longValue), widthManual > 0); assertTrue("Expected to have cell width > 0 BEFORE auto-size, but had " + widthManual + "/" + widthBeforeCell + "/" + widthBeforeCol + "/" + - SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(cell0, font, "1") + "/" + computeCellWidthFixed(cell0, font, "0000") + "/" + computeCellWidthFixed(cell0, font, longValue), + SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(font, "1") + "/" + computeCellWidthFixed(font, "0000") + "/" + computeCellWidthFixed(font, longValue), widthBeforeCell > 0); assertTrue("Expected to have column width > 0 BEFORE auto-size, but had " + widthManual + "/" + widthBeforeCell + "/" + widthBeforeCol + "/" + - SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(cell0, font, "1") + "/" + computeCellWidthFixed(cell0, font, "0000") + "/" + computeCellWidthFixed(cell0, font, longValue), + SheetUtil.canComputeColumnWidht(font) + "/" + computeCellWidthFixed(font, "1") + "/" + computeCellWidthFixed(font, "0000") + "/" + computeCellWidthFixed(font, longValue), widthBeforeCol > 0); sheet.autoSizeColumn(0); @@ -411,7 +418,7 @@ public abstract class BaseTestBugzillaIs return ((layout.getBounds().getWidth() / 1) / 8); } - private double computeCellWidthFixed(Cell cell0, Font font, String txt) { + private double computeCellWidthFixed(Font font, String txt) { final FontRenderContext fontRenderContext = new FontRenderContext(null, true, true); AttributedString str = new AttributedString(txt); copyAttributes(font, str, 0, txt.length()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org