sc/qa/uitest/calc_tests2/tdf126577.py | 44 ---------------------------------- sc/qa/unit/uicalc/uicalc.cxx | 34 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 44 deletions(-)
New commits: commit 587e3e27171d66470f7216e36ed2967c2a8b3867 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Feb 10 11:30:12 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 10 15:43:16 2022 +0100 tdf#126577: sc: move UItest to CppUnittest it's possible to know the arguments of .uno:FillSeries using the macro recorder Change-Id: I8e459c0ca42bd9cd0226e61b3a0b2107bdc22c75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129774 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sc/qa/uitest/calc_tests2/tdf126577.py b/sc/qa/uitest/calc_tests2/tdf126577.py deleted file mode 100644 index 32f2ecba81b3..000000000000 --- a/sc/qa/uitest/calc_tests2/tdf126577.py +++ /dev/null @@ -1,44 +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 libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues - -class tdf126577(UITestCase): - - def test_tdf126577(self): - with self.ui_test.create_doc_in_start_center("calc") as document: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) - - with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: - - self.assertEqual("true", get_state_as_dict(xDialog.getChild("down"))['Checked']) - self.assertEqual("true", get_state_as_dict(xDialog.getChild("linear"))['Checked']) - - xStart = xDialog.getChild("startValue") - xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - - xEnd = xDialog.getChild("endValue") - xEnd.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) - - - for i in range(10): - self.assertEqual(str(i + 1), get_cell_by_position(document, 0, 0, i).getString()) - - for i in range(10, 20): - # Without the fix in place, this test would have failed with - # AssertionError: '' != '#NUM!' - self.assertEqual("", get_cell_by_position(document, 0, 0, i).getString()) - - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index aa9233a4f868..4f5d6be187b9 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -179,6 +179,40 @@ ScModelObj* ScUiCalcTest::saveAndReload(css::uno::Reference<css::lang::XComponen return pModelObj; } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126577) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + goToCell("A1:A20"); + + uno::Sequence<beans::PropertyValue> aArgs( + comphelper::InitPropertySequence({ { "FillDir", uno::Any(OUString("B")) }, + { "FillCmd", uno::Any(OUString("L")) }, + { "FillStep", uno::Any(OUString("1")) }, + { "FillDateCmd", uno::Any(OUString("D")) }, + { "FillStart", uno::Any(OUString("1")) }, + { "FillMax", uno::Any(OUString("10")) } })); + dispatchCommand(mxComponent, ".uno:FillSeries", aArgs); + + for (size_t i = 0; i < 10; ++i) + { + CPPUNIT_ASSERT_EQUAL(OUString(OUString::number(i + 1)), + pDoc->GetString(ScAddress(0, i, 0))); + } + + for (size_t i = 10; i < 20; ++i) + { + // Without the fix in place, this test would have failed with + // - Expected: + // - Actual : #NUM! + CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, i, 0))); + } +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144308) { mxComponent = loadFromDesktop("private:factory/scalc");
