[Libreoffice-commits] core.git: sc/qa

Kohei Yoshida kohei.yoshida at gmail.com
Sat Jul 27 15:55:55 PDT 2013


 sc/qa/unit/ucalc.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit c2a94c283d6d0a82b8960e73c253ecb96c2b8140
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Sat Jul 27 18:55:23 2013 -0400

    fdo#61201: Add test for OFFSET used with external single reference.
    
    Change-Id: I5dff3c3c6ba530531762a0ab2329d1193cee6d1c

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5e72136..4af30fa 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();


More information about the Libreoffice-commits mailing list