diff options
author | Javen O'Neal <onealj@apache.org> | 2016-06-19 22:51:01 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-06-19 22:51:01 +0000 |
commit | 04f7652cf317a1f78055c179eb958f495e3a44a0 (patch) | |
tree | 6212dbecaf78bf1e0a15a09ebc43698a2b6d426e | |
parent | 550ccec9621b5088cbea9cfd4bcd856e8ccd707a (diff) | |
download | poi-04f7652cf317a1f78055c179eb958f495e3a44a0.tar.gz poi-04f7652cf317a1f78055c179eb958f495e3a44a0.zip |
bug 59728: add disabled unit test: should not be able to add an array formula to merged region
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749225 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java index 86779673cc..58919167fd 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; import static org.junit.Assert.fail; import java.io.IOException; @@ -33,6 +34,7 @@ import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.formula.FormulaParseException; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellReference; +import org.junit.Ignore; import org.junit.Test; /** @@ -574,4 +576,35 @@ public abstract class BaseTestSheetUpdateArrayFormulas { */ workbook.close(); } + + @Ignore + @Test + public void shouldNotBeAbleToCreateArrayFormulaOnPreexistingMergedRegion() throws IOException { + /* + * m = merged region + * f = array formula + * fm = cell belongs to a merged region and an array formula (illegal, that's what this tests for) + * + * A B C + * 1 f f + * 2 fm fm + * 3 f f + */ + Workbook workbook = _testDataProvider.createWorkbook(); + Sheet sheet = workbook.createSheet(); + + CellRangeAddress mergedRegion = CellRangeAddress.valueOf("B2:C2"); + sheet.addMergedRegion(mergedRegion); + CellRangeAddress arrayFormula = CellRangeAddress.valueOf("C1:C3"); + assumeTrue(mergedRegion.intersects(arrayFormula)); + assumeTrue(arrayFormula.intersects(mergedRegion)); + try { + sheet.setArrayFormula("SUM(A1:A3)", arrayFormula); + fail("expected exception: should not be able to create an array formula that intersects with a merged region"); + } catch (IllegalStateException e) { + // expected + } + + workbook.close(); + } } |