bug 56454: add disabled unit test based on Jörg Selbach's test case showing shiftRows incorrectly handles merged regions

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-20 01:44:44 +00:00
parent 015cf4c86f
commit 2804197bdb
1 changed files with 33 additions and 0 deletions

View File

@ -602,6 +602,39 @@ public abstract class BaseTestSheetShiftRows {
read.close();
}
// bug 56454
@Ignore
@Test
public void shiftRowsWithMergedRegionsThatDoNotContainColumnZero() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
// populate sheet cells
for (int i = 0; i < 10; i++) {
Row row = sheet.createRow(i);
for (int j = 0; j < 12; j++) {
Cell cell = row.createCell(j);
cell.setCellValue(i + "x" + j);
}
}
CellRangeAddress A4_B7 = new CellRangeAddress(3, 6, 0, 1);
CellRangeAddress C5_D7 = new CellRangeAddress(4, 6, 2, 3);
sheet.addMergedRegion(A4_B7);
sheet.addMergedRegion(C5_D7);
// A4:B7 will elongate vertically
// C5:D7 will be shifted down with same size
sheet.shiftRows(4, sheet.getLastRowNum(), 1);
assertEquals(2, sheet.getNumMergedRegions());
assertEquals(CellRangeAddress.valueOf("A4:B8"), sheet.getMergedRegion(0));
assertEquals(CellRangeAddress.valueOf("C5:D8"), sheet.getMergedRegion(1));
wb.close();
}
private void createHyperlink(CreationHelper helper, Cell cell, int linkType, String ref) {
cell.setCellValue(ref);
Hyperlink link = helper.createHyperlink(linkType);