You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/06/19 22:51:01 UTC
svn commit: r1749225 -
/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
Author: onealj
Date: Sun Jun 19 22:51:01 2016
New Revision: 1749225
URL: http://svn.apache.org/viewvc?rev=1749225&view=rev
Log:
bug 59728: add disabled unit test: should not be able to add an array formula to merged region
Modified:
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java?rev=1749225&r1=1749224&r2=1749225&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java Sun Jun 19 22:51:01 2016
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNot
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.ITestDataProvid
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 BaseTestSheetUpdat
*/
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();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org