From: Yegor Kozlov Date: Tue, 24 Feb 2009 08:38:16 +0000 (+0000) Subject: added setDisplayZeros / isDisplayZeros and getMergedRegion(int) to common interface... X-Git-Tag: REL_3_5_BETA6~101 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2ef665caf691d9b5514c1d474061332ccdddac10;p=poi.git added setDisplayZeros / isDisplayZeros and getMergedRegion(int) to common interface org.apache.poi.ss.usermodel.Sheet; more progress on testing common xssf-hssf interfaces git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@747307 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 9389059f55..c461c0c5bb 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,14 +36,16 @@ - + + 46703 - added setDisplayZeros / isDisplayZeros to common interface org.apache.poi.ss.usermodel.Sheet + 46708 - added getMergedRegion(int) to common interface org.apache.poi.ss.usermodel.Sheet fixed Sheet.autoSizeColumn() to use cached formula values when processing formula cells Fixed formula parser to handle names with backslashes 46660 - added Workbook getHidden() and setHidden(boolean) 46693 - Fixed bugs serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX 46627 - Fixed offset of added images if Pictures stream contains pictures with zero length - + 46536 - When shifting rows, update formulas on that sheet to point to the new location of those rows 46663 - Fixed XSSFSheet.shiftRows to properly update references of the shifted cells 46535 - Remove reference from calculation chain when a formula is deleted diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 989c45d384..b85e04df0c 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,14 +33,16 @@ - + + 46703 - added setDisplayZeros / isDisplayZeros to common interface org.apache.poi.ss.usermodel.Sheet + 46708 - added getMergedRegion(int) to common interface org.apache.poi.ss.usermodel.Sheet fixed Sheet.autoSizeColumn() to use cached formula values when processing formula cells Fixed formula parser to handle names with backslashes 46660 - added Workbook getHidden() and setHidden(boolean) 46693 - Fixed bugs serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX 46627 - Fixed offset of added images if Pictures stream contains pictures with zero length - + 46536 - When shifting rows, update formulas on that sheet to point to the new location of those rows 46663 - Fixed XSSFSheet.shiftRows to properly update references of the shifted cells 46535 - Remove reference from calculation chain when a formula is deleted diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index 86336034df..96a21810b2 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -841,6 +841,31 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { .getDisplayGuts(); } + + /** + * Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + *

+ * In Excel 2003 this option can be changed in the Options dialog on the View tab. + *

+ * @return whether all zero values on the worksheet are displayed + */ + public boolean isDisplayZeros(){ + return _sheet.getWindowTwo().getDisplayZeros(); + } + + /** + * Set whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + *

+ * In Excel 2003 this option can be set in the Options dialog on the View tab. + *

+ * @param value whether to display or hide all zero values on the worksheet + */ + public void setDisplayZeros(boolean value){ + _sheet.getWindowTwo().setDisplayZeros(value); + } + /** * fit to page option is on * @return fit or not diff --git a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java index ad3e50b09e..0a508c382e 100644 --- a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java +++ b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java @@ -238,6 +238,13 @@ public interface Sheet extends Iterable { */ int getNumMergedRegions(); + /** + * Returns the merged region at the specified index + * + * @return the merged region at the specified index + */ + public CellRangeAddress getMergedRegion(int index); + /** * Returns an iterator of the physical rows * @@ -260,6 +267,23 @@ public interface Sheet extends Iterable { */ void setDisplayGuts(boolean value); + /** + * Set whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + * + * @param value whether to display or hide all zero values on the worksheet + */ + void setDisplayZeros(boolean value); + + + /** + * Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + * + * @return whether all zero values on the worksheet are displayed + */ + boolean isDisplayZeros(); + /** * Flag indicating whether the Fit to Page print option is enabled. * diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index e44208b75e..bdc917d839 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -539,6 +539,28 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { outlinePr.setShowOutlineSymbols(value); } + /** + * Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + * + * @return whether all zero values on the worksheet are displayed + */ + public boolean isDisplayZeros(){ + CTSheetView view = getDefaultSheetView(); + return view == null ? true : view.getShowZeros(); + } + + /** + * Set whether the window should show 0 (zero) in cells containing zero value. + * When false, cells with zero value appear blank instead of showing the number zero. + * + * @param value whether to display or hide all zero values on the worksheet + */ + public void setDisplayZeros(boolean value){ + CTSheetView view = getSheetTypeSheetView(); + view.setShowZeros(value); + } + /** * Gets the first row on the sheet * diff --git a/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java b/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java new file mode 100755 index 0000000000..c0a17cf435 --- /dev/null +++ b/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java @@ -0,0 +1,49 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ +package org.apache.poi.xssf; + +import org.apache.poi.ss.ITestDataProvider; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * @author Yegor Kozlov + */ +public final class XSSFITestDataProvider implements ITestDataProvider { + + public XSSFWorkbook openSampleWorkbook(String sampleFileName) { + return XSSFTestDataSamples.openSampleWorkbook(sampleFileName); + } + + public XSSFWorkbook writeOutAndReadBack(Workbook original) { + if(!(original instanceof XSSFWorkbook)) { + throw new IllegalArgumentException("Expected an instance of XSSFWorkbook"); + } + + return XSSFTestDataSamples.writeOutAndReadBack((XSSFWorkbook)original); + } + + public XSSFWorkbook createWorkbook(){ + return new XSSFWorkbook(); + } + + private XSSFITestDataProvider(){} + private static XSSFITestDataProvider inst = new XSSFITestDataProvider(); + public static XSSFITestDataProvider getInstance(){ + return inst; + } +} diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSheetShiftRows.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSheetShiftRows.java index f3a0fb5b11..212271d0b7 100755 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSheetShiftRows.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSheetShiftRows.java @@ -17,8 +17,8 @@ package org.apache.poi.xssf.usermodel; import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.XSSFTestDataSamples; +import org.apache.poi.ss.ITestDataProvider; +import org.apache.poi.xssf.XSSFITestDataProvider; /** * @author Yegor Kozlov @@ -26,18 +26,8 @@ import org.apache.poi.xssf.XSSFTestDataSamples; public class TestSheetShiftRows extends BaseTestSheetShiftRows { @Override - protected Workbook openSampleWorkbook(String sampleFileName) { - return XSSFTestDataSamples.openSampleWorkbook(sampleFileName); - } - - @Override - protected Workbook writeOutAndReadBack(Workbook wb) { - return XSSFTestDataSamples.writeOutAndReadBack(wb); - } - - @Override - protected Workbook createWorkbook() { - return new XSSFWorkbook(); + protected ITestDataProvider getTestDataProvider(){ + return XSSFITestDataProvider.getInstance(); } public void testShiftRows() { diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index 38ad08f64e..c19ea200f1 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -926,4 +926,32 @@ public class TestXSSFSheet extends TestCase { assertEquals(500, sh2.getColumnWidth(0)); assertEquals(sh1.getColumnWidth(0), sh2.getColumnWidth(0)); } + + /** + * Tests the display of gridlines, formulas, and rowcolheadings. + * @author Shawn Laubach (slaubach at apache dot org) + */ + public void testDisplayOptions() { + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet(); + + assertEquals(sheet.isDisplayGridlines(), true); + assertEquals(sheet.isDisplayRowColHeadings(), true); + assertEquals(sheet.isDisplayFormulas(), false); + assertEquals(sheet.isDisplayZeros(), true); + + sheet.setDisplayGridlines(false); + sheet.setDisplayRowColHeadings(false); + sheet.setDisplayFormulas(true); + sheet.setDisplayZeros(false); + + wb = XSSFTestDataSamples.writeOutAndReadBack(wb); + sheet = wb.getSheetAt(0); + + assertEquals(sheet.isDisplayGridlines(), false); + assertEquals(sheet.isDisplayRowColHeadings(), false); + assertEquals(sheet.isDisplayFormulas(), true); + assertEquals(sheet.isDisplayZeros(), false); + } + } diff --git a/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java b/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java new file mode 100755 index 0000000000..2311cc0b39 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java @@ -0,0 +1,50 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.ITestDataProvider; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * @author Yegor Kozlov + */ +public final class HSSFITestDataProvider implements ITestDataProvider { + + public HSSFWorkbook openSampleWorkbook(String sampleFileName) { + return HSSFTestDataSamples.openSampleWorkbook(sampleFileName); + } + + public HSSFWorkbook writeOutAndReadBack(Workbook original) { + if(!(original instanceof HSSFWorkbook)) { + throw new IllegalArgumentException("Expected an instance of HSSFWorkbook"); + } + + return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook)original); + } + + public HSSFWorkbook createWorkbook(){ + return new HSSFWorkbook(); + } + + private HSSFITestDataProvider(){} + private static HSSFITestDataProvider inst = new HSSFITestDataProvider(); + public static HSSFITestDataProvider getInstance(){ + return inst; + } +} \ No newline at end of file diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index c119daa283..446034ebfe 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -538,16 +538,15 @@ public final class TestHSSFSheet extends TestCase { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); - wb = HSSFTestDataSamples.writeOutAndReadBack(wb); - sheet = wb.getSheetAt(0); - assertEquals(sheet.isDisplayGridlines(), true); assertEquals(sheet.isDisplayRowColHeadings(), true); assertEquals(sheet.isDisplayFormulas(), false); + assertEquals(sheet.isDisplayZeros(), true); sheet.setDisplayGridlines(false); sheet.setDisplayRowColHeadings(false); sheet.setDisplayFormulas(true); + sheet.setDisplayZeros(false); wb = HSSFTestDataSamples.writeOutAndReadBack(wb); sheet = wb.getSheetAt(0); @@ -555,6 +554,7 @@ public final class TestHSSFSheet extends TestCase { assertEquals(sheet.isDisplayGridlines(), false); assertEquals(sheet.isDisplayRowColHeadings(), false); assertEquals(sheet.isDisplayFormulas(), true); + assertEquals(sheet.isDisplayZeros(), false); } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java index 962a565503..84e0aebdd2 100755 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java @@ -17,8 +17,7 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows; /** @@ -30,23 +29,11 @@ import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows; */ public final class TestSheetShiftRows extends BaseTestSheetShiftRows { - @Override - protected Workbook openSampleWorkbook(String sampleFileName) { - return HSSFTestDataSamples.openSampleWorkbook(sampleFileName); - } - @Override - protected Workbook writeOutAndReadBack(Workbook wb) { - if (wb instanceof HSSFWorkbook) { - return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook) wb); - } - throw new IllegalArgumentException("bad workbook type (" + wb.getClass().getName() + ")"); - } - - @Override - protected Workbook createWorkbook() { - return new HSSFWorkbook(); - } + @Override + protected HSSFITestDataProvider getTestDataProvider(){ + return HSSFITestDataProvider.getInstance(); + } public void testShiftRows() { baseTestShiftRows("SimpleMultiCell.xls"); diff --git a/src/testcases/org/apache/poi/ss/ITestDataProvider.java b/src/testcases/org/apache/poi/ss/ITestDataProvider.java new file mode 100755 index 0000000000..f3ca3b256f --- /dev/null +++ b/src/testcases/org/apache/poi/ss/ITestDataProvider.java @@ -0,0 +1,47 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ +package org.apache.poi.ss; + +import org.apache.poi.ss.usermodel.Workbook; + +/** + * Incapsulates a provider of test data for common HSSF / XSSF tests. + */ +public interface ITestDataProvider { + /** + * Override to provide HSSF / XSSF specific way for re-serialising a workbook + * + * @param wb the workbook to re-serialize + * @return the re-serialized workbook + */ + Workbook writeOutAndReadBack(Workbook wb); + + /** + * Override to provide way of loading HSSF / XSSF sample workbooks + * + * @param sampleFileName the file name to load + * @return an instance of Workbook loaded from the supplied file name + */ + Workbook openSampleWorkbook(String sampleFileName); + + /** + * Override to provide way of creating HSSF / XSSF workbooks + * @return an instance of Workbook + */ + Workbook createWorkbook(); + +} diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java index 7b83cbbd53..a9305d8cae 100755 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java @@ -18,6 +18,7 @@ package org.apache.poi.ss.usermodel; import junit.framework.TestCase; +import org.apache.poi.ss.ITestDataProvider; /** * Tests row shifting capabilities. @@ -26,19 +27,11 @@ import junit.framework.TestCase; * @author Toshiaki Kamoshida (kamoshida.toshiaki at future dot co dot jp) */ public abstract class BaseTestSheetShiftRows extends TestCase { + /** - * Override to provide HSSF / XSSF specific way for re-serialising a workbook - */ - protected abstract Workbook writeOutAndReadBack(Workbook wb); - /** - * Override to provide way of loading HSSF / XSSF sample workbooks - * @param sampleFileName without the ".xls" or ".xlsx" suffix - */ - protected abstract Workbook openSampleWorkbook(String sampleFileName); - /** - * Override to provide way of creating HSSF / XSSF workbooks + * @return an object that provides test data in HSSF / XSSF specific way */ - protected abstract Workbook createWorkbook(); + protected abstract ITestDataProvider getTestDataProvider(); /** * Tests the shiftRows function. Does three different shifts. @@ -46,17 +39,17 @@ public abstract class BaseTestSheetShiftRows extends TestCase { * check. This ensures that if some changes code that breaks * writing or what not, they realize it. * - * @author Shawn Laubach (slaubach at apache dot org) + * @param sampleName the sample file to test against */ public final void baseTestShiftRows(String sampleName){ // Read initial file in - Workbook wb = openSampleWorkbook(sampleName); + Workbook wb = getTestDataProvider().openSampleWorkbook(sampleName); Sheet s = wb.getSheetAt( 0 ); // Shift the second row down 1 and write to temp file s.shiftRows( 1, 1, 1 ); - wb = writeOutAndReadBack(wb); + wb = getTestDataProvider().writeOutAndReadBack(wb); // Read from temp file and check the number of cells in each // row (in original file each row was unique) @@ -71,7 +64,7 @@ public abstract class BaseTestSheetShiftRows extends TestCase { // Shift rows 1-3 down 3 in the current one. This tests when // 1 row is blank. Write to a another temp file s.shiftRows( 0, 2, 3 ); - wb = writeOutAndReadBack(wb); + wb = getTestDataProvider().writeOutAndReadBack(wb); // Read and ensure things are where they should be s = wb.getSheetAt(0); @@ -83,12 +76,12 @@ public abstract class BaseTestSheetShiftRows extends TestCase { assertEquals(s.getRow(5).getPhysicalNumberOfCells(), 2); // Read the first file again - wb = openSampleWorkbook(sampleName); + wb = getTestDataProvider().openSampleWorkbook(sampleName); s = wb.getSheetAt( 0 ); // Shift rows 3 and 4 up and write to temp file s.shiftRows( 2, 3, -2 ); - wb = writeOutAndReadBack(wb); + wb = getTestDataProvider().writeOutAndReadBack(wb); s = wb.getSheetAt( 0 ); assertEquals(s.getRow(0).getPhysicalNumberOfCells(), 3); assertEquals(s.getRow(1).getPhysicalNumberOfCells(), 4); @@ -103,11 +96,9 @@ public abstract class BaseTestSheetShiftRows extends TestCase { /** * Tests when rows are null. - * - * @author Toshiaki Kamoshida (kamoshida.toshiaki at future dot co dot jp) */ public final void baseTestShiftRow() { - Workbook b = createWorkbook(); + Workbook b = getTestDataProvider().createWorkbook(); Sheet s = b.createSheet(); s.createRow(0).createCell(0).setCellValue("TEST1"); s.createRow(3).createCell(0).setCellValue("TEST2"); @@ -116,11 +107,9 @@ public abstract class BaseTestSheetShiftRows extends TestCase { /** * Tests when shifting the first row. - * - * @author Toshiaki Kamoshida (kamoshida.toshiaki at future dot co dot jp) */ public final void baseTestShiftRow0() { - Workbook b = createWorkbook(); + Workbook b = getTestDataProvider().createWorkbook(); Sheet s = b.createSheet(); s.createRow(0).createCell(0).setCellValue("TEST1"); s.createRow(3).createCell(0).setCellValue("TEST2"); @@ -132,7 +121,7 @@ public abstract class BaseTestSheetShiftRows extends TestCase { * */ public final void baseTestShiftRowBreaks() { - Workbook b = createWorkbook(); + Workbook b = getTestDataProvider().createWorkbook(); Sheet s = b.createSheet(); Row row = s.createRow(4); row.createCell(0).setCellValue("test"); @@ -144,7 +133,7 @@ public abstract class BaseTestSheetShiftRows extends TestCase { public final void baseTestShiftWithComments(String sampleName) { - Workbook wb = openSampleWorkbook(sampleName); + Workbook wb = getTestDataProvider().openSampleWorkbook(sampleName); Sheet sheet = wb.getSheet("Sheet1"); assertEquals(3, sheet.getLastRowNum()); @@ -182,7 +171,7 @@ public abstract class BaseTestSheetShiftRows extends TestCase { // Write out and read back in again // Ensure that the changes were persisted - wb = writeOutAndReadBack(wb); + wb = getTestDataProvider().writeOutAndReadBack(wb); sheet = wb.getSheet("Sheet1"); assertEquals(4, sheet.getLastRowNum()); @@ -203,9 +192,11 @@ public abstract class BaseTestSheetShiftRows extends TestCase { /** * See bug #34023 + * + * @param sampleName the sample file to test against */ public void baseTestShiftWithFormulas(String sampleName) { - Workbook wb = openSampleWorkbook(sampleName); + Workbook wb = getTestDataProvider().openSampleWorkbook(sampleName); Sheet sheet = wb.getSheet("Sheet1"); assertEquals(20, sheet.getLastRowNum());