[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 3 10:07:15 UTC 2021
sc/qa/uitest/validity/tdf138134.py | 63 +++++++++++++++++++++++++++++++++++++
sc/source/ui/view/output.cxx | 11 ++++++
2 files changed, 74 insertions(+)
New commits:
commit f55be8c2ed37e4428f28050f2b8b0a54fe896f03
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Tue Nov 24 13:46:45 2020 +0100
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 11:06:40 2021 +0100
tdf#138134 sc: remove red circle of updated formula
Recalculation of formulas didn't remove the red validation
circle around the formula cells despite their new valid value.
Note: to check/show the fix manually, run the test with
$ (cd sc && make -srj8 UITest_validity UITEST_TEST_NAME="tdf138134.DetectiveCircle.test_delete_circle_at_formula" SAL_USE_VCLPLUGIN=gen)
(if needed, by adding
import time
time.sleep(5)
to the called function of sc/qa/uitest/validity/tdf138134.py)
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: Ieda4449b1ef07a3cb536881e99130d967c1bb175
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106502
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 0478bdb68e8945cc76dc04c6f7040526656329a8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111877
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py
new file mode 100644
index 000000000000..6d660019d15e
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf138134.py
@@ -0,0 +1,63 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class DetectiveCircle(UITestCase):
+
+ def test_delete_circle_at_formula(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "3")
+ enter_text_to_cell(gridwin, "A3", "=SUM(A1:A2)")
+
+ #Select the cells to be validated
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
+ #Apply Data > Validity ... > Whole Numbers
+ self.ui_test.execute_dialog_through_command(".uno:Validation")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xallowempty = xDialog.getChild("allowempty")
+ xdata = xDialog.getChild("data")
+ xmin = xDialog.getChild("min")
+ xmax = xDialog.getChild("max")
+
+ props = {"TEXT": "Whole Numbers"}
+ actionProps = mkPropertyValues(props)
+ xallow.executeAction("SELECT", actionProps)
+ xallowempty.executeAction("CLICK", tuple())
+ propsA = {"TEXT": "equal"}
+ actionPropsA = mkPropertyValues(propsA)
+ xdata.executeAction("SELECT", actionPropsA)
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.xUITest.executeCommand(".uno:ShowInvalid")
+
+ detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount()
+ #There should be 1 detective circle object!
+ self.assertEqual(detectiveCircle1, 1)
+
+ enter_text_to_cell(gridwin, "A1", "2")
+
+ detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount()
+ #There should not be a detective circle object!
+ self.assertEqual(detectiveCircle2, 0)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 8683ecdadf77..8ced4bd0ba0a 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -56,6 +56,8 @@
#include <scmod.hxx>
#include <appoptio.hxx>
#include <postit.hxx>
+#include <validat.hxx>
+#include <detfunc.hxx>
#include <colorscale.hxx>
@@ -1830,6 +1832,15 @@ void ScOutputData::FindChanged()
nCol2 = std::max(rPos.Col(), nCol2);
nRow1 = std::min(rPos.Row(), nRow1);
nRow2 = std::max(rPos.Row(), nRow2);
+
+ const SfxUInt32Item* pItem = mpDoc->GetAttr(rPos, ATTR_VALIDDATA);
+ const ScValidationData* pData = mpDoc->GetValidationEntry(pItem->GetValue());
+ if (pData)
+ {
+ ScRefCellValue aCell(*mpDoc, rPos);
+ if (pData->IsDataValid(aCell, rPos))
+ ScDetectiveFunc(mpDoc, rPos.Tab()).DeleteCirclesAt(rPos.Col(), rPos.Row());
+ }
}
}
}
More information about the Libreoffice-commits
mailing list