From 339521b5448ae3f63b790f144976e78c9941ed33 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 30 Dec 2014 06:30:30 +0100 Subject: add test for fdo#81195 Change-Id: If19f4067d53c2c614f6afcc0d6349db6ec2fd602 --- sc/qa/unit/data/xls/named-ranges-local.xls | Bin 0 -> 6144 bytes sc/qa/unit/subsequent_filters-test.cxx | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 sc/qa/unit/data/xls/named-ranges-local.xls (limited to 'sc/qa') diff --git a/sc/qa/unit/data/xls/named-ranges-local.xls b/sc/qa/unit/data/xls/named-ranges-local.xls new file mode 100644 index 000000000000..7c39d204bb94 Binary files /dev/null and b/sc/qa/unit/data/xls/named-ranges-local.xls differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 703f90593ba9..bafe9921f883 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -88,6 +88,7 @@ public: //ods, xls, xlsx filter tests void testBasicCellContentODS(); void testRangeNameXLS(); + void testRangeNameLocalXLS(); void testRangeNameXLSX(); void testHyperlinksXLSX(); void testHardRecalcODS(); @@ -185,6 +186,7 @@ public: CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testRangeNameXLS); + CPPUNIT_TEST(testRangeNameLocalXLS); CPPUNIT_TEST(testRangeNameXLSX); CPPUNIT_TEST(testHyperlinksXLSX); CPPUNIT_TEST(testHardRecalcODS); @@ -363,6 +365,27 @@ void ScFiltersTest::testRangeNameXLS() xDocSh->DoClose(); } +void ScFiltersTest::testRangeNameLocalXLS() +{ + ScDocShellRef xDocSh = loadDoc("named-ranges-local.", XLS); + xDocSh->DoHardRecalc(true); + + ScDocument& rDoc = xDocSh->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); + + xDocSh->DoClose(); +} + void ScFiltersTest::testRangeNameXLSX() { ScDocShellRef xDocSh = loadDoc("named-ranges-global.", XLSX); -- cgit