From 1d9f92b8ddb4358982aa23036239fcd7036927f8 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Thu, 22 Sep 2016 07:36:52 +0000 Subject: [PATCH] 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 --- .../poi/xssf/usermodel/TestXSSFSheet.java | 18 ++++++++++++++++++ test-data/spreadsheet/59687.xlsx | Bin 0 -> 9580 bytes 2 files changed, 18 insertions(+) create mode 100644 test-data/spreadsheet/59687.xlsx 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 2c561b222d..34ae2cfc40 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -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()); + } } diff --git a/test-data/spreadsheet/59687.xlsx b/test-data/spreadsheet/59687.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8ce567fab3179817d000e3d815f0aa7485c39e4d GIT binary patch literal 9580 zcmeHN1zS|>+8(5(r9+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