poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1814290 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java test-data/spreadsheet/55814.xlsx
Date Sat, 04 Nov 2017 13:45:12 GMT
Author: centic
Date: Sat Nov  4 13:45:12 2017
New Revision: 1814290

URL: http://svn.apache.org/viewvc?rev=1814290&view=rev
Log:
Add test-case which shows that bug 55814 is fixed already by other changes

Added:
    poi/trunk/test-data/spreadsheet/55814.xlsx
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java?rev=1814290&r1=1814289&r2=1814290&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java Sat Nov
 4 13:45:12 2017
@@ -314,6 +314,39 @@ public final class TestXSSFComment exten
     }
 
     @Test
+    public void testBug55814() throws IOException {
+		try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("55814.xlsx")) {
+
+            int oldsheetIndex = wb.getSheetIndex("example");
+            Sheet oldsheet = wb.getSheetAt(oldsheetIndex);
+
+            Comment comment = oldsheet.getRow(0).getCell(0).getCellComment();
+            assertEquals("Comment Here\n", comment.getString().getString());
+
+            Sheet newsheet = wb.cloneSheet(oldsheetIndex);
+
+            wb.removeSheetAt(oldsheetIndex);
+
+            //wb.write(new FileOutputStream("/tmp/outnocomment.xlsx"));
+
+            comment = newsheet.getRow(0).getCell(0).getCellComment();
+            assertNotNull("Should have a comment on A1 in the new sheet", comment);
+            assertEquals("Comment Here\n", comment.getString().getString());
+
+            Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
+            assertNotNull(wbBack);
+            wbBack.close();
+        }
+
+        try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("55814.xlsx")) {
+            int oldsheetIndex = wb.getSheetIndex("example");
+            Sheet newsheet = wb.getSheetAt(oldsheetIndex);
+            Comment comment = newsheet.getRow(0).getCell(0).getCellComment();
+            assertEquals("Comment Here\n", comment.getString().getString());
+        }
+    }
+
+    @Test
     public void bug57838DeleteRowsWthCommentsBug() throws IOException {
         Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57838.xlsx");
         Sheet sheet=wb.getSheetAt(0);

Added: poi/trunk/test-data/spreadsheet/55814.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/55814.xlsx?rev=1814290&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/55814.xlsx (added) and poi/trunk/test-data/spreadsheet/55814.xlsx
Sat Nov  4 13:45:12 2017 differ



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


Mime
View raw message