summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2020-11-24 13:46:45 +0100
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2021-06-28 12:32:06 +0200
commitabe18073010ac88f5ccf8d1a0d60b9e17539e0b4 (patch)
treeddafb464da661feea869487038ce7fe95e71eb0c
parentc1898ecc7c15d435111a23060b0f7caf58344530 (diff)
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@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 0478bdb68e8945cc76dc04c6f7040526656329a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117977 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--sc/qa/uitest/validity/tdf138134.py63
-rw-r--r--sc/source/ui/view/output.cxx11
2 files changed, 74 insertions, 0 deletions
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 4205db5c8fae..382792f88782 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());
+ }
}
}
}