+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:
Javen O'Neal 2017-02-08 07:04:55 +00:00
parent 5c4ab1dbdf
commit 9a82490f0e
1 changed files with 24 additions and 24 deletions

View File

@ -415,40 +415,40 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
workbook.close(); workbook.close();
} }
private static String getCellFormula(Sheet sheet, String address) { private static String getCellFormula(Sheet sheet, String address) {
CellAddress cellAddress = new CellAddress(address); CellAddress cellAddress = new CellAddress(address);
Row row = sheet.getRow(cellAddress.getRow()); Row row = sheet.getRow(cellAddress.getRow());
assertNotNull(row); assertNotNull(row);
Cell cell = row.getCell(cellAddress.getColumn()); Cell cell = row.getCell(cellAddress.getColumn());
assertNotNull(cell); assertNotNull(cell);
assertEquals(CellType.FORMULA, cell.getCellTypeEnum()); assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
return cell.getCellFormula(); return cell.getCellFormula();
} }
// This test is written as expected-to-fail and should be rewritten // This test is written as expected-to-fail and should be rewritten
// as expected-to-pass when the bug is fixed. // as expected-to-pass when the bug is fixed.
@Test @Test
public void testSharedFormulas() throws Exception { public void testSharedFormulas() throws Exception {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx"); XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx");
XSSFSheet sheet = wb.getSheetAt(0); XSSFSheet sheet = wb.getSheetAt(0);
assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5")); assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5"));
assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5")); assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5"));
assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5")); assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5"));
sheet.shiftRows(3, sheet.getLastRowNum(), 1); sheet.shiftRows(3, sheet.getLastRowNum(), 1);
// FIXME: remove try, catch, and testPassesNow, skipTest when test passes // FIXME: remove try, catch, and testPassesNow, skipTest when test passes
try { try {
assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6")); assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6"));
assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6")); assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6"));
assertEquals("SUM(E2:E5)", getCellFormula(sheet, "E6")); assertEquals("SUM(E2:E5)", getCellFormula(sheet, "E6"));
testPassesNow(59983); testPassesNow(59983);
} catch (AssertionError e) { } catch (AssertionError e) {
skipTest(e); skipTest(e);
} }
wb.close(); wb.close();
} }
// bug 60260: shift rows or rename a sheet containing a named range // bug 60260: shift rows or rename a sheet containing a named range