summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-17 17:01:23 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-21 10:29:40 +0200
commit8298aa62726312eee6f8fbb64a9fc9b12680447f (patch)
treed35191b8bc0a48e0e086b19c9c3c0503e217c71b /sw
parente837f50313a703b6b26abb78f224472c1e4734ea (diff)
uitest: guard execute_blocking_action
so even if an assert fails, the dialog is closed afterwards for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I9a3adb52546238d960eeaaaf03b6bdbbd5718cf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117392 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf140528.py8
-rw-r--r--sw/qa/uitest/findReplace/findReplace.py8
-rw-r--r--sw/qa/uitest/findReplace/tdf106099.py6
-rw-r--r--sw/qa/uitest/findReplace/tdf118208.py7
-rw-r--r--sw/qa/uitest/findReplace/tdf119462.py7
-rw-r--r--sw/qa/uitest/findSimilarity/findSimilarity.py14
-rw-r--r--sw/qa/uitest/macro_tests/tdf64690.py8
-rw-r--r--sw/qa/uitest/options/optionsDialog.py6
-rw-r--r--sw/qa/uitest/options/tdf131581.py8
-rw-r--r--sw/qa/uitest/ui/index/index.py18
-rw-r--r--sw/qa/uitest/writer_tests2/bookmark.py8
-rw-r--r--sw/qa/uitest/writer_tests2/documentProperties.py16
-rw-r--r--sw/qa/uitest/writer_tests3/autoredactDialog.py42
-rw-r--r--sw/qa/uitest/writer_tests3/customizeDialog.py9
-rw-r--r--sw/qa/uitest/writer_tests3/hyperlinkdialog.py5
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py17
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113252.py11
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py5
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py9
19 files changed, 61 insertions, 151 deletions
diff --git a/sw/qa/uitest/chapterNumbering/tdf140528.py b/sw/qa/uitest/chapterNumbering/tdf140528.py
index 9b60ad9991a0..c34d33c409b3 100644
--- a/sw/qa/uitest/chapterNumbering/tdf140528.py
+++ b/sw/qa/uitest/chapterNumbering/tdf140528.py
@@ -24,7 +24,7 @@ class Tdf140528(UITestCase):
xFormat = xDialog.getChild("format")
- def handle_format_dlg(dialog):
+ with self.ui_test.execute_blocking_action(xFormat.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "10"}))) as dialog:
xEntry = dialog.getChild("entry")
self.assertEqual("Untitled 1", get_state_as_dict(xEntry)['Text'])
@@ -32,12 +32,6 @@ class Tdf140528(UITestCase):
xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"}))
- xOKBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.execute_blocking_action(xFormat.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "10"})),
- dialog_handler=handle_format_dlg)
-
self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem'])
# Go to Position tab
diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py
index 46e00135553e..30e0c0e63006 100644
--- a/sw/qa/uitest/findReplace/findReplace.py
+++ b/sw/qa/uitest/findReplace/findReplace.py
@@ -71,18 +71,12 @@ class findReplace(UITestCase):
searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
format = xDialog.getChild("format")
- def handle_format_dlg(dialog):
- #print(dialog.getChildren())
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
xTabs = dialog.getChild("tabcontrol")
select_pos(xTabs, "0")
xSizeFont = dialog.getChild("westsizelb-cjk")
xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()),
- dialog_handler=handle_format_dlg)
# Verify these didn't get set again through SvxSearchController::StateChanged, timer-
# triggered from SfxBindings::NextJob while executing the Format dialog above:
diff --git a/sw/qa/uitest/findReplace/tdf106099.py b/sw/qa/uitest/findReplace/tdf106099.py
index 2e8011dab36a..d0c1ad76f251 100644
--- a/sw/qa/uitest/findReplace/tdf106099.py
+++ b/sw/qa/uitest/findReplace/tdf106099.py
@@ -21,17 +21,13 @@ class tdf106099(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
#2. Choose Format
format = xDialog.getChild("format")
- def handle_format_dlg(dialog):
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
#Font effects - Underline Single. OK.
xTabs = dialog.getChild("tabcontrol")
select_pos(xTabs, "1") #tab font effects
underlinelb = dialog.getChild("underlinelb")
select_by_text(underlinelb, "Single")
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
- self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()),
- dialog_handler=handle_format_dlg)
#verify label searchdesc
searchdesc = xDialog.getChild("searchdesc")
print(get_state_as_dict(searchdesc))
diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py
index c602158b17a4..17cd71fc9923 100644
--- a/sw/qa/uitest/findReplace/tdf118208.py
+++ b/sw/qa/uitest/findReplace/tdf118208.py
@@ -44,12 +44,9 @@ class tdf118208(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
format = xDialog.getChild("format")
- def handle_format_dlg(dialog):
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
- self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()),
- dialog_handler=handle_format_dlg)
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())):
+ pass
#verify
self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
diff --git a/sw/qa/uitest/findReplace/tdf119462.py b/sw/qa/uitest/findReplace/tdf119462.py
index 8623873cbd02..4402d1acaedd 100644
--- a/sw/qa/uitest/findReplace/tdf119462.py
+++ b/sw/qa/uitest/findReplace/tdf119462.py
@@ -21,18 +21,13 @@ class tdf119462(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
#2. Choose Format
format = xDialog.getChild("format")
- def handle_format_dlg(dialog):
-
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
#3. Choose Bold
xTabs = dialog.getChild("tabcontrol")
select_pos(xTabs, "0")
xweststylelbcjk = dialog.getChild("weststylelb-cjk")
xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"}))
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
- self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()),
- dialog_handler=handle_format_dlg)
#verify label searchdesc
searchdesc = xDialog.getChild("searchdesc")
self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold")
diff --git a/sw/qa/uitest/findSimilarity/findSimilarity.py b/sw/qa/uitest/findSimilarity/findSimilarity.py
index ea8929983f80..8328dedbe191 100644
--- a/sw/qa/uitest/findSimilarity/findSimilarity.py
+++ b/sw/qa/uitest/findSimilarity/findSimilarity.py
@@ -28,20 +28,16 @@ class findSimilarities(UITestCase):
similarity = xDialog.getChild("similarity")
similaritybtn = xDialog.getChild("similaritybtn")
similarity.executeAction("CLICK", tuple())
- def handle_similarity_dlg(dialog):
+ with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ())) as dialog:
otherfld = dialog.getChild("otherfld")
longerfld = dialog.getChild("longerfld")
shorterfld = dialog.getChild("shorterfld")
otherfld.executeAction("DOWN", tuple())
longerfld.executeAction("DOWN", tuple())
shorterfld.executeAction("DOWN", tuple())
- xOKBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_similarity_dlg)
#open dialog again, verify values = 1; close dialog with cancel
- def handle_similarity_dlg2(dialog):
+ with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog:
otherfld = dialog.getChild("otherfld")
longerfld = dialog.getChild("longerfld")
shorterfld = dialog.getChild("shorterfld")
@@ -49,12 +45,6 @@ class findSimilarities(UITestCase):
self.assertEqual(get_state_as_dict(longerfld)["Text"], "1")
self.assertEqual(get_state_as_dict(shorterfld)["Text"], "1")
- xCancelBtn = dialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_similarity_dlg2)
-
xsearch = xDialog.getChild("search")
xsearch.executeAction("CLICK", tuple())
# Find next - not found
diff --git a/sw/qa/uitest/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py
index 7039e48df83a..7798e3bbc995 100644
--- a/sw/qa/uitest/macro_tests/tdf64690.py
+++ b/sw/qa/uitest/macro_tests/tdf64690.py
@@ -58,15 +58,11 @@ class tdf64690(UITestCase):
selection.executeAction("CLICK", tuple())
self.assertEqual("true", get_state_as_dict(selection)['Selected'])
- def handle_confirmation_dlg(dialog):
- xOKBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
replaceall = xDialog.getChild("replaceall")
# Without the fix in place, this test would have hung here
- self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirmation_dlg)
+ with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())):
+ pass
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
diff --git a/sw/qa/uitest/options/optionsDialog.py b/sw/qa/uitest/options/optionsDialog.py
index 45cb2a62954a..92494ab81ab1 100644
--- a/sw/qa/uitest/options/optionsDialog.py
+++ b/sw/qa/uitest/options/optionsDialog.py
@@ -22,14 +22,10 @@ class optionsDialog(UITestCase):
xMoreIconsBtn = xDialog.getChild("btnMoreIcons")
- def handle_more_icons_dlg(dialog):
+ with self.ui_test.execute_blocking_action(xMoreIconsBtn.executeAction, args=('CLICK', ()), close_button="buttonClose") as dialog:
# Check it doesn't crash while opening it
xCloseBtn = dialog.getChild("buttonClose")
self.ui_test.wait_until_property_is_updated(xCloseBtn, "Enabled", "true")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.execute_blocking_action(xMoreIconsBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_more_icons_dlg)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
diff --git a/sw/qa/uitest/options/tdf131581.py b/sw/qa/uitest/options/tdf131581.py
index ac30dbc579f1..3acebd4ce507 100644
--- a/sw/qa/uitest/options/tdf131581.py
+++ b/sw/qa/uitest/options/tdf131581.py
@@ -25,17 +25,11 @@ class tdf131581(UITestCase):
xExpertBtn = xDialogOpt.getChild("expertconfig")
- def handle_expert_dlg(dialog):
+ with self.ui_test.execute_blocking_action(xExpertBtn.executeAction, args=('CLICK', ())) as dialog:
# Without the fix in place, this would have hung
xSearchBtn = dialog.getChild("searchButton")
xSearchBtn.executeAction("CLICK", tuple())
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_blocking_action(xExpertBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_expert_dlg)
-
xOKBtn = xDialogOpt.getChild("ok")
xOKBtn.executeAction("CLICK", tuple())
diff --git a/sw/qa/uitest/ui/index/index.py b/sw/qa/uitest/ui/index/index.py
index c8309cdc14cc..71d9e165bbaf 100644
--- a/sw/qa/uitest/ui/index/index.py
+++ b/sw/qa/uitest/ui/index/index.py
@@ -19,25 +19,21 @@ class TestSwuiidxmrk(UITestCase):
# Given an empty Writer document:
self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry")
+ insert_entry = self.xUITest.getTopFocusWindow()
+ from_document = insert_entry.getChild("fromdocument")
+ from_document.executeAction("CLICK", tuple())
+ new = insert_entry.getChild("new")
+
# When inserting a biblio entry field with a page number:
- def handle_define_entry(define_entry):
+ with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry:
entry = define_entry.getChild("entry")
type_text(entry, "aaa")
listbox = define_entry.getChild("listbox")
select_pos(listbox, "16") # WWW document
pagecb = define_entry.getChild("pagecb-visible")
pagecb.executeAction("CLICK", tuple())
- ok = define_entry.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
- self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry")
- insert_entry = self.xUITest.getTopFocusWindow()
- from_document = insert_entry.getChild("fromdocument")
- from_document.executeAction("CLICK", tuple())
- new = insert_entry.getChild("new")
- self.ui_test.execute_blocking_action(new.executeAction,
- args=('CLICK', ()),
- dialog_handler=handle_define_entry)
insert = insert_entry.getChild("insert")
insert.executeAction("CLICK", tuple())
close = insert_entry.getChild("close")
diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py
index 57ab151adbcb..d41fd2ff81e8 100644
--- a/sw/qa/uitest/writer_tests2/bookmark.py
+++ b/sw/qa/uitest/writer_tests2/bookmark.py
@@ -78,15 +78,9 @@ class bookmarkDialog(UITestCase):
xFirstListEntry.executeAction("SELECT", tuple())
xRenameBtn = xBookDlg.getChild("rename")
- def handle_rename_dlg(dialog): #handle rename dialog - need special handling
-
+ with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog:
xNewNameTxt=dialog.getChild("entry")
xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"}))
- xOKBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_rename_dlg) #close rename dialog with OK button
xBookDlg = self.xUITest.getTopFocusWindow()
x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname"
diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py
index 72e0c48dc636..8afbac9be533 100644
--- a/sw/qa/uitest/writer_tests2/documentProperties.py
+++ b/sw/qa/uitest/writer_tests2/documentProperties.py
@@ -43,12 +43,8 @@ class documentProperties(UITestCase):
#digital signature
xDigSignBtn = xDialog.getChild("signature")
- def handle_sign_dlg(dialog):
- xNoBtn = dialog.getChild("no")
- self.ui_test.close_dialog_through_button(xNoBtn)
-
- self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_sign_dlg)
+ with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
xTabs = xDialog.getChild("tabcontrol")
select_pos(xTabs, "1") #tab Description
@@ -75,16 +71,12 @@ class documentProperties(UITestCase):
xRecordChangesCheckbox = xDialog.getChild("recordchanges")
xRecordChangesCheckbox.executeAction("CLICK", tuple())
xProtectBtn = xDialog.getChild("protect")
- def handle_protect_dlg(dialog):
- xOkBtn = dialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as dialog:
xPasswordText = dialog.getChild("pass1ed")
xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
xConfirmText = dialog.getChild("confirm1ed")
xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_protect_dlg)
select_pos(xTabs, "2") #tab Custom properties
diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py
index 240e4bd8bce5..9d3281456ca1 100644
--- a/sw/qa/uitest/writer_tests3/autoredactDialog.py
+++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py
@@ -68,24 +68,18 @@ class AutoRedactDialog(UITestCase):
["target3", "content3"],
]
- def handle_add_dlg(dialog): #handle add target dialog - need special handling
- xNewNameTxt=dialog.getChild("name")
- xNewContentTxt=dialog.getChild("content")
- xOKBtn = dialog.getChild("close")
- xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined
-
- select_pos(xTypeList, 0) #Text
- self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
-
- type_text(xNewNameTxt, targets_list[self.add_target_counter][0])
- type_text(xNewContentTxt, targets_list[self.add_target_counter][1])
-
- self.ui_test.close_dialog_through_button(xOKBtn)
-
for i in range(0, len(targets_list)):
self.add_target_counter = i
- self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_add_dlg) #close add target dialog with OK button
+ with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xNewNameTxt=dialog.getChild("name")
+ xNewContentTxt=dialog.getChild("content")
+ xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined
+
+ select_pos(xTypeList, 0) #Text
+ self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
+
+ type_text(xNewNameTxt, targets_list[self.add_target_counter][0])
+ type_text(xNewContentTxt, targets_list[self.add_target_counter][1])
# Make sure targets are added successfully
xTargetsListbox = xDialog.getChild("targets")
@@ -131,10 +125,9 @@ class AutoRedactDialog(UITestCase):
self.clearTargetsbox(xDialog)
# We first need to add a target so that we can edit it
- def handle_add_dlg(dialog): #handle add target dialog - need special handling
+ with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
xNewNameTxt=dialog.getChild("name")
xNewContentTxt=dialog.getChild("content")
- xOKBtn = dialog.getChild("close")
xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined
select_pos(xTypeList, 0) #Text
@@ -143,11 +136,6 @@ class AutoRedactDialog(UITestCase):
type_text(xNewNameTxt, "TestTarget")
type_text(xNewContentTxt, "TestContent")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_add_dlg) #close add target dialog with OK button
-
# Make sure target is added successfully
xTargetsListbox = xDialog.getChild("targets")
targets_box_state_dict = get_state_as_dict(xTargetsListbox)
@@ -158,10 +146,9 @@ class AutoRedactDialog(UITestCase):
target_entry.executeAction("SELECT", tuple())
# Now edit the target
- def handle_edit_dlg(dialog): #handle add target dialog - need special handling
+ with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
xNameTxt=dialog.getChild("name")
xContentTxt=dialog.getChild("content")
- xOKBtn = dialog.getChild("close")
xNameTxt.executeAction("CLEAR", tuple())
xContentTxt.executeAction("CLEAR", tuple())
@@ -169,11 +156,6 @@ class AutoRedactDialog(UITestCase):
type_text(xNameTxt, "TestTargetEdited")
type_text(xContentTxt, "TestContentEdited")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_edit_dlg) #close add target dialog with OK button
-
# Make sure target is still there
xTargetsListbox = xDialog.getChild("targets")
targets_box_state_dict = get_state_as_dict(xTargetsListbox)
diff --git a/sw/qa/uitest/writer_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py
index 52adae2b0ee1..ca97fbe4e10e 100644
--- a/sw/qa/uitest/writer_tests3/customizeDialog.py
+++ b/sw/qa/uitest/writer_tests3/customizeDialog.py
@@ -108,23 +108,22 @@ class ConfigureDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
- def close_dialog(dlg):
- CancelBtn = dlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(CancelBtn)
# Open the New Menu Dialog with id = 0
xDialog = self.xUITest.getTopFocusWindow()
xmenugearbtn=xDialog.getChild("menugearbtn")
def show_dialog0():
xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" }))
- self.ui_test.execute_blocking_action( action=show_dialog0, dialog_handler=close_dialog)
+ with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"):
+ pass
# Open the Rename Menu Dialog with id = 2
xDialog = self.xUITest.getTopFocusWindow()
xmenugearbtn=xDialog.getChild("menugearbtn")
def show_dialog2():
xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"}))
- self.ui_test.execute_blocking_action( action=show_dialog2, dialog_handler=close_dialog)
+ with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"):
+ pass
xDialog = self.xUITest.getTopFocusWindow()
xcancBtn = xDialog.getChild("cancel")
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
index ff1a30931b5a..5fd946afab0f 100644
--- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -105,8 +105,9 @@ class HyperlinkDialog(UITestCase):
xHelp.executeAction('FOCUS', tuple())
# Without the fix in place, this test would have crashed here
- self.ui_test.execute_blocking_action(xHelp.executeAction,
- args=("CLICK", tuple()), dialog_element="cancel")
+ with self.ui_test.execute_blocking_action(xHelp.executeAction,
+ args=("CLICK", tuple()), close_button="cancel"):
+ pass
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index ca08f7ee488d..fe329ab344c3 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -86,15 +86,16 @@ frog, dogg, catt"""
changeall.executeAction("CLICK", ())
# The third time we click on changeall, the click action is going to
# block while two message boxes are shown, so we need to do this third
- # click specially:
- self.ui_test.execute_blocking_action(
- changeall.executeAction, args=('CLICK', ()),
+ # click specially
+ # Use empty close_button to open consecutive dialogs
+ with self.ui_test.execute_blocking_action(
+ changeall.executeAction, args=('CLICK', ()), close_button="") as dialog:
# Step 5: Confirm to "Continue check at beginning of document"
- dialog_handler=lambda dialog :
- self.ui_test.execute_blocking_action(
- dialog.getChild('yes').executeAction, 'ok', ('CLICK', ())
- )
- )
+ xYesBtn = dialog.getChild("yes")
+
+ with self.ui_test.execute_blocking_action(
+ xYesBtn.executeAction, args=('CLICK', ())):
+ pass
output_text = document.Text.getString().replace('\r\n', '\n')
self.assertTrue(re.match(self.TDF46852_REGEX, output_text))
diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py
index b8f49444ba6b..5e3f868f37ad 100644
--- a/sw/qa/uitest/writer_tests4/tdf113252.py
+++ b/sw/qa/uitest/writer_tests4/tdf113252.py
@@ -23,19 +23,12 @@ class tdf113252(UITestCase):
#Click Button Organizer
xorganize = xDialog.getChild("organize")
- def handle_macro_dlg(dialog):
-
+ with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog:
xTabs = dialog.getChild("tabcontrol")
select_pos(xTabs, "0")
select_pos(xTabs, "1")
select_pos(xTabs, "2")
- #Click on its button Close
- xCloseBtn = dialog.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple())
-
- self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()),
- dialog_handler=handle_macro_dlg)
- #Click button Close in the next dialog -> crash.
+ #Click button Close in the next dialog -> crash.
xClose = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xClose)
diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py
index 48f3bf951034..9d09d25bb3c7 100644
--- a/sw/qa/uitest/writer_tests7/tdf119661.py
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -52,8 +52,9 @@ class tdf119661(UITestCase):
sBreakLink = "BREAK_LINK"
xBreakLink = xDialog.getChild(sBreakLink)
- self.ui_test.execute_blocking_action(xBreakLink.executeAction,
- args=("CLICK", tuple()), dialog_element="yes")
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
xClose = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xClose)
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index 7260ae914268..e204ef8bb62a 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -40,16 +40,15 @@ class tdf90401(UITestCase):
xSecurityPage.executeAction('SELECT', tuple())
# Click Button Options...
xOptions = xDialog.getChild('options')
- def handle_options_dlg(dialog):
+
+ with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
xRemovePersonal = dialog.getChild('removepersonal')
xRemovePersonal.executeAction('CLICK', tuple())
- #Click on its button Close
xOkBtn = dialog.getChild('ok')
+ # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the
+ # event DialogClosed after closing
xOkBtn.executeAction('CLICK', tuple())
- self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()),
- dialog_handler=handle_options_dlg)
-
xOKBtn = xDialog.getChild('ok')
self.ui_test.close_dialog_through_button(xOKBtn)