dev/null |binary sc/qa/uitest/calc_tests3/tdf63805.py | 57 ----------------------------------- sc/qa/unit/uicalc/uicalc.cxx | 52 +++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 57 deletions(-)
New commits: commit eb0a6b48cbd1346bcee92e2e418a454655c10c63 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Feb 10 13:19:55 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Feb 10 15:50:25 2022 +0100 tdf#63805: sc: Move UItest to CppUnittest Change-Id: I8b2192c1944299b92f82cc6179fcdb0842de9803 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129779 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/calc_tests3/tdf63805.py b/sc/qa/uitest/calc_tests3/tdf63805.py deleted file mode 100644 index 1e305ad571fd..000000000000 --- a/sc/qa/uitest/calc_tests3/tdf63805.py +++ /dev/null @@ -1,57 +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_url_for_data_file -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues - -#Bug 63805 - EDITING: 'Autofill - Date - Months' wrong if day of month exceeds max. days of month - -class tdf63805(UITestCase): - - def test_tdf63805_autofill_Date_Months(self): - with self.ui_test.load_file(get_url_for_data_file("tdf63805.ods")) as calc_doc: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - #1 - A1: 2012-10-31 - enter_text_to_cell(gridwin, "A1", "2012-10-31") - #2 - Select A1:A20 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) - #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok> - with self.ui_test.execute_dialog_through_command(".uno:FillSeries"): - pass - #5 -Expected: All Cells show last day of month / Actual: some months skipped - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 41213) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 41243) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 41274) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 41305) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 41333) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 5).getValue(), 41364) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 6).getValue(), 41394) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 7).getValue(), 41425) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 8).getValue(), 41455) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 9).getValue(), 41486) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getValue(), 41517) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getValue(), 41547) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 41578) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getValue(), 41608) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 14).getValue(), 41639) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 15).getValue(), 41670) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 16).getValue(), 41698) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 17).getValue(), 41729) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 18).getValue(), 41759) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 19).getValue(), 41790) - #4 - undo. - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 41213) - self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 0) - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf63805.ods b/sc/qa/uitest/data/tdf63805.ods deleted file mode 100644 index fd2affb4e1cc..000000000000 Binary files a/sc/qa/uitest/data/tdf63805.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 4f5d6be187b9..4ba8aaa040cb 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -213,6 +213,58 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126577) } } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf63805) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + insertStringToCell(*pModelObj, "A1", "2012-10-31"); + + goToCell("A1:A20"); + + uno::Sequence<beans::PropertyValue> aArgs( + comphelper::InitPropertySequence({ { "FillDir", uno::Any(OUString("B")) }, + { "FillCmd", uno::Any(OUString("D")) }, + { "FillStep", uno::Any(OUString("1")) }, + { "FillDateCmd", uno::Any(OUString("M")) }, + { "FillStart", uno::Any(OUString("41213")) } })); + dispatchCommand(mxComponent, ".uno:FillSeries", aArgs); + + CPPUNIT_ASSERT_EQUAL(OUString("2012-10-31"), pDoc->GetString(ScAddress(0, 0, 0))); + + // Without the fix in place, this test would have failed with + // - Expected: 2012-11-30 + // - Actual : 2012-12-01 + CPPUNIT_ASSERT_EQUAL(OUString("2012-11-30"), pDoc->GetString(ScAddress(0, 1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2012-12-31"), pDoc->GetString(ScAddress(0, 2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-01-31"), pDoc->GetString(ScAddress(0, 3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-02-28"), pDoc->GetString(ScAddress(0, 4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-03-31"), pDoc->GetString(ScAddress(0, 5, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-04-30"), pDoc->GetString(ScAddress(0, 6, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-05-31"), pDoc->GetString(ScAddress(0, 7, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-06-30"), pDoc->GetString(ScAddress(0, 8, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-07-31"), pDoc->GetString(ScAddress(0, 9, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-08-31"), pDoc->GetString(ScAddress(0, 10, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-09-30"), pDoc->GetString(ScAddress(0, 11, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-10-31"), pDoc->GetString(ScAddress(0, 12, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-11-30"), pDoc->GetString(ScAddress(0, 13, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2013-12-31"), pDoc->GetString(ScAddress(0, 14, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2014-01-31"), pDoc->GetString(ScAddress(0, 15, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2014-02-28"), pDoc->GetString(ScAddress(0, 16, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2014-03-31"), pDoc->GetString(ScAddress(0, 17, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2014-04-30"), pDoc->GetString(ScAddress(0, 18, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2014-05-31"), pDoc->GetString(ScAddress(0, 19, 0))); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("2012-10-31"), pDoc->GetString(ScAddress(0, 0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 0))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144308) { mxComponent = loadFromDesktop("private:factory/scalc");