+svn:eol-style native
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782109 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c4ab1dbdf
commit
9a82490f0e
@ -415,40 +415,40 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
|
||||
|
||||
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private static String getCellFormula(Sheet sheet, String address) {
|
||||
CellAddress cellAddress = new CellAddress(address);
|
||||
Row row = sheet.getRow(cellAddress.getRow());
|
||||
assertNotNull(row);
|
||||
Cell cell = row.getCell(cellAddress.getColumn());
|
||||
assertNotNull(cell);
|
||||
assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
|
||||
return cell.getCellFormula();
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCellFormula(Sheet sheet, String address) {
|
||||
CellAddress cellAddress = new CellAddress(address);
|
||||
Row row = sheet.getRow(cellAddress.getRow());
|
||||
assertNotNull(row);
|
||||
Cell cell = row.getCell(cellAddress.getColumn());
|
||||
assertNotNull(cell);
|
||||
assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
|
||||
return cell.getCellFormula();
|
||||
}
|
||||
|
||||
// This test is written as expected-to-fail and should be rewritten
|
||||
// as expected-to-pass when the bug is fixed.
|
||||
@Test
|
||||
public void testSharedFormulas() throws Exception {
|
||||
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx");
|
||||
XSSFSheet sheet = wb.getSheetAt(0);
|
||||
assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5"));
|
||||
assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5"));
|
||||
assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5"));
|
||||
|
||||
@Test
|
||||
public void testSharedFormulas() throws Exception {
|
||||
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx");
|
||||
XSSFSheet sheet = wb.getSheetAt(0);
|
||||
assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5"));
|
||||
assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5"));
|
||||
assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5"));
|
||||
|
||||
sheet.shiftRows(3, sheet.getLastRowNum(), 1);
|
||||
// FIXME: remove try, catch, and testPassesNow, skipTest when test passes
|
||||
try {
|
||||
assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6"));
|
||||
assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6"));
|
||||
// FIXME: remove try, catch, and testPassesNow, skipTest when test passes
|
||||
try {
|
||||
assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6"));
|
||||
assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6"));
|
||||
assertEquals("SUM(E2:E5)", getCellFormula(sheet, "E6"));
|
||||
testPassesNow(59983);
|
||||
} catch (AssertionError e) {
|
||||
skipTest(e);
|
||||
}
|
||||
|
||||
wb.close();
|
||||
wb.close();
|
||||
}
|
||||
|
||||
// bug 60260: shift rows or rename a sheet containing a named range
|
||||
|
Loading…
Reference in New Issue
Block a user