summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-15 19:27:58 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-15 20:10:29 +0200
commit7b3e0aa8ad02c12706547616d7a5fd695bf0d75c (patch)
treef7ee669849e39fcc293eb2c3b08eb3f399eb2b21 /sc/qa
parent65dedbd9c776afd9adf513336df80ef50d30934e (diff)
add test for tdf#88179
Change-Id: I8407a05e89129b533f62439d3ffedecd3248ec87
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx31
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9e9a934f8a7f..eb8e047af1e7 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -195,6 +195,7 @@ public:
void testExternalRef();
void testExternalRefFunctions();
+ void testExternalRangeName();
void testCopyToDocument();
@@ -531,6 +532,7 @@ public:
CPPUNIT_TEST(testFuncLCM);
CPPUNIT_TEST(testFuncSUMSQ);
CPPUNIT_TEST(testExternalRef);
+ CPPUNIT_TEST(testExternalRangeName);
CPPUNIT_TEST(testExternalRefFunctions);
CPPUNIT_TEST(testCopyToDocument);
CPPUNIT_TEST(testFuncSHEET);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index c631e1e36018..0badcac64f44 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -5157,6 +5157,37 @@ void Test::testExternalRef()
m_pDoc->DeleteTab(0);
}
+void Test::testExternalRangeName()
+{
+ ScDocShellRef xExtDocSh = new ScDocShell;
+ OUString aExtDocName("file:///extdata.fake");
+ OUString aExtSh1Name("Data1");
+ SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE);
+ xExtDocSh->DoInitNew(pMed);
+ CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
+ findLoadedDocShellByName(aExtDocName) != NULL);
+
+ ScDocument& rExtDoc = xExtDocSh->GetDocument();
+ rExtDoc.InsertTab(0, aExtSh1Name);
+ rExtDoc.SetValue(0, 0, 0, 123.456);
+
+ ScRangeName* pRangeName = rExtDoc.GetRangeName();
+ ScRangeData* pRangeData = new ScRangeData(&rExtDoc, "ExternalName",
+ "$Data1.$A$1");
+ pRangeName->insert(pRangeData);
+
+ m_pDoc->InsertTab(0, "Test Sheet");
+ m_pDoc->SetString(0, 1, 0, OUString("='file:///extdata.fake'#ExternalName"));
+
+ double nVal = m_pDoc->GetValue(0, 1, 0);
+ ASSERT_DOUBLES_EQUAL(123.456, nVal);
+
+ xExtDocSh->DoClose();
+ CPPUNIT_ASSERT_MESSAGE("external document instance should have been unloaded.",
+ findLoadedDocShellByName(aExtDocName) == NULL);
+ m_pDoc->DeleteTab(0);
+}
+
void testExtRefFuncT(ScDocument* pDoc, ScDocument& rExtDoc)
{
Test::clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));