summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-27 18:55:23 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-27 18:56:18 -0400
commitc2a94c283d6d0a82b8960e73c253ecb96c2b8140 (patch)
treeb3d87af7928f5cd5657e6f3af531d73e764bfe42
parent8b96cfd6caedbad7b3b79e57421a834f18c5c511 (diff)
fdo#61201: Add test for OFFSET used with external single reference.
Change-Id: I5dff3c3c6ba530531762a0ab2329d1193cee6d1c
-rw-r--r--sc/qa/unit/ucalc.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5e7213642483..4af30fa5237a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1821,6 +1821,19 @@ void testExtRefFuncT(ScDocument* pDoc, ScDocument* pExtDoc)
CPPUNIT_ASSERT_MESSAGE("Unexpected result with T.", aRes.isEmpty());
}
+void testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument* pExtDoc)
+{
+ Test::clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
+ Test::clearRange(pExtDoc, ScRange(0, 0, 0, 1, 9, 0));
+
+ sc::AutoCalcSwitch aACSwitch(*pDoc, true);
+
+ // External document has sheet named 'Data', and the internal doc has sheet named 'Test'.
+ pExtDoc->SetValue(ScAddress(0,1,0), 1.2); // Set 1.2 to A2.
+ pDoc->SetString(ScAddress(0,0,0), "=OFFSET('file:///extdata.fake'#Data.$A$1;1;0;1;1)");
+ CPPUNIT_ASSERT_EQUAL(1.2, pDoc->GetValue(ScAddress(0,0,0)));
+}
+
void Test::testExternalRefFunctions()
{
ScDocShellRef xExtDocSh = new ScDocShell;
@@ -1876,6 +1889,7 @@ void Test::testExternalRefFunctions()
pRefMgr->clearCache(nFileId);
testExtRefFuncT(m_pDoc, pExtDoc);
+ testExtRefFuncOFFSET(m_pDoc, pExtDoc);
// Unload the external document shell.
xExtDocSh->DoClose();