diff options
author | Dominik Stadler <centic@apache.org> | 2020-11-01 17:59:33 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2020-11-01 17:59:33 +0000 |
commit | dae47d5cedbca87646a2421618e2afac9b04fd3a (patch) | |
tree | dc2c83b9f975acea42583338c1e328702e1ff892 /src | |
parent | 38b415e26af27aa7a22d1d1ea13eb87f445a9066 (diff) | |
download | poi-dae47d5cedbca87646a2421618e2afac9b04fd3a.tar.gz poi-dae47d5cedbca87646a2421618e2afac9b04fd3a.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java index 389f909a97..25a564c917 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java @@ -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); + } + } + |