[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 29 11:26:30 UTC 2021
sw/qa/uitest/chapterNumbering/chapterNumbering.py | 114 -
sw/qa/uitest/chapterNumbering/tdf123547.py | 9
sw/qa/uitest/chapterNumbering/tdf140528.py | 41
sw/qa/uitest/classification/classification.py | 147 -
sw/qa/uitest/findReplace/tdf118208.py | 54
sw/qa/uitest/macro_tests/tdf124413.py | 49
sw/qa/uitest/macro_tests/tdf64690.py | 7
sw/qa/uitest/navigator/tdf140257.py | 13
sw/qa/uitest/navigator/tdf40427.py | 17
sw/qa/uitest/options/optionsDialog.py | 50
sw/qa/uitest/options/tdf131581.py | 25
sw/qa/uitest/options/tdf78133.py | 42
sw/qa/uitest/sidebar/stylesSidebar.py | 60
sw/qa/uitest/sidebar/tdf133189.py | 21
sw/qa/uitest/sidebar/tdf135590.py | 46
sw/qa/uitest/styleInspector/styleInspector.py | 7
sw/qa/uitest/table/insertTableDialog.py | 44
sw/qa/uitest/table/splitTable.py | 27
sw/qa/uitest/table/tableProperties.py | 309 +--
sw/qa/uitest/table/tableToText.py | 44
sw/qa/uitest/table/tdf115026.py | 14
sw/qa/uitest/table/tdf116737.py | 44
sw/qa/uitest/table/tdf128593.py | 31
sw/qa/uitest/table/tdf134881_colProportionalAdjust.py | 45
sw/qa/uitest/table/tdf135693.py | 13
sw/qa/uitest/table/tdf81292.py | 9
sw/qa/uitest/table/tdf99334.py | 8
sw/qa/uitest/table/textToTable.py | 30
sw/qa/uitest/ui/fmtui/fmtui.py | 25
sw/qa/uitest/writer_tests/compareDocuments.py | 40
sw/qa/uitest/writer_tests/insertCaption.py | 58
sw/qa/uitest/writer_tests/tdf134734.py | 75
sw/qa/uitest/writer_tests/tdf53460.py | 13
sw/qa/uitest/writer_tests/tdf78068.py | 9
sw/qa/uitest/writer_tests/tdf81457.py | 39
sw/qa/uitest/writer_tests/tdf93068.py | 32
sw/qa/uitest/writer_tests/versionDialog.py | 19
sw/qa/uitest/writer_tests/watermark.py | 72
sw/qa/uitest/writer_tests2/bookmark.py | 126 -
sw/qa/uitest/writer_tests2/documentProperties.py | 140 -
sw/qa/uitest/writer_tests2/exchangeDatabase.py | 40
sw/qa/uitest/writer_tests2/formatBulletsNumbering.py | 434 +---
sw/qa/uitest/writer_tests2/formatCharacter.py | 372 +--
sw/qa/uitest/writer_tests2/formatParagraph.py | 973 ++++------
sw/qa/uitest/writer_tests2/horizontalLine.py | 18
sw/qa/uitest/writer_tests2/pasteSpecial.py | 11
sw/qa/uitest/writer_tests2/tdf116474.py | 9
sw/qa/uitest/writer_tests3/autoredactDialog.py | 198 --
sw/qa/uitest/writer_tests3/customizeDialog.py | 119 -
sw/qa/uitest/writer_tests3/goToPage.py | 24
sw/qa/uitest/writer_tests3/hyperlinkdialog.py | 73
sw/qa/uitest/writer_tests3/insertEnvelope.py | 46
sw/qa/uitest/writer_tests3/insertFootEndnote.py | 55
sw/qa/uitest/writer_tests3/insertPageFooter.py | 18
sw/qa/uitest/writer_tests3/insertQrCodeGen.py | 49
sw/qa/uitest/writer_tests3/insertSignatureLine.py | 71
sw/qa/uitest/writer_tests3/lineNumbering.py | 125 -
sw/qa/uitest/writer_tests3/pageDialog.py | 79
sw/qa/uitest/writer_tests3/sort.py | 32
sw/qa/uitest/writer_tests3/specialCharacter.py | 122 -
sw/qa/uitest/writer_tests3/tdf79236.py | 70
sw/qa/uitest/writer_tests4/insertBreakDialog.py | 38
sw/qa/uitest/writer_tests4/insertPageHeader.py | 18
sw/qa/uitest/writer_tests4/tdf113252.py | 25
sw/qa/uitest/writer_tests4/tdf113284.py | 15
sw/qa/uitest/writer_tests4/tdf115572.py | 38
sw/qa/uitest/writer_tests4/tdf115573.py | 76
sw/qa/uitest/writer_tests4/tdf122449.py | 15
sw/qa/uitest/writer_tests4/tdf138546.py | 30
sw/qa/uitest/writer_tests4/tdf51352.py | 18
sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py | 98 -
sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py | 363 +--
sw/qa/uitest/writer_tests5/about_test.py | 8
sw/qa/uitest/writer_tests5/autocorrectOptions.py | 153 -
sw/qa/uitest/writer_tests5/columns.py | 46
sw/qa/uitest/writer_tests5/tdf107494.py | 14
sw/qa/uitest/writer_tests5/tdf118540.py | 6
sw/qa/uitest/writer_tests5/tdf122045.py | 21
sw/qa/uitest/writer_tests5/tdf122722.py | 56
sw/qa/uitest/writer_tests5/tdf123446.py | 6
sw/qa/uitest/writer_tests5/titlePage.py | 23
sw/qa/uitest/writer_tests5/titlePageWizard.py | 104 -
sw/qa/uitest/writer_tests5/titlePageWizard2.py | 77
sw/qa/uitest/writer_tests5/zoom.py | 136 -
sw/qa/uitest/writer_tests6/tdf107847.py | 23
sw/qa/uitest/writer_tests6/tdf120731.py | 6
sw/qa/uitest/writer_tests6/tdf124586.py | 18
sw/qa/uitest/writer_tests6/tdf125104.py | 31
sw/qa/uitest/writer_tests6/tdf126017.py | 18
sw/qa/uitest/writer_tests6/tdf126168.py | 17
sw/qa/uitest/writer_tests6/tdf126226.py | 11
sw/qa/uitest/writer_tests6/tdf128431.py | 37
sw/qa/uitest/writer_tests6/tdf131041.py | 34
sw/qa/uitest/writer_tests7/apply_line_cap.py | 59
sw/qa/uitest/writer_tests7/tdf104795.py | 7
sw/qa/uitest/writer_tests7/tdf109083.py | 34
sw/qa/uitest/writer_tests7/tdf115853.py | 27
sw/qa/uitest/writer_tests7/tdf119661.py | 67
sw/qa/uitest/writer_tests7/tdf122780.py | 11
sw/qa/uitest/writer_tests7/tdf131936.py | 13
sw/qa/uitest/writer_tests7/tdf132169.py | 9
sw/qa/uitest/writer_tests7/tdf133348.py | 23
sw/qa/uitest/writer_tests7/tdf134243.py | 8
sw/qa/uitest/writer_tests7/tdf137802.py | 7
sw/qa/uitest/writer_tests7/tdf137803.py | 13
sw/qa/uitest/writer_tests7/tdf139301.py | 26
sw/qa/uitest/writer_tests7/tdf140117.py | 15
sw/qa/uitest/writer_tests7/tdf140863.py | 35
sw/qa/uitest/writer_tests7/tdf141557.py | 7
sw/qa/uitest/writer_tests7/tdf46561.py | 13
sw/qa/uitest/writer_tests7/tdf90401.py | 53
111 files changed, 2994 insertions(+), 3918 deletions(-)
New commits:
commit 8b961addb7887a8b8dc8dbc6758c3dc7c1068ac4
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Jun 28 21:21:47 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 29 13:25:57 2021 +0200
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 at libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
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")
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list