summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-07 05:39:06 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-12-07 05:42:14 +0100
commitc0533a4694e63959bc198dfb190511a223d521c0 (patch)
treecd6fc5360fc10d18e1f4caaf3679436850959c1e
parent6c8ada4d81b5ff06c98b238e016b183fdca05c0b (diff)
add test for fdo#85856
Change-Id: I4b3f8a0a0ebd089862ccffc452a2852b5868a51d
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx37
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 {