]> source.dussan.org Git - poi.git/commitdiff
bug 59687: add failing unit test showing that comments when the row that contains...
authorJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 07:36:52 +0000 (07:36 +0000)
committerJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 07:36:52 +0000 (07:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761860 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
test-data/spreadsheet/59687.xlsx [new file with mode: 0644]

index 2c561b222d1ab8ac4e568d7d51adec1f9696f5ea..34ae2cfc40e390ef3159ff6e8fcfba50241f54ba 100644 (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());
+    }
 }
diff --git a/test-data/spreadsheet/59687.xlsx b/test-data/spreadsheet/59687.xlsx
new file mode 100644 (file)
index 0000000..8ce567f
Binary files /dev/null and b/test-data/spreadsheet/59687.xlsx differ