bug 59687: add failing unit test showing that comments when the row that contains the comment is deleted; patch and file contributed by Greg Woolsey

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761860 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-09-22 07:36:52 +00:00
parent 67e242cb12
commit 1d9f92b8dd
2 changed files with 18 additions and 0 deletions

View File

@ -2020,4 +2020,22 @@ public final class TestXSSFSheet extends BaseTestXSheet {
} }
} }
// bug 59687: XSSFSheet.RemoveRow doesn't handle row gaps properly when removing row comments
// This test is currently failing (thus expected AssertionError). When this bug is fixed, no error should be thrown.
@Test(expected=AssertionError.class)
public void testRemoveRowWithCommentAndGapAbove() throws IOException {
final Workbook wb = _testDataProvider.openSampleWorkbook("59687.xlsx");
final Sheet sheet = wb.getSheetAt(0);
// comment exists
CellAddress commentCellAddress = new CellAddress("A4");
assertNotNull(sheet.getCellComment(commentCellAddress));
assertEquals("Wrong starting # of comments", 1, sheet.getCellComments().size());
sheet.removeRow(sheet.getRow(commentCellAddress.getRow()));
assertEquals("There should not be any comments left!", 0, sheet.getCellComments().size());
}
} }

Binary file not shown.