summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-11-15 16:16:04 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-11-18 17:25:39 -0500
commit62b36e800d650ede5d48d8a2b81a410578407b32 (patch)
tree7bbd9d20ea5d2791adff6dda30555251bdd424eb /sc/qa
parent24ddf0d93879cfa0d92b2144685960eed26116fb (diff)
Handle sheet-local range names too.
Change-Id: Ib1503c3b69d77946b4437bdc0e1bfa5ebacbb602
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 35a35996db7e..91e4594d6803 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -45,16 +45,21 @@ void Test::testFormulaCreateStringFromTokens()
// Insert named ranges.
struct {
+ bool bGlobal;
const char* pName;
const char* pExpr;
} aNames[] = {
- { "x", "Test.H1" },
- { "y", "Test.H2" },
- { "z", "Test.H3" }
+ { true, "x", "Test.H1" },
+ { true, "y", "Test.H2" },
+ { true, "z", "Test.H3" },
+
+ { false, "sheetx", "Test.J1" }
};
ScRangeName* pGlobalNames = m_pDoc->GetRangeName();
+ ScRangeName* pSheetNames = m_pDoc->GetRangeName(0);
CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames);
+ CPPUNIT_ASSERT_MESSAGE("Failed to obtain sheet-local named expression object.", pSheetNames);
for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i)
{
@@ -62,8 +67,16 @@ void Test::testFormulaCreateStringFromTokens()
m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr),
ScAddress(0,0,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
- bool bInserted = pGlobalNames->insert(pName);
- CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
+ if (aNames[i].bGlobal)
+ {
+ bool bInserted = pGlobalNames->insert(pName);
+ CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
+ }
+ else
+ {
+ bool bInserted = pSheetNames->insert(pName);
+ CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
+ }
}
// Insert DB ranges.
@@ -99,6 +112,7 @@ void Test::testFormulaCreateStringFromTokens()
"'Kevin''s Data'.B10",
"'Past Data'.B1+'2013'.B2*(1+'Kevin''s Data'.C10)",
"x+y*z", // named ranges
+ "SUM(sheetx;x;y;z)", // sheet local and global named ranges mixed
"MAX(Table1)+MIN(Table2)*SUM(Table3)" // database ranges
};