summaryrefslogtreecommitdiff
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
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>
-rw-r--r--sw/qa/uitest/chapterNumbering/chapterNumbering.py114
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf123547.py9
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf140528.py41
-rw-r--r--sw/qa/uitest/classification/classification.py147
-rw-r--r--sw/qa/uitest/findReplace/tdf118208.py54
-rw-r--r--sw/qa/uitest/macro_tests/tdf124413.py49
-rw-r--r--sw/qa/uitest/macro_tests/tdf64690.py7
-rw-r--r--sw/qa/uitest/navigator/tdf140257.py13
-rw-r--r--sw/qa/uitest/navigator/tdf40427.py17
-rw-r--r--sw/qa/uitest/options/optionsDialog.py50
-rw-r--r--sw/qa/uitest/options/tdf131581.py25
-rw-r--r--sw/qa/uitest/options/tdf78133.py42
-rw-r--r--sw/qa/uitest/sidebar/stylesSidebar.py60
-rw-r--r--sw/qa/uitest/sidebar/tdf133189.py21
-rw-r--r--sw/qa/uitest/sidebar/tdf135590.py46
-rw-r--r--sw/qa/uitest/styleInspector/styleInspector.py7
-rw-r--r--sw/qa/uitest/table/insertTableDialog.py44
-rw-r--r--sw/qa/uitest/table/splitTable.py27
-rw-r--r--sw/qa/uitest/table/tableProperties.py309
-rw-r--r--sw/qa/uitest/table/tableToText.py44
-rw-r--r--sw/qa/uitest/table/tdf115026.py14
-rw-r--r--sw/qa/uitest/table/tdf116737.py44
-rwxr-xr-xsw/qa/uitest/table/tdf128593.py31
-rw-r--r--sw/qa/uitest/table/tdf134881_colProportionalAdjust.py45
-rw-r--r--sw/qa/uitest/table/tdf135693.py13
-rw-r--r--sw/qa/uitest/table/tdf81292.py9
-rw-r--r--sw/qa/uitest/table/tdf99334.py8
-rw-r--r--sw/qa/uitest/table/textToTable.py30
-rw-r--r--sw/qa/uitest/ui/fmtui/fmtui.py25
-rw-r--r--sw/qa/uitest/writer_tests/compareDocuments.py40
-rw-r--r--sw/qa/uitest/writer_tests/insertCaption.py58
-rw-r--r--sw/qa/uitest/writer_tests/tdf134734.py75
-rw-r--r--sw/qa/uitest/writer_tests/tdf53460.py13
-rw-r--r--sw/qa/uitest/writer_tests/tdf78068.py9
-rw-r--r--sw/qa/uitest/writer_tests/tdf81457.py39
-rw-r--r--sw/qa/uitest/writer_tests/tdf93068.py32
-rw-r--r--sw/qa/uitest/writer_tests/versionDialog.py19
-rw-r--r--sw/qa/uitest/writer_tests/watermark.py72
-rw-r--r--sw/qa/uitest/writer_tests2/bookmark.py126
-rw-r--r--sw/qa/uitest/writer_tests2/documentProperties.py140
-rw-r--r--sw/qa/uitest/writer_tests2/exchangeDatabase.py40
-rw-r--r--sw/qa/uitest/writer_tests2/formatBulletsNumbering.py434
-rw-r--r--sw/qa/uitest/writer_tests2/formatCharacter.py372
-rw-r--r--sw/qa/uitest/writer_tests2/formatParagraph.py973
-rw-r--r--sw/qa/uitest/writer_tests2/horizontalLine.py18
-rw-r--r--sw/qa/uitest/writer_tests2/pasteSpecial.py11
-rw-r--r--sw/qa/uitest/writer_tests2/tdf116474.py9
-rw-r--r--sw/qa/uitest/writer_tests3/autoredactDialog.py198
-rw-r--r--sw/qa/uitest/writer_tests3/customizeDialog.py119
-rw-r--r--sw/qa/uitest/writer_tests3/goToPage.py24
-rw-r--r--sw/qa/uitest/writer_tests3/hyperlinkdialog.py73
-rw-r--r--sw/qa/uitest/writer_tests3/insertEnvelope.py46
-rw-r--r--sw/qa/uitest/writer_tests3/insertFootEndnote.py55
-rw-r--r--sw/qa/uitest/writer_tests3/insertPageFooter.py18
-rw-r--r--sw/qa/uitest/writer_tests3/insertQrCodeGen.py49
-rw-r--r--sw/qa/uitest/writer_tests3/insertSignatureLine.py71
-rw-r--r--sw/qa/uitest/writer_tests3/lineNumbering.py125
-rw-r--r--sw/qa/uitest/writer_tests3/pageDialog.py79
-rw-r--r--sw/qa/uitest/writer_tests3/sort.py32
-rw-r--r--sw/qa/uitest/writer_tests3/specialCharacter.py122
-rw-r--r--sw/qa/uitest/writer_tests3/tdf79236.py70
-rw-r--r--sw/qa/uitest/writer_tests4/insertBreakDialog.py38
-rw-r--r--sw/qa/uitest/writer_tests4/insertPageHeader.py18
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113252.py25
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113284.py15
-rw-r--r--sw/qa/uitest/writer_tests4/tdf115572.py38
-rw-r--r--sw/qa/uitest/writer_tests4/tdf115573.py76
-rw-r--r--sw/qa/uitest/writer_tests4/tdf122449.py15
-rw-r--r--sw/qa/uitest/writer_tests4/tdf138546.py30
-rw-r--r--sw/qa/uitest/writer_tests4/tdf51352.py18
-rw-r--r--sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py98
-rw-r--r--sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py363
-rw-r--r--sw/qa/uitest/writer_tests5/about_test.py8
-rw-r--r--sw/qa/uitest/writer_tests5/autocorrectOptions.py153
-rw-r--r--sw/qa/uitest/writer_tests5/columns.py46
-rw-r--r--sw/qa/uitest/writer_tests5/tdf107494.py14
-rw-r--r--sw/qa/uitest/writer_tests5/tdf118540.py6
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122045.py21
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122722.py56
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123446.py6
-rw-r--r--sw/qa/uitest/writer_tests5/titlePage.py23
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard.py104
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard2.py77
-rw-r--r--sw/qa/uitest/writer_tests5/zoom.py136
-rw-r--r--sw/qa/uitest/writer_tests6/tdf107847.py23
-rw-r--r--sw/qa/uitest/writer_tests6/tdf120731.py6
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124586.py18
-rw-r--r--sw/qa/uitest/writer_tests6/tdf125104.py31
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126017.py18
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126168.py17
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126226.py11
-rw-r--r--sw/qa/uitest/writer_tests6/tdf128431.py37
-rw-r--r--sw/qa/uitest/writer_tests6/tdf131041.py34
-rw-r--r--sw/qa/uitest/writer_tests7/apply_line_cap.py59
-rw-r--r--sw/qa/uitest/writer_tests7/tdf104795.py7
-rw-r--r--sw/qa/uitest/writer_tests7/tdf109083.py34
-rw-r--r--sw/qa/uitest/writer_tests7/tdf115853.py27
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py67
-rw-r--r--sw/qa/uitest/writer_tests7/tdf122780.py11
-rw-r--r--sw/qa/uitest/writer_tests7/tdf131936.py13
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132169.py9
-rw-r--r--sw/qa/uitest/writer_tests7/tdf133348.py23
-rw-r--r--sw/qa/uitest/writer_tests7/tdf134243.py8
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137802.py7
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137803.py13
-rw-r--r--sw/qa/uitest/writer_tests7/tdf139301.py26
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140117.py15
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140863.py35
-rw-r--r--sw/qa/uitest/writer_tests7/tdf141557.py7
-rw-r--r--sw/qa/uitest/writer_tests7/tdf46561.py13
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py53
111 files changed, 2994 insertions, 3918 deletions
diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py
index b72e6b458ef2..8b3de300b862 100644
--- a/sw/qa/uitest/chapterNumbering/chapterNumbering.py
+++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py
@@ -22,70 +22,64 @@ class WriterChapterNumbering(UITestCase):
change_measurement_unit(self, "Millimeter")
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xstyle = xDialog.getChild("style")
- xnumbering = xDialog.getChild("numbering")
- xcharstyle = xDialog.getChild("charstyle")
- xprefix = xDialog.getChild("prefix")
- xsuffix = xDialog.getChild("suffix")
- xstartat = xDialog.getChild("startat")
- xtab = xDialog.getChild("tabcontrol")
- #second tab
- xalignedatmf = xDialog.getChild("alignedatmf")
- xnum2alignlb = xDialog.getChild("num2alignlb")
- xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
- xatmf = xDialog.getChild("atmf")
- xindentatmf = xDialog.getChild("indentatmf")
- select_pos(xtab, "0") #first tab
- select_by_text(xstyle, "Heading")
- select_by_text(xnumbering, "1, 2, 3, ...")
- select_by_text(xcharstyle, "Bullets")
- xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
- xstartat.executeAction("UP", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog") as xDialog:
+ xstyle = xDialog.getChild("style")
+ xnumbering = xDialog.getChild("numbering")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xstartat = xDialog.getChild("startat")
+ xtab = xDialog.getChild("tabcontrol")
+ #second tab
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+ select_pos(xtab, "0") #first tab
+ select_by_text(xstyle, "Heading")
+ select_by_text(xnumbering, "1, 2, 3, ...")
+ select_by_text(xcharstyle, "Bullets")
+ xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
+ xstartat.executeAction("UP", tuple())
- select_pos(xtab, "1") #second tab Position
- xalignedatmf.executeAction("UP", tuple())
- select_by_text(xnum2alignlb, "Centered")
- select_by_text(xnumfollowedbylb, "Tab stop")
- xatmf.executeAction("UP", tuple())
- xindentatmf.executeAction("UP", tuple())
+ select_pos(xtab, "1") #second tab Position
+ xalignedatmf.executeAction("UP", tuple())
+ select_by_text(xnum2alignlb, "Centered")
+ select_by_text(xnumfollowedbylb, "Tab stop")
+ xatmf.executeAction("UP", tuple())
+ xindentatmf.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog", close_button="cancel") as xDialog:
- xstyle = xDialog.getChild("style")
- xnumbering = xDialog.getChild("numbering")
- xcharstyle = xDialog.getChild("charstyle")
- xprefix = xDialog.getChild("prefix")
- xsuffix = xDialog.getChild("suffix")
- xstartat = xDialog.getChild("startat")
- xtab = xDialog.getChild("tabcontrol")
- #second tab
- xalignedatmf = xDialog.getChild("alignedatmf")
- xnum2alignlb = xDialog.getChild("num2alignlb")
- xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
- xatmf = xDialog.getChild("atmf")
- xindentatmf = xDialog.getChild("indentatmf")
- select_pos(xtab, "0")
- self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading")
- self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...")
- self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
- self.assertEqual(get_state_as_dict(xprefix)["Text"], "A")
- self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B")
- self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
- select_pos(xtab, "1") #second tab Position
- self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm")
- self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
- self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop")
- self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm")
- self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm")
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xstyle = xDialog.getChild("style")
+ xnumbering = xDialog.getChild("numbering")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xstartat = xDialog.getChild("startat")
+ xtab = xDialog.getChild("tabcontrol")
+ #second tab
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+ select_pos(xtab, "0")
+ self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading")
+ self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "A")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
+ select_pos(xtab, "1") #second tab Position
+ self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm")
+ self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
+ self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop")
+ self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm")
+ self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/chapterNumbering/tdf123547.py b/sw/qa/uitest/chapterNumbering/tdf123547.py
index a9b97d1be9f4..c7ed6ef08978 100644
--- a/sw/qa/uitest/chapterNumbering/tdf123547.py
+++ b/sw/qa/uitest/chapterNumbering/tdf123547.py
@@ -15,12 +15,9 @@ class tdf123547(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) as writer_doc:
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
#verify we didn't crash
self.assertEqual(writer_doc.CurrentController.PageCount, 1)
diff --git a/sw/qa/uitest/chapterNumbering/tdf140528.py b/sw/qa/uitest/chapterNumbering/tdf140528.py
index c34d33c409b3..305cb18443a0 100644
--- a/sw/qa/uitest/chapterNumbering/tdf140528.py
+++ b/sw/qa/uitest/chapterNumbering/tdf140528.py
@@ -16,38 +16,35 @@ class Tdf140528(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog") as xDialog:
- xTab = xDialog.getChild("tabcontrol")
- select_pos(xTab, "0")
+ xTab = xDialog.getChild("tabcontrol")
+ select_pos(xTab, "0")
- xFormat = xDialog.getChild("format")
+ xFormat = xDialog.getChild("format")
- 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'])
+ 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'])
- xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"}))
- self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem'])
+ self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem'])
- # Go to Position tab
- select_pos(xTab, "1")
+ # Go to Position tab
+ select_pos(xTab, "1")
- # Go back to Numbering tab
- select_pos(xTab, "0")
+ # Go back to Numbering tab
+ select_pos(xTab, "0")
- xFormat.executeAction('OPENFROMLIST', mkPropertyValues({"POS": "0"}))
- self.assertEqual("form1", get_state_as_dict(xFormat)['CurrentItem'])
+ xFormat.executeAction('OPENFROMLIST', mkPropertyValues({"POS": "0"}))
+ self.assertEqual("form1", get_state_as_dict(xFormat)['CurrentItem'])
- # Without the fix in place, this test would have crashed here
- select_pos(xTab, "1")
+ # Without the fix in place, this test would have crashed here
+ select_pos(xTab, "1")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py
index 72f7dd16bb8a..fbe7e9b093df 100644
--- a/sw/qa/uitest/classification/classification.py
+++ b/sw/qa/uitest/classification/classification.py
@@ -41,22 +41,19 @@ class classification(UITestCase):
writer_doc = self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- classificationEditWindow = xDialog.getChild("classificationEditWindow")
- recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
- classificationCB = xDialog.getChild("classificationCB")
- internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
- intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
- intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
-
- select_by_text(classificationCB, "Confidential")
- #verify International is set too
- self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
- #verify textBox Content
- # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ClassificationDialog") as xDialog:
+ classificationEditWindow = xDialog.getChild("classificationEditWindow")
+ recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
+ classificationCB = xDialog.getChild("classificationCB")
+ internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
+ intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
+ intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
+
+ select_by_text(classificationCB, "Confidential")
+ #verify International is set too
+ self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
+ #verify textBox Content
+ # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement()
self.assertEqual(header.String, "Confidential")
@@ -66,16 +63,13 @@ class classification(UITestCase):
#verify watermark
#Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document
- self.ui_test.execute_dialog_through_command(".uno:Watermark")
- xDialog = self.xUITest.getTopFocusWindow()
- xTextInput = xDialog.getChild("TextInput")
- xAngle = xDialog.getChild("Angle")
- xTransparency = xDialog.getChild("Transparency")
- self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Confidential")
- self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°")
- self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50")
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xAngle = xDialog.getChild("Angle")
+ xTransparency = xDialog.getChild("Transparency")
+ self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Confidential")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°")
+ self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50")
#TODO
#open dialog and add intellectualProperty text, save
@@ -83,24 +77,21 @@ class classification(UITestCase):
#reopen and verify classification and Content
#do the same for Paragraph classification
- self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- classificationEditWindow = xDialog.getChild("classificationEditWindow")
- recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
- classificationCB = xDialog.getChild("classificationCB")
- internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
- intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
- intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
-
- select_by_text(classificationCB, "Confidential")
- #verify International is set too
- self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
- #verify textBox Content TODO textbox not supported
- #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
- # print(get_state_as_dict(classificationEditWindow))
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphClassificationDialog") as xDialog:
+ classificationEditWindow = xDialog.getChild("classificationEditWindow")
+ recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
+ classificationCB = xDialog.getChild("classificationCB")
+ internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
+ intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
+ intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
+
+ select_by_text(classificationCB, "Confidential")
+ #verify International is set too
+ self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
+ #verify textBox Content TODO textbox not supported
+ #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
+ # print(get_state_as_dict(classificationEditWindow))
+
self.assertEqual(document.Text.String[0:6], "(Conf)")
self.assertEqual(header.String, "Confidential")
@@ -113,24 +104,21 @@ class classification(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#+ new file and do it only for Paragraph classification (no watermark!)
- self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- classificationEditWindow = xDialog.getChild("classificationEditWindow")
- recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
- classificationCB = xDialog.getChild("classificationCB")
- internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
- intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
- intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
-
- select_by_text(classificationCB, "Confidential")
- #verify International is set too
- self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
- #verify textBox Content TODO - texbox not supported yet
- # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
- # print(get_state_as_dict(classificationEditWindow))
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphClassificationDialog") as xDialog:
+ classificationEditWindow = xDialog.getChild("classificationEditWindow")
+ recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
+ classificationCB = xDialog.getChild("classificationCB")
+ internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
+ intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
+ intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
+
+ select_by_text(classificationCB, "Confidential")
+ #verify International is set too
+ self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential")
+ #verify textBox Content TODO - texbox not supported yet
+ # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
+ # print(get_state_as_dict(classificationEditWindow))
+
controller = self.ui_test.get_component().getCurrentController()
self.assertEqual(document.Text.String[0:6], "(Conf)")
@@ -144,25 +132,22 @@ class classification(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#+ new file and do it only for Paragraph classification (no watermark!)
- self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- classificationEditWindow = xDialog.getChild("classificationEditWindow")
- recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
- classificationCB = xDialog.getChild("classificationCB")
- internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
- intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
- intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
- #type text AA
- intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"}))
- intellectualPropertyPartAddButton.executeAction("CLICK", tuple())
- select_by_text(classificationCB, "Internal Only")
- #verify International is set too
- self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only")
- #verify textBox Content TODO - texbox not supported yet
- # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphClassificationDialog") as xDialog:
+ classificationEditWindow = xDialog.getChild("classificationEditWindow")
+ recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
+ classificationCB = xDialog.getChild("classificationCB")
+ internationalClassificationCB = xDialog.getChild("internationalClassificationCB")
+ intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry")
+ intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton")
+ #type text AA
+ intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"}))
+ intellectualPropertyPartAddButton.executeAction("CLICK", tuple())
+ select_by_text(classificationCB, "Internal Only")
+ #verify International is set too
+ self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only")
+ #verify textBox Content TODO - texbox not supported yet
+ # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
+
controller = self.ui_test.get_component().getCurrentController()
self.assertEqual(document.Text.String[0:6], "(AAIO)")
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:
diff --git a/sw/qa/uitest/macro_tests/tdf124413.py b/sw/qa/uitest/macro_tests/tdf124413.py
index d0aaccd03929..ad5a5cf47cfa 100644
--- a/sw/qa/uitest/macro_tests/tdf124413.py
+++ b/sw/qa/uitest/macro_tests/tdf124413.py
@@ -14,31 +14,30 @@ class tdf124413(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
#Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
- self.ui_test.execute_dialog_through_command(".uno:MacroDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #Open Editor
- xEditBtn = xDialog.getChild("edit")
- xEditBtn.executeAction("CLICK", tuple())
-
- resultText = "REM ***** BASIC *****\n\nSub Main\n\nEnd Sub\n"
-
- xMacroWin = self.xUITest.getTopFocusWindow()
- xEditWin = xMacroWin.getChild('EditorWindow')
-
- self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText)
-
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Paste")
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
-
- self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:MacroDialog", close_button="") as xDialog:
+ #Open Editor
+ xEditBtn = xDialog.getChild("edit")
+ xEditBtn.executeAction("CLICK", tuple())
+
+ resultText = "REM ***** BASIC *****\n\nSub Main\n\nEnd Sub\n"
+
+ xMacroWin = self.xUITest.getTopFocusWindow()
+ xEditWin = xMacroWin.getChild('EditorWindow')
+
+ self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText)
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+
+ self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py
index 7798e3bbc995..318d3e8772d4 100644
--- a/sw/qa/uitest/macro_tests/tdf64690.py
+++ b/sw/qa/uitest/macro_tests/tdf64690.py
@@ -15,11 +15,8 @@ class tdf64690(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:MacroDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xEditBtn = xDialog.getChild("edit")
- xEditBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:MacroDialog", close_button="edit"):
+ pass
xMacroWin = self.xUITest.getTopFocusWindow()
xEditWin = xMacroWin.getChild('EditorWindow')
diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py
index 9c923bedee4d..77623bef9649 100644
--- a/sw/qa/uitest/navigator/tdf140257.py
+++ b/sw/qa/uitest/navigator/tdf140257.py
@@ -14,17 +14,14 @@ class Tdf140257(UITestCase):
def change_outline_level(self, sText):
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
- select_by_text(xOutline, sText)
+ select_by_text(xOutline, sText)
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_tdf140257(self):
self.ui_test.create_doc_in_start_center("writer")
diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py
index 58f59b430643..410aa2564d5d 100644
--- a/sw/qa/uitest/navigator/tdf40427.py
+++ b/sw/qa/uitest/navigator/tdf40427.py
@@ -21,18 +21,15 @@ class tdf40427(UITestCase):
self.assertEqual(2, document.CurrentController.PageCount)
# Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- bookmode = xDialog.getChild("bookmode")
- self.assertEqual("true", get_state_as_dict(columns)["Checked"])
- self.assertEqual("2", get_state_as_dict(columnssb)["Text"])
- self.assertEqual("false", get_state_as_dict(bookmode)["Selected"])
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ bookmode = xDialog.getChild("bookmode")
+ self.assertEqual("true", get_state_as_dict(columns)["Checked"])
+ self.assertEqual("2", get_state_as_dict(columnssb)["Text"])
+ self.assertEqual("false", get_state_as_dict(bookmode)["Selected"])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# In this view, the sections "SectionB" and "SectionC" on second page are positioned on screen
# higher than "SectionY" and "SectionA" respectively; there are nested and anchored sections.
diff --git a/sw/qa/uitest/options/optionsDialog.py b/sw/qa/uitest/options/optionsDialog.py
index 92494ab81ab1..2951892b7143 100644
--- a/sw/qa/uitest/options/optionsDialog.py
+++ b/sw/qa/uitest/options/optionsDialog.py
@@ -11,47 +11,41 @@ class optionsDialog(UITestCase):
def test_moreIconsDialog(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialog:
- xDialog = self.xUITest.getTopFocusWindow()
- xPages = xDialog.getChild("pages")
- xLOEntry = xPages.getChild('0')
- xLOEntry.executeAction("EXPAND", tuple())
- xViewEntry = xLOEntry.getChild('2')
- xViewEntry.executeAction("SELECT", tuple())
+ xPages = xDialog.getChild("pages")
+ xLOEntry = xPages.getChild('0')
+ xLOEntry.executeAction("EXPAND", tuple())
+ xViewEntry = xLOEntry.getChild('2')
+ xViewEntry.executeAction("SELECT", tuple())
- xMoreIconsBtn = xDialog.getChild("btnMoreIcons")
+ xMoreIconsBtn = xDialog.getChild("btnMoreIcons")
- 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")
+ 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")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
def test_tdf138596(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xPages = xDialog.getChild("pages")
- xWriterEntry = xPages.getChild('3')
- xWriterEntry.executeAction("EXPAND", tuple())
- xFormattingAidsEntry = xWriterEntry.getChild('2')
- xFormattingAidsEntry.executeAction("SELECT", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialog:
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3')
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xFormattingAidsEntry = xWriterEntry.getChild('2')
+ xFormattingAidsEntry.executeAction("SELECT", tuple())
- xApplyBtn = xDialog.getChild("apply")
+ xApplyBtn = xDialog.getChild("apply")
- # Click apply button twice
- # Without the fix in place, this test would have crashed here
- xApplyBtn.executeAction("CLICK", tuple())
- xApplyBtn.executeAction("CLICK", tuple())
+ # Click apply button twice
+ # Without the fix in place, this test would have crashed here
+ xApplyBtn.executeAction("CLICK", tuple())
+ xApplyBtn.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/options/tdf131581.py b/sw/qa/uitest/options/tdf131581.py
index 3acebd4ce507..1ca7eb42133c 100644
--- a/sw/qa/uitest/options/tdf131581.py
+++ b/sw/qa/uitest/options/tdf131581.py
@@ -14,24 +14,21 @@ class tdf131581(UITestCase):
self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
- xDialogOpt = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialogOpt:
- xPages = xDialogOpt.getChild("pages")
- xLOEntry = xPages.getChild('0')
- xLOEntry.executeAction("EXPAND", tuple())
- xAdvancedEntry = xLOEntry.getChild('10')
- xAdvancedEntry.executeAction("SELECT", tuple())
+ xPages = xDialogOpt.getChild("pages")
+ xLOEntry = xPages.getChild('0')
+ xLOEntry.executeAction("EXPAND", tuple())
+ xAdvancedEntry = xLOEntry.getChild('10')
+ xAdvancedEntry.executeAction("SELECT", tuple())
- xExpertBtn = xDialogOpt.getChild("expertconfig")
+ xExpertBtn = xDialogOpt.getChild("expertconfig")
- 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())
+ 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 = xDialogOpt.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py
index 883c38231aa9..4c5803a90247 100644
--- a/sw/qa/uitest/options/tdf78133.py
+++ b/sw/qa/uitest/options/tdf78133.py
@@ -19,33 +19,27 @@ class tdf78133(UITestCase):
document = self.ui_test.get_component()
#New text document
#open option, go to App colors
- 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")
- xLOEntry = xPages.getChild('0') # Lo Dev
- xLOEntry.executeAction("EXPAND", tuple())
- xLoAppColorsEntry = xLOEntry.getChild('8')
- xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors
- #change text boundaries checkbox, save
- docboundaries = xDialog.getChild("docboundaries")
- docboundaries.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xPages = xDialog.getChild("pages")
+ xLOEntry = xPages.getChild('0') # Lo Dev
+ xLOEntry.executeAction("EXPAND", tuple())
+ xLoAppColorsEntry = xLOEntry.getChild('8')
+ xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors
+ #change text boundaries checkbox, save
+ docboundaries = xDialog.getChild("docboundaries")
+ docboundaries.executeAction("CLICK", tuple())
#verify - reopen dialog and check if "text boundaries" is still unchecked
- 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")
- xLOEntry = xPages.getChild('0') # Lo Dev
- xLOEntry.executeAction("EXPAND", tuple())
- xLoAppColorsEntry = xLOEntry.getChild('8')
- xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors
- #change text boundaries checkbox, save
- docboundaries = xDialog.getChild("docboundaries")
- self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xPages = xDialog.getChild("pages")
+ xLOEntry = xPages.getChild('0') # Lo Dev
+ xLOEntry.executeAction("EXPAND", tuple())
+ xLoAppColorsEntry = xLOEntry.getChild('8')
+ xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors
+ #change text boundaries checkbox, save
+ docboundaries = xDialog.getChild("docboundaries")
+ self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py
index 8364334ad77e..b04869036902 100644
--- a/sw/qa/uitest/sidebar/stylesSidebar.py
+++ b/sw/qa/uitest/sidebar/stylesSidebar.py
@@ -14,38 +14,34 @@ class StylesSidebar(UITestCase):
def test_load_styles_from_template(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:LoadStyles")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xText = xDialog.getChild("text")
- xNumbering = xDialog.getChild("numbering")
- xFrame = xDialog.getChild("frame")
- xPages = xDialog.getChild("pages")
-
- self.assertEqual('true', get_state_as_dict(xText)['Selected'])
- self.assertEqual('false', get_state_as_dict(xNumbering)['Selected'])
- self.assertEqual('false', get_state_as_dict(xFrame)['Selected'])
- self.assertEqual('false', get_state_as_dict(xPages)['Selected'])
-
- xNumbering.executeAction("CLICK", tuple())
- xFrame.executeAction("CLICK", tuple())
- xPages.executeAction("CLICK", tuple())
-
- self.assertEqual('true', get_state_as_dict(xText)['Selected'])
- self.assertEqual('true', get_state_as_dict(xNumbering)['Selected'])
- self.assertEqual('true', get_state_as_dict(xFrame)['Selected'])
- self.assertEqual('true', get_state_as_dict(xPages)['Selected'])
-
- xFileName = xDialog.getChild("fromfile")
- xFileName.executeAction("CLICK", tuple())
-
- xOpenDialog = self.xUITest.getTopFocusWindow()
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")}))
-
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:LoadStyles", close_button="") as xDialog:
+ xText = xDialog.getChild("text")
+ xNumbering = xDialog.getChild("numbering")
+ xFrame = xDialog.getChild("frame")
+ xPages = xDialog.getChild("pages")
+
+ self.assertEqual('true', get_state_as_dict(xText)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xNumbering)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xFrame)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xPages)['Selected'])
+
+ xNumbering.executeAction("CLICK", tuple())
+ xFrame.executeAction("CLICK", tuple())
+ xPages.executeAction("CLICK", tuple())
+
+ self.assertEqual('true', get_state_as_dict(xText)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xNumbering)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xFrame)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xPages)['Selected'])
+
+ xFileName = xDialog.getChild("fromfile")
+ xFileName.executeAction("CLICK", tuple())
+
+ xOpenDialog = self.xUITest.getTopFocusWindow()
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")}))
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py
index 30bd35d4c451..a48726467a8a 100644
--- a/sw/qa/uitest/sidebar/tdf133189.py
+++ b/sw/qa/uitest/sidebar/tdf133189.py
@@ -28,22 +28,19 @@ class tdf133189(UITestCase):
#change measurement to Inches
change_measurement_unit(self, 'Inch')
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild('spinWidth')
- xHeight = xDialog.getChild('spinHeight')
+ xWidth = xDialog.getChild('spinWidth')
+ xHeight = xDialog.getChild('spinHeight')
- props = {"VALUE": '8.0'}
- actionProps = mkPropertyValues(props)
+ props = {"VALUE": '8.0'}
+ actionProps = mkPropertyValues(props)
- xWidth.executeAction("VALUE", actionProps)
- xHeight.executeAction("VALUE", actionProps)
+ xWidth.executeAction("VALUE", actionProps)
+ xHeight.executeAction("VALUE", actionProps)
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py
index 6a061b7a1f96..16ce0e7b1c16 100644
--- a/sw/qa/uitest/sidebar/tdf135590.py
+++ b/sw/qa/uitest/sidebar/tdf135590.py
@@ -17,46 +17,40 @@ class tdf135590(UITestCase):
#change measurement to Centimeter
change_measurement_unit(self, 'Centimeter')
- self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertEnvelope") as xDialog:
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild('width')
- xHeight = xDialog.getChild('height')
- xFormat = xDialog.getChild("format")
+ xWidth = xDialog.getChild('width')
+ xHeight = xDialog.getChild('height')
+ xFormat = xDialog.getChild("format")
- select_by_text(xFormat, "C6 Envelope")
+ select_by_text(xFormat, "C6 Envelope")
- self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
- self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
+ self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
+ self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# A new document is created
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild('spinWidth')
- xHeight = xDialog.getChild('spinHeight')
- xFormatList = xDialog.getChild("comboPageFormat")
+ xWidth = xDialog.getChild('spinWidth')
+ xHeight = xDialog.getChild('spinHeight')
+ xFormatList = xDialog.getChild("comboPageFormat")
- # Without the fix in place, this test would have failed with
- # AssertionError: '16.2' != '11.4'
- self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
- self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
- self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '16.2' != '11.4'
+ self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
+ self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
+ self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText'])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.xUITest.executeCommand(".uno:Sidebar")
xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py
index b734cb624970..1d335de070c0 100644
--- a/sw/qa/uitest/styleInspector/styleInspector.py
+++ b/sw/qa/uitest/styleInspector/styleInspector.py
@@ -333,10 +333,9 @@ class styleNavigator(UITestCase):
# FIXME: neither LO_EXT_SHADING, nor odf:prefix/odf:suffix changes update the View,
# so add a temporary bookmark to the text range to trigger the color change immediately
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert"):
+ pass
+
self.xUITest.executeCommand(".uno:Undo")
xDirFormatting = xListBox.getChild('3')
diff --git a/sw/qa/uitest/table/insertTableDialog.py b/sw/qa/uitest/table/insertTableDialog.py
index 427920e1985c..ac4d45a10fc4 100644
--- a/sw/qa/uitest/table/insertTableDialog.py
+++ b/sw/qa/uitest/table/insertTableDialog.py
@@ -14,28 +14,24 @@ class WriterInsertTableDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable") as xDialog:
- xNameEdit = xDialog.getChild("nameedit")
+ xNameEdit = xDialog.getChild("nameedit")
- xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name}))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name}))
- xColSpin = xDialog.getChild("colspin")
- xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)}))
+ xColSpin = xDialog.getChild("colspin")
+ xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)}))
- xRowSpin = xDialog.getChild("rowspin")
- xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)}))
+ xRowSpin = xDialog.getChild("rowspin")
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)}))
- self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name)
- self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols))
- self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows))
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name)
+ self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols))
+ self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows))
document = self.ui_test.get_component()
@@ -53,21 +49,15 @@ class WriterInsertTableDialog(UITestCase):
self.insert_table("Test3", 2, 2)
- self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog")
-
- xNumberFormatDlg = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xNumberFormatDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableNumberFormatDialog"):
+ pass
self.ui_test.close_doc()
def test_cancel_button_insert_table_dialog(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- Dialog = self.xUITest.getTopFocusWindow()
- CancelBtn = Dialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(CancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable", close_button="cancel"):
+ pass
document = self.ui_test.get_component()
tables = document.getTextTables()
diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py
index 1efea8380b91..ee020ba7324e 100644
--- a/sw/qa/uitest/table/splitTable.py
+++ b/sw/qa/uitest/table/splitTable.py
@@ -17,13 +17,10 @@ class splitTable(UITestCase):
self.xUITest.executeCommand(".uno:GoDown")
self.xUITest.executeCommand(".uno:GoDown")
#dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SplitTable") as xDialog:
- copyheading = xDialog.getChild("copyheading")
- copyheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ copyheading = xDialog.getChild("copyheading")
+ copyheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
@@ -38,13 +35,10 @@ class splitTable(UITestCase):
#go to row 2
self.xUITest.executeCommand(".uno:GoDown")
self.xUITest.executeCommand(".uno:GoDown")
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SplitTable") as xDialog:
- customheading = xDialog.getChild("customheading")
- customheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ customheading = xDialog.getChild("customheading")
+ customheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
@@ -59,13 +53,10 @@ class splitTable(UITestCase):
#go to row 2
self.xUITest.executeCommand(".uno:GoDown")
self.xUITest.executeCommand(".uno:GoDown")
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SplitTable") as xDialog:
- noheading = xDialog.getChild("noheading")
- noheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ noheading = xDialog.getChild("noheading")
+ noheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py
index 15c15865b4f2..ddc817630f9a 100644
--- a/sw/qa/uitest/table/tableProperties.py
+++ b/sw/qa/uitest/table/tableProperties.py
@@ -21,123 +21,108 @@ class tableProperties(UITestCase):
change_measurement_unit(self, "Centimeter")
#dialog Table Properties - Table
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- name = xDialog.getChild("name")
- free = xDialog.getChild("free")
- widthmf = xDialog.getChild("widthmf")
- leftmf = xDialog.getChild("leftmf")
- rightmf = xDialog.getChild("rightmf")
- abovemf = xDialog.getChild("abovemf")
- belowmf = xDialog.getChild("belowmf")
- textdirection = xDialog.getChild("textdirection")
-
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
- free.executeAction("CLICK", tuple())
- widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- select_by_text(textdirection, "Left-to-right (LTR)")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ name = xDialog.getChild("name")
+ free = xDialog.getChild("free")
+ widthmf = xDialog.getChild("widthmf")
+ leftmf = xDialog.getChild("leftmf")
+ rightmf = xDialog.getChild("rightmf")
+ abovemf = xDialog.getChild("abovemf")
+ belowmf = xDialog.getChild("belowmf")
+ textdirection = xDialog.getChild("textdirection")
+
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
+ free.executeAction("CLICK", tuple())
+ widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ select_by_text(textdirection, "Left-to-right (LTR)")
#verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- name = xDialog.getChild("name")
- free = xDialog.getChild("free")
- widthmf = xDialog.getChild("widthmf")
- leftmf = xDialog.getChild("leftmf")
- rightmf = xDialog.getChild("rightmf")
- abovemf = xDialog.getChild("abovemf")
- belowmf = xDialog.getChild("belowmf")
- textdirection = xDialog.getChild("textdirection")
-
- self.assertEqual(get_state_as_dict(name)["Text"], "NewName")
- self.assertEqual(get_state_as_dict(free)["Checked"], "true")
- self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm")
- self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ name = xDialog.getChild("name")
+ free = xDialog.getChild("free")
+ widthmf = xDialog.getChild("widthmf")
+ leftmf = xDialog.getChild("leftmf")
+ rightmf = xDialog.getChild("rightmf")
+ abovemf = xDialog.getChild("abovemf")
+ belowmf = xDialog.getChild("belowmf")
+ textdirection = xDialog.getChild("textdirection")
+
+ self.assertEqual(get_state_as_dict(name)["Text"], "NewName")
+ self.assertEqual(get_state_as_dict(free)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm")
+ self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm")
#dialog Table Properties - Text flow
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- xbreak = xDialog.getChild("break")
- xbreak.executeAction("CLICK", tuple())
- column = xDialog.getChild("column")
- column.executeAction("CLICK", tuple())
- after = xDialog.getChild("after")
- after.executeAction("CLICK", tuple())
- keep = xDialog.getChild("keep")
- keep.executeAction("CLICK", tuple())
- headline = xDialog.getChild("headline")
- headline.executeAction("CLICK", tuple())
- textdirection = xDialog.getChild("textorientation")
- select_by_text(textdirection, "Vertical (bottom to top)")
- vertorient = xDialog.getChild("vertorient")
- select_by_text(vertorient, "Bottom")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xbreak = xDialog.getChild("break")
+ xbreak.executeAction("CLICK", tuple())
+ column = xDialog.getChild("column")
+ column.executeAction("CLICK", tuple())
+ after = xDialog.getChild("after")
+ after.executeAction("CLICK", tuple())
+ keep = xDialog.getChild("keep")
+ keep.executeAction("CLICK", tuple())
+ headline = xDialog.getChild("headline")
+ headline.executeAction("CLICK", tuple())
+ textdirection = xDialog.getChild("textorientation")
+ select_by_text(textdirection, "Vertical (bottom to top)")
+ vertorient = xDialog.getChild("vertorient")
+ select_by_text(vertorient, "Bottom")
#verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- xbreak = xDialog.getChild("break")
- self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true")
- column = xDialog.getChild("column")
- self.assertEqual(get_state_as_dict(column)["Checked"], "true")
- after = xDialog.getChild("column")
- self.assertEqual(get_state_as_dict(after)["Checked"], "true")
- keep = xDialog.getChild("keep")
- self.assertEqual(get_state_as_dict(keep)["Selected"], "true")
- headline = xDialog.getChild("headline")
- self.assertEqual(get_state_as_dict(headline)["Selected"], "true")
- textdirection = xDialog.getChild("textorientation")
- self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)")
- vertorient = xDialog.getChild("vertorient")
- self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xbreak = xDialog.getChild("break")
+ self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true")
+ column = xDialog.getChild("column")
+ self.assertEqual(get_state_as_dict(column)["Checked"], "true")
+ after = xDialog.getChild("column")
+ self.assertEqual(get_state_as_dict(after)["Checked"], "true")
+ keep = xDialog.getChild("keep")
+ self.assertEqual(get_state_as_dict(keep)["Selected"], "true")
+ headline = xDialog.getChild("headline")
+ self.assertEqual(get_state_as_dict(headline)["Selected"], "true")
+ textdirection = xDialog.getChild("textorientation")
+ self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)")
+ vertorient = xDialog.getChild("vertorient")
+ self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom")
#dialog Table Properties - Columns
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
- adaptwidth = xDialog.getChild("adaptwidth")
- adaptwidth.executeAction("CLICK", tuple())
+ adaptwidth = xDialog.getChild("adaptwidth")
+ adaptwidth.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
#verify
#doesn't work / probably Bug 100537 - Width and relative checkboxes disabled in Table
#dialog by default with automatic alignment
@@ -151,70 +136,58 @@ class tableProperties(UITestCase):
# self.ui_test.close_dialog_through_button(xOKBtn)
#dialog Table Properties - Borders
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- sync = xDialog.getChild("sync")
- mergeadjacent = xDialog.getChild("mergeadjacent")
- sync.executeAction("CLICK", tuple())
- mergeadjacent.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ sync = xDialog.getChild("sync")
+ mergeadjacent = xDialog.getChild("mergeadjacent")
+ sync.executeAction("CLICK", tuple())
+ mergeadjacent.executeAction("CLICK", tuple())
#verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
- sync = xDialog.getChild("sync")
- mergeadjacent = xDialog.getChild("mergeadjacent")
- # self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique
- self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+ sync = xDialog.getChild("sync")
+ mergeadjacent = xDialog.getChild("mergeadjacent")
+ # self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique
+ self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false")
#dialog Table Properties - Background
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "4")
-
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
- R_custom = xDialog.getChild("R_custom")
- G_custom = xDialog.getChild("G_custom")
- B_custom = xDialog.getChild("B_custom")
- R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- B_custom.executeAction("UP", tuple())
- B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value...
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "4")
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+ R_custom = xDialog.getChild("R_custom")
+ G_custom = xDialog.getChild("G_custom")
+ B_custom = xDialog.getChild("B_custom")
+ R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ B_custom.executeAction("UP", tuple())
+ B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value...
#verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "4")
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
- R_custom = xDialog.getChild("R_custom")
- G_custom = xDialog.getChild("G_custom")
- B_custom = xDialog.getChild("B_custom")
-
- self.assertEqual(get_state_as_dict(R_custom)["Text"], "100")
- self.assertEqual(get_state_as_dict(B_custom)["Text"], "100")
- self.assertEqual(get_state_as_dict(G_custom)["Text"], "100")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "4")
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+ R_custom = xDialog.getChild("R_custom")
+ G_custom = xDialog.getChild("G_custom")
+ B_custom = xDialog.getChild("B_custom")
+
+ self.assertEqual(get_state_as_dict(R_custom)["Text"], "100")
+ self.assertEqual(get_state_as_dict(B_custom)["Text"], "100")
+ self.assertEqual(get_state_as_dict(G_custom)["Text"], "100")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py
index 10a48fbdceaf..944891a4cd01 100644
--- a/sw/qa/uitest/table/tableToText.py
+++ b/sw/qa/uitest/table/tableToText.py
@@ -15,12 +15,9 @@ class tableToText(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
xWriterDoc = self.xUITest.getTopFocusWindow()
#dialog Table to text - Tabs; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- tabs = xDialog.getChild("tabs")
- tabs.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTableToText") as xDialog:
+ tabs = xDialog.getChild("tabs")
+ tabs.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String[0:3], "a\ta")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
@@ -29,12 +26,9 @@ class tableToText(UITestCase):
self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - Paragraph; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- paragraph = xDialog.getChild("paragraph")
- paragraph.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTableToText") as xDialog:
+ paragraph = xDialog.getChild("paragraph")
+ paragraph.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
@@ -43,12 +37,9 @@ class tableToText(UITestCase):
self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - Semicolons; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- semicolons = xDialog.getChild("semicolons")
- semicolons.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTableToText") as xDialog:
+ semicolons = xDialog.getChild("semicolons")
+ semicolons.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
@@ -57,16 +48,13 @@ class tableToText(UITestCase):
self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - other; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- other = xDialog.getChild("other")
- other.executeAction("CLICK", tuple())
- othered = xDialog.getChild("othered")
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTableToText") as xDialog:
+ other = xDialog.getChild("other")
+ other.executeAction("CLICK", tuple())
+ othered = xDialog.getChild("othered")
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
diff --git a/sw/qa/uitest/table/tdf115026.py b/sw/qa/uitest/table/tdf115026.py
index 92314753a8c3..761260110060 100644
--- a/sw/qa/uitest/table/tdf115026.py
+++ b/sw/qa/uitest/table/tdf115026.py
@@ -18,17 +18,11 @@ class tdf115026(UITestCase):
self.xUITest.executeCommand(".uno:InsertPagebreak")
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:AutoFormat"):
+ pass
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py
index 139fcea3a812..887083aa8d53 100644
--- a/sw/qa/uitest/table/tdf116737.py
+++ b/sw/qa/uitest/table/tdf116737.py
@@ -18,35 +18,29 @@ class tdf116737(UITestCase):
document = self.ui_test.get_component()
#Insert => Insert Table / It's not possible to select a table style
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable") as xDialog:
- formatlbinstable = xDialog.getChild("formatlbinstable")
- entry = formatlbinstable.getChild("11") #Simple List Shaded
- entry.executeAction("SELECT", tuple())
+ formatlbinstable = xDialog.getChild("formatlbinstable")
+ entry = formatlbinstable.getChild("11") #Simple List Shaded
+ entry.executeAction("SELECT", tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
#verify .uno:TableDialog
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4") #tab Background
-
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
-
- R_custom = xDialog.getChild("R_custom")
- G_custom = xDialog.getChild("G_custom")
- B_custom = xDialog.getChild("B_custom")
- #"Simple List Shaded" -> header should be black
- self.assertEqual(get_state_as_dict(R_custom)["Text"], "0")
- self.assertEqual(get_state_as_dict(G_custom)["Text"], "0")
- self.assertEqual(get_state_as_dict(B_custom)["Text"], "0")
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4") #tab Background
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+
+ R_custom = xDialog.getChild("R_custom")
+ G_custom = xDialog.getChild("G_custom")
+ B_custom = xDialog.getChild("B_custom")
+ #"Simple List Shaded" -> header should be black
+ self.assertEqual(get_state_as_dict(R_custom)["Text"], "0")
+ self.assertEqual(get_state_as_dict(G_custom)["Text"], "0")
+ self.assertEqual(get_state_as_dict(B_custom)["Text"], "0")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf128593.py b/sw/qa/uitest/table/tdf128593.py
index 3306a58d2b09..3ff5b26d5b54 100755
--- a/sw/qa/uitest/table/tdf128593.py
+++ b/sw/qa/uitest/table/tdf128593.py
@@ -12,26 +12,21 @@ class tdf128593(UITestCase):
MainDoc = self.ui_test.create_doc_in_start_center("writer")
MainWindow = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- InsertTableDialog = self.xUITest.getTopFocusWindow()
- xok = InsertTableDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) )
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- writer_edit = MainWindow.getChild("writer_edit")
- writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"}))
- TablePropertiesDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = TablePropertiesDialog.getChild("tabcontrol")
- tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"}))
- Rcustom = TablePropertiesDialog.getChild("R_custom") #255
- self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255")
- Gcustom = TablePropertiesDialog.getChild("G_custom") #255
- self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255")
- Bcustom = TablePropertiesDialog.getChild("B_custom") #0
- self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0")
- xok = TablePropertiesDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as TablePropertiesDialog:
+ writer_edit = MainWindow.getChild("writer_edit")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"}))
+ tabcontrol = TablePropertiesDialog.getChild("tabcontrol")
+ tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"}))
+ Rcustom = TablePropertiesDialog.getChild("R_custom") #255
+ self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255")
+ Gcustom = TablePropertiesDialog.getChild("G_custom") #255
+ self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255")
+ Bcustom = TablePropertiesDialog.getChild("B_custom") #0
+ self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0")
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
index fdde40f672bf..494df2017b2d 100644
--- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
+++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
@@ -20,29 +20,26 @@ class tdf134881(UITestCase):
change_measurement_unit(self, "Centimeter")
#dialog Table Properties
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2") #columns
-
- adaptcolumns = xDialog.getChild("adaptcolumns")
- width1 = xDialog.getChild("width1")
- width2 = xDialog.getChild("width2")
- # Get the baseline. The first column is much shorter than the second.
- self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0")
- self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0")
- # Set proportional adjust - so all columns are affected.
- adaptcolumns.executeAction("CLICK", tuple())
- # Cut the second column in half.
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"}))
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-
- # The first column should now be half it's original value, not zero (not 3 - 7)
- self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2") #columns
+
+ adaptcolumns = xDialog.getChild("adaptcolumns")
+ width1 = xDialog.getChild("width1")
+ width2 = xDialog.getChild("width2")
+ # Get the baseline. The first column is much shorter than the second.
+ self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0")
+ self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0")
+ # Set proportional adjust - so all columns are affected.
+ adaptcolumns.executeAction("CLICK", tuple())
+ # Cut the second column in half.
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"}))
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # The first column should now be half it's original value, not zero (not 3 - 7)
+ self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf135693.py b/sw/qa/uitest/table/tdf135693.py
index f4a0a7b8cfa3..6709b0af98b1 100644
--- a/sw/qa/uitest/table/tdf135693.py
+++ b/sw/qa/uitest/table/tdf135693.py
@@ -19,17 +19,14 @@ class tdf135693(UITestCase):
self.xUITest.executeCommand(".uno:GoDown")
# Without the fix in place, this would have crashed here
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xTableDlg:
- xTableDlg = self.xUITest.getTopFocusWindow()
- xTabs = xTableDlg.getChild("tabcontrol")
- select_pos(xTabs, "0")
+ xTabs = xTableDlg.getChild("tabcontrol")
+ select_pos(xTabs, "0")
- # Check we are in the right table
- self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text'])
+ # Check we are in the right table
+ self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text'])
- xok = xTableDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py
index e0be6fd8c2f2..26aca3e5ed11 100644
--- a/sw/qa/uitest/table/tdf81292.py
+++ b/sw/qa/uitest/table/tdf81292.py
@@ -17,12 +17,9 @@ class tdf81292(UITestCase):
#select whole table
self.xUITest.executeCommand(".uno:SelectTable")
#Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xDown = xDialog.getChild("down1")
- xDown.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xDown.executeAction("CLICK", tuple())
#verify
tables = writer_doc.getTextTables()
table = tables[0]
diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py
index a696c0be06ca..dfcd2b91db11 100644
--- a/sw/qa/uitest/table/tdf99334.py
+++ b/sw/qa/uitest/table/tdf99334.py
@@ -17,12 +17,8 @@ class tdf99334(UITestCase):
#select whole table
self.xUITest.executeCommand(".uno:SelectTable")
#Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- # xDown = xDialog.getChild("down1")
- # xDown.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SortDialog"):
+ pass
#verify
tables = writer_doc.getTextTables()
table = tables[0]
diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py
index 644a2a25254a..c2a958071c58 100644
--- a/sw/qa/uitest/table/textToTable.py
+++ b/sw/qa/uitest/table/textToTable.py
@@ -19,12 +19,9 @@ class textToTable(UITestCase):
#Enter A;B ; select the text ; dialog Text to table - Semicolon; verify
type_text(xWriterEdit, "A;B;C")
xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "5"}))
- self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable")
- xDialog = self.xUITest.getTopFocusWindow()
- semicolons = xDialog.getChild("semicolons")
- semicolons.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTextToTable") as xDialog:
+ semicolons = xDialog.getChild("semicolons")
+ semicolons.executeAction("CLICK", tuple())
#verify
self.assertEqual(document.TextTables.getCount(), 1)
tables = document.getTextTables()
@@ -43,18 +40,15 @@ class textToTable(UITestCase):
xWriterEdit = xWriterDoc.getChild("writer_edit")
#open file; select all text ; dialog Text to table - other ":"; verify
self.xUITest.executeCommand(".uno:SelectAll")
- self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable")
- xDialog = self.xUITest.getTopFocusWindow()
- other = xDialog.getChild("other")
- other.executeAction("CLICK", tuple())
- othered = xDialog.getChild("othered")
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
- headingcb = xDialog.getChild("headingcb")
- headingcb.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTextToTable") as xDialog:
+ other = xDialog.getChild("other")
+ other.executeAction("CLICK", tuple())
+ othered = xDialog.getChild("othered")
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
+ headingcb = xDialog.getChild("headingcb")
+ headingcb.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.TextTables.getCount(), 1)
tables = writer_doc.getTextTables()
diff --git a/sw/qa/uitest/ui/fmtui/fmtui.py b/sw/qa/uitest/ui/fmtui/fmtui.py
index 36e00c95a479..6c575d824757 100644
--- a/sw/qa/uitest/ui/fmtui/fmtui.py
+++ b/sw/qa/uitest/ui/fmtui/fmtui.py
@@ -18,20 +18,17 @@ class TestTmpdlg(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
xWriterDoc = self.xUITest.getTopFocusWindow()
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:EditStyle")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xTabs = xDialog.getChild("tabcontrol")
- # Select RID_SVXPAGE_CHAR_EFFECTS.
- select_pos(xTabs, "1")
- xFontTransparency = xDialog.getChild("fonttransparencymtr")
- # Without the accompanying fix in place, this test would have failed with:
- # AssertionError: 'false' != 'true'
- # i.e. the control was hidden in the paragraph style dialog.
- self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true")
-
- xCancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditStyle", close_button="cancel") as xDialog:
+
+ xTabs = xDialog.getChild("tabcontrol")
+ # Select RID_SVXPAGE_CHAR_EFFECTS.
+ select_pos(xTabs, "1")
+ xFontTransparency = xDialog.getChild("fonttransparencymtr")
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 'false' != 'true'
+ # i.e. the control was hidden in the paragraph style dialog.
+ self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py b/sw/qa/uitest/writer_tests/compareDocuments.py
index caac05e583a6..df0315466694 100644
--- a/sw/qa/uitest/writer_tests/compareDocuments.py
+++ b/sw/qa/uitest/writer_tests/compareDocuments.py
@@ -20,19 +20,17 @@ class compareDocuments(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:CompareDocuments", close_button="") as xOpenDialog:
- xOpenDialog = self.xUITest.getTopFocusWindow()
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
-
- # Close the dialog and open it again so the list of changes is updated
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
+ # Close the dialog and open it again so the list of changes is updated
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xcloseBtn = xTrackDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
@@ -52,19 +50,17 @@ class compareDocuments(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:CompareDocuments", close_button="") as xOpenDialog:
- xOpenDialog = self.xUITest.getTopFocusWindow()
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
-
- # Close the dialog and open it again so the list of changes is updated
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
+ # Close the dialog and open it again so the list of changes is updated
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xcloseBtn = xTrackDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
index 57f6273875db..2bc6e6578ca2 100644
--- a/sw/qa/uitest/writer_tests/insertCaption.py
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -13,58 +13,46 @@ class insertCaption(UITestCase):
def test_insert_caption(self):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame
- xDialogFr = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFrame") as xDialogFr:
- xWidth = xDialogFr.getChild("width")
- xWidth.executeAction("UP", tuple())
- xWidth.executeAction("UP", tuple())
+ xWidth = xDialogFr.getChild("width")
+ xWidth.executeAction("UP", tuple())
+ xWidth.executeAction("UP", tuple())
- xHeight = xDialogFr.getChild("height")
- xHeight.executeAction("UP", tuple())
- xHeight.executeAction("UP", tuple())
+ xHeight = xDialogFr.getChild("height")
+ xHeight.executeAction("UP", tuple())
+ xHeight.executeAction("UP", tuple())
- xOkBtn=xDialogFr.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.TextFrames.getCount(), 1)
- self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption
- xDialogCaption = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertCaptionDialog") as xDialogCaption:
- xCapt = xDialogCaption.getChild("caption_edit")
- xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
- xOkBtn=xDialogCaption.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
xFrame = document.TextFrames[0]
self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption")
- self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 2nd caption
- xDialogCaption = self.xUITest.getTopFocusWindow()
- xCapt = xDialogCaption.getChild("caption_edit")
- xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"}))
- xSep = xDialogCaption.getChild("separator_edit")
- xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertCaptionDialog") as xDialogCaption:
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"}))
+ xSep = xDialogCaption.getChild("separator_edit")
+ xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
- xOkBtn=xDialogCaption.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")
- self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 3. caption
- xDialogCaption = self.xUITest.getTopFocusWindow()
- xCapt = xDialogCaption.getChild("caption_edit")
- xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"}))
- xSep = xDialogCaption.getChild("separator_edit")
- xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
- xPos = xDialogCaption.getChild("position")
- select_pos(xPos, "1")
-
- xOkBtn=xDialogCaption.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertCaptionDialog") as xDialogCaption:
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"}))
+ xSep = xDialogCaption.getChild("separator_edit")
+ xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
+ xPos = xDialogCaption.getChild("position")
+ select_pos(xPos, "1")
+
self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py
index 5685f00a55a9..178a25adc080 100644
--- a/sw/qa/uitest/writer_tests/tdf134734.py
+++ b/sw/qa/uitest/writer_tests/tdf134734.py
@@ -17,30 +17,27 @@ class TestClass(UITestCase):
document = self.ui_test.get_component()
# set margins and fill color
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- DrawPageDialog = self.xUITest.getTopFocusWindow()
- xTabs = DrawPageDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
- self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
- spinMargLeft = DrawPageDialog.getChild("spinMargLeft")
- for _ in range(20):
- spinMargLeft.executeAction("UP",tuple())
- spinMargRight = DrawPageDialog.getChild("spinMargRight")
- for _ in range(15):
- spinMargRight.executeAction("UP",tuple())
- spinMargTop = DrawPageDialog.getChild("spinMargTop")
- for _ in range(10):
- spinMargTop.executeAction("UP",tuple())
- spinMargBot = DrawPageDialog.getChild("spinMargBot")
- for _ in range(5):
- spinMargBot.executeAction("UP",tuple())
- xTabs = DrawPageDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
- btncolor = DrawPageDialog.getChild("btncolor")
- btncolor.executeAction("CLICK",tuple())
- ok = DrawPageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
+ spinMargLeft = DrawPageDialog.getChild("spinMargLeft")
+ for _ in range(20):
+ spinMargLeft.executeAction("UP",tuple())
+ spinMargRight = DrawPageDialog.getChild("spinMargRight")
+ for _ in range(15):
+ spinMargRight.executeAction("UP",tuple())
+ spinMargTop = DrawPageDialog.getChild("spinMargTop")
+ for _ in range(10):
+ spinMargTop.executeAction("UP",tuple())
+ spinMargBot = DrawPageDialog.getChild("spinMargBot")
+ for _ in range(5):
+ spinMargBot.executeAction("UP",tuple())
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ btncolor = DrawPageDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK",tuple())
xStyle = document.StyleFamilies["PageStyles"]["Standard"]
@@ -52,15 +49,12 @@ class TestClass(UITestCase):
self.assertEqual(xStyle.BackgroundFullSize, True)
# uncheck it
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- DrawPageDialog = self.xUITest.getTopFocusWindow()
- xTabs = DrawPageDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
- self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
- checkBackgroundFullSize.executeAction("CLICK",tuple())
- ok = DrawPageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
+ checkBackgroundFullSize.executeAction("CLICK",tuple())
self.assertEqual(xStyle.FillStyle, SOLID)
self.assertEqual(xStyle.LeftMargin, 2997)
@@ -70,15 +64,12 @@ class TestClass(UITestCase):
self.assertEqual(xStyle.BackgroundFullSize, False)
# check it again
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- DrawPageDialog = self.xUITest.getTopFocusWindow()
- xTabs = DrawPageDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
- self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
- checkBackgroundFullSize.executeAction("CLICK",tuple())
- ok = DrawPageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
+ checkBackgroundFullSize.executeAction("CLICK",tuple())
self.assertEqual(xStyle.FillStyle, SOLID)
self.assertEqual(xStyle.LeftMargin, 2997)
diff --git a/sw/qa/uitest/writer_tests/tdf53460.py b/sw/qa/uitest/writer_tests/tdf53460.py
index 7f4b57416e6f..1688f155dcb6 100644
--- a/sw/qa/uitest/writer_tests/tdf53460.py
+++ b/sw/qa/uitest/writer_tests/tdf53460.py
@@ -17,17 +17,14 @@ class tdf53460(UITestCase):
xWriterEdit = xWriterDoc.getChild("writer_edit")
document = self.ui_test.get_component()
#-insert a table (by default 2x2)
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#-put the cursor inside first cell top left for example
#-insert an inner table (by default 2x2) inside this cell
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
+
#-still in top left cell, go to the line after the inner table
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
diff --git a/sw/qa/uitest/writer_tests/tdf78068.py b/sw/qa/uitest/writer_tests/tdf78068.py
index 1989722a3b1f..f8944196402d 100644
--- a/sw/qa/uitest/writer_tests/tdf78068.py
+++ b/sw/qa/uitest/writer_tests/tdf78068.py
@@ -19,12 +19,9 @@ class tdf78068(UITestCase):
#- add some text
type_text(xWriterEdit, "Test")
#- go to Format > Paragraph
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple()) #close dialog
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
self.assertEqual(document.Text.String[0:4], "Test")
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py
index 7a15327a45bc..496479e33f66 100644
--- a/sw/qa/uitest/writer_tests/tdf81457.py
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -16,26 +16,23 @@ class tdf81457(UITestCase):
#tdf 81457
def test_open_documentProperties_tdf81457(self):
with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) as writer_doc:
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2") #tab Custom properties
-
- aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
- 'BookMarkInfo12', 'BookMarkInfo13']
- aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
- '00FF0000FF210', '00FF0000FF230']
-
- for i in range(6):
- xNameBox = xDialog.getChild("namebox" + str(i + 1))
- xTypeBox = xDialog.getChild("typebox" + str(i + 1))
- xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
- self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
- self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
- self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
-
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2") #tab Custom properties
+
+ aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
+ 'BookMarkInfo12', 'BookMarkInfo13']
+ aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
+ '00FF0000FF210', '00FF0000FF230']
+
+ for i in range(6):
+ xNameBox = xDialog.getChild("namebox" + str(i + 1))
+ xTypeBox = xDialog.getChild("typebox" + str(i + 1))
+ xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
+ self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
+ self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
+ self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
+
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf93068.py b/sw/qa/uitest/writer_tests/tdf93068.py
index a77b4e42da91..2d0177a4f328 100644
--- a/sw/qa/uitest/writer_tests/tdf93068.py
+++ b/sw/qa/uitest/writer_tests/tdf93068.py
@@ -18,33 +18,23 @@ class tdf93068(UITestCase):
# tdf#135950: Character dialog crashes if multiple cells in a
# table are selected
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
self.xUITest.executeCommand(".uno:SelectAll")
# Check the table is selected
self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xFontDlg = self.xUITest.getTopFocusWindow()
- xOKBtn = xFontDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xFontDlg = self.xUITest.getTopFocusWindow()
- xCancBtn = xFontDlg.getChild("cancel")
- xCancBtn.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xFontDlg = self.xUITest.getTopFocusWindow()
- xDiscardBtn = xFontDlg.getChild("reset")
- xDiscardBtn.executeAction("CLICK", tuple())
- xOKBtn = xFontDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xFontDlg:
+ xDiscardBtn = xFontDlg.getChild("reset")
+ xDiscardBtn.executeAction("CLICK", tuple())
self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/writer_tests/versionDialog.py b/sw/qa/uitest/writer_tests/versionDialog.py
index df8d09102f1f..e5a1f1fa0ab5 100644
--- a/sw/qa/uitest/writer_tests/versionDialog.py
+++ b/sw/qa/uitest/writer_tests/versionDialog.py
@@ -18,22 +18,19 @@ class versionDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:VersionDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:VersionDialog", close_button="close") as xVersionDialog:
- xVersionDialog = self.xUITest.getTopFocusWindow()
- versiondList = xVersionDialog.getChild("versions")
+ versiondList = xVersionDialog.getChild("versions")
- text = "04/06/2020 15:18\t\tHELLO"
- self.assertEqual(1, len(versiondList.getChildren()))
- self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text)
+ text = "04/06/2020 15:18\t\tHELLO"
+ self.assertEqual(1, len(versiondList.getChildren()))
+ self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text)
- xDeleteBtn = xVersionDialog.getChild("delete")
- xDeleteBtn.executeAction("CLICK", tuple())
+ xDeleteBtn = xVersionDialog.getChild("delete")
+ xDeleteBtn.executeAction("CLICK", tuple())
- self.assertEqual(0, len(versiondList.getChildren()))
+ self.assertEqual(0, len(versiondList.getChildren()))
- xCloseBtn = xVersionDialog.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/watermark.py b/sw/qa/uitest/writer_tests/watermark.py
index 3cf7c6fd84f6..3802ce17f478 100644
--- a/sw/qa/uitest/writer_tests/watermark.py
+++ b/sw/qa/uitest/writer_tests/watermark.py
@@ -16,48 +16,36 @@ class watermark(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:Watermark")
- xDialog = self.xUITest.getTopFocusWindow()
- xTextInput = xDialog.getChild("TextInput")
- xAngle = xDialog.getChild("Angle")
- xTransparency = xDialog.getChild("Transparency")
-
- xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"}))
- xAngle.executeAction("UP", tuple())
- xTransparency.executeAction("UP", tuple())
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:Watermark")
- xDialog = self.xUITest.getTopFocusWindow()
- xTextInput = xDialog.getChild("TextInput")
- xAngle = xDialog.getChild("Angle")
- xTransparency = xDialog.getChild("Transparency")
-
- self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark")
- self.assertEqual(get_state_as_dict(xAngle)["Text"], "90°")
- self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%")
-
- xCancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:Watermark")
- xDialog = self.xUITest.getTopFocusWindow()
- xTextInput = xDialog.getChild("TextInput")
- xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:Watermark")
- xDialog = self.xUITest.getTopFocusWindow()
- xTextInput = xDialog.getChild("TextInput")
-
- self.assertEqual(get_state_as_dict(xTextInput)["Text"], "")
-
- xCancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Watermark") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xAngle = xDialog.getChild("Angle")
+ xTransparency = xDialog.getChild("Transparency")
+
+ xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"}))
+ xAngle.executeAction("UP", tuple())
+ xTransparency.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xAngle = xDialog.getChild("Angle")
+ xTransparency = xDialog.getChild("Transparency")
+
+ self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "90°")
+ self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Watermark") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+
+ self.assertEqual(get_state_as_dict(xTextInput)["Text"], "")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py
index d41fd2ff81e8..69f395af4c87 100644
--- a/sw/qa/uitest/writer_tests2/bookmark.py
+++ b/sw/qa/uitest/writer_tests2/bookmark.py
@@ -17,79 +17,55 @@ class bookmarkDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xBmk = xBookDlg.getChild("bookmarks")
- self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist
- xInsertBtn.executeAction("CLICK", tuple()) # add 2nd bookmark
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xCloseBtn = xBookDlg.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple()) # close
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xBmk = xBookDlg.getChild("bookmarks")
- self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks
- xCloseBtn = xBookDlg.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple()) # close dialog
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert"):
+ pass
-#now delete one bookmark
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xBmk = xBookDlg.getChild("bookmarks")
- xSecondListEntry = xBmk.getChild("1") # select second bookmark
- xSecondListEntry.executeAction("SELECT", tuple())
- xDelBtn = xBookDlg.getChild("delete")
- xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark
- xCloseBtn = xBookDlg.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple()) # close dialog
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xCloseBtn = xBookDlg.getChild("close")
- xBmk2 = xBookDlg.getChild("bookmarks")
- self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark
- xCloseBtn.executeAction("CLICK", tuple()) # now we have only 1 bookmark
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist
- self.ui_test.close_doc()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close"):
+ pass
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks
+#now delete one bookmark
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xSecondListEntry = xBmk.getChild("1") # select second bookmark
+ xSecondListEntry.executeAction("SELECT", tuple())
+ xDelBtn = xBookDlg.getChild("delete")
+ xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk2 = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark
+
+ self.ui_test.close_doc()
def test_bookmark_dialog_rename(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert"):
+ pass
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xBmk = xBookDlg.getChild("bookmarks")
- xFirstListEntry = xBmk.getChild("0") # select first bookmark
- xFirstListEntry.executeAction("SELECT", tuple())
- xRenameBtn = xBookDlg.getChild("rename")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xRenameBtn = xBookDlg.getChild("rename")
- with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog:
- xNewNameTxt=dialog.getChild("entry")
- xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"}))
+ with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog:
+ xNewNameTxt=dialog.getChild("entry")
+ xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"}))
- xBookDlg = self.xUITest.getTopFocusWindow()
- x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname"
- x1stListEntry.executeAction("SELECT", tuple())
+ x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname"
+ x1stListEntry.executeAction("SELECT", tuple())
- self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname"
+ self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname"
- xCloseBtn = xBookDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
self.ui_test.close_doc()
@@ -98,33 +74,23 @@ class bookmarkDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
-
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert"):
+ pass
type_text(xWriterEdit, "Test for bookmark")
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
type_text(xWriterEdit, "Test2 for bookmark")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="insert"):
+ pass
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # second bookmark
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xBmk = xBookDlg.getChild("bookmarks")
- xFirstListEntry = xBmk.getChild("0") # select first bookmark
- xFirstListEntry.executeAction("SELECT", tuple())
- xGoToBtn = xBookDlg.getChild("goto")
- xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark
- xCloseBtn = xBookDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xGoToBtn = xBookDlg.getChild("goto")
+ xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py
index 8afbac9be533..0f534276013e 100644
--- a/sw/qa/uitest/writer_tests2/documentProperties.py
+++ b/sw/qa/uitest/writer_tests2/documentProperties.py
@@ -30,100 +30,94 @@ class documentProperties(UITestCase):
def test_open_documentProperties_writer(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- xResetBtn = xDialog.getChild("reset")
- xResetBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties") as xDialog:
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
- xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data
- xUserDataCheckbox.executeAction("CLICK", tuple())
- xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document
- xThumbSaveCheckbox.executeAction("CLICK", tuple())
+ xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data
+ xUserDataCheckbox.executeAction("CLICK", tuple())
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document
+ xThumbSaveCheckbox.executeAction("CLICK", tuple())
#digital signature
- xDigSignBtn = xDialog.getChild("signature")
+ xDigSignBtn = xDialog.getChild("signature")
- with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"):
- pass
+ 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
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1") #tab Description
- xTitleText = xDialog.getChild("title")
- xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"}))
- xSubjectText = xDialog.getChild("subject")
- xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"}))
- xKeywordsText = xDialog.getChild("keywords")
- xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"}))
- xCommentsText = xDialog.getChild("comments")
- xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"}))
+ xTitleText = xDialog.getChild("title")
+ xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"}))
+ xSubjectText = xDialog.getChild("subject")
+ xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"}))
+ xKeywordsText = xDialog.getChild("keywords")
+ xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"}))
+ xCommentsText = xDialog.getChild("comments")
+ xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"}))
#Font tab
- select_pos(xTabs, "4") #tab Fonts
- xFontEmbedCheckbox = xDialog.getChild("embedFonts")
- xFontEmbedCheckbox.executeAction("CLICK", tuple())
+ select_pos(xTabs, "4") #tab Fonts
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xFontEmbedCheckbox.executeAction("CLICK", tuple())
#Security tab
- select_pos(xTabs, "3") #tab Security
- xReadOnlyCheckbox = xDialog.getChild("readonly")
- xReadOnlyCheckbox.executeAction("CLICK", tuple())
- xRecordChangesCheckbox = xDialog.getChild("recordchanges")
- xRecordChangesCheckbox.executeAction("CLICK", tuple())
- xProtectBtn = xDialog.getChild("protect")
+ select_pos(xTabs, "3") #tab Security
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xReadOnlyCheckbox.executeAction("CLICK", tuple())
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xRecordChangesCheckbox.executeAction("CLICK", tuple())
+ xProtectBtn = xDialog.getChild("protect")
- 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"}))
+ 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"}))
- select_pos(xTabs, "2") #tab Custom properties
+ select_pos(xTabs, "2") #tab Custom properties
- self.assert_custom_properties(xDialog, False)
+ self.assert_custom_properties(xDialog, False)
- xAddBtn = xDialog.getChild("add")
- xAddBtn.executeAction("CLICK", tuple())
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
- self.assert_custom_properties(xDialog, True)
+ self.assert_custom_properties(xDialog, True)
- xRemoveBtn = xDialog.getChild("remove1")
- xRemoveBtn.executeAction("CLICK", tuple())
+ xRemoveBtn = xDialog.getChild("remove1")
+ xRemoveBtn.executeAction("CLICK", tuple())
- self.assert_custom_properties(xDialog, False)
+ self.assert_custom_properties(xDialog, False)
- select_pos(xTabs, "5") #tab Statistics
- xUpdateBtn = xDialog.getChild("update")
- xUpdateBtn.executeAction("CLICK", tuple())
+ select_pos(xTabs, "5") #tab Statistics
+ xUpdateBtn = xDialog.getChild("update")
+ xUpdateBtn.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
#now open the dialog again and read the properties
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- xTitleText = xDialog.getChild("title")
- xSubjectText = xDialog.getChild("subject")
- xKeywordsText = xDialog.getChild("keywords")
- xCommentsText = xDialog.getChild("comments")
- xReadOnlyCheckbox = xDialog.getChild("readonly")
- xRecordChangesCheckbox = xDialog.getChild("recordchanges")
- xFontEmbedCheckbox = xDialog.getChild("embedFonts")
- xUserDataCheckbox = xDialog.getChild("userdatacb")
- xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb")
- self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text")
- self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text")
- self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text")
- self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text")
- xResetBtn = xDialog.getChild("reset")
- xResetBtn.executeAction("CLICK", tuple())
- xCancBtn = xDialog.getChild("cancel")
- xCancBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xTitleText = xDialog.getChild("title")
+ xSubjectText = xDialog.getChild("subject")
+ xKeywordsText = xDialog.getChild("keywords")
+ xCommentsText = xDialog.getChild("comments")
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xUserDataCheckbox = xDialog.getChild("userdatacb")
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb")
+ self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text")
+ self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text")
+ self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
index 3f3a49660bfc..bba8a8bc1aee 100644
--- a/sw/qa/uitest/writer_tests2/exchangeDatabase.py
+++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
@@ -14,10 +14,8 @@ class exchangeDB(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
- xExDBDlg = self.xUITest.getTopFocusWindow()
- xCloseBtn = xExDBDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChangeDatabaseField", close_button="close"):
+ pass
self.ui_test.close_doc()
@@ -25,30 +23,22 @@ class exchangeDB(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
- xExDBDlg = self.xUITest.getTopFocusWindow()
- xTreelist = xExDBDlg.getChild("availablelb")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChangeDatabaseField") as xExDBDlg:
+ xTreelist = xExDBDlg.getChild("availablelb")
- xLabeldb = xExDBDlg.getChild("dbnameft")
- self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")
- xTreeEntry = xTreelist.getChild('0') #Available Databases
- xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography
- xTreeEntry.executeAction("COLLAPSE", tuple())
- xTreeEntry.executeAction("EXPAND", tuple())
- xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases
- xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio
+ xTreeEntry = xTreelist.getChild('0') #Available Databases
+ xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography
+ xTreeEntry.executeAction("COLLAPSE", tuple())
+ xTreeEntry.executeAction("EXPAND", tuple())
+ xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases
+ xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio
- xDefineBtn = xExDBDlg.getChild("ok")
- xDefineBtn.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
- xExDBDlg = self.xUITest.getTopFocusWindow()
- xLabeldb = xExDBDlg.getChild("dbnameft")
- self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
-
- xCloseBtn = xExDBDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChangeDatabaseField", close_button="close") as xExDBDlg:
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index 4633666f468d..93a67bd8152e 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -21,39 +21,33 @@ class formatBulletsNumbering(UITestCase):
change_measurement_unit(self, "Millimeter")
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xalignedatmf = xDialog.getChild("alignedatmf")
- xnum2alignlb = xDialog.getChild("num2alignlb")
- xatmf = xDialog.getChild("atmf")
- xindentatmf = xDialog.getChild("indentatmf")
- xokbtn = xDialog.getChild("ok")
-
- xalignedatmf.executeAction("UP", tuple())
- select_by_text(xnum2alignlb, "Centered")
- xatmf.executeAction("UP", tuple())
- xindentatmf.executeAction("UP", tuple())
-
- self.ui_test.close_dialog_through_button(xokbtn)
-
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xalignedatmf = xDialog.getChild("alignedatmf")
- xnum2alignlb = xDialog.getChild("num2alignlb")
- xatmf = xDialog.getChild("atmf")
- xindentatmf = xDialog.getChild("indentatmf")
-
- self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm")
- self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
- self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm")
- self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm")
-
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+
+ xalignedatmf.executeAction("UP", tuple())
+ select_by_text(xnum2alignlb, "Centered")
+ xatmf.executeAction("UP", tuple())
+ xindentatmf.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+
+ self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm")
+ self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
+ self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm")
+ self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm")
+
self.ui_test.close_doc()
@@ -62,25 +56,19 @@ class formatBulletsNumbering(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
- select_by_text(xnumfollowedbylb, "Space")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ select_by_text(xnumfollowedbylb, "Space")
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
- self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space")
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
self.ui_test.close_doc()
@@ -89,77 +77,63 @@ class formatBulletsNumbering(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
- xnumfmtlb = xDialog.getChild("numfmtlb")
- xstartat = xDialog.getChild("startat")
- xcharstyle = xDialog.getChild("charstyle")
- xprefix = xDialog.getChild("prefix")
- xsuffix = xDialog.getChild("suffix")
- xallsame = xDialog.getChild("allsame")
-
- select_by_text(xnumfmtlb, "A, B, C, ...")
- xstartat.executeAction("UP", tuple())
- select_by_text(xcharstyle, "Bullets")
- xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"}))
- xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
- xallsame.executeAction("CLICK", tuple())
-
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
-
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
- xnumfmtlb = xDialog.getChild("numfmtlb")
- xstartat = xDialog.getChild("startat")
- xcharstyle = xDialog.getChild("charstyle")
- xprefix = xDialog.getChild("prefix")
- xsuffix = xDialog.getChild("suffix")
- xallsame = xDialog.getChild("allsame")
-
- self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...")
- self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
- self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
- self.assertEqual(get_state_as_dict(xprefix)["Text"], "o")
- self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a")
- self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true")
-
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
-
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xremovebtn = xDialog.getChild("user")
- self.ui_test.close_dialog_through_button(xremovebtn) #remove new settings, back to default
-
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
- xnumfmtlb = xDialog.getChild("numfmtlb")
- xstartat = xDialog.getChild("startat")
- xcharstyle = xDialog.getChild("charstyle")
- xprefix = xDialog.getChild("prefix")
- xsuffix = xDialog.getChild("suffix")
- xallsame = xDialog.getChild("allsame")
-
- self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...")
- self.assertEqual(get_state_as_dict(xstartat)["Text"], "1")
- self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None")
- self.assertEqual(get_state_as_dict(xprefix)["Text"], "")
- self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".")
- self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false")
-
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ select_by_text(xnumfmtlb, "A, B, C, ...")
+ xstartat.executeAction("UP", tuple())
+ select_by_text(xcharstyle, "Bullets")
+ xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xallsame.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "o")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="user") as xDialog:
+ pass
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false")
+
self.ui_test.close_doc()
@@ -171,37 +145,28 @@ class formatBulletsNumbering(UITestCase):
change_measurement_unit(self, "Millimeter")
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn) #create bullets
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- self.assertEqual(indentValue < indentValue2 , True)
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- self.assertEqual(indentValue == indentValue3 , True)
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
self.ui_test.close_doc()
@@ -212,37 +177,28 @@ class formatBulletsNumbering(UITestCase):
change_measurement_unit(self, "Millimeter")
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn) #create bullets
self.xUITest.executeCommand(".uno:DecrementSubLevels")
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- self.assertEqual(indentValue < indentValue2 , True)
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
self.xUITest.executeCommand(".uno:IncrementLevel")
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xindentatmf = xDialog.getChild("indentatmf")
- indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
- self.assertEqual(indentValue == indentValue3 , True)
- xcancbtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
self.ui_test.close_doc()
@@ -252,78 +208,72 @@ class formatBulletsNumbering(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# Test Bullet Page
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- # Select the BulletPage's Selector
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xBulletPage = xDialog.getChild("PickBulletPage")
- xselector = xBulletPage.getChild("valueset")
- self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
- # Select element num 3
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3")
- self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets")
- # Select element num 7
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7")
- self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+
+ # Select the BulletPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xBulletPage = xDialog.getChild("PickBulletPage")
+ xselector = xBulletPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 3
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets")
+ # Select element num 7
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets")
+
# Test other Pages
- self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- # Select the NumberingPage's Selector
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xNumberingPage = xDialog.getChild("PickNumberingPage")
- xselector = xNumberingPage.getChild("valueset")
- self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
- # Select element num 5
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5")
- self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)")
- # Select element num 8
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8")
- self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.")
-
- # Select the OutlinePage's Selector
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
- xOutlinePage = xDialog.getChild("PickOutlinePage")
- xselector = xOutlinePage.getChild("valueset")
- self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
- # Select element num 1
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1")
- self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet")
-
- # Select the GraphicPage's Selector
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
- xGraphicPage = xDialog.getChild("PickGraphicPage")
- xselector = xGraphicPage.getChild("valueset")
- self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92")
- # Select element num 22
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22")
- # Select element num 73
- xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"}))
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72")
- self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:BulletsAndNumberingDialog") as xDialog:
+ # Select the NumberingPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNumberingPage = xDialog.getChild("PickNumberingPage")
+ xselector = xNumberingPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 5
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)")
+ # Select element num 8
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.")
+
+ # Select the OutlinePage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xOutlinePage = xDialog.getChild("PickOutlinePage")
+ xselector = xOutlinePage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 1
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet")
+
+ # Select the GraphicPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ xGraphicPage = xDialog.getChild("PickGraphicPage")
+ xselector = xGraphicPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92")
+ # Select element num 22
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22")
+ # Select element num 73
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py
index c0106ddcd47e..00660cc233b5 100644
--- a/sw/qa/uitest/writer_tests2/formatCharacter.py
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -18,48 +18,42 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
-
- xSizeFont = xDialog.getChild("westsizelb-cjk")
- xSizeFontEast = xDialog.getChild("eastsizelb")
- xSizeFontCTL = xDialog.getChild("ctlsizelb")
- xLangFont = xDialog.getChild("westlanglb-cjk")
- xLangFontEast = xDialog.getChild("eastlanglb")
- xLangFontCTL = xDialog.getChild("ctllanglb")
-
- xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
- xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
- xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
- select_pos(xLangFont, "0")
- select_pos(xLangFontEast, "0")
- select_pos(xLangFontCTL, "0")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xSizeFont = xDialog.getChild("westsizelb-cjk")
- xSizeFontEast = xDialog.getChild("eastsizelb")
- xSizeFontCTL = xDialog.getChild("ctlsizelb")
- xLangFont = xDialog.getChild("westlanglb-cjk")
- xLangFontEast = xDialog.getChild("eastlanglb")
- xLangFontCTL = xDialog.getChild("ctllanglb")
-
- self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
- self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
- self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
- self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
- self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
- self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ xSizeFont = xDialog.getChild("westsizelb-cjk")
+ xSizeFontEast = xDialog.getChild("eastsizelb")
+ xSizeFontCTL = xDialog.getChild("ctlsizelb")
+ xLangFont = xDialog.getChild("westlanglb-cjk")
+ xLangFontEast = xDialog.getChild("eastlanglb")
+ xLangFontCTL = xDialog.getChild("ctllanglb")
+
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ select_pos(xLangFont, "0")
+ select_pos(xLangFontEast, "0")
+ select_pos(xLangFontCTL, "0")
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xSizeFont = xDialog.getChild("westsizelb-cjk")
+ xSizeFontEast = xDialog.getChild("eastsizelb")
+ xSizeFontCTL = xDialog.getChild("ctlsizelb")
+ xLangFont = xDialog.getChild("westlanglb-cjk")
+ xLangFontEast = xDialog.getChild("eastlanglb")
+ xLangFontCTL = xDialog.getChild("ctllanglb")
+
+ self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
+ self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
+ self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
+ self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
+ self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
+ self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")
+
self.ui_test.close_doc()
@@ -68,57 +62,51 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
-
- select_pos(xEffects, "1")
- select_pos(xRelief, "1")
- xHidden.executeAction("CLICK", tuple())
- select_pos(xOverline, "1")
- select_pos(xStrikeout, "1")
- select_pos(xUnderline, "1")
- select_pos(xEmphasis, "1")
- select_pos(xPosition, "1")
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
-
- self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE")
- self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed")
- self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single")
- self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single")
- self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single")
- self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot")
- self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ select_pos(xEffects, "1")
+ select_pos(xRelief, "1")
+ xHidden.executeAction("CLICK", tuple())
+ select_pos(xOverline, "1")
+ select_pos(xStrikeout, "1")
+ select_pos(xUnderline, "1")
+ select_pos(xEmphasis, "1")
+ select_pos(xPosition, "1")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE")
+ self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed")
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text")
+
self.ui_test.close_doc()
@@ -127,47 +115,41 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- xURL = xDialog.getChild("urled")
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
- xTexted = xDialog.getChild("texted")
- xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
- xName = xDialog.getChild("nameed")
- xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))
+ xURL = xDialog.getChild("urled")
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
+ xTexted = xDialog.getChild("texted")
+ xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
+ xName = xDialog.getChild("nameed")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))
- xVisited = xDialog.getChild("visitedlb")
- select_by_text(xVisited, "Bullets")
- xUnVisited = xDialog.getChild("unvisitedlb")
- select_by_text(xUnVisited, "Bullets")
+ xVisited = xDialog.getChild("visitedlb")
+ select_by_text(xVisited, "Bullets")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+ select_by_text(xUnVisited, "Bullets")
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
self.xUITest.executeCommand(".uno:GoLeft")
self.assertEqual(document.Text.String[0:11], "LibreOffice")
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
- xURL = xDialog.getChild("urled")
- xTexted = xDialog.getChild("texted")
- xName = xDialog.getChild("nameed")
- xVisited = xDialog.getChild("visitedlb")
- xUnVisited = xDialog.getChild("unvisitedlb")
-
- self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
- self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
- self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
- self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
- self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xURL = xDialog.getChild("urled")
+ xTexted = xDialog.getChild("texted")
+ xName = xDialog.getChild("nameed")
+ xVisited = xDialog.getChild("visitedlb")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+
+ self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
+ self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
+ self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
+ self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")
+
self.ui_test.close_doc()
def test_format_character_tab_asian_layout(self):
@@ -175,26 +157,20 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
- xTwolines = xDialog.getChild("twolines")
- xTwolines.executeAction("CLICK", tuple())
+ xTwolines = xDialog.getChild("twolines")
+ xTwolines.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
- xTwolines = xDialog.getChild("twolines")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ xTwolines = xDialog.getChild("twolines")
- self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
self.ui_test.close_doc()
def test_format_character_tab_position(self):
@@ -202,51 +178,45 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
-
- xSuperscript = xDialog.getChild("superscript")
- xRelFontSize = xDialog.getChild("fontsizesb")
- x90deg = xDialog.getChild("90deg")
- xScalewidth = xDialog.getChild("scalewidthsb")
- xKerning = xDialog.getChild("kerningsb")
- xPairKerning = xDialog.getChild("pairkerning")
- xFitToLine = xDialog.getChild("fittoline")
-
- xSuperscript.executeAction("CLICK", tuple())
- xRelFontSize.executeAction("UP", tuple())
- x90deg.executeAction("CLICK", tuple())
- xScalewidth.executeAction("UP", tuple())
- xKerning.executeAction("UP", tuple())
- xPairKerning.executeAction("CLICK", tuple())
- xFitToLine.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
-
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
- xSuperscript = xDialog.getChild("superscript")
- xRelFontSize = xDialog.getChild("fontsizesb")
- x90deg = xDialog.getChild("90deg")
- xScalewidth = xDialog.getChild("scalewidthsb")
- xKerning = xDialog.getChild("kerningsb")
- xPairKerning = xDialog.getChild("pairkerning")
- xFitToLine = xDialog.getChild("fittoline")
-
- self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true")
- self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%")
- self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt")
- self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ xSuperscript.executeAction("CLICK", tuple())
+ xRelFontSize.executeAction("UP", tuple())
+ x90deg.executeAction("CLICK", tuple())
+ xScalewidth.executeAction("UP", tuple())
+ xKerning.executeAction("UP", tuple())
+ xPairKerning.executeAction("CLICK", tuple())
+ xFitToLine.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%")
+ self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt")
+ self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true")
+
self.ui_test.close_doc()
@@ -255,26 +225,20 @@ class formatCharacter(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
- xScalewidth = xDialog.getChild("scalewidthsb")
- xScalewidth.executeAction("UP", tuple())
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xScalewidth.executeAction("UP", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
- xScalewidth = xDialog.getChild("scalewidthsb")
- self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%")
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py
index 00cce192cb0b..a46864544744 100644
--- a/sw/qa/uitest/writer_tests2/formatParagraph.py
+++ b/sw/qa/uitest/writer_tests2/formatParagraph.py
@@ -19,60 +19,54 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
-
- xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
- xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
- xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
- xAutomaticChk = xDialog.getChild("checkCB_AUTO")
- xAbovePar = xDialog.getChild("spinED_TOPDIST")
- xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
- xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
- xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
- xActivate = xDialog.getChild("checkCB_REGISTER")
-
- xBeforeText.executeAction("UP", tuple())
- xAfterText.executeAction("UP", tuple())
- xFirstLine.executeAction("UP", tuple())
- xAutomaticChk.executeAction("CLICK", tuple())
- xAbovePar.executeAction("UP", tuple())
- xBelowPar.executeAction("UP", tuple())
- xChkspace.executeAction("CLICK", tuple())
- select_by_text(xLineSpacing, "Double")
- xActivate.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
- xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
- xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
- xAutomaticChk = xDialog.getChild("checkCB_AUTO")
- xAbovePar = xDialog.getChild("spinED_TOPDIST")
- xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
- xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
- xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
- xActivate = xDialog.getChild("checkCB_REGISTER")
-
- self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch")
- self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch")
- self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch")
- self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line")
- self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line")
- self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double")
- self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ xBeforeText.executeAction("UP", tuple())
+ xAfterText.executeAction("UP", tuple())
+ xFirstLine.executeAction("UP", tuple())
+ xAutomaticChk.executeAction("CLICK", tuple())
+ xAbovePar.executeAction("UP", tuple())
+ xBelowPar.executeAction("UP", tuple())
+ xChkspace.executeAction("CLICK", tuple())
+ select_by_text(xLineSpacing, "Double")
+ xActivate.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double")
+ self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true")
+
self.ui_test.close_doc()
@@ -81,49 +75,43 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
- xAlignment = xDialog.getChild("comboLB_VERTALIGN")
- xSnapToText = xDialog.getChild("checkCB_SNAP")
- xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
- xLastLine = xDialog.getChild("comboLB_LASTLINE")
- xExpandChk = xDialog.getChild("checkCB_EXPAND")
-
- select_by_text(xTextDirection, "Left-to-right (LTR)")
- select_by_text(xAlignment, "Top")
- xSnapToText.executeAction("CLICK", tuple())
- xJustified.executeAction("CLICK", tuple())
- select_by_text(xLastLine, "Justified")
- xExpandChk.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
- xAlignment = xDialog.getChild("comboLB_VERTALIGN")
- xSnapToText = xDialog.getChild("checkCB_SNAP")
- xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
- xLastLine = xDialog.getChild("comboLB_LASTLINE")
- xExpandChk = xDialog.getChild("checkCB_EXPAND")
-
- self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)")
- self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top")
- self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified")
- self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ select_by_text(xTextDirection, "Left-to-right (LTR)")
+ select_by_text(xAlignment, "Top")
+ xSnapToText.executeAction("CLICK", tuple())
+ xJustified.executeAction("CLICK", tuple())
+ select_by_text(xLastLine, "Justified")
+ xExpandChk.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)")
+ self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top")
+ self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified")
+ self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true")
+
self.ui_test.close_doc()
@@ -132,77 +120,71 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
-
- xAutomaticaly = xDialog.getChild("checkAuto")
- xEnd = xDialog.getChild("spinLineEnd")
- xBegin = xDialog.getChild("spinLineBegin")
- xMax = xDialog.getChild("spinMaxNum")
- xIns = xDialog.getChild("checkInsert")
- xType = xDialog.getChild("comboBreakType")
- xPosition = xDialog.getChild("comboBreakPosition")
- xspinOrphan = xDialog.getChild("spinOrphan")
- xspinWidow = xDialog.getChild("spinWidow")
- xcheckWidow = xDialog.getChild("checkWidow")
- xcheckOrphan = xDialog.getChild("checkOrphan")
- xcheckSplitPara = xDialog.getChild("checkSplitPara")
- xcheckKeepPara = xDialog.getChild("checkKeepPara")
-
- xAutomaticaly.executeAction("CLICK", tuple())
- xEnd.executeAction("UP", tuple())
- xBegin.executeAction("UP", tuple())
- xMax.executeAction("UP", tuple())
- xIns.executeAction("CLICK", tuple())
- select_by_text(xType, "Column")
- select_by_text(xPosition, "After")
- xspinOrphan.executeAction("UP", tuple())
- xspinWidow.executeAction("UP", tuple())
- xcheckWidow.executeAction("CLICK", tuple())
- xcheckOrphan.executeAction("CLICK", tuple())
- xcheckSplitPara.executeAction("CLICK", tuple())
- xcheckKeepPara.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
-
- xAutomaticaly = xDialog.getChild("checkAuto")
- xEnd = xDialog.getChild("spinLineEnd")
- xBegin = xDialog.getChild("spinLineBegin")
- xMax = xDialog.getChild("spinMaxNum")
- xIns = xDialog.getChild("checkInsert")
- xType = xDialog.getChild("comboBreakType")
- xPosition = xDialog.getChild("comboBreakPosition")
- xspinOrphan = xDialog.getChild("spinOrphan")
- xspinWidow = xDialog.getChild("spinWidow")
- xcheckWidow = xDialog.getChild("checkWidow")
- xcheckOrphan = xDialog.getChild("checkOrphan")
- xcheckSplitPara = xDialog.getChild("checkSplitPara")
- xcheckKeepPara = xDialog.getChild("checkKeepPara")
-
- self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xEnd)["Text"], "3")
- self.assertEqual(get_state_as_dict(xBegin)["Text"], "3")
- self.assertEqual(get_state_as_dict(xMax)["Text"], "1")
- self.assertEqual(get_state_as_dict(xIns)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column")
- self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After")
- self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2")
- self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2")
- self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ xAutomaticaly.executeAction("CLICK", tuple())
+ xEnd.executeAction("UP", tuple())
+ xBegin.executeAction("UP", tuple())
+ xMax.executeAction("UP", tuple())
+ xIns.executeAction("CLICK", tuple())
+ select_by_text(xType, "Column")
+ select_by_text(xPosition, "After")
+ xspinOrphan.executeAction("UP", tuple())
+ xspinWidow.executeAction("UP", tuple())
+ xcheckWidow.executeAction("CLICK", tuple())
+ xcheckOrphan.executeAction("CLICK", tuple())
+ xcheckSplitPara.executeAction("CLICK", tuple())
+ xcheckKeepPara.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xBegin)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xMax)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xIns)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After")
+ self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true")
+
self.ui_test.close_doc()
@@ -211,37 +193,31 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
- xcheckForbidList = xDialog.getChild("checkForbidList")
- xcheckHangPunct = xDialog.getChild("checkHangPunct")
- xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
- xcheckForbidList.executeAction("CLICK", tuple())
- xcheckHangPunct.executeAction("CLICK", tuple())
- xcheckApplySpacing.executeAction("CLICK", tuple())
+ xcheckForbidList.executeAction("CLICK", tuple())
+ xcheckHangPunct.executeAction("CLICK", tuple())
+ xcheckApplySpacing.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
- xcheckForbidList = xDialog.getChild("checkForbidList")
- xcheckHangPunct = xDialog.getChild("checkHangPunct")
- xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
- self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false")
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
self.ui_test.close_doc()
@@ -250,41 +226,35 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
- xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
- xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
- xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
- select_by_text(xOutline, "Level 1")
- select_by_text(xNumbering, "Bullet •")
- xPara.executeAction("CLICK", tuple())
- xParaSpin.executeAction("UP", tuple())
+ select_by_text(xOutline, "Level 1")
+ select_by_text(xNumbering, "Bullet •")
+ xPara.executeAction("CLICK", tuple())
+ xParaSpin.executeAction("UP", tuple())
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
- xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
- xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
- xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
- self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1")
- self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •")
- self.assertEqual(get_state_as_dict(xPara)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1")
+ self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •")
+ self.assertEqual(get_state_as_dict(xPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2")
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
self.ui_test.close_doc()
@@ -295,135 +265,111 @@ class formatParagraph(UITestCase):
change_measurement_unit(self, "Centimeter")
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
- xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
- xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
- xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
- xNewButtn = xDialog.getChild("buttonBTN_NEW")
- xED_TABPOS = xDialog.getChild("ED_TABPOS")
-
- xDecimal.executeAction("CLICK", tuple())
- xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
- xFill.executeAction("CLICK", tuple())
- xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"}))
- xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- xNewButtn.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
- xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
- xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
- xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
- xNewButtn = xDialog.getChild("buttonBTN_NEW")
- xED_TABPOS = xDialog.getChild("ED_TABPOS")
-
- self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i")
- self.assertEqual(get_state_as_dict(xFill)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p")
- self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
- xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
- xNewButtn = xDialog.getChild("buttonBTN_NEW")
-
- xCentered.executeAction("CLICK", tuple())
- xUnderscore.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
- xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
- self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
- xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
- xNewButtn = xDialog.getChild("buttonBTN_NEW")
-
- xRight.executeAction("CLICK", tuple())
- xDashLine.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
- xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
- self.assertEqual(get_state_as_dict(xRight)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
- xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
- xNewButtn = xDialog.getChild("buttonBTN_NEW")
-
- xLeft.executeAction("CLICK", tuple())
- xPointsLine.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
-
- xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
- xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
- self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ xDecimal.executeAction("CLICK", tuple())
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
+ xFill.executeAction("CLICK", tuple())
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ xNewButtn.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i")
+ self.assertEqual(get_state_as_dict(xFill)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p")
+ self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xCentered.executeAction("CLICK", tuple())
+ xUnderscore.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xRight.executeAction("CLICK", tuple())
+ xDashLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ self.assertEqual(get_state_as_dict(xRight)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xLeft.executeAction("CLICK", tuple())
+ xPointsLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true")
+
self.ui_test.close_doc()
@@ -432,46 +378,40 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "6")
-
- xDisplay = xDialog.getChild("checkCB_SWITCH")
- xWholeWord = xDialog.getChild("checkCB_WORD")
- xLines = xDialog.getChild("spinFLD_LINES")
- xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
- xText = xDialog.getChild("entryEDT_TEXT")
- xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
-
- xDisplay.executeAction("CLICK", tuple())
- xWholeWord.executeAction("CLICK", tuple())
- xLines.executeAction("UP", tuple())
- xSpaceToText.executeAction("UP", tuple())
- xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- select_by_text(xCharStyle, "Definition")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "6")
-
- xDisplay = xDialog.getChild("checkCB_SWITCH")
- xWholeWord = xDialog.getChild("checkCB_WORD")
- xLines = xDialog.getChild("spinFLD_LINES")
- xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
- xText = xDialog.getChild("entryEDT_TEXT")
- xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
-
- self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xText)["Text"], "A")
- self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ xDisplay.executeAction("CLICK", tuple())
+ xWholeWord.executeAction("CLICK", tuple())
+ xLines.executeAction("UP", tuple())
+ xSpaceToText.executeAction("UP", tuple())
+ xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ select_by_text(xCharStyle, "Definition")
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xText)["Text"], "A")
+ self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition")
+
self.ui_test.close_doc()
@@ -482,55 +422,49 @@ class formatParagraph(UITestCase):
change_measurement_unit(self, "Centimeter")
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "7")
-
- xStyle = xDialog.getChild("linestylelb")
- xwidth = xDialog.getChild("linewidthmf")
- xSync = xDialog.getChild("sync")
- xLeft = xDialog.getChild("leftmf")
- xRight = xDialog.getChild("rightmf")
- xTop = xDialog.getChild("topmf")
- xBottom = xDialog.getChild("bottommf")
- xMerge = xDialog.getChild("mergewithnext")
-
- xwidth.executeAction("UP", tuple())
- xSync.executeAction("CLICK", tuple())
- xLeft.executeAction("UP", tuple())
- xLeft.executeAction("UP", tuple())
- xRight.executeAction("UP", tuple())
- xTop.executeAction("UP", tuple())
- xBottom.executeAction("UP", tuple())
- xMerge.executeAction("CLICK", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "7")
-
- xStyle = xDialog.getChild("linestylelb")
- xwidth = xDialog.getChild("linewidthmf")
- xSync = xDialog.getChild("sync")
- xLeft = xDialog.getChild("leftmf")
- xRight = xDialog.getChild("rightmf")
- xTop = xDialog.getChild("topmf")
- xBottom = xDialog.getChild("bottommf")
- xMerge = xDialog.getChild("mergewithnext")
-
- self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
- self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ xwidth.executeAction("UP", tuple())
+ xSync.executeAction("CLICK", tuple())
+ xLeft.executeAction("UP", tuple())
+ xLeft.executeAction("UP", tuple())
+ xRight.executeAction("UP", tuple())
+ xTop.executeAction("UP", tuple())
+ xBottom.executeAction("UP", tuple())
+ xMerge.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
+ self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")
+
self.ui_test.close_doc()
def test_format_paragraph_area(self):
@@ -538,24 +472,21 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "8")
-
- xColor = xDialog.getChild("btncolor")
- xGradient = xDialog.getChild("btngradient")
- xBitmap = xDialog.getChild("btnbitmap")
- xPattern = xDialog.getChild("btnpattern")
- xHatch = xDialog.getChild("btnhatch")
-
- xColor.executeAction("CLICK", tuple())
- xGradient.executeAction("CLICK", tuple())
- xBitmap.executeAction("CLICK", tuple())
- xPattern.executeAction("CLICK", tuple())
- xHatch.executeAction("CLICK", tuple())
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "8")
+
+ xColor = xDialog.getChild("btncolor")
+ xGradient = xDialog.getChild("btngradient")
+ xBitmap = xDialog.getChild("btnbitmap")
+ xPattern = xDialog.getChild("btnpattern")
+ xHatch = xDialog.getChild("btnhatch")
+
+ xColor.executeAction("CLICK", tuple())
+ xGradient.executeAction("CLICK", tuple())
+ xBitmap.executeAction("CLICK", tuple())
+ xPattern.executeAction("CLICK", tuple())
+ xHatch.executeAction("CLICK", tuple())
self.ui_test.close_doc()
def test_format_paragraph_transparency(self):
@@ -563,77 +494,65 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
-
- xTran = xDialog.getChild("RBT_TRANS_LINEAR")
- xTranText = xDialog.getChild("MTR_TRANSPARENT")
-
- xTran.executeAction("CLICK", tuple())
- xTranText.executeAction("UP", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
-
- xTran = xDialog.getChild("RBT_TRANS_LINEAR")
- xTranText = xDialog.getChild("MTR_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xTran)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
-
- xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
- xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
- xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
- xBorder = xDialog.getChild("MTR_TRGR_BORDER")
- xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
- xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
-
- xGradient.executeAction("CLICK", tuple())
- select_by_text(xType, "Axial")
- xAngle.executeAction("UP", tuple())
- xBorder.executeAction("UP", tuple())
- xStart.executeAction("UP", tuple())
- xEnd.executeAction("UP", tuple())
-
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
-
- xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
- xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
- xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
- xBorder = xDialog.getChild("MTR_TRGR_BORDER")
- xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
- xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
-
- self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial")
- self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°")
- self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%")
- self.assertEqual(get_state_as_dict(xStart)["Text"], "1%")
- self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%")
-
- xCanc = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanc)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ xTran.executeAction("CLICK", tuple())
+ xTranText.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xTran)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ xGradient.executeAction("CLICK", tuple())
+ select_by_text(xType, "Axial")
+ xAngle.executeAction("UP", tuple())
+ xBorder.executeAction("UP", tuple())
+ xStart.executeAction("UP", tuple())
+ xEnd.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°")
+ self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xStart)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py
index f004badfc6ec..dddaada8bdea 100644
--- a/sw/qa/uitest/writer_tests2/horizontalLine.py
+++ b/sw/qa/uitest/writer_tests2/horizontalLine.py
@@ -19,22 +19,16 @@ class WriterInsertHorizontalLine(UITestCase):
self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
- self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xStyleNametxt = xDialog.getChild("name")
- self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
- xCancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditStyle", close_button="cancel") as xDialog:
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Redo")
- self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xStyleNametxt = xDialog.getChild("name")
- self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
- xCancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditStyle", close_button="cancel") as xDialog:
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/pasteSpecial.py b/sw/qa/uitest/writer_tests2/pasteSpecial.py
index 2af43215d99d..ae1ee10be4c6 100644
--- a/sw/qa/uitest/writer_tests2/pasteSpecial.py
+++ b/sw/qa/uitest/writer_tests2/pasteSpecial.py
@@ -21,16 +21,13 @@ class PasteSpecial(UITestCase):
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PasteSpecial") as xDialog:
- xList = xDialog.getChild('list')
- xChild = xList.getChild(str(i))
+ xList = xDialog.getChild('list')
+ xChild = xList.getChild(str(i))
- xChild.executeAction("SELECT", tuple())
+ xChild.executeAction("SELECT", tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
index e6436b73fd73..8f6fc8951a6b 100644
--- a/sw/qa/uitest/writer_tests2/tdf116474.py
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -24,14 +24,11 @@ class tdf116474(UITestCase):
#select image
document.getCurrentController().select(document.getDrawPage()[0])
- self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption
- xDialogCaption = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertCaptionDialog") as xDialogCaption:
- xCapt = xDialogCaption.getChild("caption_edit")
- xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
- xOkBtn=xDialogCaption.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
xFrame = document.TextFrames[0]
self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py
index 9d3281456ca1..2ea73bccfc47 100644
--- a/sw/qa/uitest/writer_tests3/autoredactDialog.py
+++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py
@@ -14,13 +14,6 @@ class AutoRedactDialog(UITestCase):
add_target_counter = 0
- # Open the Auto Redact Dialog
- def launch_and_get_autoredact_dialog(self):
- self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc")
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertTrue(xDialog is not None)
- return xDialog
-
def getText(self, xObj):
return get_state_as_dict(xObj)["Text"]
@@ -44,131 +37,114 @@ class AutoRedactDialog(UITestCase):
# Verify
self.assertEqual(len(xTargetsListbox.getChildren()), 0)
-
- def test_open_AutoRedactDialog_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
- xDialog = self.launch_and_get_autoredact_dialog()
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
- self.ui_test.close_doc()
-
def test_add_target(self):
self.ui_test.create_doc_in_start_center("writer")
- xDialog = self.launch_and_get_autoredact_dialog()
- xAddBtn = xDialog.getChild("add")
-
- # Make sure we are starting with an empty targets list
- self.clearTargetsbox(xDialog)
-
- # Names need to be distinct
- # ["target name", "target content"],
- targets_list = [
- ["target1", "content1"],
- ["target2", "content2"],
- ["target3", "content3"],
- ]
-
- for i in range(0, len(targets_list)):
- self.add_target_counter = i
- 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")
- targets_box_state_dict = get_state_as_dict(xTargetsListbox)
- self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
-
- # Make sure targets are added with correct names and contents
- for i in range(0, len(targets_list)):
- child = xTargetsListbox.getChild(i)
- child_text = self.parseTargetContent(child)
- self.assertEqual(child_text[0], targets_list[i][0]) #name
- self.assertEqual(child_text[2], targets_list[i][1]) #content
-
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xAddBtn = xDialog.getChild("add")
+
+ # Make sure we are starting with an empty targets list
+ self.clearTargetsbox(xDialog)
+
+ # Names need to be distinct
+ # ["target name", "target content"],
+ targets_list = [
+ ["target1", "content1"],
+ ["target2", "content2"],
+ ["target3", "content3"],
+ ]
+
+ for i in range(0, len(targets_list)):
+ self.add_target_counter = i
+ 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")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
+
+ # Make sure targets are added with correct names and contents
+ for i in range(0, len(targets_list)):
+ child = xTargetsListbox.getChild(i)
+ child_text = self.parseTargetContent(child)
+ self.assertEqual(child_text[0], targets_list[i][0]) #name
+ self.assertEqual(child_text[2], targets_list[i][1]) #content
# Now let's make sure the dialog remembers last state
- xDialog = self.launch_and_get_autoredact_dialog()
- xTargetsListbox = xDialog.getChild("targets")
- targets_box_state_dict = get_state_as_dict(xTargetsListbox)
- self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
-
- # Make sure targets are remembered with correct names and contents
- for i in range(0, len(targets_list)):
- child = xTargetsListbox.getChild(i)
- child_text = self.parseTargetContent(child)
- self.assertEqual(child_text[0], targets_list[i][0]) #name
- self.assertEqual(child_text[2], targets_list[i][1]) #content
-
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
+
+ # Make sure targets are remembered with correct names and contents
+ for i in range(0, len(targets_list)):
+ child = xTargetsListbox.getChild(i)
+ child_text = self.parseTargetContent(child)
+ self.assertEqual(child_text[0], targets_list[i][0]) #name
+ self.assertEqual(child_text[2], targets_list[i][1]) #content
self.ui_test.close_doc()
def test_edit_target(self):
self.ui_test.create_doc_in_start_center("writer")
- xDialog = self.launch_and_get_autoredact_dialog()
- xAddBtn = xDialog.getChild("add")
- xEditBtn = xDialog.getChild("edit")
-
- # Make sure we are starting with an empty targets list
- self.clearTargetsbox(xDialog)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xAddBtn = xDialog.getChild("add")
+ xEditBtn = xDialog.getChild("edit")
- # We first need to add a target so that we can edit it
- 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
+ # Make sure we are starting with an empty targets list
+ self.clearTargetsbox(xDialog)
- select_pos(xTypeList, 0) #Text
- self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
+ # We first need to add a target so that we can edit it
+ 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
- type_text(xNewNameTxt, "TestTarget")
- type_text(xNewContentTxt, "TestContent")
+ select_pos(xTypeList, 0) #Text
+ self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
- # Make sure target is added successfully
- xTargetsListbox = xDialog.getChild("targets")
- targets_box_state_dict = get_state_as_dict(xTargetsListbox)
- self.assertEqual(int(targets_box_state_dict["Children"]), 1)
+ type_text(xNewNameTxt, "TestTarget")
+ type_text(xNewContentTxt, "TestContent")
- # Select the added target
- target_entry = xTargetsListbox.getChild(0)
- target_entry.executeAction("SELECT", tuple())
+ # Make sure target is added successfully
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), 1)
- # Now edit the target
- with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
- xNameTxt=dialog.getChild("name")
- xContentTxt=dialog.getChild("content")
+ # Select the added target
+ target_entry = xTargetsListbox.getChild(0)
+ target_entry.executeAction("SELECT", tuple())
- xNameTxt.executeAction("CLEAR", tuple())
- xContentTxt.executeAction("CLEAR", tuple())
+ # Now edit the target
+ with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xNameTxt=dialog.getChild("name")
+ xContentTxt=dialog.getChild("content")
- type_text(xNameTxt, "TestTargetEdited")
- type_text(xContentTxt, "TestContentEdited")
+ xNameTxt.executeAction("CLEAR", tuple())
+ xContentTxt.executeAction("CLEAR", tuple())
- # Make sure target is still there
- xTargetsListbox = xDialog.getChild("targets")
- targets_box_state_dict = get_state_as_dict(xTargetsListbox)
- self.assertEqual(int(targets_box_state_dict["Children"]), 1)
+ type_text(xNameTxt, "TestTargetEdited")
+ type_text(xContentTxt, "TestContentEdited")
- # Make sure target has the new values
- target_entry = xTargetsListbox.getChild(0)
- target_text = self.parseTargetContent(target_entry)
- self.assertEqual(target_text[0], "TestTargetEdited") #name
- self.assertEqual(target_text[2], "TestContentEdited") #content
+ # Make sure target is still there
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), 1)
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
+ # Make sure target has the new values
+ target_entry = xTargetsListbox.getChild(0)
+ target_text = self.parseTargetContent(target_entry)
+ self.assertEqual(target_text[0], "TestTargetEdited") #name
+ self.assertEqual(target_text[2], "TestContentEdited") #content
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py
index ca97fbe4e10e..3e9a9cbf9fd7 100644
--- a/sw/qa/uitest/writer_tests3/customizeDialog.py
+++ b/sw/qa/uitest/writer_tests3/customizeDialog.py
@@ -16,76 +16,67 @@ class ConfigureDialog(UITestCase):
def test_open_ConfigureDialog_writer(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xcancBtn = xDialog.getChild("cancel")
- xcancBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConfigureDialog", close_button="cancel"):
+ pass
self.ui_test.close_doc()
def test_search_filter(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConfigureDialog", close_button="cancel") as xDialog:
- xfunc = xDialog.getChild("functions")
- xSearch = xDialog.getChild("searchEntry")
+ xfunc = xDialog.getChild("functions")
+ xSearch = xDialog.getChild("searchEntry")
- initialEntryCount = get_state_as_dict(xfunc)["Children"]
- self.assertTrue(initialEntryCount != 0)
+ initialEntryCount = get_state_as_dict(xfunc)["Children"]
+ self.assertTrue(initialEntryCount != 0)
- xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"}))
+ xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"}))
- # Wait for the search/filter op to be completed
- timeout = time.time() + 1
- while time.time() < timeout:
- filteredEntryCount = get_state_as_dict(xfunc)["Children"]
- if filteredEntryCount != initialEntryCount:
- break
- time.sleep(0.1)
+ # Wait for the search/filter op to be completed
+ timeout = time.time() + 1
+ while time.time() < timeout:
+ filteredEntryCount = get_state_as_dict(xfunc)["Children"]
+ if filteredEntryCount != initialEntryCount:
+ break
+ time.sleep(0.1)
- self.assertTrue(filteredEntryCount < initialEntryCount)
+ self.assertTrue(filteredEntryCount < initialEntryCount)
- xSearch.executeAction("CLEAR", tuple())
+ xSearch.executeAction("CLEAR", tuple())
- # Wait for the search/filter op to be completed
- timeout = time.time() + 1
- while time.time() < timeout:
- finalEntryCount = get_state_as_dict(xfunc)["Children"]
- if finalEntryCount != filteredEntryCount:
- break
- time.sleep(0.1)
+ # Wait for the search/filter op to be completed
+ timeout = time.time() + 1
+ while time.time() < timeout:
+ finalEntryCount = get_state_as_dict(xfunc)["Children"]
+ if finalEntryCount != filteredEntryCount:
+ break
+ time.sleep(0.1)
- self.assertEqual(initialEntryCount, finalEntryCount)
+ self.assertEqual(initialEntryCount, finalEntryCount)
- xcancBtn = xDialog.getChild("cancel") #button Cancel
- xcancBtn.executeAction("CLICK", tuple()) #click the button
self.ui_test.close_doc()
def test_category_listbox(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConfigureDialog", close_button="cancel") as xDialog:
- xFunc = xDialog.getChild("functions")
- xCategory = xDialog.getChild("commandcategorylist")
+ xFunc = xDialog.getChild("functions")
+ xCategory = xDialog.getChild("commandcategorylist")
- initialEntryCount = get_state_as_dict(xFunc)["Children"]
- self.assertTrue(initialEntryCount != 0)
+ initialEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertTrue(initialEntryCount != 0)
- select_pos(xCategory, "1")
- filteredEntryCount = get_state_as_dict(xFunc)["Children"]
- self.assertTrue(filteredEntryCount < initialEntryCount)
+ select_pos(xCategory, "1")
+ filteredEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertTrue(filteredEntryCount < initialEntryCount)
- select_pos(xCategory, "0")
- finalEntryCount = get_state_as_dict(xFunc)["Children"]
- self.assertEqual(initialEntryCount, finalEntryCount)
+ select_pos(xCategory, "0")
+ finalEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertEqual(initialEntryCount, finalEntryCount)
- xcancBtn = xDialog.getChild("cancel") #button Cancel
- xcancBtn.executeAction("CLICK", tuple()) #click the button
self.ui_test.close_doc()
@@ -96,38 +87,30 @@ class ConfigureDialog(UITestCase):
# Without the fix in place, calling customize dialog after inserting
# a formula object would crash
- self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xcancBtn = xDialog.getChild("cancel")
- xcancBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConfigureDialog", close_button="cancel"):
+ pass
self.ui_test.close_doc()
def test_gear_button_menu(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConfigureDialog", close_button="cancel") as xDialog:
- # 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" }))
- with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"):
- pass
+ # Open the New Menu Dialog with id = 0
+ xmenugearbtn=xDialog.getChild("menugearbtn")
+ def show_dialog0():
+ xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" }))
+ 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"}))
- with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"):
- pass
+ # Open the Rename Menu Dialog with id = 2
+ xmenugearbtn=xDialog.getChild("menugearbtn")
+ def show_dialog2():
+ xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"}))
+ with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"):
+ pass
- xDialog = self.xUITest.getTopFocusWindow()
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests3/goToPage.py b/sw/qa/uitest/writer_tests3/goToPage.py
index 4d46a0740c53..3a6220fa2a27 100644
--- a/sw/qa/uitest/writer_tests3/goToPage.py
+++ b/sw/qa/uitest/writer_tests3/goToPage.py
@@ -14,29 +14,21 @@ class GoToPage_dialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
# check cancel button
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:GotoPage", close_button="cancel"):
+ pass
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
index be48fa6a750d..890cb10fb7cf 100644
--- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -21,31 +21,28 @@ class HyperlinkDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
MainWindow = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:HyperlinkDialog", close_button="cancel") as xDialog:
- # Test the vertical tab
- xtab=xDialog.getChild("tabcontrol")
- self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4")
+ # Test the vertical tab
+ xtab=xDialog.getChild("tabcontrol")
+ self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4")
- xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"}))
- self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet")
- self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0")
+ xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"}))
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0")
- xtab.executeAction("SELECT", mkPropertyValues({"POS": "1"}))
- self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail")
- self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1")
+ xtab.executeAction("SELECT", mkPropertyValues({"POS": "1"}))
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1")
- xtab.executeAction("SELECT", mkPropertyValues({"POS": "2"}))
- self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document")
- self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2")
+ xtab.executeAction("SELECT", mkPropertyValues({"POS": "2"}))
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2")
- xtab.executeAction("SELECT", mkPropertyValues({"POS": "3"}))
- self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document")
- self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3")
+ xtab.executeAction("SELECT", mkPropertyValues({"POS": "3"}))
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3")
- xcancel = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancel)
self.ui_test.close_doc()
@@ -54,23 +51,20 @@ class HyperlinkDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
xMainWindow = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:HyperlinkDialog") as xDialog:
- # insert link
- xtab=xDialog.getChild("tabcontrol")
- xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"}))
+ # insert link
+ xtab=xDialog.getChild("tabcontrol")
+ xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"}))
- xtarget = xDialog.getChild("target")
- xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"}))
- self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/")
+ xtarget = xDialog.getChild("target")
+ xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"}))
+ self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/")
- xindication = xDialog.getChild("indication")
- xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"}))
- self.assertEqual(get_state_as_dict(xindication)["Text"], "link")
+ xindication = xDialog.getChild("indication")
+ xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"}))
+ self.assertEqual(get_state_as_dict(xindication)["Text"], "link")
- xok = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
# Check that the link is added
xMainWindow = self.xUITest.getTopFocusWindow()
@@ -99,15 +93,14 @@ class HyperlinkDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xHelp = xDialog.getChild("help")
- xHelp.executeAction('FOCUS', tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:HyperlinkDialog", close_button="") as xDialog:
+ xHelp = xDialog.getChild("help")
+ xHelp.executeAction('FOCUS', tuple())
- # Without the fix in place, this test would have crashed here
- with self.ui_test.execute_blocking_action(xHelp.executeAction,
- args=("CLICK", tuple()), close_button="cancel"):
- pass
+ # Without the fix in place, this test would have crashed here
+ 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_tests3/insertEnvelope.py b/sw/qa/uitest/writer_tests3/insertEnvelope.py
index 0b5a8cfe99fb..a0cf97cd22f9 100644
--- a/sw/qa/uitest/writer_tests3/insertEnvelope.py
+++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py
@@ -16,34 +16,24 @@ class WriterInsertEnvelope(UITestCase):
def test_insert_envelope(self):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xAddrTxt= xDialog.getChild("addredit")
- xSenderTxt = xDialog.getChild("senderedit")
- xSenderCheckBox = xDialog.getChild("sender")
-
- xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
- xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"}))
-
- xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
- xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"}))
-
- xInsBtn = xDialog.getChild("user")
- xInsBtn.executeAction("CLICK", tuple())
-
- self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope")
- xDialog = self.xUITest.getTopFocusWindow()
- xAddrTxt= xDialog.getChild("addredit")
- xSenderTxt = xDialog.getChild("senderedit")
- self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address")
- self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender")
-
- xcancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertEnvelope", close_button="user") as xDialog:
+ xAddrTxt= xDialog.getChild("addredit")
+ xSenderTxt = xDialog.getChild("senderedit")
+ xSenderCheckBox = xDialog.getChild("sender")
+
+ xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
+ xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"}))
+
+ xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
+ xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"}))
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertEnvelope", close_button="cancel") as xDialog:
+ xAddrTxt= xDialog.getChild("addredit")
+ xSenderTxt = xDialog.getChild("senderedit")
+ self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address")
+ self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
index 575abc9ab477..c5e3c8078870 100644
--- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
@@ -15,63 +15,48 @@ class insertFootEndnote(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
#Automatic - Footnote
- self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFootnoteDialog"):
+ pass
+
self.assertEqual(document.Footnotes.getCount(), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes.getCount(), 0)
#Automatic - Endnote
- self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xEndnote = xDialog.getChild("endnote")
- xEndnote.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFootnoteDialog") as xDialog:
+ xEndnote = xDialog.getChild("endnote")
+ xEndnote.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.Endnotes.getCount(), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
#Character - Footnote
- self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFootnoteDialog") as xDialog:
+ xChar = xDialog.getChild("character")
+ xChar.executeAction("CLICK", tuple())
+ xCharentry = xDialog.getChild("characterentry")
+ xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- xChar = xDialog.getChild("character")
- xChar.executeAction("CLICK", tuple())
- xCharentry = xDialog.getChild("characterentry")
- xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.Footnotes.getCount(), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes.getCount(), 0)
#Character - Endnote
- self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xChar = xDialog.getChild("character")
- xChar.executeAction("CLICK", tuple())
- xCharentry = xDialog.getChild("characterentry")
- xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFootnoteDialog") as xDialog:
+ xChar = xDialog.getChild("character")
+ xChar.executeAction("CLICK", tuple())
+ xCharentry = xDialog.getChild("characterentry")
+ xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- xEndnote = xDialog.getChild("endnote")
- xEndnote.executeAction("CLICK", tuple())
+ xEndnote = xDialog.getChild("endnote")
+ xEndnote.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.Endnotes.getCount(), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
#Cancel button
- self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFootnoteDialog", close_button="cancel"):
+ pass
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertPageFooter.py b/sw/qa/uitest/writer_tests3/insertPageFooter.py
index 4bec545965f0..034952077d17 100644
--- a/sw/qa/uitest/writer_tests3/insertPageFooter.py
+++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py
@@ -27,13 +27,9 @@ class WriterInsertPageFooter(UITestCase):
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
- self.ui_test.execute_dialog_through_command(
- ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(
+ ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
@@ -52,12 +48,8 @@ class WriterInsertPageFooter(UITestCase):
self.insert_footer()
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
-
- xInsertDlg = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xInsertDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
document = self.ui_test.get_component()
diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
index 26bb21b89159..be74dc6d2355 100644
--- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
+++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
@@ -16,32 +16,26 @@ class insertQrCode(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# cancel the dialog without doing anything
- self.ui_test.execute_dialog_through_command(".uno:InsertQrCode")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertQrCode", close_button="cancel") as xDialog:
- xURL = xDialog.getChild("edit_text")
- type_text(xURL, "www.libreoffice.org")
+ xURL = xDialog.getChild("edit_text")
+ type_text(xURL, "www.libreoffice.org")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
with self.assertRaises(IndexOutOfBoundsException):
document.DrawPage.getByIndex(0)
# Reopen the dialog box
- self.ui_test.execute_dialog_through_command(".uno:InsertQrCode")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertQrCode") as xDialog:
- # Get elements in the Dialog Box
- xURL = xDialog.getChild("edit_text")
- xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text.
- xBorder = xDialog.getChild("edit_margin")
+ # Get elements in the Dialog Box
+ xURL = xDialog.getChild("edit_text")
+ xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text.
+ xBorder = xDialog.getChild("edit_margin")
- type_text(xURL, "www.libreoffice.org") #set the QR code
- xECC_Low.executeAction("CLICK", tuple())
- xBorder.executeAction("UP", tuple())
- xBorder.executeAction("DOWN", tuple())
- xOKBtn = xDialog.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
+ type_text(xURL, "www.libreoffice.org") #set the QR code
+ xECC_Low.executeAction("CLICK", tuple())
+ xBorder.executeAction("UP", tuple())
+ xBorder.executeAction("DOWN", tuple())
# check the QR code in the document
self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org")
@@ -55,19 +49,16 @@ class insertQrCode(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:InsertQrCode")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertQrCode") as xDialog:
- xURL = xDialog.getChild("edit_text")
- xECC_Low = xDialog.getChild("button_low")
- xBorder = xDialog.getChild("edit_margin")
+ xURL = xDialog.getChild("edit_text")
+ xECC_Low = xDialog.getChild("button_low")
+ xBorder = xDialog.getChild("edit_margin")
- type_text(xURL, "www.libreoffice.org") #set the QR code
- xECC_Low.executeAction("CLICK", tuple())
- xBorder.executeAction("UP", tuple())
- xBorder.executeAction("DOWN", tuple())
- xOKBtn = xDialog.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
+ type_text(xURL, "www.libreoffice.org") #set the QR code
+ xECC_Low.executeAction("CLICK", tuple())
+ xBorder.executeAction("UP", tuple())
+ xBorder.executeAction("DOWN", tuple())
#check the QR Code in the document
self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org")
diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
index ecfc1c61a1d2..7c44f2253d39 100644
--- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py
+++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
@@ -16,34 +16,28 @@ class insertSignatureLine(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# cancel the dialog without doing anything
- self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSignatureLine", close_button="cancel") as xDialog:
- xName = xDialog.getChild("edit_name")
- xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+ xName = xDialog.getChild("edit_name")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
with self.assertRaises(IndexOutOfBoundsException):
document.DrawPage.getByIndex(0)
# set the signature line
- self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xName = xDialog.getChild("edit_name")
- xTitle = xDialog.getChild("edit_title")
- xEmail = xDialog.getChild("edit_email")
- xComment = xDialog.getChild("checkbox_can_add_comments")
- xInstructions = xDialog.getChild("edit_instructions")
-
- xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
- xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
- xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
- xComment.executeAction("CLICK", tuple())
- xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
- xOKBtn = xDialog.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSignatureLine") as xDialog:
+
+ xName = xDialog.getChild("edit_name")
+ xTitle = xDialog.getChild("edit_title")
+ xEmail = xDialog.getChild("edit_email")
+ xComment = xDialog.getChild("checkbox_can_add_comments")
+ xInstructions = xDialog.getChild("edit_instructions")
+
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+ xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
+ xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
+ xComment.executeAction("CLICK", tuple())
+ xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
#check the signature Line in the document
element = document.DrawPage.getByIndex(0)
@@ -62,24 +56,21 @@ class insertSignatureLine(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xName = xDialog.getChild("edit_name")
- xTitle = xDialog.getChild("edit_title")
- xEmail = xDialog.getChild("edit_email")
- xComment = xDialog.getChild("checkbox_can_add_comments")
- xDate = xDialog.getChild("checkbox_show_sign_date")
- xInstructions = xDialog.getChild("edit_instructions")
-
- xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
- xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
- xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
- xDate.executeAction("CLICK", tuple())
- xComment.executeAction("CLICK", tuple())
- xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
- xOKBtn = xDialog.getChild("ok")
- xOKBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSignatureLine") as xDialog:
+
+ xName = xDialog.getChild("edit_name")
+ xTitle = xDialog.getChild("edit_title")
+ xEmail = xDialog.getChild("edit_email")
+ xComment = xDialog.getChild("checkbox_can_add_comments")
+ xDate = xDialog.getChild("checkbox_show_sign_date")
+ xInstructions = xDialog.getChild("edit_instructions")
+
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+ xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
+ xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
+ xDate.executeAction("CLICK", tuple())
+ xComment.executeAction("CLICK", tuple())
+ xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
#check the signature Line in the document
element = document.DrawPage.getByIndex(0)
diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py
index ec51b4132f80..20e77a30db7c 100644
--- a/sw/qa/uitest/writer_tests3/lineNumbering.py
+++ b/sw/qa/uitest/writer_tests3/lineNumbering.py
@@ -19,82 +19,73 @@ class WriterLineNumbering(UITestCase):
change_measurement_unit(self, "Centimeter")
- self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xshownumbering = xDialog.getChild("shownumbering")
- xstyledropdown = xDialog.getChild("styledropdown")
- xformatdropdown = xDialog.getChild("formatdropdown")
- xpositiondropdown = xDialog.getChild("positiondropdown")
- xspacingspin = xDialog.getChild("spacingspin")
- xintervalspin = xDialog.getChild("intervalspin")
- xtextentry = xDialog.getChild("textentry")
- xlinesspin = xDialog.getChild("linesspin")
- xblanklines = xDialog.getChild("blanklines")
- xlinesintextframes = xDialog.getChild("linesintextframes")
- xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
- xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:LineNumberingDialog") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xstyledropdown = xDialog.getChild("styledropdown")
+ xformatdropdown = xDialog.getChild("formatdropdown")
+ xpositiondropdown = xDialog.getChild("positiondropdown")
+ xspacingspin = xDialog.getChild("spacingspin")
+ xintervalspin = xDialog.getChild("intervalspin")
+ xtextentry = xDialog.getChild("textentry")
+ xlinesspin = xDialog.getChild("linesspin")
+ xblanklines = xDialog.getChild("blanklines")
+ xlinesintextframes = xDialog.getChild("linesintextframes")
+ xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
+ xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
- xshownumbering.executeAction("CLICK", tuple())
- select_by_text(xstyledropdown, "Bullets")
- select_by_text(xformatdropdown, "A, B, C, ...")
- select_by_text(xpositiondropdown, "Right")
- xspacingspin.executeAction("UP", tuple())
- xintervalspin.executeAction("UP", tuple())
- xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
- xlinesspin.executeAction("UP", tuple())
- xblanklines.executeAction("CLICK", tuple())
- xlinesintextframes.executeAction("CLICK", tuple())
- xshowfooterheadernumbering.executeAction("CLICK", tuple())
- xrestarteverynewpage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xshownumbering.executeAction("CLICK", tuple())
+ select_by_text(xstyledropdown, "Bullets")
+ select_by_text(xformatdropdown, "A, B, C, ...")
+ select_by_text(xpositiondropdown, "Right")
+ xspacingspin.executeAction("UP", tuple())
+ xintervalspin.executeAction("UP", tuple())
+ xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
+ xlinesspin.executeAction("UP", tuple())
+ xblanklines.executeAction("CLICK", tuple())
+ xlinesintextframes.executeAction("CLICK", tuple())
+ xshowfooterheadernumbering.executeAction("CLICK", tuple())
+ xrestarteverynewpage.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xshownumbering = xDialog.getChild("shownumbering")
- xstyledropdown = xDialog.getChild("styledropdown")
- xformatdropdown = xDialog.getChild("formatdropdown")
- xpositiondropdown = xDialog.getChild("positiondropdown")
- xspacingspin = xDialog.getChild("spacingspin")
- xintervalspin = xDialog.getChild("intervalspin")
- xtextentry = xDialog.getChild("textentry")
- xlinesspin = xDialog.getChild("linesspin")
- xblanklines = xDialog.getChild("blanklines")
- xlinesintextframes = xDialog.getChild("linesintextframes")
- xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
- xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:LineNumberingDialog", close_button="cancel") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xstyledropdown = xDialog.getChild("styledropdown")
+ xformatdropdown = xDialog.getChild("formatdropdown")
+ xpositiondropdown = xDialog.getChild("positiondropdown")
+ xspacingspin = xDialog.getChild("spacingspin")
+ xintervalspin = xDialog.getChild("intervalspin")
+ xtextentry = xDialog.getChild("textentry")
+ xlinesspin = xDialog.getChild("linesspin")
+ xblanklines = xDialog.getChild("blanklines")
+ xlinesintextframes = xDialog.getChild("linesintextframes")
+ xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
+ xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
- self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets")
- self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...")
- self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right")
- self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm")
- self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6")
- self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";")
- self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4")
- self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true")
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...")
+ self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right")
+ self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm")
+ self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6")
+ self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";")
+ self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true")
self.ui_test.close_doc()
def test_tdf86185(self):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xshownumbering = xDialog.getChild("shownumbering")
- xformatdropdown = xDialog.getChild("formatdropdown")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:LineNumberingDialog", close_button="cancel") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xformatdropdown = xDialog.getChild("formatdropdown")
- xshownumbering.executeAction("CLICK", tuple())
- itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."]
- for i in range(6):
- select_by_text(xformatdropdown, itemFormat[i])
- self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i])
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xshownumbering.executeAction("CLICK", tuple())
+ itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."]
+ for i in range(6):
+ select_by_text(xformatdropdown, itemFormat[i])
+ self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i])
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py
index 942aa6d2e96f..196876ed1e01 100644
--- a/sw/qa/uitest/writer_tests3/pageDialog.py
+++ b/sw/qa/uitest/writer_tests3/pageDialog.py
@@ -14,15 +14,6 @@ from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE
class WriterPageDialog(UITestCase):
- def launch_dialog_and_select_tab(self, tab):
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
-
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, str(tab))
-
- return xDialog
-
def click_button(self, dialog, button):
xButton = dialog.getChild(button)
xButton.executeAction("CLICK", tuple())
@@ -127,19 +118,18 @@ class WriterPageDialog(UITestCase):
buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
for index, button in enumerate(buttons):
- xDialog = self.launch_dialog_and_select_tab(2)
-
- self.click_button(xDialog, button)
-
- self.click_button(xDialog, 'ok')
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+ self.click_button(xDialog, button)
self.check_default_area(button)
- xDialog = self.launch_dialog_and_select_tab(2)
-
- self.click_button(xDialog, 'btnnone')
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
- self.click_button(xDialog, 'ok')
+ self.click_button(xDialog, 'btnnone')
self.check_default_area('btnnone')
@@ -157,15 +147,14 @@ class WriterPageDialog(UITestCase):
for i in range(30):
with self.subTest(i=i):
- xDialog = self.launch_dialog_and_select_tab(1)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ xFormatList = xDialog.getChild("comboPageFormat")
+ select_pos(xFormatList, str(i))
- xFormatList = xDialog.getChild("comboPageFormat")
- select_pos(xFormatList, str(i))
-
- self.assertEqual(
- get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i])
-
- self.click_button(xDialog, 'ok')
+ self.assertEqual(
+ get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i])
self.ui_test.close_doc()
@@ -178,20 +167,18 @@ class WriterPageDialog(UITestCase):
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
- xDialog = self.launch_dialog_and_select_tab(1)
-
- self.click_button(xDialog, 'radiobuttonLandscape')
-
- self.click_button(xDialog, 'ok')
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ self.click_button(xDialog, 'radiobuttonLandscape')
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.IsLandscape, True)
- xDialog = self.launch_dialog_and_select_tab(1)
-
- self.click_button(xDialog, 'radiobuttonPortrait')
-
- self.click_button(xDialog, 'ok')
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ self.click_button(xDialog, 'radiobuttonPortrait')
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
@@ -209,15 +196,15 @@ class WriterPageDialog(UITestCase):
for i in range(4):
with self.subTest(i=i):
- xDialog = self.launch_dialog_and_select_tab(1)
-
- xTextDirectionList = xDialog.getChild("comboTextFlowBox")
- select_pos(xTextDirectionList, str(i))
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- self.assertEqual(
- get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i])
+ xTextDirectionList = xDialog.getChild("comboTextFlowBox")
+ select_pos(xTextDirectionList, str(i))
- self.click_button(xDialog, 'ok')
+ self.assertEqual(
+ get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i])
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.WritingMode, i)
@@ -227,10 +214,8 @@ class WriterPageDialog(UITestCase):
def test_cancel_button_page_dialog(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog", close_button="cancel") as xDialog:
+ pass
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py
index 2868c9f8a49e..948f8bbe0b99 100644
--- a/sw/qa/uitest/writer_tests3/sort.py
+++ b/sw/qa/uitest/writer_tests3/sort.py
@@ -25,12 +25,9 @@ class WriterSort(UITestCase):
selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
#Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xDown = xDialog.getChild("down1")
- xDown.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xDown.executeAction("CLICK", tuple())
#check
self.assertEqual(document.Text.String[0:1], "v")
@@ -48,19 +45,16 @@ class WriterSort(UITestCase):
selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
#Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xDown = xDialog.getChild("down1")
- xcolsb1 = xDialog.getChild("colsb1")
- xtypelb1 = xDialog.getChild("typelb1")
- xcharacter = xDialog.getChild("character")
- xseparator = xDialog.getChild("separator")
- xDown.executeAction("CLICK", tuple())
- select_by_text(xtypelb1, "Numerical")
- xcharacter.executeAction("CLICK", tuple())
- xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xcolsb1 = xDialog.getChild("colsb1")
+ xtypelb1 = xDialog.getChild("typelb1")
+ xcharacter = xDialog.getChild("character")
+ xseparator = xDialog.getChild("separator")
+ xDown.executeAction("CLICK", tuple())
+ select_by_text(xtypelb1, "Numerical")
+ xcharacter.executeAction("CLICK", tuple())
+ xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
#check
self.assertEqual(document.Text.String[0:5], "2;8;3")
diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py
index 20955856ba88..420a9c3fb630 100644
--- a/sw/qa/uitest/writer_tests3/specialCharacter.py
+++ b/sw/qa/uitest/writer_tests3/specialCharacter.py
@@ -21,70 +21,64 @@ class specialCharacter(UITestCase):
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") # specialCharacter dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xCharSet = xDialog.getChild("showcharset") # default charset
-
- xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected
-
- xHexText = xDialog.getChild("hexvalue")
- xDecText = xDialog.getChild("decimalvalue")
-
- self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal
- self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
-
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xComboFont = xDialog.getChild("fontlb")
- select_pos(xComboFont, "0") # select font
- xComboFont2 = xDialog.getChild("subsetlb")
- select_pos(xComboFont2, "0") # select font subset
-
- xSearchText = xDialog.getChild("search") # test search textBox
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "d"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "g"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": " "}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "f"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "o"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "u"}))
- xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "r"}))
-
- # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64.
- # Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font.
- # Therefore, if the font is not available or not selected by default the test fails.
- # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset
- # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result;
- # sleep(1) #try sleep here
- # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit
- ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34'
-
- # xHexText = xDialog.getChild("hexvalue")
- # xDecText = xDialog.getChild("decimalvalue")
- # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4
- # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
-
- # xAddFavBtn = xDialog.getChild("favbtn")
- # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button
-
- # xInsrBtn = xDialog.getChild("insert")
- # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
-
- # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
-
- # self.xUITest.executeCommand(".uno:Undo")
- # self.xUITest.executeCommand(".uno:Redo") #undo, redo
-
- # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo
-
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSymbol", close_button="cancel") as xDialog:
+ xCharSet = xDialog.getChild("showcharset") # default charset
+
+ xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected
+
+ xHexText = xDialog.getChild("hexvalue")
+ xDecText = xDialog.getChild("decimalvalue")
+
+ self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal
+ self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
+
+
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSymbol", close_button="cancel") as xDialog:
+
+ xComboFont = xDialog.getChild("fontlb")
+ select_pos(xComboFont, "0") # select font
+ xComboFont2 = xDialog.getChild("subsetlb")
+ select_pos(xComboFont2, "0") # select font subset
+
+ xSearchText = xDialog.getChild("search") # test search textBox
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "d"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "g"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": " "}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "f"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "o"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "u"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "r"}))
+
+ # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64.
+ # Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font.
+ # Therefore, if the font is not available or not selected by default the test fails.
+ # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset
+ # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result;
+ # sleep(1) #try sleep here
+ # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit
+ ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34'
+
+ # xHexText = xDialog.getChild("hexvalue")
+ # xDecText = xDialog.getChild("decimalvalue")
+ # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4
+ # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
+
+ # xAddFavBtn = xDialog.getChild("favbtn")
+ # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button
+
+ # xInsrBtn = xDialog.getChild("insert")
+ # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
+
+ # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
+
+ # self.xUITest.executeCommand(".uno:Undo")
+ # self.xUITest.executeCommand(".uno:Redo") #undo, redo
+
+ # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/tdf79236.py b/sw/qa/uitest/writer_tests3/tdf79236.py
index bd3862b5e27a..1f9089d11499 100644
--- a/sw/qa/uitest/writer_tests3/tdf79236.py
+++ b/sw/qa/uitest/writer_tests3/tdf79236.py
@@ -30,35 +30,32 @@ class tdf79236(UITestCase):
self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xParagraphDlg:
- xParagraphDlg = self.xUITest.getTopFocusWindow()
- xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
- for _ in range(0,20):
- xLeftSpnBtn.executeAction("UP", tuple())
+ xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
+ for _ in range(0,20):
+ xLeftSpnBtn.executeAction("UP", tuple())
- xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
- for _ in range(0,20):
- xRightSpnBtn.executeAction("UP", tuple())
+ xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
+ for _ in range(0,20):
+ xRightSpnBtn.executeAction("UP", tuple())
- xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
- for _ in range(0,20):
- xLineSpnBtn.executeAction("UP", tuple())
+ xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
+ for _ in range(0,20):
+ xLineSpnBtn.executeAction("UP", tuple())
- xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
- for _ in range(0,20):
- xBottomSpnBtn.executeAction("UP", tuple())
+ xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
+ for _ in range(0,20):
+ xBottomSpnBtn.executeAction("UP", tuple())
- xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
- for _ in range(0,20):
- xTopSpnBtn.executeAction("UP", tuple())
+ xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
+ for _ in range(0,20):
+ xTopSpnBtn.executeAction("UP", tuple())
- xOkBtn = xParagraphDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
@@ -66,33 +63,30 @@ class tdf79236(UITestCase):
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
- self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ParagraphDialog") as xParagraphDlg:
- xParagraphDlg = self.xUITest.getTopFocusWindow()
- xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
- for _ in range(0,20):
- xLeftSpnBtn.executeAction("DOWN", tuple())
+ xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
+ for _ in range(0,20):
+ xLeftSpnBtn.executeAction("DOWN", tuple())
- xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
- for _ in range(0,20):
- xRightSpnBtn.executeAction("DOWN", tuple())
+ xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
+ for _ in range(0,20):
+ xRightSpnBtn.executeAction("DOWN", tuple())
- xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
- for _ in range(0,20):
- xLineSpnBtn.executeAction("DOWN", tuple())
+ xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
+ for _ in range(0,20):
+ xLineSpnBtn.executeAction("DOWN", tuple())
- xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
- for _ in range(0,20):
- xBottomSpnBtn.executeAction("DOWN", tuple())
+ xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
+ for _ in range(0,20):
+ xBottomSpnBtn.executeAction("DOWN", tuple())
- xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
- for _ in range(0,20):
- xTopSpnBtn.executeAction("DOWN", tuple())
+ xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
+ for _ in range(0,20):
+ xTopSpnBtn.executeAction("DOWN", tuple())
- xOkBtn = xParagraphDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
index 6dda5b2fcf94..f0c4101501f8 100644
--- a/sw/qa/uitest/writer_tests4/insertBreakDialog.py
+++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
@@ -9,16 +9,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class WriterInsertBreakDialog(UITestCase):
- def launch_dialog_and_select_option(self, child):
-
- self.ui_test.execute_dialog_through_command(".uno:InsertBreak")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOption = xDialog.getChild(child)
- xOption.executeAction("CLICK", tuple())
-
- return xDialog
-
def getPages(self, total):
document = self.ui_test.get_component()
@@ -28,9 +18,9 @@ class WriterInsertBreakDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- xDialog = self.launch_dialog_and_select_option("linerb")
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("linerb")
+ xOption.executeAction("CLICK", tuple())
self.getPages(1)
@@ -40,9 +30,9 @@ class WriterInsertBreakDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- xDialog = self.launch_dialog_and_select_option("columnrb")
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("columnrb")
+ xOption.executeAction("CLICK", tuple())
self.getPages(1)
@@ -54,13 +44,13 @@ class WriterInsertBreakDialog(UITestCase):
for i in range(9):
with self.subTest(i=i):
- xDialog = self.launch_dialog_and_select_option("pagerb")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBreak") as xDialog:
- xStyleList = xDialog.getChild("stylelb")
- xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)}))
+ xOption = xDialog.getChild("pagerb")
+ xOption.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xStyleList = xDialog.getChild("stylelb")
+ xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)}))
self.getPages(i + 2)
@@ -70,10 +60,8 @@ class WriterInsertBreakDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertBreak")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertBreak", close_button="cancel"):
+ pass
self.getPages(1)
diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py
index 245073ace5a5..42c2df3d84fc 100644
--- a/sw/qa/uitest/writer_tests4/insertPageHeader.py
+++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py
@@ -26,13 +26,9 @@ class WriterInsertPageHeader(UITestCase):
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
- self.ui_test.execute_dialog_through_command(
- ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
@@ -51,12 +47,8 @@ class WriterInsertPageHeader(UITestCase):
self.insert_header()
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
-
- xInsertDlg = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xInsertDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
document = self.ui_test.get_component()
diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py
index 5e3f868f37ad..69ebc0b0b34d 100644
--- a/sw/qa/uitest/writer_tests4/tdf113252.py
+++ b/sw/qa/uitest/writer_tests4/tdf113252.py
@@ -18,20 +18,17 @@ class tdf113252(UITestCase):
xWriterEdit = xWriterDoc.getChild("writer_edit")
#Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
- self.ui_test.execute_dialog_through_command(".uno:MacroDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- #Click Button Organizer
- xorganize = xDialog.getChild("organize")
- 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 button Close in the next dialog -> crash.
-
- xClose = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xClose)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:MacroDialog", close_button="close") as xDialog:
+
+ #Click Button Organizer
+ xorganize = xDialog.getChild("organize")
+ 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 button Close in the next dialog -> crash.
+
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py
index 1edc923ebe28..2bd253f1ec8f 100644
--- a/sw/qa/uitest/writer_tests4/tdf113284.py
+++ b/sw/qa/uitest/writer_tests4/tdf113284.py
@@ -18,20 +18,15 @@ class tdf113284(UITestCase):
xToolkit.processEventsToIdle()
xPageCount = writer_doc.CurrentController.PageCount
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
xToolkit.processEventsToIdle()
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xCancBtn = xDiagIndex.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn) # close dialog
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditCurIndex", close_button="cancel"):
+ pass
#page count is not constant
#self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
diff --git a/sw/qa/uitest/writer_tests4/tdf115572.py b/sw/qa/uitest/writer_tests4/tdf115572.py
index 511da669ccc9..7abfcae3f365 100644
--- a/sw/qa/uitest/writer_tests4/tdf115572.py
+++ b/sw/qa/uitest/writer_tests4/tdf115572.py
@@ -19,10 +19,8 @@ class tdf115572(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -35,14 +33,11 @@ class tdf115572(UITestCase):
self.xUITest.executeCommand(".uno:GoLeft")
self.xUITest.executeCommand(".uno:GoLeft")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
@@ -51,10 +46,8 @@ class tdf115572(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -64,14 +57,11 @@ class tdf115572(UITestCase):
#delete column
self.xUITest.executeCommand(".uno:DeleteColumns")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf115573.py b/sw/qa/uitest/writer_tests4/tdf115573.py
index af22c155b21e..5e40d8c09420 100644
--- a/sw/qa/uitest/writer_tests4/tdf115573.py
+++ b/sw/qa/uitest/writer_tests4/tdf115573.py
@@ -19,10 +19,8 @@ class tdf115573(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -35,14 +33,11 @@ class tdf115573(UITestCase):
self.xUITest.executeCommand(".uno:GoUp")
self.xUITest.executeCommand(".uno:GoUp")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
@@ -51,10 +46,8 @@ class tdf115573(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -67,14 +60,11 @@ class tdf115573(UITestCase):
self.xUITest.executeCommand(".uno:GoUp")
self.xUITest.executeCommand(".uno:GoUp")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
@@ -83,10 +73,8 @@ class tdf115573(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -94,14 +82,11 @@ class tdf115573(UITestCase):
#insert column left
self.xUITest.executeCommand(".uno:InsertColumnsBefore")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
@@ -110,10 +95,8 @@ class tdf115573(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#insert table 2x2
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#select font format - Bold and write text "abc"
self.xUITest.executeCommand(".uno:Bold")
tables = document.getTextTables()
@@ -121,14 +104,11 @@ class tdf115573(UITestCase):
#insert column left
self.xUITest.executeCommand(".uno:InsertColumnsAfter")
#check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
- self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
- xCloseBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = xDialog.getChild("weststylelb-cjk")
+ self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py
index 0ef066eb372a..23c57ef6b64e 100644
--- a/sw/qa/uitest/writer_tests4/tdf122449.py
+++ b/sw/qa/uitest/writer_tests4/tdf122449.py
@@ -31,18 +31,13 @@ class tdf122449(UITestCase):
self.ui_test.close_dialog_through_button(xcloseBtn)
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
# invoke Index dialog Index entry .uno:IndexEntryDialog
- self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:IndexEntryDialog", close_button="close"):
+ pass
# close
# Go to page 2
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
# verify
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py
index 528fcda84911..4cbec4d3a49c 100644
--- a/sw/qa/uitest/writer_tests4/tdf138546.py
+++ b/sw/qa/uitest/writer_tests4/tdf138546.py
@@ -18,25 +18,19 @@ class tdf138546(UITestCase):
change_measurement_unit(self, "Centimeter")
#dialog Columns
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatColumns", close_button="cancel") as xDialog:
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "7") #Columns
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog", close_button="cancel") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "7") #Columns
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf51352.py b/sw/qa/uitest/writer_tests4/tdf51352.py
index fdc5c66b7e85..773f9518fa89 100644
--- a/sw/qa/uitest/writer_tests4/tdf51352.py
+++ b/sw/qa/uitest/writer_tests4/tdf51352.py
@@ -19,16 +19,12 @@ class tdf51352(UITestCase):
#1. New a text document
#2. Insert a table and then in one cell create another table
#-insert a table (by default 2x2)
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#-put the cursor inside first cell top left for example
#-insert an inner table (by default 2x2) inside this cell
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable"):
+ pass
#3. Select the first table
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
@@ -37,10 +33,8 @@ class tdf51352(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
self.assertEqual(document.TextTables.getCount(), 2)
#4. From menu "Table->Convert->Table to Text
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ConvertTableToText"):
+ pass
self.assertEqual(document.TextTables.getCount(), 0)
#5. Undo/Redo
self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
index c3a48302dc18..815de4f9dc2f 100644
--- a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -15,30 +15,24 @@ class dateFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# open the dialog again
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
+ itemsList = xDialog.getChild("date_formats_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_date_field_with_custom_format(self):
# open a file with a date form field
@@ -46,17 +40,14 @@ class dateFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_date_reformat(self):
# open a file with a date form field
@@ -65,21 +56,18 @@ class dateFormFieldDialog(UITestCase):
self.assertEqual(writer_doc.getText().getString(), "07/17/19")
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# after applying the new format, the field content should be updated
self.assertEqual(writer_doc.getText().getString(), "07-17")
@@ -91,21 +79,18 @@ class dateFormFieldDialog(UITestCase):
self.assertEqual(writer_doc.getText().getString(), "[select date]")
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# a placeholder text is not changed by format change
self.assertEqual(writer_doc.getText().getString(), "[select date]")
@@ -120,21 +105,18 @@ class dateFormFieldDialog(UITestCase):
self.assertEqual(writer_doc.getText().getString(), "07/17/19")
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- # select a new format
- itemsList.getChild("3").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
+ # select a new format
+ itemsList.getChild("3").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# a placeholder text is not changed by format change
self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
index 00bd01acf785..f37691efa313 100644
--- a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -17,53 +17,47 @@ class dropDownFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
# check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_remove_items(self):
@@ -72,74 +66,68 @@ class dropDownFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and remove it
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
-
- # check whether the right item was removed
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and remove it
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+
+ # check whether the right item was removed
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
# check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- # remove all items
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
+ # remove all items
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_move_items(self):
@@ -148,85 +136,79 @@ class dropDownFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- upButton = xDialog.getChild("up_button")
- downButton = xDialog.getChild("down_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and move it up
- itemsList.getChild("1").executeAction("SELECT", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
- upButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # move down the selected item
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ upButton = xDialog.getChild("up_button")
+ downButton = xDialog.getChild("down_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and move it up
+ itemsList.getChild("1").executeAction("SELECT", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+ upButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # move down the selected item
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
# check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
def test_drop_down_after_import(self):
@@ -237,21 +219,18 @@ class dropDownFormFieldDialog(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("items_treeview")
+ itemsList = xDialog.getChild("items_treeview")
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py
index 7005dbb65221..ab301efa0074 100644
--- a/sw/qa/uitest/writer_tests5/about_test.py
+++ b/sw/qa/uitest/writer_tests5/about_test.py
@@ -13,12 +13,8 @@ class AboutDlgTest(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:About")
-
- xAboutDlg = self.xUITest.getTopFocusWindow()
-
- xCloseBtn = xAboutDlg.getChild("btnClose")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:About", close_button="btnClose"):
+ pass
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
index 645a334187eb..828fdd26a661 100644
--- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py
+++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
@@ -16,84 +16,81 @@ class autocorrectOptions(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0") #tab replace
- origtext = xDialog.getChild("origtext")
- newtext = xDialog.getChild("newtext")
- xnew = xDialog.getChild("new")
- xdelete = xDialog.getChild("delete")
- xtabview = xDialog.getChild("tabview")
- xreset = xDialog.getChild("reset")
- nrRows = get_state_as_dict(xtabview)["VisibleCount"]
-
- self.assertTrue(int(nrRows) > 0)
-
- #add new rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xnew.executeAction("CLICK", tuple())
- nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
- nrRowsDiff = int(nrRowsNew) - int(nrRows)
- self.assertEqual(nrRowsDiff, 1) #we have +1 rule
- #delete rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xdelete.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
-
- select_pos(xTabs, "1") #tab Exceptions
- #abbreviations
- abbrev = xDialog.getChild("abbrev")
- newabbrev = xDialog.getChild("newabbrev")
- delabbrev = xDialog.getChild("delabbrev")
- abbrevlist = xDialog.getChild("abbrevlist")
-
- nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsAbb) > 0)
-
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
- newabbrev.executeAction("CLICK", tuple())
- nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
- nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
- self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
- delabbrev.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
-
- #words with two initial capitals
- double = xDialog.getChild("double")
- newdouble = xDialog.getChild("newdouble")
- deldouble = xDialog.getChild("deldouble")
- doublelist = xDialog.getChild("doublelist")
-
- nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsDouble) > 0)
-
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
- newdouble.executeAction("CLICK", tuple())
- nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
- nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
- self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
- deldouble.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
-
- xCancelButton = xDialog.getChild("cancel")
- xCancelButton.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab replace
+ origtext = xDialog.getChild("origtext")
+ newtext = xDialog.getChild("newtext")
+ xnew = xDialog.getChild("new")
+ xdelete = xDialog.getChild("delete")
+ xtabview = xDialog.getChild("tabview")
+ xreset = xDialog.getChild("reset")
+ nrRows = get_state_as_dict(xtabview)["VisibleCount"]
+
+ self.assertTrue(int(nrRows) > 0)
+
+ #add new rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xnew.executeAction("CLICK", tuple())
+ nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
+ nrRowsDiff = int(nrRowsNew) - int(nrRows)
+ self.assertEqual(nrRowsDiff, 1) #we have +1 rule
+ #delete rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xdelete.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
+
+ select_pos(xTabs, "1") #tab Exceptions
+ #abbreviations
+ abbrev = xDialog.getChild("abbrev")
+ newabbrev = xDialog.getChild("newabbrev")
+ delabbrev = xDialog.getChild("delabbrev")
+ abbrevlist = xDialog.getChild("abbrevlist")
+
+ nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsAbb) > 0)
+
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
+ newabbrev.executeAction("CLICK", tuple())
+ nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
+ nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
+ self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
+ delabbrev.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
+
+ #words with two initial capitals
+ double = xDialog.getChild("double")
+ newdouble = xDialog.getChild("newdouble")
+ deldouble = xDialog.getChild("deldouble")
+ doublelist = xDialog.getChild("doublelist")
+
+ nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsDouble) > 0)
+
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
+ newdouble.executeAction("CLICK", tuple())
+ nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
+ nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
+ self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
+ deldouble.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
+
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py
index 03ca73b083ad..172f4fbf4f0d 100644
--- a/sw/qa/uitest/writer_tests5/columns.py
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -19,35 +19,29 @@ class columns(UITestCase):
change_measurement_unit(self, "Centimeter")
#dialog Columns
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatColumns") as xDialog:
- colsnf = xDialog.getChild("colsnf")
- colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- colsnf.executeAction("UP", tuple())
- colsnf.executeAction("DOWN", tuple())
- spacing1mf = xDialog.getChild("spacing1mf")
- spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- autowidth = xDialog.getChild("autowidth")
- autowidth.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ colsnf = xDialog.getChild("colsnf")
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ colsnf.executeAction("UP", tuple())
+ colsnf.executeAction("DOWN", tuple())
+ spacing1mf = xDialog.getChild("spacing1mf")
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ autowidth = xDialog.getChild("autowidth")
+ autowidth.executeAction("CLICK", tuple())
#verify
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- colsnf = xDialog.getChild("colsnf")
- spacing1mf = xDialog.getChild("spacing1mf")
- autowidth = xDialog.getChild("autowidth")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatColumns", close_button="cancel") as xDialog:
+ colsnf = xDialog.getChild("colsnf")
+ spacing1mf = xDialog.getChild("spacing1mf")
+ autowidth = xDialog.getChild("autowidth")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py
index 0657f33f0635..5939c6f18eb2 100644
--- a/sw/qa/uitest/writer_tests5/tdf107494.py
+++ b/sw/qa/uitest/writer_tests5/tdf107494.py
@@ -38,10 +38,9 @@ class tdf107494(UITestCase):
textGraphic.Graphic = graphic
text.insertTextContent(cursor, textGraphic, False)
# Delete the header
- self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false")
- xDialog = self.xUITest.getTopFocusWindow() #question dialog
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
@@ -74,10 +73,9 @@ class tdf107494(UITestCase):
textGraphic.Graphic = graphic
text.insertTextContent(cursor, textGraphic, False)
# Delete the footer
- self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false")
- xDialog = self.xUITest.getTopFocusWindow() #question dialog
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(
+ ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py
index e64ab5229761..947d9115e2e6 100644
--- a/sw/qa/uitest/writer_tests5/tdf118540.py
+++ b/sw/qa/uitest/writer_tests5/tdf118540.py
@@ -16,10 +16,8 @@ class tdf118540(UITestCase):
def test_tdf118540_preview_document_properties(self):
with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc:
self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties"):
+ pass
self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
self.xUITest.getTopFocusWindow() #Get focus after closing preview
diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py
index c40469a70de8..cf625f7344f7 100644
--- a/sw/qa/uitest/writer_tests5/tdf122045.py
+++ b/sw/qa/uitest/writer_tests5/tdf122045.py
@@ -16,23 +16,20 @@ class tdf122045(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
- xApplyBtn = xDialog.getChild("apply")
- xApplyBtn.executeAction("CLICK", tuple())
+ xApplyBtn = xDialog.getChild("apply")
+ xApplyBtn.executeAction("CLICK", tuple())
- self.assertTrue(document.isModified())
- self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
+ self.assertTrue(document.isModified())
+ self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
self.assertTrue(document.isModified())
self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py
index 4e91519a37af..67e9ccb5ff53 100644
--- a/sw/qa/uitest/writer_tests5/tdf122722.py
+++ b/sw/qa/uitest/writer_tests5/tdf122722.py
@@ -27,44 +27,38 @@ class tdf122722(UITestCase):
#6. Opened Character, Select "Font Effect" tab
#7. Check Hidden, and click [OK]
#8. Crash a LibreOffice
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
- xHidden.executeAction("CLICK", tuple())
+ xHidden.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
#un-hidden
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
- self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
- xHidden.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ xHidden.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
self.assertEqual(document.Text.String[0:11], "LibreOffice")
diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py
index 5a48578fa593..6d9c3a2c9e73 100644
--- a/sw/qa/uitest/writer_tests5/tdf123446.py
+++ b/sw/qa/uitest/writer_tests5/tdf123446.py
@@ -26,10 +26,8 @@ class tdf123446(UITestCase):
self.xUITest.executeCommand(".uno:GoLeft")
self.xUITest.executeCommand(".uno:GoLeft")
- self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex")
- xDialog = self.xUITest.getTopFocusWindow()
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertMultiIndex"):
+ pass
#- Undo the ToC insertion.
self.xUITest.executeCommand(".uno:Undo")
#- Redo the ToC insertion.
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py
index f048bc6ea006..390e0bb4fa68 100644
--- a/sw/qa/uitest/writer_tests5/titlePage.py
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -13,24 +13,17 @@ class titlePage(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #print(xDialog.getChildren())
-
- #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xpageCount = xDialog.getChild("NF_PAGE_COUNT")
- xpageCount.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xpageCount = xDialog.getChild("NF_PAGE_COUNT")
+ xpageCount.executeAction("UP", tuple())
self.assertEqual(document.CurrentController.PageCount, 3)
# check cancel button
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog", close_button="cancel"):
+ pass
self.assertEqual(document.CurrentController.PageCount, 3)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py
index a3e4bd8729d4..b2b43ce3f9ca 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py
@@ -36,13 +36,10 @@ class tdf138907(UITestCase):
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 2. With this doc, it defaults to resetting to 1.
- xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
- xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
Paragraphs = document.Text.createEnumeration()
Para1 = Paragraphs.nextElement()
@@ -54,11 +51,8 @@ class tdf138907(UITestCase):
self.assertEqual(Para2.PageDescName, "Landscape")
#re-run dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #accept defaults and OK without making any changes.
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog"):
+ pass
# Without this fix, re-running the wizard was failing with the title page restarting at page 2.
Paragraphs = document.Text.createEnumeration()
@@ -75,20 +69,16 @@ class tdf138907(UITestCase):
#Now test replacing several pages with title and index styles
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Convert three pages to title/index pages starting at page two.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- xStartingPage.executeAction("UP", tuple()) #Start at page 2.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #Convert three pages to title/index pages starting at page two.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
Paragraphs = document.Text.createEnumeration()
Para1 = Paragraphs.nextElement()
@@ -111,23 +101,19 @@ class tdf138907(UITestCase):
#Now test inserting at the end of the document
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert three title/index pages at the end of the document (plus a content page).
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,18):
- xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages at the end of the document (plus a content page).
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,18):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
# Without the fix, the pages were being inserted before the last page.
text = document.Text.String.replace('\r\n', '\n')
@@ -143,24 +129,20 @@ class tdf138907(UITestCase):
#Now test inserting in the middle of the document
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert three title/index pages starting at page 2.
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,10):
- xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
- xStartingPage.executeAction("UP", tuple()) #Start at page 2.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages starting at page 2.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,10):
+ xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
# Without first re-calculating the layout, the styles were applied to the wrong pages.
Paragraphs = document.Text.createEnumeration()
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
index fa03a76f51dd..b3f7d15c3320 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard2.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
@@ -15,24 +15,21 @@ class tdf138907(UITestCase):
# Test an undefined situation - try to modify pages beyond the end of the document.
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 2. With this doc, it defaults to resetting to 1.
- xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
- xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
- #Convert three pages to title/index pages starting at non-existing page twenty.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,19):
- xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+ #Convert three pages to title/index pages starting at non-existing page twenty.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,19):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# Nothing should happen when modifying pages that don't exist.
# Just a page break, without a valid restart page number on page 2
@@ -56,23 +53,20 @@ class tdf138907(UITestCase):
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 1 - which is the default.
- #set restart title page to 1 - the current value for this document is 6.
- xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
- print(xDialog.getChildren())
- for _ in range(0,5):
- xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
- #Insert two title/index pages at beginning of the document.
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,1):
- xPageCount.executeAction("UP", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 1 - which is the default.
+ #set restart title page to 1 - the current value for this document is 6.
+ xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
+ print(xDialog.getChildren())
+ for _ in range(0,5):
+ xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
+ #Insert two title/index pages at beginning of the document.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,1):
+ xPageCount.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
Paragraphs = document.Text.createEnumeration()
Para1 = Paragraphs.nextElement()
@@ -96,18 +90,15 @@ class tdf138907(UITestCase):
#Now test replacing several pages with title and index styles
#dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Convert four pages to title/index pages starting at page one.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,3):
- xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
- for _ in range(0,3):
- xPageCount.executeAction("UP", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TitlePageDialog") as xDialog:
+ print(xDialog.getChildren())
+ #Convert four pages to title/index pages starting at page one.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,3):
+ xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
+ for _ in range(0,3):
+ xPageCount.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
Paragraphs = document.Text.createEnumeration()
Para1 = Paragraphs.nextElement()
diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py
index df92b35e929e..05024eeed487 100644
--- a/sw/qa/uitest/writer_tests5/zoom.py
+++ b/sw/qa/uitest/writer_tests5/zoom.py
@@ -15,89 +15,71 @@ class writerZoom(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#dialog View-Zoom-Zoom
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
- #select Optimal & Automatic - OK - open and verify
- optimal = xDialog.getChild("optimal")
- optimal.executeAction("CLICK", tuple())
- automatic = xDialog.getChild("automatic")
- automatic.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #select Optimal & Automatic - OK - open and verify
+ optimal = xDialog.getChild("optimal")
+ optimal.executeAction("CLICK", tuple())
+ automatic = xDialog.getChild("automatic")
+ automatic.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- optimal = xDialog.getChild("optimal")
- automatic = xDialog.getChild("automatic")
- self.assertEqual(get_state_as_dict(optimal)["Checked"], "true")
- self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
- #select fit weight & Single page - OK - open and verify
- fitwandh = xDialog.getChild("fitwandh")
- singlepage = xDialog.getChild("singlepage")
- fitwandh.executeAction("CLICK", tuple())
- singlepage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
+ optimal = xDialog.getChild("optimal")
+ automatic = xDialog.getChild("automatic")
+ self.assertEqual(get_state_as_dict(optimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ #select fit weight & Single page - OK - open and verify
+ fitwandh = xDialog.getChild("fitwandh")
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh.executeAction("CLICK", tuple())
+ singlepage.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- singlepage = xDialog.getChild("singlepage")
- fitwandh = xDialog.getChild("fitwandh")
- self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true")
- self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true")
- #select fit width & columns - OK - open and verify
- fitw = xDialog.getChild("fitw")
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- fitw.executeAction("CLICK", tuple())
- columns.executeAction("CLICK", tuple())
- columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh = xDialog.getChild("fitwandh")
+ self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true")
+ #select fit width & columns - OK - open and verify
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ fitw.executeAction("CLICK", tuple())
+ columns.executeAction("CLICK", tuple())
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- fitw = xDialog.getChild("fitw")
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- self.assertEqual(get_state_as_dict(fitw)["Checked"], "true")
- self.assertEqual(get_state_as_dict(columns)["Checked"], "true")
- self.assertEqual(get_state_as_dict(columnssb)["Text"], "3")
- #select 100% & Automatic - OK - open and verify
- automatic = xDialog.getChild("automatic")
- x100pc = xDialog.getChild("100pc")
- x100pc.executeAction("CLICK", tuple())
- automatic.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ self.assertEqual(get_state_as_dict(fitw)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columns)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columnssb)["Text"], "3")
+ #select 100% & Automatic - OK - open and verify
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ x100pc.executeAction("CLICK", tuple())
+ automatic.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- automatic = xDialog.getChild("automatic")
- x100pc = xDialog.getChild("100pc")
- self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
- self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true")
- #select variable 103% & Automatic - OK - open and verify
- variable = xDialog.getChild("variable")
- zoomsb = xDialog.getChild("zoomsb")
- variable.executeAction("CLICK", tuple())
- zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true")
+ #select variable 103% & Automatic - OK - open and verify
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ variable.executeAction("CLICK", tuple())
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- variable = xDialog.getChild("variable")
- zoomsb = xDialog.getChild("zoomsb")
- self.assertEqual(get_state_as_dict(variable)["Checked"], "true")
- self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Zoom") as xDialog:
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ self.assertEqual(get_state_as_dict(variable)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%")
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py
index 522fe99beba1..99705d6c2203 100644
--- a/sw/qa/uitest/writer_tests6/tdf107847.py
+++ b/sw/qa/uitest/writer_tests6/tdf107847.py
@@ -15,19 +15,16 @@ class tdf107847(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- select_pos(xTabs, "2")
- select_pos(xTabs, "3")
- select_pos(xTabs, "4")
- select_pos(xTabs, "5")
- select_pos(xTabs, "6")
- select_pos(xTabs, "7")
- select_pos(xTabs, "8") #tab Macro
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFrame") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ select_pos(xTabs, "2")
+ select_pos(xTabs, "3")
+ select_pos(xTabs, "4")
+ select_pos(xTabs, "5")
+ select_pos(xTabs, "6")
+ select_pos(xTabs, "7")
+ select_pos(xTabs, "8") #tab Macro
self.assertEqual(document.TextFrames.getCount(), 1)
self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py b/sw/qa/uitest/writer_tests6/tdf120731.py
index c81553266a1f..fdcc17dcd334 100644
--- a/sw/qa/uitest/writer_tests6/tdf120731.py
+++ b/sw/qa/uitest/writer_tests6/tdf120731.py
@@ -15,9 +15,7 @@ class tdf120731(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
self.xUITest.executeCommand(".uno:SelectAll")
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FontDialog"):
+ pass
self.assertEqual(writer_doc.Text.String[0:5], "Lorem")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py
index ee5e37d8371f..23c5e5700a69 100644
--- a/sw/qa/uitest/writer_tests6/tdf124586.py
+++ b/sw/qa/uitest/writer_tests6/tdf124586.py
@@ -16,19 +16,13 @@ class tdf124586(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
#Goto Tools > Chapter Numbering.
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xstyle = xDialog.getChild("style")
- select_by_text(xstyle, "MyHeading")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog") as xDialog:
+ xstyle = xDialog.getChild("style")
+ select_by_text(xstyle, "MyHeading")
self.assertEqual(writer_doc.Text.String[0:8], "Schritte")
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xstyle = xDialog.getChild("style")
- self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:ChapterNumberingDialog") as xDialog:
+ xstyle = xDialog.getChild("style")
+ self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py
index 0fa36587b20e..8b56104f123a 100644
--- a/sw/qa/uitest/writer_tests6/tdf125104.py
+++ b/sw/qa/uitest/writer_tests6/tdf125104.py
@@ -11,18 +11,11 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf125104(UITestCase):
- def open_page_style_dialog(self):
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- return xDialog.getChild("comboLayoutFormat")
-
def set_combo_layout_format(self, dialog, format):
+ tabcontrol = dialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
comboLayoutFormat = dialog.getChild("comboLayoutFormat")
select_by_text(comboLayoutFormat, format)
- okBtn = dialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
def test_tdf125104_pageFormat_numbering(self):
self.ui_test.create_doc_in_start_center("writer")
@@ -37,25 +30,29 @@ class tdf125104(UITestCase):
self.assertEqual(text[2:3], "2")
# Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
- self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "1st, 2nd, 3rd, ...")
+
text = document.Text.String.replace('\r\n', '\n')
self.assertEqual(text[0:3], "1st")
self.assertEqual(text[4:7], "2nd")
- xDialog = self.open_page_style_dialog()
- comboLayoutFormat = xDialog.getChild("comboLayoutFormat")
- self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...")
- cancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(cancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog", close_button="cancel") as xDialog:
+ comboLayoutFormat = xDialog.getChild("comboLayoutFormat")
+ self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...")
# change to devanagari alphabet format
- self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "क, ख, ग, ...")
+
text = document.Text.String.replace('\r\n', '\n')
self.assertEqual(text[0:1], "क")
self.assertEqual(text[2:3], "ख")
# change to devanagari number format
- self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "१, २, ३, ...")
+
text = document.Text.String.replace('\r\n', '\n')
self.assertEqual(text[0:1], "१")
self.assertEqual(text[2:3], "२")
diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py
index 0dcbebcad4b5..6894b550b479 100644
--- a/sw/qa/uitest/writer_tests6/tdf126017.py
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -25,21 +25,15 @@ class tdf126017(UITestCase):
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
#edit index
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xOKBtn = xDiagIndex.getChild("ok")
- title = xDiagIndex.getChild("title")
- title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditCurIndex") as xDiagIndex:
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
self.xUITest.executeCommand(".uno:Undo")
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xOKBtn = xDiagIndex.getChild("ok")
- title = xDiagIndex.getChild("title")
- title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditCurIndex") as xDiagIndex:
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py
index db60e9edbea0..5d65724c4bf1 100644
--- a/sw/qa/uitest/writer_tests6/tdf126168.py
+++ b/sw/qa/uitest/writer_tests6/tdf126168.py
@@ -18,19 +18,14 @@ class tdf126168(UITestCase):
#2) Menu > Insert > Frame > Frame
#3) Press OK in Frame dialog
- self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame
- xDialog = self.xUITest.getTopFocusWindow()
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertFrame"):
+ pass
self.assertEqual(document.TextFrames.getCount(), 1)
#New Style from Selection [uno:StyleNewByExample]
- self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample")
- #5) Enter a name in the Create Style dialog and press OK
- xDialog = self.xUITest.getTopFocusWindow()
- stylename = xDialog.getChild("stylename")
- stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:StyleNewByExample") as xDialog:
+ #5) Enter a name in the Create Style dialog and press OK
+ stylename = xDialog.getChild("stylename")
+ stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
#6) ctrl+z 3 times
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests6/tdf126226.py b/sw/qa/uitest/writer_tests6/tdf126226.py
index 9d397a060792..c638574d141d 100644
--- a/sw/qa/uitest/writer_tests6/tdf126226.py
+++ b/sw/qa/uitest/writer_tests6/tdf126226.py
@@ -15,14 +15,11 @@ class Tdf126226(UITestCase):
self.xUITest.executeCommand(".uno:SelectAll")
# Without the fix in place, this test would have crashed here
- self.ui_test.execute_dialog_through_command(".uno:CommentChangeTracking")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:CommentChangeTracking") as xDialog:
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"])
- self.assertEqual("Autor desconocido, 07/04/2019 13:43:52",
- get_state_as_dict(xDialog.getChild("lastedit"))["Text"])
+ self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"])
+ self.assertEqual("Autor desconocido, 07/04/2019 13:43:52",
+ get_state_as_dict(xDialog.getChild("lastedit"))["Text"])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py
index 17d876bb9a4c..2e53b2eb8054 100644
--- a/sw/qa/uitest/writer_tests6/tdf128431.py
+++ b/sw/qa/uitest/writer_tests6/tdf128431.py
@@ -17,26 +17,23 @@ class tdf128431(UITestCase):
change_measurement_unit(self, "Centimeter")
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, 6) #borders
-
- sync = xDialog.getChild("sync")
- bottomft = xDialog.getChild("bottommf")
- topft = xDialog.getChild("topmf")
- rightft = xDialog.getChild("rightmf")
- leftft = xDialog.getChild("leftmf")
-
- self.assertEqual(get_state_as_dict(sync)["Selected"], "true")
- bottomft.executeAction("UP", tuple())
- self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm")
-
- okBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, 6) #borders
+
+ sync = xDialog.getChild("sync")
+ bottomft = xDialog.getChild("bottommf")
+ topft = xDialog.getChild("topmf")
+ rightft = xDialog.getChild("rightmf")
+ leftft = xDialog.getChild("leftmf")
+
+ self.assertEqual(get_state_as_dict(sync)["Selected"], "true")
+ bottomft.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm")
+
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py
index aa0df0aa1d10..8ba2fc2fabbb 100644
--- a/sw/qa/uitest/writer_tests6/tdf131041.py
+++ b/sw/qa/uitest/writer_tests6/tdf131041.py
@@ -13,34 +13,30 @@ class tdf131041(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, 4) #header
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, 4) #header
- xHeaderOn = xDialog.getChild("checkHeaderOn")
- xMoreBtn = xDialog.getChild("buttonMore")
+ xHeaderOn = xDialog.getChild("checkHeaderOn")
+ xMoreBtn = xDialog.getChild("buttonMore")
- self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false")
- self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false")
- xHeaderOn.executeAction("CLICK", tuple())
+ xHeaderOn.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true")
- with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg:
+ with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg:
- #modify any property
- bottomft = xBorderDlg.getChild("bottommf")
- bottomft.executeAction("UP", tuple())
+ #modify any property
+ bottomft = xBorderDlg.getChild("bottommf")
+ bottomft.executeAction("UP", tuple())
- #it would crash here
+ #it would crash here
- xDialog = self.xUITest.getTopFocusWindow()
- okBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py
index 2813c997ad1e..9e308acc0ff8 100644
--- a/sw/qa/uitest/writer_tests7/apply_line_cap.py
+++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py
@@ -22,22 +22,19 @@ class apply_line_cap(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # select 'Dot (Rounded)', but store the previous value
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
- select_pos(xLineStyle, "3")
+ # select 'Dot (Rounded)', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "3")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.assertEqual(cap_style, 'Flat')
self.assertEqual(style, 'Long Dash Dot')
@@ -49,22 +46,19 @@ class apply_line_cap(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # select 'Dot', but store the previous value
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
- select_pos(xLineStyle, "2")
+ # select 'Dot', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "2")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# This was 'Flat' (set only dash style of the line style before)
self.assertEqual(cap_style, 'Round')
@@ -77,20 +71,17 @@ class apply_line_cap(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
# This was 'Flat' (set only dash style of the line style before)
self.assertEqual(cap_style, 'Flat')
diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py
index 58316db101b5..00b71bb2b97c 100644
--- a/sw/qa/uitest/writer_tests7/tdf104795.py
+++ b/sw/qa/uitest/writer_tests7/tdf104795.py
@@ -14,13 +14,10 @@ class tdf104795(UITestCase):
def test_tdf104795(self):
with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as writer_doc:
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties") as xDialog:
- sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']
+ sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
# Without the fix in place, this test would have failed with
# AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!'
diff --git a/sw/qa/uitest/writer_tests7/tdf109083.py b/sw/qa/uitest/writer_tests7/tdf109083.py
index bf61a0e4ee3f..eb83582b4431 100644
--- a/sw/qa/uitest/writer_tests7/tdf109083.py
+++ b/sw/qa/uitest/writer_tests7/tdf109083.py
@@ -18,13 +18,10 @@ class tdf109083(UITestCase):
#generate two 2x2 tables with the same autoformat table style (Default Table Style)
#Note that this style is different than applying nothing!
for i in range(0, 2):
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
- formatlbinstable = xDialog.getChild("formatlbinstable")
- entry = formatlbinstable.getChild("1")
- entry.executeAction("SELECT", tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable") as xDialog:
+ formatlbinstable = xDialog.getChild("formatlbinstable")
+ entry = formatlbinstable.getChild("1")
+ entry.executeAction("SELECT", tuple())
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
#select the last row of the first table
@@ -48,19 +45,16 @@ class tdf109083(UITestCase):
#first row's cells must be yellow, second/last row's cells must be updated to yellow by now
for i in range (0,4):
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4") #tab Background
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
- hex_custom = xDialog.getChild("hex_custom")
- if i >= 2:
- self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00")
- else:
- self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff")
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4") #tab Background
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+ hex_custom = xDialog.getChild("hex_custom")
+ if i >= 2:
+ self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00")
+ else:
+ self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff")
self.xUITest.executeCommand(".uno:GoRight")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf115853.py b/sw/qa/uitest/writer_tests7/tdf115853.py
index 42cddb2b388b..05825bf15043 100644
--- a/sw/qa/uitest/writer_tests7/tdf115853.py
+++ b/sw/qa/uitest/writer_tests7/tdf115853.py
@@ -16,28 +16,25 @@ class tdf115853(UITestCase):
def test_tdf115853(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
+ xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
+ select_pos(xTabs, "2")
- xAddBtn = xDialog.getChild("add")
- xAddBtn.executeAction("CLICK", tuple())
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
- xNameBox1 = xDialog.getChild("namebox1")
- xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"}))
+ xNameBox1 = xDialog.getChild("namebox1")
+ xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"}))
- xAddBtn = xDialog.getChild("add")
- xAddBtn.executeAction("CLICK", tuple())
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Text' != ''
- self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Text' != ''
+ self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text'])
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py
index 9ad178f8a722..afdbba2dd99c 100644
--- a/sw/qa/uitest/writer_tests7/tdf119661.py
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -17,62 +17,53 @@ class tdf119661(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertGraphic")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertGraphic", close_button="") as xOpenDialog:
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
- xOpenDialog = self.xUITest.getTopFocusWindow()
+ xLink = xOpenDialog.getChild("link")
+ self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
+ xLink.executeAction("CLICK", tuple())
- xLink = xOpenDialog.getChild("link")
- self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
- xLink.executeAction("CLICK", tuple())
+ #Confirmation dialog is displayed
+ xWarnDialog = self.xUITest.getTopFocusWindow()
+ xOK = xWarnDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:LinkDialog", close_button="close") as xDialog:
- #Confirmation dialog is displayed
- xWarnDialog = self.xUITest.getTopFocusWindow()
- xOK = xWarnDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- self.ui_test.execute_dialog_through_command(".uno:LinkDialog")
+ sLinks = "TB_LINKS"
+ xLinks = xDialog.getChild(sLinks)
+ self.assertEqual(1, len(xLinks.getChildren()))
- xDialog = self.xUITest.getTopFocusWindow()
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
- sLinks = "TB_LINKS"
- xLinks = xDialog.getChild(sLinks)
- self.assertEqual(1, len(xLinks.getChildren()))
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
- sFileName = "FULL_FILE_NAME"
- xFileName = xDialog.getChild(sFileName)
- self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
- sBreakLink = "BREAK_LINK"
- xBreakLink = xDialog.getChild(sBreakLink)
-
- 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)
with TemporaryDirectory() as tempdir:
xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
# Save Copy as
- self.ui_test.execute_dialog_through_command(".uno:SaveAs")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SaveAs", close_button="open") as xDialog:
- xFileName = xDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ xFileName = xDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
- xOpenBtn = xDialog.getChild("open")
- self.ui_test.close_dialog_through_button(xOpenBtn)
# Close the Writer document
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py
index 45f6a75b5906..a128f95eaf1c 100644
--- a/sw/qa/uitest/writer_tests7/tdf122780.py
+++ b/sw/qa/uitest/writer_tests7/tdf122780.py
@@ -14,13 +14,10 @@ class tdf122780(UITestCase):
def test_tdf122780(self):
with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) as writer_doc:
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SetDocumentProperties") as xDialog:
- # Without the fix in place, this test would have hung here
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
- self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ # Without the fix in place, this test would have hung here
+ self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
+ self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py
index 7e147f006326..07298084b2a7 100644
--- a/sw/qa/uitest/writer_tests7/tdf131936.py
+++ b/sw/qa/uitest/writer_tests7/tdf131936.py
@@ -12,14 +12,11 @@ class tdf131936(UITestCase):
def test_tdf131936_saveas_docx_version(self):
with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")):
- self.ui_test.execute_dialog_through_command(".uno:SaveAs")
- time.sleep(DEFAULT_SLEEP)
- xDialog = self.xUITest.getTopFocusWindow()
- xFileTypeCombo = xDialog.getChild("file_type")
- state = get_state_as_dict(xFileTypeCombo)
- self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:SaveAs", close_button="cancel") as xDialog:
+ time.sleep(DEFAULT_SLEEP)
+ xFileTypeCombo = xDialog.getChild("file_type")
+ state = get_state_as_dict(xFileTypeCombo)
+ self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")
- xCancel = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancel)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py
index e535ebbc3326..2466a7cb5545 100644
--- a/sw/qa/uitest/writer_tests7/tdf132169.py
+++ b/sw/qa/uitest/writer_tests7/tdf132169.py
@@ -23,12 +23,9 @@ class tdf132169(UITestCase):
self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt")
#Check changing value from dialog also works
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
- type_text(xWidth, "4.0")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
+ xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
+ type_text(xWidth, "4.0")
self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt")
self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt")
diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py
index e9f91d8f17b6..c5ebb726f4f9 100644
--- a/sw/qa/uitest/writer_tests7/tdf133348.py
+++ b/sw/qa/uitest/writer_tests7/tdf133348.py
@@ -21,19 +21,16 @@ class tdf133348(UITestCase):
xArgs = mkPropertyValues({"Text": "C1"})
self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
- xDialogOpt = self.xUITest.getTopFocusWindow()
- xPages = xDialogOpt.getChild("pages")
- xEntry = xPages.getChild('0')
- xEntry.executeAction("EXPAND", tuple())
- xGeneralEntry = xEntry.getChild('0')
- xGeneralEntry.executeAction("SELECT", tuple())
- xFirstName = xDialogOpt.getChild("firstname")
- props = {"TEXT": "Known Author"}
- actionProps = mkPropertyValues(props)
- xFirstName.executeAction("TYPE", actionProps)
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:OptionsTreeDialog") as xDialogOpt:
+ xPages = xDialogOpt.getChild("pages")
+ xEntry = xPages.getChild('0')
+ xEntry.executeAction("EXPAND", tuple())
+ xGeneralEntry = xEntry.getChild('0')
+ xGeneralEntry.executeAction("SELECT", tuple())
+ xFirstName = xDialogOpt.getChild("firstname")
+ props = {"TEXT": "Known Author"}
+ actionProps = mkPropertyValues(props)
+ xFirstName.executeAction("TYPE", actionProps)
xWriterDoc = self.xUITest.getTopFocusWindow()
xArgs = mkPropertyValues({"Text": "C2"})
diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py
index e41cb5ce410c..1e1c4a5db3f4 100644
--- a/sw/qa/uitest/writer_tests7/tdf134243.py
+++ b/sw/qa/uitest/writer_tests7/tdf134243.py
@@ -13,12 +13,8 @@ class tdf134243(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as writer_doc:
# Without the fix in place, it would hung launching the mailmerge wizard
- self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:MailMergeWizard", close_button="cancel"):
+ pass
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py
index df7deea94522..c91642c2f9a3 100644
--- a/sw/qa/uitest/writer_tests7/tdf137802.py
+++ b/sw/qa/uitest/writer_tests7/tdf137802.py
@@ -25,14 +25,11 @@ class tdf137802(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TransformDialog") as xDialog:
- xDialog = self.xUITest.getTopFocusWindow()
- xDialog.getChild('topage').executeAction("CLICK", tuple())
+ xDialog.getChild('topage').executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py
index 3116dd609dd9..3fceb5cb814e 100644
--- a/sw/qa/uitest/writer_tests7/tdf137803.py
+++ b/sw/qa/uitest/writer_tests7/tdf137803.py
@@ -18,14 +18,11 @@ class tdf137803(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# open textattrs dialog
- self.ui_test.execute_dialog_through_command(".uno:TextAttributes")
- TextDialog = self.xUITest.getTopFocusWindow();
-
- # check autosize on
- TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE')
- TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
- ok = TextDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TextAttributes") as TextDialog:
+
+ # check autosize on
+ TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE')
+ TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
# get the shape
drawPage = document.getDrawPages().getByIndex(0)
diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py
index 7436dce42bda..d62e0db3c290 100644
--- a/sw/qa/uitest/writer_tests7/tdf139301.py
+++ b/sw/qa/uitest/writer_tests7/tdf139301.py
@@ -22,16 +22,13 @@ class tdf139301(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # check preset line style
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.assertEqual(style, self.styles[i])
@@ -48,16 +45,13 @@ class tdf139301(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
# line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:FormatLine") as xFormatLineDlg:
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # check preset line style
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
self.assertEqual(style, self.styles[i] + style_name_extension)
diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py
index e0d79893f188..07437903f755 100644
--- a/sw/qa/uitest/writer_tests7/tdf140117.py
+++ b/sw/qa/uitest/writer_tests7/tdf140117.py
@@ -45,16 +45,13 @@ class tdf140117(UITestCase):
elif i == 2:
self.assertEqual("XXXXleft", xHeaderLeftText)
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- PageDialog = self.xUITest.getTopFocusWindow();
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as PageDialog:
- xTabs = PageDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- # Change option "same content on left and right pages" for the next iteration
- Button = xTabs.getChild('checkSameLR')
- Button.executeAction("CLICK", tuple())
- ok = PageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ # Change option "same content on left and right pages" for the next iteration
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py
index f0355e4684ed..bb558c15590b 100644
--- a/sw/qa/uitest/writer_tests7/tdf140863.py
+++ b/sw/qa/uitest/writer_tests7/tdf140863.py
@@ -15,12 +15,8 @@ class tdf140863(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
# Insert one section
- self.ui_test.execute_dialog_through_command(".uno:InsertSection")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertSection"):
+ pass
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
@@ -35,33 +31,22 @@ class tdf140863(UITestCase):
self.assertTrue(document.TextSections.Section1.IsVisible)
- self.ui_test.execute_dialog_through_command(".uno:EditRegion")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xHide = xDialog.getChild('hide')
- self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditRegion") as xDialog:
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
- xHide.executeAction('CLICK', tuple())
+ xHide.executeAction('CLICK', tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
self.assertEqual(1, len(document.TextSections))
self.assertFalse(document.TextSections.Section1.IsVisible)
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- self.ui_test.execute_dialog_through_command(".uno:EditRegion")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- xHide = xDialog.getChild('hide')
- self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
-
- xHide.executeAction('CLICK', tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:EditRegion") as xDialog:
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xHide.executeAction('CLICK', tuple())
self.assertEqual(1, len(document.TextSections))
self.assertTrue(document.TextSections.Section1.IsVisible)
diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py
index 3d25c7908d99..0a15db24dd50 100644
--- a/sw/qa/uitest/writer_tests7/tdf141557.py
+++ b/sw/qa/uitest/writer_tests7/tdf141557.py
@@ -23,14 +23,11 @@ class tdf141557(UITestCase):
self.ui_test.wait_until_child_is_available('metricfield')
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TransformDialog") as xDialog:
- xDialog = self.xUITest.getTopFocusWindow()
- xDialog.getChild('topara').executeAction("CLICK", tuple())
+ xDialog.getChild('topara').executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
# Without the fix in place, at this point crash occurs.
self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py
index 1c34a89a71b4..41acea93ed16 100644
--- a/sw/qa/uitest/writer_tests7/tdf46561.py
+++ b/sw/qa/uitest/writer_tests7/tdf46561.py
@@ -37,16 +37,13 @@ class tdf46561(UITestCase):
# Switch "same left and right page headers" on and off a few times
for _ in range(4):
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- PageDialog = self.xUITest.getTopFocusWindow();
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageDialog") as PageDialog:
- xTabs = PageDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
- Button = xTabs.getChild('checkSameLR')
- Button.executeAction("CLICK",tuple())
- ok = PageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK",tuple())
# We should be back to the starting state after 2*k on/off changes
self.check_header_texts(master="right", first="1st", left="left", right="right")
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index b6d100cb6241..fd8c9b91b135 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -30,26 +30,24 @@ class tdf90401(UITestCase):
# enable remove personal info security option
- self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
-
- xPages = xDialog.getChild('pages')
- xGenEntry = xPages.getChild('0')
- xSecurityPage = xGenEntry.getChild('6')
- xSecurityPage.executeAction('SELECT', tuple())
- # Click Button Options...
- xOptions = xDialog.getChild('options')
-
- with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
- xRemovePersonal = dialog.getChild('removepersonal')
- xRemovePersonal.executeAction('CLICK', tuple())
- 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())
-
- xOKBtn = xDialog.getChild('ok')
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command_guarded('.uno:OptionsTreeDialog', close_button="") as xDialog:
+ xPages = xDialog.getChild('pages')
+ xGenEntry = xPages.getChild('0')
+ xSecurityPage = xGenEntry.getChild('6')
+ xSecurityPage.executeAction('SELECT', tuple())
+ # Click Button Options...
+ xOptions = xDialog.getChild('options')
+
+ with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ xRemovePersonal = dialog.getChild('removepersonal')
+ xRemovePersonal.executeAction('CLICK', tuple())
+ 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())
+
+ xOKBtn = xDialog.getChild('ok')
+ self.ui_test.close_dialog_through_button(xOKBtn)
# save and reload the document to remove personal info
@@ -57,16 +55,11 @@ class tdf90401(UITestCase):
xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt')
# Save Copy as
- self.ui_test.execute_dialog_through_command('.uno:SaveAs')
- xDialog = self.xUITest.getTopFocusWindow()
-
- xFileName = xDialog.getChild('file_name')
- xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
- xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
- xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
-
- xOpenBtn = xDialog.getChild('open')
- self.ui_test.close_dialog_through_button(xOpenBtn)
+ with self.ui_test.execute_dialog_through_command_guarded('.uno:SaveAs', close_button="open") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
# Close the Writer document
self.ui_test.close_doc()