summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-23 02:18:14 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-23 02:18:14 +0200
commit7d65dd728ca2b7dea073ef085110dccdf22c2d5c (patch)
tree146f0d908b969f9e61f7f93b8ab5404d2799a971
parent0d3d836ec6541b7a1e0a7fa48195ebb678e2951e (diff)
add test case for copy/paste formulas, related fdo#48482
-rw-r--r--sc/qa/unit/ucalc.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 07782daaa23d..9542320a2e03 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -209,6 +209,7 @@ public:
void testRenameTable();
void testAutoFill();
+ void testCopyPasteFormulas();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testCollator);
@@ -249,6 +250,7 @@ public:
CPPUNIT_TEST(testSetBackgroundColor);
CPPUNIT_TEST(testRenameTable);
CPPUNIT_TEST(testAutoFill);
+ CPPUNIT_TEST(testCopyPasteFormulas);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4221,6 +4223,25 @@ void Test::testAutoFill()
m_pDoc->DeleteTab(0);
}
+void Test::testCopyPasteFormulas()
+{
+ m_pDoc->InsertTab(0, "Sheet1");
+ m_pDoc->InsertTab(1, "Sheet2");
+
+ m_pDoc->SetString(0,0,0, "=COLUMN($A$1)");
+ m_pDoc->SetInTest();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,0,0), 1.0, 1e-08);
+ ScDocFunc& rDocFunc = m_xDocShRef->GetDocFunc();
+ bool bMoveDone = rDocFunc.MoveBlock(ScRange(0,0,0), ScAddress( 10, 10, 0), false, false, false, true);
+
+ // check that moving was succesful, mainly for editable tester
+ CPPUNIT_ASSERT(bMoveDone);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,10,0), 1.0, 1e-8);
+ rtl::OUString aFormula;
+ m_pDoc->GetFormula(10,10,0, aFormula);
+ CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString("=COLUMN($A$1)"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}