diff options
author | Nick Burch <nick@apache.org> | 2014-07-25 15:46:05 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-07-25 15:46:05 +0000 |
commit | ed4ee108b459e4adea6d6c2aebde0cbe78fc43ad (patch) | |
tree | 6e061604b8634ffa735205ee36ddb2529e6b7ec6 /src/testcases/org/apache/poi/ss/formula | |
parent | eb66cf9a089050c1d950ab5a9801b40e0c817c7c (diff) | |
download | poi-ed4ee108b459e4adea6d6c2aebde0cbe78fc43ad.tar.gz poi-ed4ee108b459e4adea6d6c2aebde0cbe78fc43ad.zip |
Update the RefEval method signature to cope with multi-sheet references, and have appropriate functions take advantage of this. For bug #55906
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613453 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula')
3 files changed, 26 insertions, 18 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java b/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java index fe28f1cd23..67cbcb2f7a 100644 --- a/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java +++ b/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java @@ -20,8 +20,6 @@ package org.apache.poi.ss.formula.eval; import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.apache.poi.ss.formula.ptg.AreaI; -import org.apache.poi.ss.formula.ptg.AreaI.OffsetArea; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator; import org.apache.poi.hssf.usermodel.HSSFRow; @@ -29,6 +27,8 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.AreaReference; import org.apache.poi.hssf.util.CellReference; import org.apache.poi.ss.formula.TwoDEval; +import org.apache.poi.ss.formula.ptg.AreaI; +import org.apache.poi.ss.formula.ptg.AreaI.OffsetArea; import org.apache.poi.ss.usermodel.CellValue; /** @@ -71,11 +71,10 @@ public final class TestRangeEval extends TestCase { } private static final class MockRefEval extends RefEvalBase { - public MockRefEval(int rowIndex, int columnIndex) { - super(rowIndex, columnIndex); + super(-1, -1, rowIndex, columnIndex); } - public ValueEval getInnerValueEval() { + public ValueEval getInnerValueEval(int sheetIndex) { throw new RuntimeException("not expected to be called during this test"); } public AreaEval offset(int relFirstRowIx, int relLastRowIx, int relFirstColIx, diff --git a/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java b/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java index 31d5250704..e294be59f3 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java @@ -17,17 +17,17 @@ package org.apache.poi.ss.formula.functions; -import org.apache.poi.ss.formula.ptg.AreaI; -import org.apache.poi.ss.formula.ptg.AreaPtg; -import org.apache.poi.ss.formula.ptg.Ref3DPtg; -import org.apache.poi.ss.formula.ptg.RefPtg; +import org.apache.poi.ss.formula.TwoDEval; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.AreaEvalBase; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.RefEval; import org.apache.poi.ss.formula.eval.RefEvalBase; import org.apache.poi.ss.formula.eval.ValueEval; -import org.apache.poi.ss.formula.TwoDEval; +import org.apache.poi.ss.formula.ptg.AreaI; +import org.apache.poi.ss.formula.ptg.AreaPtg; +import org.apache.poi.ss.formula.ptg.Ref3DPtg; +import org.apache.poi.ss.formula.ptg.RefPtg; /** * Test helper class for creating mock <code>Eval</code> objects @@ -157,14 +157,14 @@ public final class EvalFactory { private static final class MockRefEval extends RefEvalBase { private final ValueEval _value; public MockRefEval(RefPtg ptg, ValueEval value) { - super(ptg.getRow(), ptg.getColumn()); + super(-1, -1, ptg.getRow(), ptg.getColumn()); _value = value; } public MockRefEval(Ref3DPtg ptg, ValueEval value) { - super(ptg.getRow(), ptg.getColumn()); + super(-1, -1, ptg.getRow(), ptg.getColumn()); _value = value; } - public ValueEval getInnerValueEval() { + public ValueEval getInnerValueEval(int sheetIndex) { return _value; } public AreaEval offset(int relFirstRowIx, int relLastRowIx, int relFirstColIx, int relLastColIx) { diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestEDate.java b/src/testcases/org/apache/poi/ss/formula/functions/TestEDate.java index 6e337003b3..3a5d527b77 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestEDate.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestEDate.java @@ -46,14 +46,23 @@ public class TestEDate extends TestCase{ throw new UnsupportedOperationException(); } + public ValueEval getInnerValueEval(int sheetIndex) { + return value; + } + + public int getNumberOfSheets() { + return 1; + } + public int getFirstSheetIndex() { + return 0; + } + public int getLastSheetIndex() { + return 0; + } + public int getRow() { throw new UnsupportedOperationException(); } - - public ValueEval getInnerValueEval() { - return value; - } - public int getColumn() { throw new UnsupportedOperationException(); } |