diff options
author | Javen O'Neal <onealj@apache.org> | 2016-02-18 04:05:45 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-02-18 04:05:45 +0000 |
commit | 865bf1d24f910178167aef05a91dfc75cb9ae738 (patch) | |
tree | f5d58b8bebf0b3feb919a82ffe1ca7db209bdb9c /src/testcases/org | |
parent | 2ffd1d9dd5f66f654f24cdf7d3d72dbec00f0a03 (diff) | |
download | poi-865bf1d24f910178167aef05a91dfc75cb9ae738.tar.gz poi-865bf1d24f910178167aef05a91dfc75cb9ae738.zip |
move trackColumnsForAutoSizingIfSXSSF into ITestDataProvider, replace ITestDataProvider.trackColumnsForAutosizing(Sheet, int...) with ITestDataProvider.trackAllColumnsForAutosizing(Sheet) to avoid cluttering unit tests with specific columns that will be autosized
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1730999 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
3 files changed, 6 insertions, 13 deletions
diff --git a/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java b/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java index 58e6327eb4..5d80a26d53 100644 --- a/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java +++ b/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java @@ -67,8 +67,6 @@ public final class HSSFITestDataProvider implements ITestDataProvider { } @Override - public void trackColumnsForAutosizing(Sheet sheet, int...columns) {} - @Override public void trackAllColumnsForAutosizing(Sheet sheet) {} //************ End SXSSF-specific methods ***************// diff --git a/src/testcases/org/apache/poi/ss/ITestDataProvider.java b/src/testcases/org/apache/poi/ss/ITestDataProvider.java index c88794854e..e258e1a4a2 100644 --- a/src/testcases/org/apache/poi/ss/ITestDataProvider.java +++ b/src/testcases/org/apache/poi/ss/ITestDataProvider.java @@ -60,7 +60,6 @@ public interface ITestDataProvider { * Only matters for SXSSF - enables tracking of the column * widths so that autosizing can work. No-op on others. */ - void trackColumnsForAutosizing(Sheet sheet, int...columns); void trackAllColumnsForAutosizing(Sheet sheet); //************ End SXSSF-specific methods ***************// diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index e5991adf9a..99c07c0c6c 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -55,10 +55,6 @@ public abstract class BaseTestBugzillaIssues { protected BaseTestBugzillaIssues(ITestDataProvider testDataProvider) { _testDataProvider = testDataProvider; } - - protected void trackColumnsForAutoSizingIfSXSSF(Sheet sheet) { - // do nothing for Sheet base class. This will be overridden for SXSSFSheets. - } /** * Unlike org.junit.Assert.assertEquals(double expected, double actual, double delta), @@ -377,7 +373,7 @@ public abstract class BaseTestBugzillaIssues { Workbook wb = _testDataProvider.createWorkbook(); BaseTestSheetAutosizeColumn.fixFonts(wb); Sheet sheet = wb.createSheet("Sheet1"); - trackColumnsForAutoSizingIfSXSSF(sheet); + _testDataProvider.trackAllColumnsForAutosizing(sheet); Row row = sheet.createRow(0); Cell cell0 = row.createCell(0); @@ -434,7 +430,7 @@ public abstract class BaseTestBugzillaIssues { Workbook wb = _testDataProvider.createWorkbook(); BaseTestSheetAutosizeColumn.fixFonts(wb); Sheet sheet = wb.createSheet(); - trackColumnsForAutoSizingIfSXSSF(sheet); + _testDataProvider.trackAllColumnsForAutosizing(sheet); Row row = sheet.createRow(0); Cell cell0 = row.createCell(0); Cell cell1 = row.createCell(1); @@ -670,7 +666,7 @@ public abstract class BaseTestBugzillaIssues { d2Percent.setDataFormat(format.getFormat("0.00%")); Sheet s = wb.createSheet(); - trackColumnsForAutoSizingIfSXSSF(s); + _testDataProvider.trackAllColumnsForAutosizing(s); Row r1 = s.createRow(0); for (int i=0; i<3; i++) { @@ -1393,7 +1389,7 @@ public abstract class BaseTestBugzillaIssues { cell.setCellValue((String)null); assertEquals(Cell.CELL_TYPE_BLANK, cell.getCellType()); - _testDataProvider.trackColumnsForAutosizing(s, 0); + _testDataProvider.trackAllColumnsForAutosizing(s); s.autoSizeColumn(0); assertEquals(2048, s.getColumnWidth(0)); @@ -1480,11 +1476,11 @@ public abstract class BaseTestBugzillaIssues { } } - public long time() { + protected long time() { final long currentTime = System.currentTimeMillis(); return currentTime; } - public double delta(long startTimeMillis) { + protected double delta(long startTimeMillis) { return time() - startTimeMillis; } } |