diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-30 20:04:42 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-30 21:39:30 +0200 |
commit | 551141c90f969421be77d9dc90a8feac791267ab (patch) | |
tree | c7905b1675ba5da0c448c38b3b82b83bd7e0d3db | |
parent | ecdb3826e852a6270e3106d30dac44793ad56e1a (diff) |
tdf#45020: sc: move UItest to CppUnittest
Change-Id: I14e8fec80e06403868a80cabfe5231420bdd6f2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132328
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf45020.py | 36 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 28 |
2 files changed, 28 insertions, 36 deletions
diff --git a/sc/qa/uitest/calc_tests7/tdf45020.py b/sc/qa/uitest/calc_tests7/tdf45020.py deleted file mode 100644 index c09b68fcd3ea..000000000000 --- a/sc/qa/uitest/calc_tests7/tdf45020.py +++ /dev/null @@ -1,36 +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 uitest.uihelper.common import get_state_as_dict -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.uno.propertyvalue import mkPropertyValues - -class tdf45020(UITestCase): - def test_tdf45020_hide_rows_select(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - #in cell A1-A4: apple pear melon mango - enter_text_to_cell(gridwin, "A1", "apple") - enter_text_to_cell(gridwin, "A1", "pear") - enter_text_to_cell(gridwin, "A1", "melon") - enter_text_to_cell(gridwin, "A1", "mango") - #select A2 and A3 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) - #format > Row > Hide - self.ui_test._xUITest.executeCommand(".uno:HideRow") - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #press Shift+down - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+DOWN"})) - #verify A1:A4 selected - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 917ef6b2d9b9..ceaa63bab1f3 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1334,6 +1334,34 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994) CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.D3:Sheet1.D4"), aMarkedAreaString); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf45020) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + goToCell("A2:A3"); + + dispatchCommand(mxComponent, ".uno:HideRow", {}); + + goToCell("A1"); + + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_DOWN); + Scheduler::ProcessEventsToIdle(); + + ScRangeList aMarkedArea = ScDocShell::GetViewData()->GetMarkData().GetMarkedRanges(); + OUString aMarkedAreaString; + ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + + // Without the fix in place, this test would have failed with + // - Expected: Sheet1.A1:Sheet1.A4 + // - Actual : Sheet1.A1:Sheet1.A2 + CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A4"), aMarkedAreaString); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) { mxComponent = loadFromDesktop("private:factory/scalc"); |