[Libreoffice-commits] core.git: sc/qa
shubham656 (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 8 20:52:55 UTC 2021
sc/qa/uitest/calc_tests7/tdf124822.py | 37 ----------------------------------
sc/qa/unit/uicalc/uicalc.cxx | 21 +++++++++++++++++++
2 files changed, 21 insertions(+), 37 deletions(-)
New commits:
commit 7a303569002bc7cf65ec5e470c4274c4ef03814c
Author: shubham656 <shubham656jain at gmail.com>
AuthorDate: Thu Dec 31 17:41:51 2020 +0530
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Jan 8 21:52:15 2021 +0100
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 at libreoffice.org>
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
similarity index 100%
rename from sc/qa/uitest/data/tdf124822.xls
rename to 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");
More information about the Libreoffice-commits
mailing list