summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/findReplace/tdf118208.py
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-28 21:21:47 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-29 13:25:57 +0200
commit8b961addb7887a8b8dc8dbc6758c3dc7c1068ac4 (patch)
tree7314f1340c336d5fc0e39bd12c5701ed52309bef /sw/qa/uitest/findReplace/tdf118208.py
parent279ab35ad07a958b5b8d7d593b9817e7365b9bb5 (diff)
uitest: guard execute_dialog_through_command in sw
Mostly done with a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I9def7e8fd8256c3131ca2904f78976b9cd59aa96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118037 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/findReplace/tdf118208.py')
-rw-r--r--sw/qa/uitest/findReplace/tdf118208.py54
1 files changed, 24 insertions, 30 deletions
diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py
index d46ed7ae8f02..3d1f6e072f7b 100644
--- a/sw/qa/uitest/findReplace/tdf118208.py
+++ b/sw/qa/uitest/findReplace/tdf118208.py
@@ -20,24 +20,21 @@ class tdf118208(UITestCase):
# 2. Press ctrl-H to show the search and replace dialog.
# 3. Press the "Format..." button.
#Libreoffice immediately crashed.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialog:
- xPages = xDialog.getChild("pages")
- xLanguageEntry = xPages.getChild('2') # Language Settings
- xLanguageEntry.executeAction("EXPAND", tuple())
- xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
- xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
+ xPages = xDialog.getChild("pages")
+ xLanguageEntry = xPages.getChild('2') # Language Settings
+ xLanguageEntry.executeAction("EXPAND", tuple())
+ xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+ xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
- asianlanguage = xDialog.getChild("asiansupport")
- complexlanguage = xDialog.getChild("ctlsupport")
- if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
- asianlanguage.executeAction("CLICK", tuple())
- if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
- complexlanguage.executeAction("CLICK", tuple())
+ asianlanguage = xDialog.getChild("asiansupport")
+ complexlanguage = xDialog.getChild("ctlsupport")
+ if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
+ asianlanguage.executeAction("CLICK", tuple())
+ if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
+ complexlanguage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
xDialog = self.xUITest.getTopFocusWindow()
@@ -53,22 +50,19 @@ class tdf118208(UITestCase):
self.ui_test.close_dialog_through_button(xcloseBtn)
#enable lang support again
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialog:
- xPages = xDialog.getChild("pages")
- xLanguageEntry = xPages.getChild('2') # Language Settings
- xLanguageEntry.executeAction("EXPAND", tuple())
- xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
- xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
+ xPages = xDialog.getChild("pages")
+ xLanguageEntry = xPages.getChild('2') # Language Settings
+ xLanguageEntry.executeAction("EXPAND", tuple())
+ xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+ xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
- asianlanguage = xDialog.getChild("asiansupport")
- complexlanguage = xDialog.getChild("ctlsupport")
- if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
- asianlanguage.executeAction("CLICK", tuple())
- if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
- complexlanguage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ asianlanguage = xDialog.getChild("asiansupport")
+ complexlanguage = xDialog.getChild("ctlsupport")
+ if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
+ asianlanguage.executeAction("CLICK", tuple())
+ if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
+ complexlanguage.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab: