diff options
author | shubham656 <shubham656jain@gmail.com> | 2020-12-31 17:41:51 +0530 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-01-08 21:52:15 +0100 |
commit | 7a303569002bc7cf65ec5e470c4274c4ef03814c (patch) | |
tree | ad4db3ade2b9113735b4f468c8cfe5d1d22f436c | |
parent | ef1b6642feb39aab502c90436286aeee9a7fa241 (diff) |
tdf#124822 Move UItest to CppUnitTest
Change-Id: Ifb9c68dc8b1e61f8c180e44948c9a8f037a22fec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108535
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf124822.py | 37 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf124822.xls (renamed from sc/qa/uitest/data/tdf124822.xls) | bin | 17920 -> 17920 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 21 |
3 files changed, 21 insertions, 37 deletions
diff --git a/sc/qa/uitest/calc_tests7/tdf124822.py b/sc/qa/uitest/calc_tests7/tdf124822.py deleted file mode 100644 index 8c438df79725..000000000000 --- a/sc/qa/uitest/calc_tests7/tdf124822.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict -from uitest.uihelper.common import select_pos -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, type_text -from uitest.debug import sleep -import org.libreoffice.unotest -import pathlib - -def get_url_for_data_file(file_name): - return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() - -# Bug 124822 - CRASH: cutting and undoing - -class tdf124822(UITestCase): - def test_tdf124822_crash_cut_undo(self): - calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124822.xls")) - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #Select all ( Ctrl + A ) ; Cut ( Ctrl + X );Undo - self.xUITest.executeCommand(".uno:selectAll") - self.xUITest.executeCommand(".uno:Cut") - self.xUITest.executeCommand(".uno:Undo") - #verify; no crashes - self.assertEqual(get_cell_by_position(document, 2, 0, 0).getString(), "X") - self.ui_test.close_doc() -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf124822.xls b/sc/qa/unit/uicalc/data/tdf124822.xls Binary files differindex 2e5656978a9d..2e5656978a9d 100644 --- a/sc/qa/uitest/data/tdf124822.xls +++ b/sc/qa/unit/uicalc/data/tdf124822.xls diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index a004e2e2c800..a77a80d6e2d5 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -352,6 +352,27 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf83901) CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124822) +{ + ScModelObj* pModelObj = createDoc("tdf124822.xls"); + + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + CPPUNIT_ASSERT_EQUAL(OUString("X"), pDoc->GetString(ScAddress(0, 0, 2))); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 2))); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("X"), pDoc->GetString(ScAddress(0, 0, 2))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428) { mxComponent = loadFromDesktop("private:factory/scalc"); |