summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/uitest/calc_tests/sheetRename.py9
-rw-r--r--sc/qa/uitest/calc_tests3/tdf57274.py8
-rw-r--r--sc/qa/uitest/calc_tests3/tdf69981.py7
-rw-r--r--sc/qa/uitest/calc_tests4/tdf131170.py12
-rw-r--r--sc/qa/uitest/calc_tests4/textToColumns.py46
-rw-r--r--sc/qa/uitest/calc_tests6/tdf116996.py16
-rw-r--r--sc/qa/uitest/calc_tests6/tdf91726.py27
-rw-r--r--sc/qa/uitest/calc_tests8/tdf125051.py8
-rw-r--r--sc/qa/uitest/calc_tests9/pivotTable.py32
-rw-r--r--sc/qa/uitest/calc_tests9/tdf117879.py10
-rw-r--r--sc/qa/uitest/calc_tests9/tdf141244.py11
-rw-r--r--sc/qa/uitest/chart/chartDataLabels.py42
-rw-r--r--sc/qa/uitest/goalSeek/goalSeek.py8
-rw-r--r--sc/qa/uitest/goalSeek/tdf37341.py10
-rw-r--r--sc/qa/uitest/goalSeek/tdf43693.py8
-rw-r--r--sc/qa/uitest/manual_tests/calc.py6
-rw-r--r--sc/qa/uitest/options/tdf122977.py7
-rw-r--r--sc/qa/uitest/solver/solver.py9
-rw-r--r--sd/qa/uitest/impress_tests/customSlideShow.py13
-rw-r--r--sd/qa/uitest/impress_tests/tdf141297.py5
-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
-rw-r--r--uitest/uitest/test.py26
-rw-r--r--writerperfect/qa/uitest/epubexport/epubexport.py51
41 files changed, 187 insertions, 396 deletions
diff --git a/sc/qa/uitest/calc_tests/sheetRename.py b/sc/qa/uitest/calc_tests/sheetRename.py
index 2e6ffc6fb740..0f8478b8454b 100644
--- a/sc/qa/uitest/calc_tests/sheetRename.py
+++ b/sc/qa/uitest/calc_tests/sheetRename.py
@@ -41,13 +41,10 @@ class sheetRename(UITestCase):
nameVal = get_state_as_dict(xname_entry)["Text"]
xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName**"}))
xOKBtn = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- #show warning
- xok = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())):
+ pass
+
xCancelBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
diff --git a/sc/qa/uitest/calc_tests3/tdf57274.py b/sc/qa/uitest/calc_tests3/tdf57274.py
index 9465d9bee5db..be5b0abcb760 100644
--- a/sc/qa/uitest/calc_tests3/tdf57274.py
+++ b/sc/qa/uitest/calc_tests3/tdf57274.py
@@ -30,12 +30,10 @@ class tdf57274(UITestCase):
xLink.executeAction("CLICK", tuple())
xOkBtn = xDialog.getChild("ok")
# self.ui_test.close_dialog_through_button(xOkBtn)
- def handle_confirm_dlg(dialog):
- xOKBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirm_dlg)
+ with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank.
self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0)
self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6")
diff --git a/sc/qa/uitest/calc_tests3/tdf69981.py b/sc/qa/uitest/calc_tests3/tdf69981.py
index 5306122902fe..cf4c7eed0c2d 100644
--- a/sc/qa/uitest/calc_tests3/tdf69981.py
+++ b/sc/qa/uitest/calc_tests3/tdf69981.py
@@ -45,12 +45,9 @@ class tdf69981(UITestCase):
#overwrite warning come up
#press Ok.
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Original")
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a")
diff --git a/sc/qa/uitest/calc_tests4/tdf131170.py b/sc/qa/uitest/calc_tests4/tdf131170.py
index fc7b097a8b2d..87805af1a167 100644
--- a/sc/qa/uitest/calc_tests4/tdf131170.py
+++ b/sc/qa/uitest/calc_tests4/tdf131170.py
@@ -23,15 +23,11 @@ class tdf131170(UITestCase):
self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "--- Row ---")
self.assertEqual(get_state_as_dict(xRange.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
- def handle_confirmation_dlg(dialog2):
- xOKBtn2 = dialog2.getChild("yes")
- self.ui_test.close_dialog_through_button(xOKBtn2)
-
xDeleteBtn = xDialog.getChild("delete")
xRange.getChild('1').executeAction("SELECT", tuple())
- self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirmation_dlg)
+ with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
self.assertEqual(3, len(xRange.getChildren()))
self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
@@ -39,8 +35,8 @@ class tdf131170(UITestCase):
self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
xRange.getChild('2').executeAction("SELECT", tuple())
- self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirmation_dlg)
+ with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
self.assertEqual(2, len(xRange.getChildren()))
self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
diff --git a/sc/qa/uitest/calc_tests4/textToColumns.py b/sc/qa/uitest/calc_tests4/textToColumns.py
index efa74d8c36bc..5c4bbf6c59af 100644
--- a/sc/qa/uitest/calc_tests4/textToColumns.py
+++ b/sc/qa/uitest/calc_tests4/textToColumns.py
@@ -56,14 +56,10 @@ class CalcTextToColumns(UITestCase):
#Does an overwrite warning come up? If not file an Issue.
#Tag the 'Do not show warning again' checkbox and press Ok.
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes") as dialog:
xask = dialog.getChild("ask")
xask.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
@@ -150,12 +146,10 @@ class CalcTextToColumns(UITestCase):
xComma.executeAction("CLICK", tuple())
# Click Ok
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
@@ -226,12 +220,10 @@ class CalcTextToColumns(UITestCase):
xSemicolon.executeAction("CLICK", tuple())
# Click Ok
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
@@ -303,12 +295,10 @@ class CalcTextToColumns(UITestCase):
# xspace.executeAction("CLICK", tuple())
# Click Ok
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
@@ -386,12 +376,10 @@ class CalcTextToColumns(UITestCase):
xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
# Click Ok
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
@@ -470,12 +458,10 @@ class CalcTextToColumns(UITestCase):
xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
# Click Ok
xOK = xDialog.getChild("ok")
- def handle_warn_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
- self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
- dialog_handler=handle_warn_dlg)
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#Verify
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py
index 84047adbb151..31cde88f909b 100644
--- a/sc/qa/uitest/calc_tests6/tdf116996.py
+++ b/sc/qa/uitest/calc_tests6/tdf116996.py
@@ -29,12 +29,8 @@ class tdf116996(UITestCase):
xOKBtn = xDialogOpt.getChild("ok")
- def handle_confirm_dlg(dialog):
- xLaterBtn = dialog.getChild("no")
- self.ui_test.close_dialog_through_button(xLaterBtn)
-
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirm_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
#reopen options dialog and verify
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
@@ -50,12 +46,8 @@ class tdf116996(UITestCase):
xexperimental.executeAction("CLICK", tuple()) #disable experimental features
xOKBtn = xDialogOpt.getChild("ok")
- def handle_confirm_dlg(dialog):
- xLaterBtn = dialog.getChild("no")
- self.ui_test.close_dialog_through_button(xLaterBtn)
-
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_confirm_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py
index 402179a30c1d..bc134547aaf8 100644
--- a/sc/qa/uitest/calc_tests6/tdf91726.py
+++ b/sc/qa/uitest/calc_tests6/tdf91726.py
@@ -22,29 +22,26 @@ class tdf91726(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
#add new style "Default"
xadd = xDialog.getChild("add")
- def handle_name_dlg(dialog):
+
+ # Use empty close_button to open consecutive dialogs
+ with self.ui_test.execute_blocking_action(
+ xadd.executeAction, args=('CLICK', ()), close_button="") as dialog:
nameEntry = dialog.getChild("name_entry")
nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"}))
xOKBtn = dialog.getChild("ok")
- def handle_error_dlg(dialog2):
+
+ with self.ui_test.execute_blocking_action(
+ xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2:
#Error message: You have entered an invalid name.
#AutoFormat could not be created.
#Try again using a different name.
xOKBtn2 = dialog2.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn2)
-
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_error_dlg)
-
- xDialog = self.xUITest.getTopFocusWindow()
- nameEntry = xDialog.getChild("name_entry")
- #back to name dialog, LO should not crash
- self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default")
- xCanceltn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanceltn)
- self.ui_test.execute_blocking_action(xadd.executeAction, args=('CLICK', ()),
- dialog_handler=handle_name_dlg)
+ with self.ui_test.execute_blocking_action(
+ xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3:
+ nameEntry = dialog3.getChild("name_entry")
+ #back to name dialog, LO should not crash
+ self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default")
xCanceltn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCanceltn)
diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py
index d993aacdf689..5ebd02446450 100644
--- a/sc/qa/uitest/calc_tests8/tdf125051.py
+++ b/sc/qa/uitest/calc_tests8/tdf125051.py
@@ -31,13 +31,9 @@ class tdf125051(UITestCase):
xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
#open options
optionsBtn = xDialog.getChild("options")
- def handle_options_dlg(dialog):
- #print(dialog.getChildren())
- xCancelBtn = dialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
- self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_options_dlg)
+ 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)
diff --git a/sc/qa/uitest/calc_tests9/pivotTable.py b/sc/qa/uitest/calc_tests9/pivotTable.py
index 2da282bb19d3..6fd0ff0517cc 100644
--- a/sc/qa/uitest/calc_tests9/pivotTable.py
+++ b/sc/qa/uitest/calc_tests9/pivotTable.py
@@ -43,50 +43,26 @@ class pivotTable(UITestCase):
xPageChild = xPage.getChild('0')
self.assertEqual("qtX", get_state_as_dict(xPageChild)['Text'])
- def handle_dataField_dialog(dialog):
+ with self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ())) as dialog:
optionBtn = dialog.getChild("options")
- def handle_options_dialog_first_time(dialog2):
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
xEmptyLine = dialog2.getChild("emptyline")
xEmptyLine.executeAction("CLICK", tuple())
self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
- xOKBtn = dialog2.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
-
- def handle_options_dialog_second_time(dialog2):
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog2:
xEmptyLine = dialog2.getChild("emptyline")
xEmptyLine.executeAction("CLICK", tuple())
self.assertEqual('false', get_state_as_dict(xEmptyLine)['Selected'])
- xCancelBtn = dialog2.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
-
- def handle_options_dialog_third_time(dialog2):
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
xEmptyLine = dialog2.getChild("emptyline")
self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
- xOKBtn = dialog2.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
-
- self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_options_dialog_first_time)
-
- self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_options_dialog_second_time)
-
- self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_options_dialog_third_time)
-
- xOkBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ()),
- dialog_handler=handle_dataField_dialog)
-
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf117879.py b/sc/qa/uitest/calc_tests9/tdf117879.py
index 003c47531284..b67e27ff4c89 100644
--- a/sc/qa/uitest/calc_tests9/tdf117879.py
+++ b/sc/qa/uitest/calc_tests9/tdf117879.py
@@ -22,8 +22,9 @@ class tdf117879(UITestCase):
type_text(gridwin, "=SUM({A1},2,3,4,5}")
# Without the fix in place, this dialog wouldn't have been displayed
- self.ui_test.execute_blocking_action(gridwin.executeAction,
- args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), dialog_element="yes")
+ with self.ui_test.execute_blocking_action(gridwin.executeAction,
+ args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="yes"):
+ pass
document = self.ui_test.get_component()
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5)")
@@ -31,8 +32,9 @@ class tdf117879(UITestCase):
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
type_text(gridwin, "=SUM({A1},2,3,4,5}")
- self.ui_test.execute_blocking_action(gridwin.executeAction,
- args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), dialog_element="no")
+ with self.ui_test.execute_blocking_action(gridwin.executeAction,
+ args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="no"):
+ pass
document = self.ui_test.get_component()
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5})")
diff --git a/sc/qa/uitest/calc_tests9/tdf141244.py b/sc/qa/uitest/calc_tests9/tdf141244.py
index 2c605108c011..402215fdf333 100644
--- a/sc/qa/uitest/calc_tests9/tdf141244.py
+++ b/sc/qa/uitest/calc_tests9/tdf141244.py
@@ -26,19 +26,14 @@ class tdf141244(UITestCase):
xLinks = xDialog.getChild("TB_LINKS")
self.assertEqual(1, len(xLinks.getChildren()))
- def handle_modify_dlg(dialog):
+ xChangeBtn = xDialog.getChild("CHANGE_SOURCE")
+
+ with self.ui_test.execute_blocking_action(xChangeBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog:
self.assertEqual("soffice", get_state_as_dict(dialog.getChild("app"))['Text'])
self.assertEqual("data1.ods", get_state_as_dict(dialog.getChild("file"))['Text'])
self.assertEqual("sheet1.A1", get_state_as_dict(dialog.getChild("category"))['Text'])
# tdf#141770: Without the fix in place, the cancel button wouldn't have worked here
- xCancelBtn = dialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- xChangeBtn = xDialog.getChild("CHANGE_SOURCE")
-
- self.ui_test.execute_blocking_action(xChangeBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_modify_dlg)
xClose = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xClose)
diff --git a/sc/qa/uitest/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py
index ebdc700eb402..d634aab839fb 100644
--- a/sc/qa/uitest/chart/chartDataLabels.py
+++ b/sc/qa/uitest/chart/chartDataLabels.py
@@ -161,26 +161,20 @@ class chartDataLabels(UITestCase):
valueAsPercentage.executeAction("CLICK", tuple())
#button Percentage format
- def handle_perc_dlg(dialog):
- sourceformat = dialog.getChild("sourceformat")
- decimalsed = dialog.getChild("decimalsed")
- leadzerosed = dialog.getChild("leadzerosed")
- negnumred = dialog.getChild("negnumred")
- thousands = dialog.getChild("thousands")
- formatted = dialog.getChild("formatted")
-
- sourceformat.executeAction("CLICK", tuple())
- decimalsed.executeAction("UP", tuple())
- leadzerosed.executeAction("UP", tuple())
- negnumred.executeAction("CLICK", tuple())
- thousands.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%")
-
- xOKButton = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKButton)
-
- self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ()),
- dialog_handler=handle_perc_dlg)
+ with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as dialog:
+ sourceformat = dialog.getChild("sourceformat")
+ decimalsed = dialog.getChild("decimalsed")
+ leadzerosed = dialog.getChild("leadzerosed")
+ negnumred = dialog.getChild("negnumred")
+ thousands = dialog.getChild("thousands")
+ formatted = dialog.getChild("formatted")
+
+ sourceformat.executeAction("CLICK", tuple())
+ decimalsed.executeAction("UP", tuple())
+ leadzerosed.executeAction("UP", tuple())
+ negnumred.executeAction("CLICK", tuple())
+ thousands.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%")
self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false")
self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true")
@@ -262,7 +256,7 @@ class chartDataLabels(UITestCase):
xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT")
- def handle_number_dlg(dialog):
+ with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as dialog:
categoryformat = dialog.getChild("categorylb")
formatted = dialog.getChild("formatted")
sourceformat = dialog.getChild("sourceformat")
@@ -275,12 +269,6 @@ class chartDataLabels(UITestCase):
self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00")
- xOKButton = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKButton)
-
- self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_number_dlg)
-
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
diff --git a/sc/qa/uitest/goalSeek/goalSeek.py b/sc/qa/uitest/goalSeek/goalSeek.py
index e7be69fb0ff5..f17377c5b505 100644
--- a/sc/qa/uitest/goalSeek/goalSeek.py
+++ b/sc/qa/uitest/goalSeek/goalSeek.py
@@ -27,13 +27,9 @@ class goalSeek(UITestCase):
xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"}))
xOKBtn = xDialog.getChild("ok")
- def handle_OK_dlg(dialog):
- print(dialog.getChildren())
- xYesButn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xYesButn)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_OK_dlg)
#verify
self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 200000)
self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 15000)
diff --git a/sc/qa/uitest/goalSeek/tdf37341.py b/sc/qa/uitest/goalSeek/tdf37341.py
index 7df5ef6feaba..117949fb44b1 100644
--- a/sc/qa/uitest/goalSeek/tdf37341.py
+++ b/sc/qa/uitest/goalSeek/tdf37341.py
@@ -28,14 +28,12 @@ class tdf37341(UITestCase):
xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"}))
xOKBtn = xDialog.getChild("ok")
- def handle_OK_dlg(dialog):
- xYesButn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xYesButn)
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_OK_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#verify
self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue() > 0, True)
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py
index 7b1cd9643c1a..07e4ece7ab1a 100644
--- a/sc/qa/uitest/goalSeek/tdf43693.py
+++ b/sc/qa/uitest/goalSeek/tdf43693.py
@@ -28,12 +28,10 @@ class tdf43693(UITestCase):
xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"}))
xOKBtn = xDialog.getChild("ok")
- def handle_OK_dlg(dialog):
- xYesButn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xYesButn)
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_OK_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
#verify
self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0.04)
self.ui_test.close_doc()
diff --git a/sc/qa/uitest/manual_tests/calc.py b/sc/qa/uitest/manual_tests/calc.py
index 691bf62986af..88cc750ca834 100644
--- a/sc/qa/uitest/manual_tests/calc.py
+++ b/sc/qa/uitest/manual_tests/calc.py
@@ -120,8 +120,10 @@ class ManualCalcTests(UITestCase):
def enter_text(cell, text):
enter_text_to_cell(xGridWin, cell, text)
- self.ui_test.execute_blocking_action(enter_text, "ok", args=("A1", "abc"))
- self.ui_test.execute_blocking_action(enter_text, "ok", args=("B6", "2.18"))
+ with self.ui_test.execute_blocking_action(enter_text, args=("A1", "abc")):
+ pass
+ with self.ui_test.execute_blocking_action(enter_text, args=("B6", "2.18")):
+ pass
enter_text_to_cell(xGridWin, "C2", "24")
diff --git a/sc/qa/uitest/options/tdf122977.py b/sc/qa/uitest/options/tdf122977.py
index 11d0ff98888c..b81adbc2616a 100644
--- a/sc/qa/uitest/options/tdf122977.py
+++ b/sc/qa/uitest/options/tdf122977.py
@@ -42,12 +42,9 @@ class chartDefaultColors(UITestCase):
self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1))
#delete new color
- def handle_delete_dlg(dialog):
- xyesBtn = dialog.getChild("yes")
- self.ui_test.close_dialog_through_button(xyesBtn)
+ with self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()),
- dialog_handler=handle_delete_dlg)
self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors)
xAdd.executeAction("CLICK", tuple()) #add new color
diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py
index 617b2147a7cc..e8d62ae789fb 100644
--- a/sc/qa/uitest/solver/solver.py
+++ b/sc/qa/uitest/solver/solver.py
@@ -41,13 +41,10 @@ class solver(UITestCase):
xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
xOKBtn = xDialog.getChild("ok")
- def handle_OK_dlg(dialog):
- #('SolverSuccessDialog', 'cancel', 'dialog-action_area1', 'dialog-vbox1', 'grid1', 'label1', 'label2', 'ok', 'result')
- xYesButn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xYesButn)
- self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
- dialog_handler=handle_OK_dlg)
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())):
+ pass
+
#verify
self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 400)
self.ui_test.close_doc()
diff --git a/sd/qa/uitest/impress_tests/customSlideShow.py b/sd/qa/uitest/impress_tests/customSlideShow.py
index 9f491d9a5141..a7aa67b25816 100644
--- a/sd/qa/uitest/impress_tests/customSlideShow.py
+++ b/sd/qa/uitest/impress_tests/customSlideShow.py
@@ -19,7 +19,7 @@ class customSlideShow(UITestCase):
new = CustomSlideShows.getChild("new")
ok = CustomSlideShows.getChild("ok")
- def handle_new_dlg(DefineCustomSlideShow):
+ with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as DefineCustomSlideShow:
customname = DefineCustomSlideShow.getChild("customname")
customname.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
@@ -29,11 +29,7 @@ class customSlideShow(UITestCase):
xEntry.executeAction("SELECT", tuple())
add = DefineCustomSlideShow.getChild("add")
add.executeAction("CLICK",tuple())
- ok = DefineCustomSlideShow.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
- self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ()),
- dialog_handler=handle_new_dlg)
self.ui_test.close_dialog_through_button(ok)
#verify
self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog")
@@ -43,7 +39,7 @@ class customSlideShow(UITestCase):
self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1")
ok = CustomSlideShows.getChild("ok")
- def handle_edit_dlg(DefineCustomSlideShow):
+ with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="cancel") as DefineCustomSlideShow:
customname = DefineCustomSlideShow.getChild("customname")
self.assertEqual(get_state_as_dict(customname)["Text"], "aa")
# print(DefineCustomSlideShow.getChildren())
@@ -58,11 +54,6 @@ class customSlideShow(UITestCase):
# remove.executeAction("CLICK",tuple()) #tdf126951
self.assertEqual(get_state_as_dict(custompages)["Children"], "1")
self.assertEqual(get_state_as_dict(pages)["Children"], "1")
- cancel = DefineCustomSlideShow.getChild("cancel")
- self.ui_test.close_dialog_through_button(cancel)
-
- self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()),
- dialog_handler=handle_edit_dlg)
CustomSlideShows = self.xUITest.getTopFocusWindow()
delete = CustomSlideShows.getChild("delete")
diff --git a/sd/qa/uitest/impress_tests/tdf141297.py b/sd/qa/uitest/impress_tests/tdf141297.py
index 4140f40aadb7..76aab4d4594f 100644
--- a/sd/qa/uitest/impress_tests/tdf141297.py
+++ b/sd/qa/uitest/impress_tests/tdf141297.py
@@ -56,8 +56,9 @@ class tdf141297(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/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)
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index cfa9b83e5a1c..c83759bf6b80 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -192,8 +192,8 @@ class UITest(object):
if frames:
frames[0].activate()
- def execute_blocking_action(self, action, dialog_element=None,
- args=(), dialog_handler=None, printNames=False):
+ @contextmanager
+ def execute_blocking_action(self, action, args=(), close_button="ok", printNames=False):
"""Executes an action which blocks while a dialog is shown.
Click a button or perform some other action on the dialog when it
@@ -202,11 +202,10 @@ class UITest(object):
Args:
action(callable): Will be called to show a dialog, and is expected
to block while the dialog is shown.
- dialog_element(str, optional): The name of a button on the dialog
- which will be clicked when the dialog is shown.
+ close_button(str): The name of a button which will be clicked to close
+ the dialog. if it's empty, the dialog won't be closed from here.
+ This is useful when consecutive dialogs are open one after the other.
args(tuple, optional): The arguments to be passed to `action`
- dialog_handler(callable, optional): Will be called when the dialog
- is shown, with the dialog object passed as a parameter.
printNames: print all received event names
"""
@@ -217,15 +216,14 @@ class UITest(object):
# we are not necessarily opening a dialog, so wait much longer
while time_ < 10 * MAX_WAIT:
if event.executed:
- xDlg = self._xUITest.getTopFocusWindow()
- if dialog_element:
- xUIElement = xDlg.getChild(dialog_element)
- xUIElement.executeAction("CLICK", tuple())
- if dialog_handler:
- dialog_handler(xDlg)
- thread.join()
+ xDialog = self._xUITest.getTopFocusWindow()
+ try:
+ yield xDialog
+ finally:
+ if close_button:
+ self.close_dialog_through_button(xDialog.getChild(close_button))
+ thread.join()
return
-
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
raise DialogNotExecutedException("did not execute a dialog for a blocking action")
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py
index b8e7d3f52fd9..861280f5537b 100644
--- a/writerperfect/qa/uitest/epubexport/epubexport.py
+++ b/writerperfect/qa/uitest/epubexport/epubexport.py
@@ -15,11 +15,6 @@ import uno
class EPUBExportTest(UITestCase):
def testUIComponent(self):
- def handleDialog(dialog):
- # Select the second entry to request EPUB2, not EPUB3.
- dialog.getChild("versionlb").executeAction("SELECT", mkPropertyValues({"POS": "1"}))
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
# Make sure we get what we asked for.
@@ -28,7 +23,9 @@ class EPUBExportTest(UITestCase):
# Just make sure this doesn't fail.
uiComponent.setTitle(str())
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
+ # Select the second entry to request EPUB2, not EPUB3.
+ dialog.getChild("versionlb").executeAction("SELECT", mkPropertyValues({"POS": "1"}))
propertyValues = uiComponent.getPropertyValues()
filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
epubVersion = [i.Value for i in filterData if i.Name == "EPUBVersion"][0]
@@ -53,30 +50,24 @@ class EPUBExportTest(UITestCase):
self.assertEqual(30, epubVersion)
def testDialogVersionInput(self):
- def handleDialog(dialog):
- versionlb = get_state_as_dict(dialog.getChild("versionlb"))
- # Log the state of the versionlb widget and exit.
- positions.append(versionlb["SelectEntryPos"])
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
positions = []
for version in (20, 30):
filterData = (PropertyValue(Name="EPUBVersion", Value=version),)
propertyValues = (PropertyValue(Name="FilterData", Value=uno.Any("[]com.sun.star.beans.PropertyValue", filterData)),)
uiComponent.setPropertyValues(propertyValues)
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
+ versionlb = get_state_as_dict(dialog.getChild("versionlb"))
+ # Log the state of the versionlb widget and exit.
+ positions.append(versionlb["SelectEntryPos"])
# Make sure that initializing with 2 different versions results in 2 different widget states.
self.assertEqual(2, len(set(positions)))
def testCoverImage(self):
- def handleDialog(dialog):
- dialog.getChild("coverpath").executeAction("TYPE", mkPropertyValues({"TEXT": "cover.png"}))
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
+ dialog.getChild("coverpath").executeAction("TYPE", mkPropertyValues({"TEXT": "cover.png"}))
propertyValues = uiComponent.getPropertyValues()
filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
# The RVNGCoverImage key was missing, EPUBExportDialog::OKClickHdl() did not set it.
@@ -84,13 +75,10 @@ class EPUBExportTest(UITestCase):
self.assertEqual("cover.png", coverImage)
def testMediaDir(self):
- def handleDialog(dialog):
- dialog.getChild("mediadir").executeAction("TYPE", mkPropertyValues({"TEXT": "file:///foo/bar"}))
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
+ dialog.getChild("mediadir").executeAction("TYPE", mkPropertyValues({"TEXT": "file:///foo/bar"}))
propertyValues = uiComponent.getPropertyValues()
filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
# The RVNGMediaDir key was missing, EPUBExportDialog::OKClickHdl() did not set it.
@@ -98,14 +86,11 @@ class EPUBExportTest(UITestCase):
self.assertEqual("file:///foo/bar", mediaDir)
def testFixedLayout(self):
- def handleDialog(dialog):
- # Select the second entry to request fixed, not reflowable layout.
- dialog.getChild("layoutlb").executeAction("SELECT", mkPropertyValues({"POS": "1"}))
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
+ # Select the second entry to request fixed, not reflowable layout.
+ dialog.getChild("layoutlb").executeAction("SELECT", mkPropertyValues({"POS": "1"}))
propertyValues = uiComponent.getPropertyValues()
filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
# The EPUBLayoutMethod key was missing, EPUBExportDialog::OKClickHdl() did not set it.
@@ -114,17 +99,15 @@ class EPUBExportTest(UITestCase):
self.assertEqual(1, layout)
def testMeta(self):
- def handleDialog(dialog):
+ uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
+
+ with self.ui_test.execute_blocking_action(action=uiComponent.execute) as dialog:
dialog.getChild("identifier").executeAction("TYPE", mkPropertyValues({"TEXT": "baddcafe-e394-4cd6-9b83-7172794612e5"}))
dialog.getChild("title").executeAction("TYPE", mkPropertyValues({"TEXT": "unknown title from ui"}))
dialog.getChild("author").executeAction("TYPE", mkPropertyValues({"TEXT": "unknown author from ui"}))
dialog.getChild("language").executeAction("TYPE", mkPropertyValues({"TEXT": "sk"}))
dialog.getChild("date").executeAction("TYPE", mkPropertyValues({"TEXT": "2013-11-20T17:16:07Z"}))
- dialog.getChild("ok").executeAction("CLICK", tuple())
-
- uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
- self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
propertyValues = uiComponent.getPropertyValues()
filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
# These keys were missing, EPUBExportDialog::OKClickHdl() did not set them.