Add test-case which shows that bug 55814 is fixed already by other changes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1814290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-11-04 13:45:12 +00:00
parent 48d6e6c9cf
commit 4d13aefd6e
2 changed files with 33 additions and 0 deletions

View File

@ -313,6 +313,39 @@ public final class TestXSSFComment extends BaseTestCellComment {
} }
} }
@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 @Test
public void bug57838DeleteRowsWthCommentsBug() throws IOException { public void bug57838DeleteRowsWthCommentsBug() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57838.xlsx"); Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57838.xlsx");

Binary file not shown.