Add unit-test from bug 56454 to show that the problem is fixed now

Probably fixed as part of 64460 via r1883037.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2020-11-01 17:59:33 +00:00
parent 38b415e26a
commit dae47d5ced
1 changed files with 32 additions and 0 deletions
src/testcases/org/apache/poi/ss/usermodel

View File

@ -764,6 +764,38 @@ public abstract class BaseTestSheetShiftRows {
}
@Test
public void checkMergedRegions56454() {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet();
// populate sheet cells
for (int i = 0; i < 10; i++) {
Row row = sheet.createRow(i);
for (int j = 0; j < 10; j++) {
Cell cell = row.createCell(j, CellType.STRING);
cell.setCellValue(i + "x" + j);
}
}
CellRangeAddress region1 = new CellRangeAddress(3, 6, 0, 1);
CellRangeAddress region2 = new CellRangeAddress(3, 6, 2, 3);
sheet.addMergedRegion(region1);
sheet.addMergedRegion(region2);
sheet.shiftRows(4, sheet.getLastRowNum(), 1);
// check, if all regions still start at row 3
for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
CellRangeAddress cr = sheet.getMergedRegion(i);
assertEquals(cr.getFirstRow(), 3);
}
}