aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/model
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-07-24 22:44:51 +0000
committerNick Burch <nick@apache.org>2014-07-24 22:44:51 +0000
commitc5dd59014ee431b7a4417034b22d93c08a8ee7d2 (patch)
treef6c2105f2da5ae59ee15a0db19f39d3e34d36a2e /src/testcases/org/apache/poi/hssf/model
parentc40ed2f75442ba34964001a3c36f66cc288883e1 (diff)
downloadpoi-c5dd59014ee431b7a4417034b22d93c08a8ee7d2.tar.gz
poi-c5dd59014ee431b7a4417034b22d93c08a8ee7d2.zip
More progress towards #55906 - FormulaParser is able to identify and parse multi-sheet references, but not yet fully round-trip them. (No evaluation support yet either)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613317 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/model')
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
index 59faa04303..f780bde0e6 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
@@ -454,6 +454,34 @@ public final class TestFormulaParser extends TestCase {
assertEquals("A1:A2", formula);
}
+ public void testMultiSheetReference() {
+ HSSFWorkbook wb = new HSSFWorkbook();
+
+ wb.createSheet("Cash_Flow");
+ wb.createSheet("Test Sheet");
+
+ HSSFSheet sheet = wb.createSheet("Test");
+ HSSFRow row = sheet.createRow(0);
+ HSSFCell cell = row.createCell(0);
+ String formula = null;
+
+ // One sheet
+ cell.setCellFormula("Cash_Flow!A1");
+ formula = cell.getCellFormula();
+ assertEquals("Cash_Flow!A1", formula);
+
+ // Then the other
+ cell.setCellFormula("\'Test Sheet\'!A1");
+ formula = cell.getCellFormula();
+ assertEquals("\'Test Sheet\'!A1", formula);
+
+ // Now both
+ // TODO Implement remaining logic for #55906
+ cell.setCellFormula("Cash_Flow:\'Test Sheet\'!A1");
+ formula = cell.getCellFormula();
+// assertEquals("Cash_Flow:\'Test Sheet\'!A1", formula);
+ }
+
/**
* Test for bug observable at svn revision 618865 (5-Feb-2008)<br/>
* a formula consisting of a single no-arg function got rendered without the function braces