From 056ba01ee95db5dfd7df362e72bb418893c4c530 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 11 Mar 2020 18:53:27 +0100 Subject: tdf#83901: move UItest to CppunitTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0d074da097912f8abba6bae6171596076d71e998 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90345 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ --- sc/qa/uitest/calc_tests/rows.py | 18 ------------------ sc/qa/unit/uicalc/data/empty.ods | Bin 0 -> 6981 bytes sc/qa/unit/uicalc/uicalc.cxx | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 sc/qa/unit/uicalc/data/empty.ods (limited to 'sc') 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: */ -- cgit