[Libreoffice-commits] .: sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 1 19:26:15 PDT 2012


 sc/qa/unit/ucalc.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 86b1ccc71cd8bc38599576ce6acab9cfab4d9231
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Nov 1 21:47:16 2012 -0400

    New unit test for shifting cells.
    
    Change-Id: Ic004490ffaf1da5cdb43f0a1336437eb312813bf

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 247a75f..7c2c1af 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();


More information about the Libreoffice-commits mailing list