summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-11-01 21:47:16 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-11-01 22:25:28 -0400
commit86b1ccc71cd8bc38599576ce6acab9cfab4d9231 (patch)
tree119d01cd8d81186bcdf8bda8f03c3b757b7e12fc /sc/qa
parent069e4f80333b5d4027d91d334bc8dae6f5a68533 (diff)
New unit test for shifting cells.
Change-Id: Ic004490ffaf1da5cdb43f0a1336437eb312813bf
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 247a75fc3e77..7c2c1af5807b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -228,6 +228,7 @@ public:
void testFindAreaPosColRight();
void testSort();
void testSortWithFormulaRefs();
+ void testShiftCells();
void testDeleteRow();
void testDeleteCol();
@@ -281,6 +282,7 @@ public:
CPPUNIT_TEST(testFindAreaPosColRight);
CPPUNIT_TEST(testSort);
CPPUNIT_TEST(testSortWithFormulaRefs);
+ CPPUNIT_TEST(testShiftCells);
CPPUNIT_TEST(testDeleteRow);
CPPUNIT_TEST(testDeleteCol);
CPPUNIT_TEST_SUITE_END();
@@ -5199,6 +5201,28 @@ void Test::testSort()
pDoc->DeleteTab(0);
}
+void Test::testShiftCells()
+{
+ m_pDoc->InsertTab(0, "foo");
+
+ OUString aTestVal("Some Text");
+
+ // Text into cell E5.
+ m_pDoc->SetString(4, 3, 0, aTestVal);
+
+ // Insert cell at D5. This should shift the string cell to right.
+ m_pDoc->InsertCol(3, 0, 3, 0, 3, 1);
+ OUString aStr = m_pDoc->GetString(5, 3, 0);
+ CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal);
+
+ // Delete cell D5, to shift the text cell back into D5.
+ m_pDoc->DeleteCol(3, 0, 3, 0, 3, 1);
+ aStr = m_pDoc->GetString(4, 3, 0);
+ CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testDeleteRow()
{
ScDocument* pDoc = m_xDocShRef->GetDocument();