summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-01 11:52:52 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-01 14:27:40 +0200
commitb6b28854c77731f7506b2551dc5dd47f798ca946 (patch)
treeb45e195d47cd546119c6bd481dafda2aa53e85f6
parentb64cd9c8e0498b8aecc49eba873d2a3fd3065a6a (diff)
tdf#154174: sc: move UItest to CppUnittest
Change-Id: I62e1e9a0dbcbea509d5d9a9b493c2484dc373854 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152483 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins
-rw-r--r--sc/qa/uitest/calc_tests9/tdf154174.py35
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx32
2 files changed, 32 insertions, 35 deletions
diff --git a/sc/qa/uitest/calc_tests9/tdf154174.py b/sc/qa/uitest/calc_tests9/tdf154174.py
deleted file mode 100644
index 3cb0da9ea2a3..000000000000
--- a/sc/qa/uitest/calc_tests9/tdf154174.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# 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 libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_cell_by_position
-from uitest.uihelper.calc import enter_text_to_cell
-
-#Bug 154174 - empty edit cell after fill (Ctrl+Shft+Y)
-
-class tdf154174(UITestCase):
- def test_tdf154174_repeat_empty(self):
- with self.ui_test.create_doc_in_start_center("calc") as document:
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- # enter data
- enter_text_to_cell(gridwin, "A1", "aaaa")
- # focus on A2
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
- # repeat (Ctrl+Shft+Y)
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+CTRL+Y"}))
- # edit A2 data
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F2"}))
- # if is empty, then erased, else unchanged
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- # test A2
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aaaa")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index b6a0db8bcd74..820f44ad4604 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -594,6 +594,38 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf56036)
CPPUNIT_ASSERT_EQUAL(OUString("6"), pDoc->GetString(ScAddress(0, 0, 0)));
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154174_repeat_empty)
+{
+ createScDoc();
+
+ insertStringToCell("A1", u"aaaa");
+
+ ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_SHIFT | awt::Key::Y);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | KEY_SHIFT | awt::Key::Y);
+ Scheduler::ProcessEventsToIdle();
+
+ ScDocument* pDoc = getScDoc();
+ CPPUNIT_ASSERT_EQUAL(OUString("aaaa"), pDoc->GetString(ScAddress(0, 1, 0)));
+
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2);
+ Scheduler::ProcessEventsToIdle();
+
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE);
+ Scheduler::ProcessEventsToIdle();
+
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+ Scheduler::ProcessEventsToIdle();
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: aaaa
+ // - Actual :
+ CPPUNIT_ASSERT_EQUAL(OUString("aaaa"), pDoc->GetString(ScAddress(0, 1, 0)));
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119162)
{
createScDoc();