Author: onealj
Date: Thu Sep 22 07:36:52 2016
New Revision: 1761860

URL: http://svn.apache.org/viewvc?rev=1761860&view=rev
Log:
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

Added:
    poi/trunk/test-data/spreadsheet/59687.xlsx   (with props)
Modified:
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=1761860&r1=1761859&r2=1761860&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java 
(original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java 
Thu Sep 22 07:36:52 2016
@@ -2020,4 +2020,22 @@ public final class TestXSSFSheet extends
                }
 
     }
+    
+    // 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());
+    }
 }

Added: poi/trunk/test-data/spreadsheet/59687.xlsx
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/59687.xlsx?rev=1761860&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/59687.xlsx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Thu Sep 22 07:36:52 2016
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to