diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-12-07 05:39:06 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-12-07 05:42:14 +0100 |
commit | c0533a4694e63959bc198dfb190511a223d521c0 (patch) | |
tree | cd6fc5360fc10d18e1f4caaf3679436850959c1e /sc/qa | |
parent | we need the original context that contains the data, fdo#85856 (diff) | |
download | core-c0533a4694e63959bc198dfb190511a223d521c0.tar.gz core-c0533a4694e63959bc198dfb190511a223d521c0.zip |
add test for fdo#85856
Change-Id: I4b3f8a0a0ebd089862ccffc452a2852b5868a51d
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d5fd98380263..ed35ca1dac7c 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -148,6 +148,7 @@ public: void testFormulaRefUpdateNameMove(); void testFormulaRefUpdateNameExpandRef(); void testFormulaRefUpdateNameDeleteRow(); + void testFormulaRefUpdateNameCopySheet(); void testFormulaRefUpdateValidity(); void testMultipleOperations(); void testFuncCOLUMN(); @@ -451,6 +452,7 @@ public: CPPUNIT_TEST(testFormulaRefUpdateNameMove); CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef); CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow); + CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet); CPPUNIT_TEST(testFormulaRefUpdateValidity); CPPUNIT_TEST(testMultipleOperations); CPPUNIT_TEST(testFuncCOLUMN); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index c66194c34a4b..44c78f328a02 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2599,6 +2599,43 @@ void Test::testFormulaRefUpdateNameDeleteRow() m_pDoc->DeleteTab(0); } +void Test::testFormulaRefUpdateNameCopySheet() +{ + m_pDoc->InsertTab(0, "Test"); + m_pDoc->InsertTab(1, "Test2"); + + bool bInserted = m_pDoc->InsertNewRangeName("RED", ScAddress(0,0,0), "$Test.$B$2"); + CPPUNIT_ASSERT(bInserted); + bInserted = m_pDoc->InsertNewRangeName("BLUE", ScAddress(0,0,0), "$Test.$B$3"); + CPPUNIT_ASSERT(bInserted); + m_pDoc->SetValue(1, 1, 0, 1); + m_pDoc->SetValue(1, 2, 0, 2); + + // insert formula into Test2 that is =RED+BLUE + m_pDoc->SetString(ScAddress(2,2,1), "=RED+BLUE"); + + double nVal = m_pDoc->GetValue(2, 2, 1); + CPPUNIT_ASSERT_EQUAL(3.0, nVal); + m_pDoc->CopyTab(1, 0); + + nVal = m_pDoc->GetValue(2, 2, 2); + CPPUNIT_ASSERT_EQUAL(3.0, nVal); + + nVal = m_pDoc->GetValue(2, 2, 0); + CPPUNIT_ASSERT_EQUAL(3.0, nVal); + + m_pDoc->SetValue(1, 1, 1, 3); + + nVal = m_pDoc->GetValue(2, 2, 2); + CPPUNIT_ASSERT_EQUAL(5.0, nVal); + + nVal = m_pDoc->GetValue(2, 2, 0); + CPPUNIT_ASSERT_EQUAL(5.0, nVal); + + m_pDoc->DeleteTab(1); + m_pDoc->DeleteTab(0); +} + void Test::testFormulaRefUpdateValidity() { struct { |