[bug-64536] add another test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899092 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-03-20 22:06:27 +00:00
parent 56b4313997
commit 49668edbf2
1 changed files with 26 additions and 18 deletions

View File

@ -1414,9 +1414,9 @@ public final class TestXSSFSheet extends BaseTestXSheet {
}) })
void bug54607(String file, String topRows, String leftCols) throws IOException { void bug54607(String file, String topRows, String leftCols) throws IOException {
Consumer<Workbook> testFun = (wb) -> { Consumer<Workbook> testFun = (wb) -> {
for (int i=0; i<2; i++) { for (int i = 0; i < 2; i++) {
Function<Sheet, Short> sheetFun = (i==0) ? Sheet::getTopRow : Sheet::getLeftCol; Function<Sheet, Short> sheetFun = (i == 0) ? Sheet::getTopRow : Sheet::getLeftCol;
String exp = (i==0) ? topRows : leftCols; String exp = (i == 0) ? topRows : leftCols;
wb.forEach(sh -> assertNotNull(sh.getSheetName())); wb.forEach(sh -> assertNotNull(sh.getSheetName()));
@ -1487,7 +1487,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
} }
} }
private XSSFWorkbook setupSheet(){ private XSSFWorkbook setupSheet() {
//set up workbook //set up workbook
XSSFWorkbook wb = new XSSFWorkbook(); XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(); XSSFSheet sheet = wb.createSheet();
@ -2087,7 +2087,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
Sheet sheet3 = wb.cloneSheet(0); Sheet sheet3 = wb.cloneSheet(0);
wb.setSheetName(2, "Sheet 3"); wb.setSheetName(2, "Sheet 3");
Sheet[] sheets = { sheet2, sheet3 }; Sheet[] sheets = {sheet2, sheet3};
for (Sheet sheet : sheets) { for (Sheet sheet : sheets) {
Drawing<?> drawing = sheet.createDrawingPatriarch(); Drawing<?> drawing = sheet.createDrawingPatriarch();
@ -2156,16 +2156,16 @@ public final class TestXSSFSheet extends BaseTestXSheet {
@Test @Test
void testSheetForceFormulaRecalculationDefaultValues() throws IOException { void testSheetForceFormulaRecalculationDefaultValues() throws IOException {
try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")){ try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")) {
for (Sheet s : wb) { for (Sheet s : wb) {
assertEquals(wb.getForceFormulaRecalculation(),s.getForceFormulaRecalculation()); assertEquals(wb.getForceFormulaRecalculation(), s.getForceFormulaRecalculation());
} }
} }
} }
@Test @Test
void testWorkbookSetForceFormulaRecalculation() throws IOException { void testWorkbookSetForceFormulaRecalculation() throws IOException {
try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")){ try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")) {
wb.setForceFormulaRecalculation(true); wb.setForceFormulaRecalculation(true);
assertTrue(wb.getForceFormulaRecalculation()); assertTrue(wb.getForceFormulaRecalculation());
} }
@ -2277,4 +2277,12 @@ public final class TestXSSFSheet extends BaseTestXSheet {
} }
} }
} }
@Test
void testNewSheetGetDimension() throws IOException {
try (XSSFWorkbook xssfWorkbook = new XSSFWorkbook()) {
XSSFSheet sheet = xssfWorkbook.createSheet();
assertEquals(CellRangeAddress.valueOf("A1"), sheet.getDimension());
}
}
} }