summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/validity
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/validity
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/validity')
-rw-r--r--sc/qa/uitest/validity/tdf137945.py30
-rw-r--r--sc/qa/uitest/validity/tdf138134.py55
-rw-r--r--sc/qa/uitest/validity/tdf53920.py65
-rw-r--r--sc/qa/uitest/validity/tdf65686.py50
-rw-r--r--sc/qa/uitest/validity/tdf96698.py98
-rw-r--r--sc/qa/uitest/validity/validity.py114
6 files changed, 412 insertions, 0 deletions
diff --git a/sc/qa/uitest/validity/tdf137945.py b/sc/qa/uitest/validity/tdf137945.py
new file mode 100644
index 000000000..abe7b2605
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf137945.py
@@ -0,0 +1,30 @@
+# -*- 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 select_pos
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class Tdf137945(UITestCase):
+
+ def test_tdf137945(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf137945.ods")):
+
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xInput = xDialog.getChild("inputhelp")
+ xTitle = xDialog.getChild("title")
+
+ self.assertEqual("test", get_state_as_dict(xTitle)['Text'])
+ # Without the fix in place, this test would have failed with
+ # '1 2 3 4 5 10 end' != '1 2 3 4 5 10 end'
+ self.assertEqual("1 2 3 4 5 10 end", get_state_as_dict(xInput)['Text'])
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py
new file mode 100644
index 000000000..c16bdc8d0
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf138134.py
@@ -0,0 +1,55 @@
+# -*- 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.calc import enter_text_to_cell
+from uitest.uihelper.common import select_by_text, select_pos
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+class DetectiveCircle(UITestCase):
+
+ def test_delete_circle_at_formula(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ 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
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xallowempty = xDialog.getChild("allowempty")
+ xdata = xDialog.getChild("data")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Whole Numbers")
+ xallowempty.executeAction("CLICK", tuple())
+ select_by_text(xdata, "equal")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"}))
+
+ 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)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf53920.py b/sc/qa/uitest/validity/tdf53920.py
new file mode 100644
index 000000000..51b46ae31
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf53920.py
@@ -0,0 +1,65 @@
+# -*- 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_state_as_dict
+from uitest.uihelper.common import select_by_text, select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells
+class tdf53920(UITestCase):
+ def test_tdf53920_validity_multiple_cells(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #. Provide the desired values in a range of cells
+ enter_text_to_cell(gridwin, "C1", "A")
+ enter_text_to_cell(gridwin, "C2", "B")
+ enter_text_to_cell(gridwin, "C3", "C")
+ #Select the cells to be validated
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5", "EXTEND":"1"}))
+ #Apply Data > Validity ... > Cell Range
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Cell range")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"}))
+
+ #Expected behavior: All selected cells validate data.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf65686.py b/sc/qa/uitest/validity/tdf65686.py
new file mode 100644
index 000000000..fe1a0fbc6
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf65686.py
@@ -0,0 +1,50 @@
+# -*- 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_state_as_dict
+from uitest.uihelper.common import select_by_text, select_pos
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 65686 - EDITING Data > Validity broken (for list entries at least)
+class tdf65686(UITestCase):
+ def test_tdf65686_validity_list(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #- Data > Validity
+ #- Select Allow List
+ #- Enter Entries Aap Noot Mies
+ #- OK
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ minlist = xDialog.getChild("minlist")
+
+ select_by_text(xallow, "List")
+ minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"}))
+ minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"}))
+ minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Mies"}))
+ #- again open Data > Validity
+ #> there are empty lines in the list Entries
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ minlist = xDialog.getChild("minlist")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List")
+ self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf96698.py b/sc/qa/uitest/validity/tdf96698.py
new file mode 100644
index 000000000..d25a5378f
--- /dev/null
+++ b/sc/qa/uitest/validity/tdf96698.py
@@ -0,0 +1,98 @@
+# -*- 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_state_as_dict
+from uitest.uihelper.common import select_by_text, select_pos
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 96698 - Data => Validity => Custom (like Excel) is missing
+class tdf96698(UITestCase):
+ def test_tdf96698_validity_custom_formula(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ #A general validity check for the entered new content of the active cell - especially for text
+ #with a custom formula like in Excel is not possible.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Custom")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"}))
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))")
+
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Custom")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"}))
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))")
+
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Custom")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"}))
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))")
+
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ select_by_text(xallow, "Custom")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"}))
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xmin = xDialog.getChild("min")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/validity.py b/sc/qa/uitest/validity/validity.py
new file mode 100644
index 000000000..25e691a42
--- /dev/null
+++ b/sc/qa/uitest/validity/validity.py
@@ -0,0 +1,114 @@
+# -*- 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_state_as_dict
+from uitest.uihelper.common import select_by_text, select_pos
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+class validity(UITestCase):
+ def test_validity_tab_criteria(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ 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")
+
+ select_by_text(xallow, "Whole Numbers")
+ xallowempty.executeAction("CLICK", tuple())
+ select_by_text(xdata, "valid range")
+ xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ #reopen and verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation", close_button="cancel") as xDialog:
+ xallow = xDialog.getChild("allow")
+ xallowempty = xDialog.getChild("allowempty")
+ xdata = xDialog.getChild("data")
+ xmin = xDialog.getChild("min")
+ xmax = xDialog.getChild("max")
+
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Whole Numbers")
+ self.assertEqual(get_state_as_dict(xallowempty)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range")
+ self.assertEqual(get_state_as_dict(xmin)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xmax)["Text"], "2")
+
+
+ def test_validity_tab_inputHelp(self):
+ #validationhelptabpage.ui
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xtsbhelp = xDialog.getChild("tsbhelp")
+ xtitle = xDialog.getChild("title")
+ xinputhelp = xDialog.getChild("inputhelp")
+
+ xtsbhelp.executeAction("CLICK", tuple())
+ xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
+ #reopen and verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ xtsbhelp = xDialog.getChild("tsbhelp")
+ xtitle = xDialog.getChild("title")
+ xinputhelp = xDialog.getChild("inputhelp")
+ select_pos(xTabs, "1")
+ self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xtitle)["Text"], "A")
+ self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B")
+
+
+ def test_validity_tab_errorAlert(self):
+ # erroralerttabpage.ui
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xactionCB = xDialog.getChild("actionCB")
+ xerroralerttitle = xDialog.getChild("erroralert_title")
+ xerrorMsg = xDialog.getChild("errorMsg")
+
+ select_by_text(xactionCB, "Warning")
+ xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"}))
+ xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"}))
+ #reopen and verify
+ with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xactionCB = xDialog.getChild("actionCB")
+ xerroralerttitle = xDialog.getChild("erroralert_title")
+ xerrorMsg = xDialog.getChild("errorMsg")
+
+ self.assertEqual(get_state_as_dict(xactionCB)["SelectEntryText"], "Warning")
+ self.assertEqual(get_state_as_dict(xerroralerttitle)["Text"], "Warn")
+ self.assertEqual(get_state_as_dict(xerrorMsg)["Text"], "Warn2")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: