From 28318bed905f21d25aa69d4153858e91b6d13cd1 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 5 Apr 2022 14:03:38 +0200 Subject: tdf#99386: sc: move UItest to CppUnittest Change-Id: I8e79fd47abe238cbee47eed07ab3840f77dac431 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132573 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/qa/uitest/calc_tests4/tdf99386.py | 30 ------------------------------ sc/qa/uitest/data/tdf99386.ods | Bin 9128 -> 0 bytes sc/qa/unit/uicalc/uicalc.cxx | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 sc/qa/uitest/calc_tests4/tdf99386.py delete mode 100644 sc/qa/uitest/data/tdf99386.ods (limited to 'sc') diff --git a/sc/qa/uitest/calc_tests4/tdf99386.py b/sc/qa/uitest/calc_tests4/tdf99386.py deleted file mode 100644 index 4f03793535e6..000000000000 --- a/sc/qa/uitest/calc_tests4/tdf99386.py +++ /dev/null @@ -1,30 +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 libreoffice.uno.propertyvalue import mkPropertyValues -from libreoffice.calc.document import get_cell_by_position - -class tdf99386(UITestCase): - - def test_td99386_undo_merged_cell_needs_hard_recalculate(self): - - with self.ui_test.load_file(get_url_for_data_file("tdf99386.ods")) as calc_doc: - - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) #select cells - self.xUITest.executeCommand(".uno:ToggleMergeCells") # merge cells - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "This") - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf99386.ods b/sc/qa/uitest/data/tdf99386.ods deleted file mode 100644 index 767d0ead49e2..000000000000 Binary files a/sc/qa/uitest/data/tdf99386.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 1da2c2559aac..efb043f73604 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2796,6 +2796,35 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144022) } } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf99386) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + insertStringToCell(*pModelObj, "B1", "This"); + insertStringToCell(*pModelObj, "B2", "=B1"); + + goToCell("A1:B1"); + + dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(1, 1, 0))); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("This"), pDoc->GetString(ScAddress(1, 0, 0))); + + // Without the fix in place, this test would have failed with + // - Expected: This + // - Actual : 0 + CPPUNIT_ASSERT_EQUAL(OUString("This"), pDoc->GetString(ScAddress(1, 1, 0))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126926) { mxComponent = loadFromDesktop("private:factory/scalc"); -- cgit on value='distro/collabora/cp-4.1'>distro/collabora/cp-4.1 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author