aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftColumns.java2
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java24
2 files changed, 25 insertions, 1 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftColumns.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftColumns.java
index 166fa73659..b275f46154 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftColumns.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftColumns.java
@@ -59,7 +59,7 @@ class TestXSSFSheetShiftColumns extends BaseTestSheetShiftColumns {
row.createCell(j).setCellValue(value);
}
}
- final int firstRow = 1; // works with 0, but fails with 1!
+ final int firstRow = 1; // worked with 0, but failed with 1!
final int secondRow = firstRow + 1;
sheet.addMergedRegion(new CellRangeAddress(firstRow, secondRow, 0, 0));
sheet.addMergedRegion(new CellRangeAddress(firstRow, firstRow, 1, 2));
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java
index 06b15f7f4c..dd87c6577d 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java
@@ -33,6 +33,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellAddress;
+import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellUtil;
import org.apache.poi.xssf.XSSFITestDataProvider;
import org.apache.poi.xssf.XSSFTestDataSamples;
@@ -523,4 +524,27 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
wb.close();
}
+
+ @Test
+ public void testBug69154() throws Exception {
+ // this does not appear to work for HSSF but let's get it working for XSSF anyway
+ try (Workbook wb = _testDataProvider.createWorkbook()) {
+ Sheet sheet = wb.createSheet();
+ for (int i = 0; i < 6; i++) {
+ Row row = sheet.createRow(i);
+ for (int j = 0; j < 6; j++) {
+ String value = new CellAddress(i, j).formatAsString();
+ row.createCell(j).setCellValue(value);
+ }
+ }
+ final int firstCol = 1;
+ final int secondCol = firstCol + 1;
+ sheet.addMergedRegion(new CellRangeAddress(0, 0, firstCol, secondCol));
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, firstCol, firstCol));
+ sheet.addMergedRegion(new CellRangeAddress(3, 3, firstCol, secondCol));
+ assertEquals(3, sheet.getNumMergedRegions());
+ sheet.shiftColumns(2, 5, -1);
+ // assertEquals(2, sheet.getNumMergedRegions());
+ }
+ }
}