dev/null |binary sc/qa/uitest/goalSeek/tdf37341.py | 36 ------------------------------------ sc/qa/uitest/goalSeek/tdf43693.py | 36 ------------------------------------ sc/qa/unit/GoalSeekTest.cxx | 25 +++++++++++++++++++++++++ 4 files changed, 25 insertions(+), 72 deletions(-)
New commits: commit 20f9fc1030ffc0f37d5dc528e010d4167210eb02 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Jun 18 10:16:08 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jun 18 14:10:36 2024 +0200 tdf#37341, tdf#43693: move UItest to CppUnittest and remove duplicated test, tdf43693.py, which is basically the same as tdf37341.py Change-Id: Ib29638ecbc2f89e717712ad03afccc70c5aa47ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169079 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/data/tdf43693.ods b/sc/qa/uitest/data/tdf43693.ods deleted file mode 100644 index 501a07765e71..000000000000 Binary files a/sc/qa/uitest/data/tdf43693.ods and /dev/null differ diff --git a/sc/qa/uitest/goalSeek/tdf37341.py b/sc/qa/uitest/goalSeek/tdf37341.py deleted file mode 100644 index ad1a1f1792e6..000000000000 --- a/sc/qa/uitest/goalSeek/tdf37341.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_url_for_data_file - -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues - - -# Bug 37341 - Goal Seek hangs indefinitely for too many calculation steps (Formula Cell $F$110) -class tdf37341(UITestCase): - def test_tdf37341_goalSeek(self): - with self.ui_test.load_file(get_url_for_data_file("tdf37341.ods")) as calc_doc: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F111"})) - with self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog", close_button="") as xDialog: - xtarget = xDialog.getChild("target") - xvaredit = xDialog.getChild("varedit") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"})) - xOKBtn = xDialog.getChild("ok") - - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): - pass - - #verify - self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 6).getValue() > 0, True) - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py deleted file mode 100644 index 3c0436ef7239..000000000000 --- a/sc/qa/uitest/goalSeek/tdf43693.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_url_for_data_file - -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues - - -# Bug 43693 - Goal Seek: reproducible crash using "target value search" -class tdf43693(UITestCase): - def test_tdf43693_goalSeek(self): - with self.ui_test.load_file(get_url_for_data_file("tdf43693.ods")) as calc_doc: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "K248"})) - with self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog", close_button="") as xDialog: - xtarget = xDialog.getChild("target") - xvaredit = xDialog.getChild("varedit") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"})) - xOKBtn = xDialog.getChild("ok") - - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): - pass - - #verify - self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 4).getValue(), 0.04) - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/GoalSeekTest.cxx b/sc/qa/unit/GoalSeekTest.cxx index ae94c5dd40b3..8b5521964556 100644 --- a/sc/qa/unit/GoalSeekTest.cxx +++ b/sc/qa/unit/GoalSeekTest.cxx @@ -47,6 +47,31 @@ CPPUNIT_TEST_FIXTURE(ScGoalSeekTest, testTdf161511) CPPUNIT_ASSERT_EQUAL(DBL_MAX, res.Divergence); } +CPPUNIT_TEST_FIXTURE(ScGoalSeekTest, testTdf37341) +{ + createScDoc("ods/tdf37341.ods"); + + // E7 + table::CellAddress aVariableCell; + aVariableCell.Sheet = 0; + aVariableCell.Row = 6; + aVariableCell.Column = 4; + + // F111 + table::CellAddress aFormulaCell; + aFormulaCell.Sheet = 0; + aFormulaCell.Row = 110; + aFormulaCell.Column = 5; + + ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); + CPPUNIT_ASSERT(pModelObj); + + // Without the fix in place, this test would have hung here + sheet::GoalResult res = pModelObj->seekGoal(aFormulaCell, aVariableCell, "0"); + CPPUNIT_ASSERT_DOUBLES_EQUAL(11778.08775, res.Result, 0.0001); + CPPUNIT_ASSERT_EQUAL(DBL_MAX, res.Divergence); +} + CPPUNIT_TEST_FIXTURE(ScGoalSeekTest, testTdf68034) { createScDoc(); diff --git a/sc/qa/uitest/data/tdf37341.ods b/sc/qa/unit/data/ods/tdf37341.ods similarity index 100% rename from sc/qa/uitest/data/tdf37341.ods rename to sc/qa/unit/data/ods/tdf37341.ods