sc/qa/uitest/calc_tests/rows.py  |   18 ------------------
 sc/qa/unit/uicalc/data/empty.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx     |   23 +++++++++++++++++++++++
 3 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit 056ba01ee95db5dfd7df362e72bb418893c4c530
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Mar 11 18:53:27 2020 +0100
Commit:     Xisco FaulĂ­ <xiscofa...@libreoffice.org>
CommitDate: Thu Mar 12 09:53:40 2020 +0100

    tdf#83901: move UItest to CppunitTest
    
    Change-Id: I0d074da097912f8abba6bae6171596076d71e998
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90345
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/calc_tests/rows.py b/sc/qa/uitest/calc_tests/rows.py
index 00b04e5f9d6e..96cffaf5fd1a 100644
--- a/sc/qa/uitest/calc_tests/rows.py
+++ b/sc/qa/uitest/calc_tests/rows.py
@@ -283,22 +283,4 @@ class CalcRows(UITestCase):
 
         self.ui_test.close_doc()
 
-    def test_tdf83901_row_insert_after(self):
-        #Bug 83901 - ROW() value is not updated if row is inserted after
-        calc_doc = self.ui_test.create_doc_in_start_center("calc")
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        #- A2 = ROW(A3)
-        enter_text_to_cell(gridwin, "A2", "=ROW(A3)")
-        #- Insert a row between rows 2 and 3 by right-clicking on row 3 and 
choosing "insert rows above".
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
-        self.xUITest.executeCommand(".uno:SelectRow")
-        self.xUITest.executeCommand(".uno:InsertRowsBefore")
-
-        #- Result: cell A2 still shows "3" as its value, although it should 
show "4".
-        self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 4)
-
-        self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/unit/uicalc/data/empty.ods b/sc/qa/unit/uicalc/data/empty.ods
new file mode 100644
index 000000000000..0c797725af28
Binary files /dev/null and b/sc/qa/unit/uicalc/data/empty.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index ece9c4dbbff7..222849673095 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -149,6 +149,29 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124815)
     CPPUNIT_ASSERT_EQUAL(OUString("Rakennukset"), pDoc->GetString(ScAddress(2, 
0, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf83901)
+{
+    ScModelObj* pModelObj = createDoc("empty.ods");
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    checkCurrentCell(0, 0);
+    pDoc->SetString(ScAddress(0, 1, 0), "=ROW(A3)");
+    CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0)));
+
+    dispatchCommand(mxComponent, ".uno:GoDown", {});
+    dispatchCommand(mxComponent, ".uno:GoDown", {});
+    checkCurrentCell(0, 2);
+    dispatchCommand(mxComponent, ".uno:SelectRow", {});
+    dispatchCommand(mxComponent, ".uno:InsertRowsBefore", {});
+
+    //Without the fix, it would be 3.0
+    CPPUNIT_ASSERT_EQUAL(4.0, pDoc->GetValue(ScAddress(0, 1, 0)));
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0)));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to