summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/validity
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 11:01:58 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 13:17:54 +0200
commit57e8d25a40d7c053fef8ecb452e159264c659604 (patch)
tree9b7ca9fc7cbe8972d1caba9e583fc77f6c5a91b1 /sc/qa/uitest/validity
parentadf59322c651e8e6740a8d97d963dcf0972bdc54 (diff)
uitest: guard create_doc_in_start_center in sc
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I9392c56e6efccde958f0cdd497376b3939b75be4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118152 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/validity')
-rw-r--r--sc/qa/uitest/validity/tdf138134.py74
-rw-r--r--sc/qa/uitest/validity/tdf53920.py80
-rw-r--r--sc/qa/uitest/validity/tdf65686.py58
-rw-r--r--sc/qa/uitest/validity/tdf96698.py174
-rw-r--r--sc/qa/uitest/validity/validity.py186
5 files changed, 279 insertions, 293 deletions
diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py
index c39529b78154..5480c64a2d19 100644
--- a/sc/qa/uitest/validity/tdf138134.py
+++ b/sc/qa/uitest/validity/tdf138134.py
@@ -15,43 +15,41 @@ 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
- 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, "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)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("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")
+ xmax = xDialog.getChild("max")
+
+ 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
index 82687900c3b0..3ebb6e991a16 100644
--- a/sc/qa/uitest/validity/tdf53920.py
+++ b/sc/qa/uitest/validity/tdf53920.py
@@ -15,51 +15,49 @@ from uitest.debug import sleep
#Bug 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells
class tdf53920(UITestCase):
def test_tdf53920_validity_multiple_cells(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()
- 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")
+ with self.ui_test.create_doc_in_start_center_guarded("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"}))
+ 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")
+ #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": "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")
+ 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")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf65686.py b/sc/qa/uitest/validity/tdf65686.py
index 04e0955c352c..278f0d78caf1 100644
--- a/sc/qa/uitest/validity/tdf65686.py
+++ b/sc/qa/uitest/validity/tdf65686.py
@@ -14,39 +14,37 @@ 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):
- 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()
- 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")
- xallowempty = xDialog.getChild("allowempty")
- minlist = xDialog.getChild("minlist")
+ with self.ui_test.create_doc_in_start_center_guarded("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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
+ xallowempty = xDialog.getChild("allowempty")
+ minlist = xDialog.getChild("minlist")
- self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List")
- self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies")
+ self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List")
+ self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf96698.py b/sc/qa/uitest/validity/tdf96698.py
index fcea7464ea96..95f55284a5e6 100644
--- a/sc/qa/uitest/validity/tdf96698.py
+++ b/sc/qa/uitest/validity/tdf96698.py
@@ -14,93 +14,91 @@ 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):
- 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()
-
- #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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- 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")
- xallowempty = xDialog.getChild("allowempty")
- xmin = xDialog.getChild("min")
-
- self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
- self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))")
-
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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")
+ xallowempty = xDialog.getChild("allowempty")
+ 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
index 3ac4f790c6cc..789c55e31a85 100644
--- a/sc/qa/uitest/validity/validity.py
+++ b/sc/qa/uitest/validity/validity.py
@@ -14,107 +14,101 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class validity(UITestCase):
def test_validity_tab_criteria(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()
- 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")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("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
- 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()
- 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")
- # print(get_state_as_dict(xtsbhelp))
- 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")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("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")
+ # print(get_state_as_dict(xtsbhelp))
+ 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
- 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()
- 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")
-
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("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: