From 0aefc72fd42e744beb218c14121147bfcef89ca3 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 30 Dec 2014 06:48:08 +0100 Subject: correct test for fdo#81195 Change-Id: I961603e3ea20aae4f12705c2656864dcbe8e1eca --- sc/qa/unit/subsequent_export-test.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1727d30c959b..57ff3b224855 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -136,6 +136,7 @@ public: void testImageWithSpecialID(); void testSupBookVirtualPath(); + void testSheetLocalRangeNameXLS(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -182,6 +183,7 @@ public: CPPUNIT_TEST(testSwappedOutImageExport); CPPUNIT_TEST(testLinkedGraphicRT); CPPUNIT_TEST(testImageWithSpecialID); + CPPUNIT_TEST(testSheetLocalRangeNameXLS); CPPUNIT_TEST_SUITE_END(); @@ -2491,6 +2493,30 @@ void ScExportTest::testImageWithSpecialID() } } +void ScExportTest::testSheetLocalRangeNameXLS() +{ + ScDocShellRef xDocSh = loadDoc("named-ranges-local.", XLS); + xDocSh->DoHardRecalc(true); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh, XLS); + xDocSh->DoClose(); + xDocSh2->DoHardRecalc(true); + + ScDocument& rDoc = xDocSh2->GetDocument(); + ScRangeName* pRangeName = rDoc.GetRangeName(0); + CPPUNIT_ASSERT(pRangeName); + CPPUNIT_ASSERT_EQUAL(size_t(2), pRangeName->size()); + + OUString aFormula; + rDoc.GetFormula(3, 11, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(local_name2)"), aFormula); + ASSERT_DOUBLES_EQUAL(14.0, rDoc.GetValue(3, 11, 0)); + + rDoc.GetFormula(6, 4, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=local_name1"), aFormula); + + xDocSh2->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit