aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java18
-rw-r--r--test-data/spreadsheet/59687.xlsxbin0 -> 9580 bytes
2 files changed, 18 insertions, 0 deletions
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 0000000000..8ce567fab3
--- /dev/null
+++ b/test-data/spreadsheet/59687.xlsx
Binary files differ