summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/calc_tests8
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-22 11:17:29 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-22 21:47:11 +0200
commit374baf308979306aa35575118c40ccd7caae1e29 (patch)
tree2570881a42fe5b5555db1dbf2aecc0a3fdd33878 /sc/qa/uitest/calc_tests8
parentb2331179fc508fd6bc37355e5c3c5a5ee54557c4 (diff)
uitest: guard create_doc_in_start_center
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I75ef7712af3676363a9a464acf83f6f68ffc4f85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117617 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests8')
-rw-r--r--sc/qa/uitest/calc_tests8/navigator.py50
-rw-r--r--sc/qa/uitest/calc_tests8/tdf114710.py2
-rw-r--r--sc/qa/uitest/calc_tests8/tdf118308.py65
-rw-r--r--sc/qa/uitest/calc_tests8/tdf125051.py52
-rw-r--r--sc/qa/uitest/calc_tests8/tdf126248.py2
-rw-r--r--sc/qa/uitest/calc_tests8/tdf137726.py22
6 files changed, 93 insertions, 100 deletions
diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py
index d92226771eb5..e2cb99ad7f68 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -114,40 +114,38 @@ class navigator(UITestCase):
def test_tdf134390(self):
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWin = xCalcDoc.getChild("grid_window")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xToolBar = xNavigatorPanel.getChild("toolbox2")
- xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
- xRow = xNavigatorPanel.getChild('row')
- xColumn = xNavigatorPanel.getChild('column')
- self.assertEqual(get_state_as_dict(xColumn)['Value'], '1')
- self.assertEqual(get_state_as_dict(xRow)['Value'], '1')
- self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0")
- self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xToolBar = xNavigatorPanel.getChild("toolbox2")
+ xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button
- xRow.executeAction("UP", tuple())
- xColumn.executeAction("UP", tuple())
+ xRow = xNavigatorPanel.getChild('row')
+ xColumn = xNavigatorPanel.getChild('column')
+ self.assertEqual(get_state_as_dict(xColumn)['Value'], '1')
+ self.assertEqual(get_state_as_dict(xRow)['Value'], '1')
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0")
- # Use return to update the current cell
- xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+ xRow.executeAction("UP", tuple())
+ xColumn.executeAction("UP", tuple())
- self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
- self.assertEqual(get_state_as_dict(xRow)['Value'], '2')
+ # Use return to update the current cell
+ xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
- self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1")
- self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1")
+ self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
+ self.assertEqual(get_state_as_dict(xRow)['Value'], '2')
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1")
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_tdf141973(self):
with self.ui_test.load_file(get_url_for_data_file("tdf141973.ods")):
diff --git a/sc/qa/uitest/calc_tests8/tdf114710.py b/sc/qa/uitest/calc_tests8/tdf114710.py
index a4989a72de58..6bddee42a85b 100644
--- a/sc/qa/uitest/calc_tests8/tdf114710.py
+++ b/sc/qa/uitest/calc_tests8/tdf114710.py
@@ -21,7 +21,7 @@ class tdf114710(UITestCase):
self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center("writer"):
self.xUITest.getTopFocusWindow()
diff --git a/sc/qa/uitest/calc_tests8/tdf118308.py b/sc/qa/uitest/calc_tests8/tdf118308.py
index 2c38cd11394d..80c79eedb1c9 100644
--- a/sc/qa/uitest/calc_tests8/tdf118308.py
+++ b/sc/qa/uitest/calc_tests8/tdf118308.py
@@ -13,49 +13,48 @@ from libreoffice.calc.document import get_cell_by_position
class tdf118308(UITestCase):
def test_tdf118308(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()
+ with 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", "A")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:Copy")
+ enter_text_to_cell(gridwin, "A1", "A")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.execute_dialog_through_command(".uno:CloseDoc")
- xDialog = self.xUITest.getTopFocusWindow()
- xDiscardBtn = xDialog.getChild("discard")
- self.ui_test.close_dialog_through_button(xDiscardBtn)
+ self.ui_test.execute_dialog_through_command(".uno:CloseDoc")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xDiscardBtn = xDialog.getChild("discard")
+ self.ui_test.close_dialog_through_button(xDiscardBtn)
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ with self.ui_test.create_doc_in_start_center("calc"):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- # Without the fix in place, this test would have failed here
- # since a different dialog would have been opened and the children
- # wouldn't have been found
- xText = xDialog.getChild("text")
- xNumbers = xDialog.getChild("numbers")
- xDatetime = xDialog.getChild("datetime")
- xFormats = xDialog.getChild("formats")
+ # Without the fix in place, this test would have failed here
+ # since a different dialog would have been opened and the children
+ # wouldn't have been found
+ xText = xDialog.getChild("text")
+ xNumbers = xDialog.getChild("numbers")
+ xDatetime = xDialog.getChild("datetime")
+ xFormats = xDialog.getChild("formats")
- self.assertEqual("true", get_state_as_dict(xText)["Selected"])
- self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"])
- self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"])
- self.assertEqual("false", get_state_as_dict(xFormats)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xText)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"])
+ self.assertEqual("false", get_state_as_dict(xFormats)["Selected"])
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- self.assertEqual("A", get_cell_by_position(document, 0, 0, 0).getString())
- self.ui_test.close_doc()
+ self.assertEqual("A", get_cell_by_position(document, 0, 0, 0).getString())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py
index 5ebd02446450..8cc02ff2d67e 100644
--- a/sc/qa/uitest/calc_tests8/tdf125051.py
+++ b/sc/qa/uitest/calc_tests8/tdf125051.py
@@ -15,32 +15,30 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf125051(UITestCase):
def test_tdf125051_crash_spelling_dialog(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", "text")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.ui_test.execute_dialog_through_command(".uno:SpellDialog")
- xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
-
- xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK"
- okBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
-
- xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
- #open options
- optionsBtn = xDialog.getChild("options")
-
- with self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), close_button="cancel"):
- pass
-
- closeBtn = xDialog.getChild("close") #close Spelling dialog
- self.ui_test.close_dialog_through_button(closeBtn)
-
- #verify, we didn't crash
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text")
-
- self.ui_test.close_doc()
+ with 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", "text")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.ui_test.execute_dialog_through_command(".uno:SpellDialog")
+ xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
+
+ xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK"
+ okBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
+
+ xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
+ #open options
+ optionsBtn = xDialog.getChild("options")
+
+ with self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), close_button="cancel"):
+ pass
+
+ closeBtn = xDialog.getChild("close") #close Spelling dialog
+ self.ui_test.close_dialog_through_button(closeBtn)
+
+ #verify, we didn't crash
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py
index 27482acd0cde..8cc43708c72d 100644
--- a/sc/qa/uitest/calc_tests8/tdf126248.py
+++ b/sc/qa/uitest/calc_tests8/tdf126248.py
@@ -49,7 +49,7 @@ class tdf126248(UITestCase):
def test_tdf126248(self):
- with guarded.create_doc_in_start_center(self, "calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
self.changeLocalSetting("Chinese (traditional)")
diff --git a/sc/qa/uitest/calc_tests8/tdf137726.py b/sc/qa/uitest/calc_tests8/tdf137726.py
index 8256a778ba26..0d6cd00f8b00 100644
--- a/sc/qa/uitest/calc_tests8/tdf137726.py
+++ b/sc/qa/uitest/calc_tests8/tdf137726.py
@@ -9,20 +9,18 @@ from uitest.framework import UITestCase
class tdf137726(UITestCase):
def test_tdf137726(self):
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun")
+ self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun")
- # three dialogs are displayed one after the other, click OK in all of them
- for i in range(3):
- xDialog = self.xUITest.getTopFocusWindow()
- xOKBtn = xDialog.getChild('ok')
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # three dialogs are displayed one after the other, click OK in all of them
+ for i in range(3):
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOKBtn = xDialog.getChild('ok')
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # Without the fix in place, this test would have hung here
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have hung here
# vim: set shiftwidth=4 softtabstop=4 expandtab: