summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 09:50:25 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 13:17:33 +0200
commitadf59322c651e8e6740a8d97d963dcf0972bdc54 (patch)
treea6728276e58544f87167a4bbb69a846584596afd
parentf7300b2f07f308118967c797206dbc4a1e9a61a4 (diff)
uitest: guard create_doc_in_start_center in sw
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I513c76fe3536ce2d541b3588ce3f23990a0771be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118145 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sw/qa/uitest/chapterNumbering/chapterNumbering.py114
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf140528.py42
-rw-r--r--sw/qa/uitest/chart/tdf138556.py55
-rw-r--r--sw/qa/uitest/classification/classification.py216
-rw-r--r--sw/qa/uitest/findBar/findbar.py79
-rw-r--r--sw/qa/uitest/findBar/tdf136941.py65
-rw-r--r--sw/qa/uitest/findBar/tdf138232.py45
-rw-r--r--sw/qa/uitest/findBar/tdf88608.py51
-rw-r--r--sw/qa/uitest/findReplace/findReplace.py78
-rw-r--r--sw/qa/uitest/findReplace/tdf106099.py46
-rw-r--r--sw/qa/uitest/findReplace/tdf119462.py44
-rw-r--r--sw/qa/uitest/librelogo/run.py80
-rw-r--r--sw/qa/uitest/macro_tests/tdf124413.py55
-rw-r--r--sw/qa/uitest/macro_tests/tdf64690.py73
-rw-r--r--sw/qa/uitest/navigator/tdf137274.py61
-rw-r--r--sw/qa/uitest/navigator/tdf140257.py114
-rw-r--r--sw/qa/uitest/options/optionsDialog.py50
-rw-r--r--sw/qa/uitest/options/tdf131581.py27
-rw-r--r--sw/qa/uitest/options/tdf78133.py48
-rw-r--r--sw/qa/uitest/sidebar/stylesSidebar.py77
-rw-r--r--sw/qa/uitest/sidebar/tdf133189.py119
-rw-r--r--sw/qa/uitest/sidebar/tdf135590.py77
-rw-r--r--sw/qa/uitest/styleInspector/tdf137105.py48
-rw-r--r--sw/qa/uitest/styleInspector/tdf137513.py65
-rw-r--r--sw/qa/uitest/table/insertTableDialog.py66
-rw-r--r--sw/qa/uitest/table/sheetToTable.py20
-rw-r--r--sw/qa/uitest/table/tdf115026.py21
-rw-r--r--sw/qa/uitest/table/tdf116737.py42
-rwxr-xr-xsw/qa/uitest/table/tdf128593.py33
-rw-r--r--sw/qa/uitest/table/textToTable.py38
-rw-r--r--sw/qa/uitest/ui/fmtui/fmtui.py28
-rw-r--r--sw/qa/uitest/ui/index/index.py70
-rw-r--r--sw/qa/uitest/writer_tests/comments.py240
-rw-r--r--sw/qa/uitest/writer_tests/insertCaption.py58
-rw-r--r--sw/qa/uitest/writer_tests/tdf134734.py114
-rw-r--r--sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py23
-rw-r--r--sw/qa/uitest/writer_tests/tdf53460.py102
-rw-r--r--sw/qa/uitest/writer_tests/tdf78068.py22
-rw-r--r--sw/qa/uitest/writer_tests/tdf93068.py46
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py191
-rw-r--r--sw/qa/uitest/writer_tests/watermark.py48
-rw-r--r--sw/qa/uitest/writer_tests/wordCount.py304
-rw-r--r--sw/qa/uitest/writer_tests2/asianPhoneticGuide.py40
-rw-r--r--sw/qa/uitest/writer_tests2/bookmark.py105
-rw-r--r--sw/qa/uitest/writer_tests2/deleteAllComments.py42
-rw-r--r--sw/qa/uitest/writer_tests2/documentProperties.py139
-rw-r--r--sw/qa/uitest/writer_tests2/exchangeDatabase.py36
-rw-r--r--sw/qa/uitest/writer_tests2/fontworks.py35
-rw-r--r--sw/qa/uitest/writer_tests2/formatBulletsNumbering.py452
-rw-r--r--sw/qa/uitest/writer_tests2/formatCharacter.py400
-rw-r--r--sw/qa/uitest/writer_tests2/formatParagraph.py902
-rw-r--r--sw/qa/uitest/writer_tests2/horizontalLine.py27
-rw-r--r--sw/qa/uitest/writer_tests2/insertFootnote.py34
-rw-r--r--sw/qa/uitest/writer_tests2/pasteSpecial.py28
-rw-r--r--sw/qa/uitest/writer_tests2/tdf116474.py58
-rw-r--r--sw/qa/uitest/writer_tests3/autoredactDialog.py186
-rw-r--r--sw/qa/uitest/writer_tests3/customizeDialog.py123
-rw-r--r--sw/qa/uitest/writer_tests3/hyperlinkdialog.py93
-rw-r--r--sw/qa/uitest/writer_tests3/insertEndnote.py34
-rw-r--r--sw/qa/uitest/writer_tests3/insertEnvelope.py42
-rw-r--r--sw/qa/uitest/writer_tests3/insertFootEndnote.py68
-rw-r--r--sw/qa/uitest/writer_tests3/insertPageFooter.py27
-rw-r--r--sw/qa/uitest/writer_tests3/insertQrCodeGen.py76
-rw-r--r--sw/qa/uitest/writer_tests3/insertSignatureLine.py136
-rw-r--r--sw/qa/uitest/writer_tests3/lineNumbering.py126
-rw-r--r--sw/qa/uitest/writer_tests3/pageDialog.py113
-rw-r--r--sw/qa/uitest/writer_tests3/sort.py86
-rw-r--r--sw/qa/uitest/writer_tests3/specialCharacter.py92
-rw-r--r--sw/qa/uitest/writer_tests3/tdf79236.py134
-rw-r--r--sw/qa/uitest/writer_tests4/insertBreakDialog.py50
-rw-r--r--sw/qa/uitest/writer_tests4/insertPageHeader.py27
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py74
-rw-r--r--sw/qa/uitest/writer_tests4/start.py30
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113252.py30
-rw-r--r--sw/qa/uitest/writer_tests4/tdf115572.py86
-rw-r--r--sw/qa/uitest/writer_tests4/tdf115573.py164
-rw-r--r--sw/qa/uitest/writer_tests4/tdf51352.py58
-rw-r--r--sw/qa/uitest/writer_tests4/tdf92611.py7
-rw-r--r--sw/qa/uitest/writer_tests5/about_test.py7
-rw-r--r--sw/qa/uitest/writer_tests5/autocorrectOptions.py160
-rw-r--r--sw/qa/uitest/writer_tests5/columns.py52
-rw-r--r--sw/qa/uitest/writer_tests5/tdf107494.py116
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122045.py28
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122722.py84
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123378.py16
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123446.py48
-rw-r--r--sw/qa/uitest/writer_tests5/titlePage.py30
-rw-r--r--sw/qa/uitest/writer_tests5/xwindow.py188
-rw-r--r--sw/qa/uitest/writer_tests5/zoom.py126
-rw-r--r--sw/qa/uitest/writer_tests6/infobar.py59
-rw-r--r--sw/qa/uitest/writer_tests6/tdf107847.py32
-rw-r--r--sw/qa/uitest/writer_tests6/tdf118883.py23
-rw-r--r--sw/qa/uitest/writer_tests6/tdf125104.py78
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126168.py50
-rw-r--r--sw/qa/uitest/writer_tests6/tdf128431.py34
-rw-r--r--sw/qa/uitest/writer_tests6/tdf131041.py34
-rw-r--r--sw/qa/uitest/writer_tests6/tdf44837.py54
-rw-r--r--sw/qa/uitest/writer_tests7/tdf109083.py83
-rw-r--r--sw/qa/uitest/writer_tests7/tdf115853.py27
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py84
-rw-r--r--sw/qa/uitest/writer_tests7/tdf133348.py66
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140731.py80
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140863.py58
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py1
104 files changed, 4347 insertions, 4626 deletions
diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py
index 6c34a722c833..c1fe43f7caab 100644
--- a/sw/qa/uitest/chapterNumbering/chapterNumbering.py
+++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py
@@ -17,69 +17,67 @@ from uitest.uihelper.common import change_measurement_unit
class WriterChapterNumbering(UITestCase):
def test_chapter_numbering_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- change_measurement_unit(self, "Millimeter")
+ change_measurement_unit(self, "Millimeter")
- with self.ui_test.execute_dialog_through_command(".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())
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog", close_button="cancel") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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/tdf140528.py b/sw/qa/uitest/chapterNumbering/tdf140528.py
index dc83265899ef..0fc4fc1b51cb 100644
--- a/sw/qa/uitest/chapterNumbering/tdf140528.py
+++ b/sw/qa/uitest/chapterNumbering/tdf140528.py
@@ -13,39 +13,37 @@ from uitest.uihelper.common import select_pos
class Tdf140528(UITestCase):
def test_tdf140528(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/chart/tdf138556.py b/sw/qa/uitest/chart/tdf138556.py
index 14dbc8675f41..6f06a546bb94 100644
--- a/sw/qa/uitest/chart/tdf138556.py
+++ b/sw/qa/uitest/chart/tdf138556.py
@@ -17,31 +17,30 @@ class tdf138556( UITestCase ):
def test_stock_chart13_insert_series( self ):
#Start LibreOffice Writer
- xDocument = self.ui_test.create_doc_in_start_center( "writer" )
- xMainTop = self.xUITest.getTopFocusWindow()
-
- #Insert Chart
- self.xUITest.executeCommand( ".uno:InsertObjectChart" )
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild( "chart_window" )
- xChart = xChartMain.getChild( "CID/Page=" )
-
- #Change Chart Type to Stock 1
- #TODO: test other subtypes
- with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramType" })) as xDialog:
- xChartType = xDialog.getChild( "charttype" )
- xStockType = xChartType.getChild( "8" )
- xStockType.executeAction( "SELECT", tuple())
-
- #Insert Data Series
- with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramData" }), close_button="close") as xDialog:
- xToolbar = xDialog.getChild( "toolbar" )
- xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" }))
-
- #Check Number of Sequences
- xDocument = self.ui_test.get_component()
- nSequences = len( xDocument.FirstDiagram.
- CoordinateSystems[0].ChartTypes[0].DataSeries[0].DataSequences )
- self.assertEqual( nSequences, 3 )
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded( "writer" ):
+ xMainTop = self.xUITest.getTopFocusWindow()
+
+ #Insert Chart
+ self.xUITest.executeCommand( ".uno:InsertObjectChart" )
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild( "chart_window" )
+ xChart = xChartMain.getChild( "CID/Page=" )
+
+ #Change Chart Type to Stock 1
+ #TODO: test other subtypes
+ with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramType" })) as xDialog:
+ xChartType = xDialog.getChild( "charttype" )
+ xStockType = xChartType.getChild( "8" )
+ xStockType.executeAction( "SELECT", tuple())
+
+ #Insert Data Series
+ with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramData" }), close_button="close") as xDialog:
+ xToolbar = xDialog.getChild( "toolbar" )
+ xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" }))
+
+ #Check Number of Sequences
+ xDocument = self.ui_test.get_component()
+ nSequences = len( xDocument.FirstDiagram.
+ CoordinateSystems[0].ChartTypes[0].DataSeries[0].DataSequences )
+ self.assertEqual( nSequences, 3 )
+
diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py
index e3b4a41e2c99..ab0c88939525 100644
--- a/sw/qa/uitest/classification/classification.py
+++ b/sw/qa/uitest/classification/classification.py
@@ -38,121 +38,115 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class classification(UITestCase):
def test_document_classification_dialog(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".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")
-
- controller = self.ui_test.get_component().getCurrentController()
- self.assertTrue(controller.hasInfobar("classification"))
-
- #verify watermark
- #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document
- with self.ui_test.execute_dialog_through_command(".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
- #verify
- #reopen and verify classification and Content
-
- #do the same for Paragraph classification
- with self.ui_test.execute_dialog_through_command(".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")
- self.assertTrue(controller.hasInfobar("classification"))
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command(".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")
+
+ controller = document.getCurrentController()
+ self.assertTrue(controller.hasInfobar("classification"))
+
+ #verify watermark
+ #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document
+ with self.ui_test.execute_dialog_through_command(".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
+ #verify
+ #reopen and verify classification and Content
+
+ #do the same for Paragraph classification
+ with self.ui_test.execute_dialog_through_command(".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")
+ self.assertTrue(controller.hasInfobar("classification"))
- self.ui_test.close_doc()
def test_paragraph_classification_dialog(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #+ new file and do it only for Paragraph classification (no watermark!)
- with self.ui_test.execute_dialog_through_command(".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))
-
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #+ new file and do it only for Paragraph classification (no watermark!)
+ with self.ui_test.execute_dialog_through_command(".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 = document.getCurrentController()
+ self.assertEqual(document.Text.String[0:6], "(Conf)")
+ self.assertFalse(controller.hasInfobar("classification"))
+ self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn)
- controller = self.ui_test.get_component().getCurrentController()
- self.assertEqual(document.Text.String[0:6], "(Conf)")
- self.assertFalse(controller.hasInfobar("classification"))
- self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn)
-
- self.ui_test.close_doc()
def test_paragraph_classification_dialog_text(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #+ new file and do it only for Paragraph classification (no watermark!)
- with self.ui_test.execute_dialog_through_command(".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)")
- self.assertFalse(controller.hasInfobar("classification"))
- self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #+ new file and do it only for Paragraph classification (no watermark!)
+ with self.ui_test.execute_dialog_through_command(".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 = document.getCurrentController()
+ self.assertEqual(document.Text.String[0:6], "(AAIO)")
+ self.assertFalse(controller.hasInfobar("classification"))
+ self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findBar/findbar.py b/sw/qa/uitest/findBar/findbar.py
index 75bfbb33abd9..288a9df1013b 100644
--- a/sw/qa/uitest/findBar/findbar.py
+++ b/sw/qa/uitest/findBar/findbar.py
@@ -16,54 +16,53 @@ class FindBar(UITestCase):
def test_find_bar(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- # Type some lines to search for words on them
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"}))
+ # Type some lines to search for words on them
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"}))
- # open the Find Bar
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"}))
+ # open the Find Bar
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"}))
- # Type the Word that we want to search for it
- xfind = xWriterDoc.getChild("find")
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"}))
+ # Type the Word that we want to search for it
+ xfind = xWriterDoc.getChild("find")
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"}))
- # Select the Find Bar
- xfind_bar = xWriterDoc.getChild("FindBar")
- self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14")
+ # Select the Find Bar
+ xfind_bar = xWriterDoc.getChild("FindBar")
+ self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14")
- # Press on FindAll in the Find Bar
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All")
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll")
- self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre")
+ # Press on FindAll in the Find Bar
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All")
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre")
- # Press on Find Next in the Find Bar
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4")
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next")
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch")
- self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
+ # Press on Find Next in the Find Bar
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4")
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next")
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
- # Press on Find Previous in the Find Bar
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3")
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous")
- self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch")
- self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
+ # Press on Find Previous in the Find Bar
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3")
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous")
+ self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
- # Close the Find Bar
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close
+ # Close the Find Bar
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findBar/tdf136941.py b/sw/qa/uitest/findBar/tdf136941.py
index c77a7e2a2277..99b8b33acba7 100644
--- a/sw/qa/uitest/findBar/tdf136941.py
+++ b/sw/qa/uitest/findBar/tdf136941.py
@@ -12,55 +12,54 @@ class tdf136941(UITestCase):
def test_tdf136941(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"}))
- self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+ self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
- xfind = xWriterDoc.getChild("find")
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+ xfind = xWriterDoc.getChild("find")
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
- self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
+ self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
- xfind_bar = xWriterDoc.getChild("FindBar")
+ xfind_bar = xWriterDoc.getChild("FindBar")
- # Search Next
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ # Search Next
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
- # Close button
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
+ # Close button
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
- # Check the toolbar is closed
- self.assertTrue("find" not in xWriterDoc.getChildren())
- self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText'])
+ # Check the toolbar is closed
+ self.assertTrue("find" not in xWriterDoc.getChildren())
+ self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText'])
- self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+ self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
- xfind = xWriterDoc.getChild("find")
- self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello")
- self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText'])
+ xfind = xWriterDoc.getChild("find")
+ self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello")
+ self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText'])
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
- # Without the fix in place, this test would have failed with
- # AssertionError: 'World' != 'WorldHello'
- self.assertEqual("World", get_state_as_dict(xfind)['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'World' != 'WorldHello'
+ self.assertEqual("World", get_state_as_dict(xfind)['Text'])
- xfind_bar = xWriterDoc.getChild("FindBar")
+ xfind_bar = xWriterDoc.getChild("FindBar")
- # Search Next
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ # Search Next
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
- # Close button
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
+ # Close button
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"}))
- # Check the toolbar is closed
- self.assertTrue("find" not in xWriterDoc.getChildren())
- self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText'])
+ # Check the toolbar is closed
+ self.assertTrue("find" not in xWriterDoc.getChildren())
+ self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findBar/tdf138232.py b/sw/qa/uitest/findBar/tdf138232.py
index 62a79824ea4d..f6ec1161c56d 100644
--- a/sw/qa/uitest/findBar/tdf138232.py
+++ b/sw/qa/uitest/findBar/tdf138232.py
@@ -12,40 +12,39 @@ class tdf138232(UITestCase):
def test_tdf138232(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
- self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+ self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
- xfind = xWriterDoc.getChild("find")
- self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true")
- self.assertEqual("true", get_state_as_dict(xfind)['HasFocus'])
+ xfind = xWriterDoc.getChild("find")
+ self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true")
+ self.assertEqual("true", get_state_as_dict(xfind)['HasFocus'])
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
- self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+ self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
- xfind_bar = xWriterDoc.getChild("FindBar")
+ xfind_bar = xWriterDoc.getChild("FindBar")
- # Click on Find All
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+ # Click on Find All
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
- self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText'])
+ self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText'])
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
- # Without the fix in place, this test would have failed with
- # AssertionError: 'HelloWorld' != 'World'
- self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'HelloWorld' != 'World'
+ self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text'])
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
- self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText'])
+ self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findBar/tdf88608.py b/sw/qa/uitest/findBar/tdf88608.py
index b3576ec7587e..050f234b075e 100644
--- a/sw/qa/uitest/findBar/tdf88608.py
+++ b/sw/qa/uitest/findBar/tdf88608.py
@@ -12,44 +12,43 @@ class tdf88608(UITestCase):
def test_tdf88608(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"}))
- self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+ self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
- # Search a word that doesn't exist
- xfind = xWriterDoc.getChild("find")
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "X"}))
- self.assertEqual("X", get_state_as_dict(xfind)['Text'])
+ # Search a word that doesn't exist
+ xfind = xWriterDoc.getChild("find")
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "X"}))
+ self.assertEqual("X", get_state_as_dict(xfind)['Text'])
- xfind_bar = xWriterDoc.getChild("FindBar")
- self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
+ xfind_bar = xWriterDoc.getChild("FindBar")
+ self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
- # Search Next
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ # Search Next
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
- self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
+ self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
- self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText'])
+ self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText'])
- xfind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
- self.assertEqual("World", get_state_as_dict(xfind)['Text'])
+ xfind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"}))
+ self.assertEqual("World", get_state_as_dict(xfind)['Text'])
- # Without the fix in place, this test would have failed with
- # AssertionError: '' != 'Search key not found'
- self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '' != 'Search key not found'
+ self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
- # Search Next
- xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ # Search Next
+ xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
- self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
+ self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text'])
- self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText'])
+ self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py
index 68f9f882b3e9..d9128ec23e6b 100644
--- a/sw/qa/uitest/findReplace/findReplace.py
+++ b/sw/qa/uitest/findReplace/findReplace.py
@@ -94,30 +94,28 @@ class findReplace(UITestCase):
#Bug 39022 - find-replace->$1, not pattern
def test_tdf39022_replace_regexp(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "test number1 testnot")
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"T(est|other)\\>"})) #find
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"replaced$1"})) #replace
- regexp = xDialog.getChild("regexp")
- regexp.executeAction("CLICK", tuple()) #regular expressions
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot")
- regexp.executeAction("CLICK", tuple())
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ type_text(xWriterEdit, "test number1 testnot")
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"T(est|other)\\>"})) #find
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"replaced$1"})) #replace
+ regexp = xDialog.getChild("regexp")
+ regexp.executeAction("CLICK", tuple()) #regular expressions
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot")
+ regexp.executeAction("CLICK", tuple())
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+
#tdf116242 ţ ț
def test_tdf116242_replace_t_with_cedilla(self):
@@ -167,34 +165,32 @@ class findReplace(UITestCase):
self.ui_test.close_dialog_through_button(xcloseBtn)
def test_tdf136577(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- type_text(xWriterEdit, "x")
+ type_text(xWriterEdit, "x")
- self.assertEqual(document.Text.String, "x")
+ self.assertEqual(document.Text.String, "x")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"x"}))
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"x"}))
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple())
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String, "")
+ self.assertEqual(document.Text.String, "")
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- # Without the fix in place, this test would have failed with AssertionError: '' != 'x'
- self.assertEqual(document.Text.String, "x")
+ # Without the fix in place, this test would have failed with AssertionError: '' != 'x'
+ self.assertEqual(document.Text.String, "x")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findReplace/tdf106099.py b/sw/qa/uitest/findReplace/tdf106099.py
index d0c1ad76f251..483bf2c3aff6 100644
--- a/sw/qa/uitest/findReplace/tdf106099.py
+++ b/sw/qa/uitest/findReplace/tdf106099.py
@@ -13,30 +13,28 @@ from uitest.uihelper.common import get_state_as_dict
class tdf106099(UITestCase):
def test_tdf106099_find_format_underline(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #Find and replace
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #2. Choose Format
- format = xDialog.getChild("format")
- with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
- #Font effects - Underline Single. OK.
- xTabs = dialog.getChild("tabcontrol")
- select_pos(xTabs, "1") #tab font effects
- underlinelb = dialog.getChild("underlinelb")
- select_by_text(underlinelb, "Single")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #Find and replace
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #2. Choose Format
+ format = xDialog.getChild("format")
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
+ #Font effects - Underline Single. OK.
+ xTabs = dialog.getChild("tabcontrol")
+ select_pos(xTabs, "1") #tab font effects
+ underlinelb = dialog.getChild("underlinelb")
+ select_by_text(underlinelb, "Single")
- #verify label searchdesc
- searchdesc = xDialog.getChild("searchdesc")
- print(get_state_as_dict(searchdesc))
- self.assertEqual(get_state_as_dict(searchdesc)["Text"], "Single underline")
- noformat = xDialog.getChild("noformat")
- noformat.executeAction("CLICK", tuple()) #click No format button
- self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
+ #verify label searchdesc
+ searchdesc = xDialog.getChild("searchdesc")
+ print(get_state_as_dict(searchdesc))
+ self.assertEqual(get_state_as_dict(searchdesc)["Text"], "Single underline")
+ noformat = xDialog.getChild("noformat")
+ noformat.executeAction("CLICK", tuple()) #click No format button
+ self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findReplace/tdf119462.py b/sw/qa/uitest/findReplace/tdf119462.py
index 4402d1acaedd..3c3601193311 100644
--- a/sw/qa/uitest/findReplace/tdf119462.py
+++ b/sw/qa/uitest/findReplace/tdf119462.py
@@ -13,29 +13,27 @@ from uitest.uihelper.common import get_state_as_dict
class tdf119462(UITestCase):
def test_tdf119462_find_format(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #1. Choose Edit > Find and Replace
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #2. Choose Format
- format = xDialog.getChild("format")
- with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
- #3. Choose Bold
- xTabs = dialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xweststylelbcjk = dialog.getChild("weststylelb-cjk")
- xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"}))
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #1. Choose Edit > Find and Replace
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #2. Choose Format
+ format = xDialog.getChild("format")
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
+ #3. Choose Bold
+ xTabs = dialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xweststylelbcjk = dialog.getChild("weststylelb-cjk")
+ xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"}))
- #verify label searchdesc
- searchdesc = xDialog.getChild("searchdesc")
- self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold")
- noformat = xDialog.getChild("noformat")
- noformat.executeAction("CLICK", tuple()) #click No format button
- self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
+ #verify label searchdesc
+ searchdesc = xDialog.getChild("searchdesc")
+ self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold")
+ noformat = xDialog.getChild("noformat")
+ noformat.executeAction("CLICK", tuple()) #click No format button
+ self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py
index 26b8f5c7df44..7d7ca4611f3b 100644
--- a/sw/qa/uitest/librelogo/run.py
+++ b/sw/qa/uitest/librelogo/run.py
@@ -28,43 +28,42 @@ class LibreLogoTest(UITestCase):
self.xUITest.executeCommand(self.LIBRELOGO_PATH %command)
def test_librelogo(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- # to check the state of LibreLogo program execution
- xIsAlive = self.getScript("__is_alive__")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # to check the state of LibreLogo program execution
+ xIsAlive = self.getScript("__is_alive__")
- # run a program with basic drawing commands FORWARD and RIGHT
- # using their abbreviated names FD and RT
- type_text(xWriterEdit, "fd 100 rt 45 fd 100")
- self.logo("run")
- # wait for LibreLogo program termination
- while xIsAlive.invoke((), (), ())[0]:
- pass
- # check shape count for
- # a) program running:
- # - turtle shape: result of program start
- # - line shape: result of turtle drawing
- # b) continuous line drawing (the regression
- # related to the fix of tdf#106792 resulted shorter line
- # segments than the turtle path and non-continuous line
- # drawing, ie. in this example, three line shapes
- # instead of a single one. See its fix in
- # commit 502e8785085f9e8b54ee383080442c2dcaf95b15)
- self.assertEqual(document.DrawPage.getCount(), 2)
+ # run a program with basic drawing commands FORWARD and RIGHT
+ # using their abbreviated names FD and RT
+ type_text(xWriterEdit, "fd 100 rt 45 fd 100")
+ self.logo("run")
+ # wait for LibreLogo program termination
+ while xIsAlive.invoke((), (), ())[0]:
+ pass
+ # check shape count for
+ # a) program running:
+ # - turtle shape: result of program start
+ # - line shape: result of turtle drawing
+ # b) continuous line drawing (the regression
+ # related to the fix of tdf#106792 resulted shorter line
+ # segments than the turtle path and non-continuous line
+ # drawing, ie. in this example, three line shapes
+ # instead of a single one. See its fix in
+ # commit 502e8785085f9e8b54ee383080442c2dcaf95b15)
+ self.assertEqual(document.DrawPage.getCount(), 2)
- # check formatting by "magic wand"
- self.logo("__translate__")
- # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT,
- # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n")
- self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100")
- # c) check usage of real paragraphs instead of line break (tdf#120422)
- # first paragraph is empty (for working page break)
- self.assertEqual(document.Text.createEnumeration().nextElement().String, "")
+ # check formatting by "magic wand"
+ self.logo("__translate__")
+ # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT,
+ # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n")
+ self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100")
+ # c) check usage of real paragraphs instead of line break (tdf#120422)
+ # first paragraph is empty (for working page break)
+ self.assertEqual(document.Text.createEnumeration().nextElement().String, "")
- # function definitions and calls can be in arbitrary order
- document.Text.String = """
+ # function definitions and calls can be in arbitrary order
+ document.Text.String = """
; dragon curve
TO x n
IF n = 0 [ STOP ]
@@ -85,13 +84,12 @@ END
PICTURE ; start new line draw
x 3 ; draw only a few levels
"""
- self.logo("run")
- # wait for LibreLogo program termination
- while xIsAlive.invoke((), (), ())[0]:
- pass
- # new shape + previous two ones = 3
- self.assertEqual(document.DrawPage.getCount(), 3)
+ self.logo("run")
+ # wait for LibreLogo program termination
+ while xIsAlive.invoke((), (), ())[0]:
+ pass
+ # new shape + previous two ones = 3
+ self.assertEqual(document.DrawPage.getCount(), 3)
- self.ui_test.close_doc()
# 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 a81faffbb34f..b2577267b803 100644
--- a/sw/qa/uitest/macro_tests/tdf124413.py
+++ b/sw/qa/uitest/macro_tests/tdf124413.py
@@ -12,33 +12,32 @@ class tdf124413(UITestCase):
def test_copy_paste_overwriting_undo_redo_in_macro_editor_tdf124413(self):
- self.ui_test.create_doc_in_start_center("writer")
- #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
+ with self.ui_test.execute_dialog_through_command(".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)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py
index 26a7bc949131..a764185646a1 100644
--- a/sw/qa/uitest/macro_tests/tdf64690.py
+++ b/sw/qa/uitest/macro_tests/tdf64690.py
@@ -13,60 +13,59 @@ class tdf64690(UITestCase):
def test_tdf64690(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="edit"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="edit"):
+ pass
- xMacroWin = self.xUITest.getTopFocusWindow()
- xEditWin = xMacroWin.getChild('EditorWindow')
+ xMacroWin = self.xUITest.getTopFocusWindow()
+ xEditWin = xMacroWin.getChild('EditorWindow')
- self.xUITest.executeCommand(".uno:SelectAll")
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ self.xUITest.executeCommand(".uno:SelectAll")
+ xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- self.assertEqual("\n", get_state_as_dict(xEditWin)['Text'])
+ self.assertEqual("\n", get_state_as_dict(xEditWin)['Text'])
- xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"}))
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
- xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"}))
+ xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"}))
+ xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+ xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"}))
- self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text'])
+ self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text'])
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"}))
- regexp = xDialog.getChild("regexp")
- if get_state_as_dict(regexp)['Selected'] == 'false':
- regexp.executeAction("CLICK", tuple())
- self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
+ regexp = xDialog.getChild("regexp")
+ if get_state_as_dict(regexp)['Selected'] == 'false':
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
- selection = xDialog.getChild("selection")
- if get_state_as_dict(selection)['Selected'] == 'false':
- selection.executeAction("CLICK", tuple())
- self.assertEqual("true", get_state_as_dict(selection)['Selected'])
+ selection = xDialog.getChild("selection")
+ if get_state_as_dict(selection)['Selected'] == 'false':
+ selection.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(selection)['Selected'])
- replaceall = xDialog.getChild("replaceall")
+ replaceall = xDialog.getChild("replaceall")
- # Without the fix in place, this test would have hung here
- with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())):
- pass
+ # Without the fix in place, this test would have hung here
+ with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())):
+ pass
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
- self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text'])
+ self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py
index 36f25f4c2d7a..b37d6413160b 100644
--- a/sw/qa/uitest/navigator/tdf137274.py
+++ b/sw/qa/uitest/navigator/tdf137274.py
@@ -12,54 +12,53 @@ class tdf137274(UITestCase):
def test_tdf137274(self):
- xMainDoc = self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- xMainWindow = self.xUITest.getTopFocusWindow()
- xWriterEdit = xMainWindow.getChild("writer_edit")
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xMainWindow.getChild("writer_edit")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"}))
- # Insert first comment
- xArgs = mkPropertyValues({"Text": "C1"})
- self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+ # Insert first comment
+ xArgs = mkPropertyValues({"Text": "C1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
- # wait until the comment is available
- self.ui_test.wait_until_child_is_available('Comment1')
+ # wait until the comment is available
+ self.ui_test.wait_until_child_is_available('Comment1')
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
- # wait until the navigator panel is available
- xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
+ # wait until the navigator panel is available
+ xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
- xContentTree = xNavigatorPanel.getChild("contenttree")
- xComments = xContentTree.getChild('10')
- self.assertEqual('Comments', get_state_as_dict(xComments)['Text'])
+ xContentTree = xNavigatorPanel.getChild("contenttree")
+ xComments = xContentTree.getChild('10')
+ self.assertEqual('Comments', get_state_as_dict(xComments)['Text'])
- xComments.executeAction("EXPAND", tuple())
+ xComments.executeAction("EXPAND", tuple())
- self.assertEqual(1, len(xComments.getChildren()))
- self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text'])
+ self.assertEqual(1, len(xComments.getChildren()))
+ self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text'])
- xComments.executeAction("COLLAPSE", tuple())
+ xComments.executeAction("COLLAPSE", tuple())
- xArgs = mkPropertyValues({"Text": "C2"})
- self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+ xArgs = mkPropertyValues({"Text": "C2"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
- # wait until the second comment is available
- self.ui_test.wait_until_child_is_available('Comment2')
+ # wait until the second comment is available
+ self.ui_test.wait_until_child_is_available('Comment2')
- xComments.executeAction("EXPAND", tuple())
+ xComments.executeAction("EXPAND", tuple())
- # Without the fix in place, this test would have failed with AssertionError: 2 != 0
- self.assertEqual(2, len(xComments.getChildren()))
- self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text'])
+ # Without the fix in place, this test would have failed with AssertionError: 2 != 0
+ self.assertEqual(2, len(xComments.getChildren()))
+ self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text'])
- xComments.executeAction("COLLAPSE", tuple())
+ xComments.executeAction("COLLAPSE", tuple())
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py
index 24bc177d47d7..b7b5e7aefa3c 100644
--- a/sw/qa/uitest/navigator/tdf140257.py
+++ b/sw/qa/uitest/navigator/tdf140257.py
@@ -24,89 +24,87 @@ class Tdf140257(UITestCase):
def test_tdf140257(self):
- self.ui_test.create_doc_in_start_center("writer")
- xMainWindow = self.xUITest.getTopFocusWindow()
- xWriterEdit = xMainWindow.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xMainWindow.getChild("writer_edit")
- self.change_outline_level("Level 1")
+ self.change_outline_level("Level 1")
- for i in range(4):
- type_text(xWriterEdit, 'P' + str(i + 1))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ for i in range(4):
+ type_text(xWriterEdit, 'P' + str(i + 1))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- type_text(xWriterEdit, 'P5')
+ type_text(xWriterEdit, 'P5')
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
- # wait until the navigator panel is available
- xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
+ # wait until the navigator panel is available
+ xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
- xContentTree = xNavigatorPanel.getChild("contenttree")
- xHeadings = xContentTree.getChild('0')
- self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text'])
+ xContentTree = xNavigatorPanel.getChild("contenttree")
+ xHeadings = xContentTree.getChild('0')
+ self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text'])
- xHeadings.executeAction("EXPAND", tuple())
+ xHeadings.executeAction("EXPAND", tuple())
- self.assertEqual(5, len(xHeadings.getChildren()))
+ self.assertEqual(5, len(xHeadings.getChildren()))
- for i in range(5):
- self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text'])
+ for i in range(5):
+ self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text'])
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- document = self.ui_test.get_component()
- cursor = document.getCurrentController().getViewCursor()
+ cursor = document.getCurrentController().getViewCursor()
- # Use Adding Selection
- selectionProperty = mkPropertyValues({"SelectionMode": 2})
- self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty)
+ # Use Adding Selection
+ selectionProperty = mkPropertyValues({"SelectionMode": 2})
+ self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty)
- # Go to P2 and select it
- cursor.goUp(3, False)
- cursor.gotoStartOfLine(False)
- cursor.gotoEndOfLine(True)
+ # Go to P2 and select it
+ cursor.goUp(3, False)
+ cursor.gotoStartOfLine(False)
+ cursor.gotoEndOfLine(True)
- # Go to P4 and select it
- cursor.goDown(2, False)
- cursor.gotoStartOfLine(False)
- cursor.gotoEndOfLine(True)
+ # Go to P4 and select it
+ cursor.goDown(2, False)
+ cursor.gotoStartOfLine(False)
+ cursor.gotoEndOfLine(True)
- self.change_outline_level("Level 2")
+ self.change_outline_level("Level 2")
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
- # wait until the navigator panel is available
- xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
+ # wait until the navigator panel is available
+ xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
- xContentTree = xNavigatorPanel.getChild("contenttree")
- xHeadings = xContentTree.getChild('0')
- self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text'])
+ xContentTree = xNavigatorPanel.getChild("contenttree")
+ xHeadings = xContentTree.getChild('0')
+ self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text'])
- xHeadings.executeAction("EXPAND", tuple())
+ xHeadings.executeAction("EXPAND", tuple())
- # Without the fix in place, this test would have failed with
- # AssertionError: 3 != 4
- self.assertEqual(3, len(xHeadings.getChildren()))
- xChild1 = xHeadings.getChild('0')
- self.assertEqual('P1', get_state_as_dict(xChild1)['Text'])
- xChild1.executeAction("EXPAND", tuple())
- self.assertEqual(1, len(xChild1.getChildren()))
- self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 3 != 4
+ self.assertEqual(3, len(xHeadings.getChildren()))
+ xChild1 = xHeadings.getChild('0')
+ self.assertEqual('P1', get_state_as_dict(xChild1)['Text'])
+ xChild1.executeAction("EXPAND", tuple())
+ self.assertEqual(1, len(xChild1.getChildren()))
+ self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text'])
- xChild2 = xHeadings.getChild('1')
- self.assertEqual('P3', get_state_as_dict(xChild2)['Text'])
- xChild2.executeAction("EXPAND", tuple())
- self.assertEqual(1, len(xChild2.getChildren()))
- self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text'])
+ xChild2 = xHeadings.getChild('1')
+ self.assertEqual('P3', get_state_as_dict(xChild2)['Text'])
+ xChild2.executeAction("EXPAND", tuple())
+ self.assertEqual(1, len(xChild2.getChildren()))
+ self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text'])
- self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text'])
+ self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text'])
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/options/optionsDialog.py b/sw/qa/uitest/options/optionsDialog.py
index c7bbcf71ec49..20099df1a2d7 100644
--- a/sw/qa/uitest/options/optionsDialog.py
+++ b/sw/qa/uitest/options/optionsDialog.py
@@ -9,44 +9,42 @@ from uitest.framework import UITestCase
class optionsDialog(UITestCase):
def test_moreIconsDialog(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
- 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")
- self.ui_test.close_doc()
def test_tdf138596(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
- 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(".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())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/options/tdf131581.py b/sw/qa/uitest/options/tdf131581.py
index 0c59f076cdf3..aab3865dc51d 100644
--- a/sw/qa/uitest/options/tdf131581.py
+++ b/sw/qa/uitest/options/tdf131581.py
@@ -10,26 +10,25 @@ from uitest.framework import UITestCase
class tdf131581(UITestCase):
def test_tdf131581(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt:
+ with self.ui_test.execute_dialog_through_command(".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())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py
index ac71e642d062..79b38e1f6db5 100644
--- a/sw/qa/uitest/options/tdf78133.py
+++ b/sw/qa/uitest/options/tdf78133.py
@@ -14,32 +14,30 @@ class tdf78133(UITestCase):
def test_tdf78133_options_app_colors(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- #New text document
- #open option, go to App colors
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #New text document
+ #open option, go to App colors
+ with self.ui_test.execute_dialog_through_command(".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())
- #verify - reopen dialog and check if "text boundaries" is still unchecked
- with self.ui_test.execute_dialog_through_command(".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())
+ #verify - reopen dialog and check if "text boundaries" is still unchecked
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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 7480c8008d78..8a7a7a5b1e92 100644
--- a/sw/qa/uitest/sidebar/stylesSidebar.py
+++ b/sw/qa/uitest/sidebar/stylesSidebar.py
@@ -12,61 +12,60 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class StylesSidebar(UITestCase):
def test_load_styles_from_template(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:LoadStyles", close_button="") as xDialog:
- xText = xDialog.getChild("text")
- xNumbering = xDialog.getChild("numbering")
- xFrame = xDialog.getChild("frame")
- xPages = xDialog.getChild("pages")
+ with self.ui_test.execute_dialog_through_command(".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'])
+ 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())
+ 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'])
+ 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 = xDialog.getChild("fromfile")
- with self.ui_test.execute_dialog_through_action(xFileName, 'CLICK', close_button="open") as dialog:
- xFileName = dialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")}))
+ with self.ui_test.execute_dialog_through_action(xFileName, 'CLICK', close_button="open") as dialog:
+ xFileName = dialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")}))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
- xFilter = xWriterEdit.getChild('filter')
- select_by_text(xFilter, "Custom Styles")
+ xFilter = xWriterEdit.getChild('filter')
+ select_by_text(xFilter, "Custom Styles")
- expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle",
- "customPageStyle", "customNumberingStyle"]
+ expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle",
+ "customPageStyle", "customNumberingStyle"]
- for i in range(5):
- xLeft = xWriterEdit.getChild('left')
+ for i in range(5):
+ xLeft = xWriterEdit.getChild('left')
- #change to another style type
- xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )}))
+ #change to another style type
+ xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )}))
- xFlatView = xWriterEdit.getChild("flatview")
+ xFlatView = xWriterEdit.getChild("flatview")
- self.assertEqual(1, len(xFlatView.getChildren()))
+ self.assertEqual(1, len(xFlatView.getChildren()))
- xFlatView.getChild('0').executeAction("SELECT", tuple())
- self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText'])
+ xFlatView.getChild('0').executeAction("SELECT", tuple())
+ self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText'])
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py
index 978358f0c2fe..0c40c8c8d72c 100644
--- a/sw/qa/uitest/sidebar/tdf133189.py
+++ b/sw/qa/uitest/sidebar/tdf133189.py
@@ -11,66 +11,65 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf133189(UITestCase):
def test_tdf133189(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
-
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
-
- xPaperSize = xWriterEdit.getChild('papersize')
- xPaperWidth = xWriterEdit.getChild('paperwidth')
- xPaperHeight = xWriterEdit.getChild('paperheight')
- xPaperOrient = xWriterEdit.getChild('paperorientation')
- xPaperMargin = xWriterEdit.getChild('marginLB')
-
- #change measurement to Inches
- change_measurement_unit(self, 'Inch')
-
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- xWidth = xDialog.getChild('spinWidth')
- xHeight = xDialog.getChild('spinHeight')
-
- props = {"VALUE": '8.0'}
- actionProps = mkPropertyValues(props)
-
- xWidth.executeAction("VALUE", actionProps)
- xHeight.executeAction("VALUE", actionProps)
-
-
- self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
- self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
- self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
- self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
- self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
- self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
- self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″")
- self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″")
- self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″")
- self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
-
- #change measurement again to Centimeters
- change_measurement_unit(self, 'Centimeter')
-
- self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
- # tdf#129267
- self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
- self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
- self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
- self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
- self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
- self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm")
- self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm")
- self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm")
- self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm")
-
- self.xUITest.executeCommand(".uno:Sidebar")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
+
+ xPaperSize = xWriterEdit.getChild('papersize')
+ xPaperWidth = xWriterEdit.getChild('paperwidth')
+ xPaperHeight = xWriterEdit.getChild('paperheight')
+ xPaperOrient = xWriterEdit.getChild('paperorientation')
+ xPaperMargin = xWriterEdit.getChild('marginLB')
+
+ #change measurement to Inches
+ change_measurement_unit(self, 'Inch')
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild('spinWidth')
+ xHeight = xDialog.getChild('spinHeight')
+
+ props = {"VALUE": '8.0'}
+ actionProps = mkPropertyValues(props)
+
+ xWidth.executeAction("VALUE", actionProps)
+ xHeight.executeAction("VALUE", actionProps)
+
+
+ self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
+ self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+ self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
+ self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″")
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
+
+ #change measurement again to Centimeters
+ change_measurement_unit(self, 'Centimeter')
+
+ self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
+ # tdf#129267
+ self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+ self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
+ self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm")
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py
index b2a86700b5d3..149ebfc04086 100644
--- a/sw/qa/uitest/sidebar/tdf135590.py
+++ b/sw/qa/uitest/sidebar/tdf135590.py
@@ -12,64 +12,63 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf135590(UITestCase):
def test_tdf135590(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- #change measurement to Centimeter
- change_measurement_unit(self, 'Centimeter')
+ #change measurement to Centimeter
+ change_measurement_unit(self, 'Centimeter')
- with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog:
- 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'])
- # A new document is created
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # A new document is created
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ with self.ui_test.execute_dialog_through_command(".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'])
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
- xPaperSize = xWriterEdit.getChild('papersize')
- self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
- self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+ xPaperSize = xWriterEdit.getChild('papersize')
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
- xPaperHeight = xWriterEdit.getChild('paperheight')
- self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm")
- self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm")
+ xPaperHeight = xWriterEdit.getChild('paperheight')
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm")
- xPaperWidth = xWriterEdit.getChild('paperwidth')
- self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm")
- self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm")
+ xPaperWidth = xWriterEdit.getChild('paperwidth')
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm")
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/styleInspector/tdf137105.py b/sw/qa/uitest/styleInspector/tdf137105.py
index b0a6b709d1e8..6c8d353fba33 100644
--- a/sw/qa/uitest/styleInspector/tdf137105.py
+++ b/sw/qa/uitest/styleInspector/tdf137105.py
@@ -9,30 +9,28 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf137105(UITestCase):
def test_tdf137105(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- text = document.getText()
- cursor = text.createTextCursor()
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- #select image
- document.getCurrentController().select(document.getDrawPage()[0])
-
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- # Without the fix in place, this test would have crashed here
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
-
- # if the image is selected, there is nothing in the panel
- self.assertEqual('0', get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children'])
-
- self.xUITest.executeCommand(".uno:Sidebar")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ text = document.getText()
+ cursor = text.createTextCursor()
+ textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
+ provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+ graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
+ textGraphic.Graphic = graphic
+ text.insertTextContent(cursor, textGraphic, False)
+ #select image
+ document.getCurrentController().select(document.getDrawPage()[0])
+
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ # Without the fix in place, this test would have crashed here
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ # if the image is selected, there is nothing in the panel
+ self.assertEqual('0', get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children'])
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/styleInspector/tdf137513.py b/sw/qa/uitest/styleInspector/tdf137513.py
index 6c216b40f33a..8ca2792bfcf7 100644
--- a/sw/qa/uitest/styleInspector/tdf137513.py
+++ b/sw/qa/uitest/styleInspector/tdf137513.py
@@ -9,50 +9,49 @@ from uitest.uihelper.common import get_state_as_dict, type_text
class tdf137513(UITestCase):
def test_tdf137513(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2")
+ self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "test")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ type_text(xWriterEdit, "test")
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Bold")
+ self.xUITest.executeCommand(".uno:Bold")
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
- xListBox = xWriterEdit.getChild('listbox_fonts')
+ xListBox = xWriterEdit.getChild('listbox_fonts')
- # The cursor is on text inside the table with direct formatting
- self.assertEqual(2, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ # The cursor is on text inside the table with direct formatting
+ self.assertEqual(2, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- xTableContent = xListBox.getChild('0').getChild('1')
- self.assertEqual(5, len(xTableContent.getChildren()))
- self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text'])
- self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('1'))['Text'])
- self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('2'))['Text'])
- self.assertEqual("Para Orphans\t0", get_state_as_dict(xTableContent.getChild('3'))['Text'])
- self.assertEqual("Para Widows\t0", get_state_as_dict(xTableContent.getChild('4'))['Text'])
+ xTableContent = xListBox.getChild('0').getChild('1')
+ self.assertEqual(5, len(xTableContent.getChildren()))
+ self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text'])
+ self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('1'))['Text'])
+ self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('2'))['Text'])
+ self.assertEqual("Para Orphans\t0", get_state_as_dict(xTableContent.getChild('3'))['Text'])
+ self.assertEqual("Para Widows\t0", get_state_as_dict(xTableContent.getChild('4'))['Text'])
- xParDirFormatting = xListBox.getChild('1')
+ xParDirFormatting = xListBox.getChild('1')
- # Without the fix in place, this test would have failed here with
- # AssertionError: 3 != 0
- self.assertEqual(3, len(xParDirFormatting.getChildren()))
- self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
- self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+ # Without the fix in place, this test would have failed here with
+ # AssertionError: 3 != 0
+ self.assertEqual(3, len(xParDirFormatting.getChildren()))
+ self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
+ self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/insertTableDialog.py b/sw/qa/uitest/table/insertTableDialog.py
index 2bea520282c6..b4af11f372bd 100644
--- a/sw/qa/uitest/table/insertTableDialog.py
+++ b/sw/qa/uitest/table/insertTableDialog.py
@@ -10,59 +10,51 @@ from uitest.uihelper.common import get_state_as_dict
class WriterInsertTableDialog(UITestCase):
- def insert_table(self, name, rows, cols):
-
- self.ui_test.create_doc_in_start_center("writer")
-
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
+ def insertTextIntoCell(self, table, cellName, text ):
+ tableText = table.getCellByName( cellName )
+ tableText.setString( text )
- xNameEdit = xDialog.getChild("nameedit")
+ def test_tdf104158(self):
- xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name}))
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xColSpin = xDialog.getChild("colspin")
- xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)}))
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
- xRowSpin = xDialog.getChild("rowspin")
- xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)}))
+ xNameEdit = xDialog.getChild("nameedit")
- 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))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test3"}))
- document = self.ui_test.get_component()
+ xColSpin = xDialog.getChild("colspin")
+ xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
- tables = document.getTextTables()
+ xRowSpin = xDialog.getChild("rowspin")
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
- self.assertEqual(tables[0].getName(), name)
- self.assertEqual(len(tables[0].getRows()), rows)
- self.assertEqual(len(tables[0].getColumns()), cols)
+ self.assertEqual(get_state_as_dict(xNameEdit)["Text"], "Test3")
+ self.assertEqual(get_state_as_dict(xColSpin)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xRowSpin)["Text"], "2")
- def insertTextIntoCell(self, table, cellName, text ):
- tableText = table.getCellByName( cellName )
- tableText.setString( text )
- def test_tdf104158(self):
+ tables = document.getTextTables()
- self.insert_table("Test3", 2, 2)
+ self.assertEqual(tables[0].getName(), "Test3")
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[0].getColumns()), 2)
- with self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog"):
- pass
+ with self.ui_test.execute_dialog_through_command(".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")
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable", close_button="cancel"):
- pass
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable", close_button="cancel"):
+ pass
- document = self.ui_test.get_component()
- tables = document.getTextTables()
- self.assertEqual(len(tables), 0)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables), 0)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py
index 1beafa67214d..168b5423b02a 100644
--- a/sw/qa/uitest/table/sheetToTable.py
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -59,22 +59,20 @@ class sheetToTable(UITestCase):
self.assertEqual(table.getCellByName("A2").getString(), "3")
def test_tdf129083(self):
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- enter_text_to_cell(gridwin, "A1", "Test 1")
- enter_text_to_cell(gridwin, "A2", "Test 2")
- enter_text_to_cell(gridwin, "A3", "Test 3")
- enter_text_to_cell(gridwin, "A4", "Test 4")
+ enter_text_to_cell(gridwin, "A1", "Test 1")
+ enter_text_to_cell(gridwin, "A2", "Test 2")
+ enter_text_to_cell(gridwin, "A3", "Test 3")
+ enter_text_to_cell(gridwin, "A4", "Test 4")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.close_doc()
with self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) as writer_doc:
xWriterDoc = self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/table/tdf115026.py b/sw/qa/uitest/table/tdf115026.py
index d6f46aaedb4f..4d1299f068f5 100644
--- a/sw/qa/uitest/table/tdf115026.py
+++ b/sw/qa/uitest/table/tdf115026.py
@@ -11,20 +11,19 @@ from uitest.uihelper.common import get_state_as_dict
class tdf115026(UITestCase):
def test_pageBreak_and_tableAutoFormat(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:InsertPagebreak")
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:AutoFormat"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat"):
+ pass
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py
index ac77ec5cd2f0..74b46b63873e 100644
--- a/sw/qa/uitest/table/tdf116737.py
+++ b/sw/qa/uitest/table/tdf116737.py
@@ -13,34 +13,32 @@ from uitest.uihelper.common import select_pos
class tdf116737(UITestCase):
def test_tdf116737_select_table_style(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- #Insert => Insert Table / It's not possible to select a table style
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
+ #Insert => Insert Table / It's not possible to select a table style
+ with self.ui_test.execute_dialog_through_command(".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())
- #verify .uno:TableDialog
- with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4") #tab Background
+ #verify .uno:TableDialog
+ with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4") #tab Background
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
+ 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")
+ 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 d7413a5ccc5f..435b155f4af7 100755
--- a/sw/qa/uitest/table/tdf128593.py
+++ b/sw/qa/uitest/table/tdf128593.py
@@ -9,25 +9,24 @@ from uitest.uihelper.common import get_state_as_dict
class tdf128593(UITestCase):
def test_tdf128593_table_background_color(self):
- MainDoc = self.ui_test.create_doc_in_start_center("writer")
- MainWindow = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ MainWindow = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) )
- with self.ui_test.execute_dialog_through_command(".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.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) )
+ with self.ui_test.execute_dialog_through_command(".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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py
index 63cfbb19f02f..dcadce096536 100644
--- a/sw/qa/uitest/table/textToTable.py
+++ b/sw/qa/uitest/table/textToTable.py
@@ -12,27 +12,25 @@ from uitest.uihelper.common import get_url_for_data_file, type_text
class textToTable(UITestCase):
def test_text_to_table(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #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"}))
- with self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") as xDialog:
- semicolons = xDialog.getChild("semicolons")
- semicolons.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.TextTables.getCount(), 1)
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 1)
- self.assertEqual(len(tables[0].getColumns()), 3)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 0)
- self.assertEqual(document.Text.String[0:5], "A;B;C")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #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"}))
+ with self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") as xDialog:
+ semicolons = xDialog.getChild("semicolons")
+ semicolons.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.TextTables.getCount(), 1)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 1)
+ self.assertEqual(len(tables[0].getColumns()), 3)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(document.Text.String[0:5], "A;B;C")
- self.ui_test.close_doc()
def test_text_to_table_header(self):
with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc:
diff --git a/sw/qa/uitest/ui/fmtui/fmtui.py b/sw/qa/uitest/ui/fmtui/fmtui.py
index dc71faa23ec3..8ab79c8d9961 100644
--- a/sw/qa/uitest/ui/fmtui/fmtui.py
+++ b/sw/qa/uitest/ui/fmtui/fmtui.py
@@ -15,20 +15,18 @@ class TestTmpdlg(UITestCase):
def test_para_style_semi_transparent_text(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command(".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")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/ui/index/index.py b/sw/qa/uitest/ui/index/index.py
index 71d9e165bbaf..3a222fb2b893 100644
--- a/sw/qa/uitest/ui/index/index.py
+++ b/sw/qa/uitest/ui/index/index.py
@@ -17,41 +17,39 @@ class TestSwuiidxmrk(UITestCase):
def test_bibliography_page_number_insert(self):
# Given an empty Writer document:
- self.ui_test.create_doc_in_start_center("writer")
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry")
- insert_entry = self.xUITest.getTopFocusWindow()
- from_document = insert_entry.getChild("fromdocument")
- from_document.executeAction("CLICK", tuple())
- new = insert_entry.getChild("new")
-
- # When inserting a biblio entry field with a page number:
- with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry:
- entry = define_entry.getChild("entry")
- type_text(entry, "aaa")
- listbox = define_entry.getChild("listbox")
- select_pos(listbox, "16") # WWW document
- pagecb = define_entry.getChild("pagecb-visible")
- pagecb.executeAction("CLICK", tuple())
-
- insert = insert_entry.getChild("insert")
- insert.executeAction("CLICK", tuple())
- close = insert_entry.getChild("close")
- self.ui_test.close_dialog_through_button(close)
-
- # Then make sure the URL contains that page number:
- component = self.ui_test.get_component()
- paragraphs = component.Text.createEnumeration()
- paragraph = paragraphs.nextElement()
- portions = paragraph.createEnumeration()
- portion = portions.nextElement()
- for field in portion.TextField.Fields:
- if field.Name != "URL":
- continue
- # Without the accompanying fix in place, this test would have failed with:
- # AssertionError: '' != '#page=1'
- # i.e. the page number was not part of the URL.
- self.assertEqual(field.Value, "#page=1")
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as component:
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry")
+ insert_entry = self.xUITest.getTopFocusWindow()
+ from_document = insert_entry.getChild("fromdocument")
+ from_document.executeAction("CLICK", tuple())
+ new = insert_entry.getChild("new")
+
+ # When inserting a biblio entry field with a page number:
+ with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry:
+ entry = define_entry.getChild("entry")
+ type_text(entry, "aaa")
+ listbox = define_entry.getChild("listbox")
+ select_pos(listbox, "16") # WWW document
+ pagecb = define_entry.getChild("pagecb-visible")
+ pagecb.executeAction("CLICK", tuple())
+
+ insert = insert_entry.getChild("insert")
+ insert.executeAction("CLICK", tuple())
+ close = insert_entry.getChild("close")
+ self.ui_test.close_dialog_through_button(close)
+
+ # Then make sure the URL contains that page number:
+ paragraphs = component.Text.createEnumeration()
+ paragraph = paragraphs.nextElement()
+ portions = paragraph.createEnumeration()
+ portion = portions.nextElement()
+ for field in portion.TextField.Fields:
+ if field.Name != "URL":
+ continue
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: '' != '#page=1'
+ # i.e. the page number was not part of the URL.
+ self.assertEqual(field.Value, "#page=1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/comments.py b/sw/qa/uitest/writer_tests/comments.py
index 66ecb06bb246..a8dd761a5456 100644
--- a/sw/qa/uitest/writer_tests/comments.py
+++ b/sw/qa/uitest/writer_tests/comments.py
@@ -16,142 +16,140 @@ class Comments(UITestCase):
def test_comments_features(self):
- xMainDoc = self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- xMainWindow = self.xUITest.getTopFocusWindow()
+ xMainWindow = self.xUITest.getTopFocusWindow()
- xwriter_edit = xMainWindow.getChild("writer_edit")
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "}))
+ xwriter_edit = xMainWindow.getChild("writer_edit")
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "}))
- # adding new Comment
- self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # adding new Comment
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
- # wait until the comment is available
- xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
- xEditView1 = xComment1.getChild("editview")
- xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
- self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
- self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
- self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
- self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
+ self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
+ self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
- xComment1.executeAction("LEAVE", mkPropertyValues({}))
+ xComment1.executeAction("LEAVE", mkPropertyValues({}))
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"}))
- xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"}))
- self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" )
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"}))
+ xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"}))
+ self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" )
- # test Resolve Comment
- xComment1.executeAction("RESOLVE", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" )
+ # test Resolve Comment
+ xComment1.executeAction("RESOLVE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" )
- # test Select text from Comment
- xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"}))
- self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" )
+ # test Select text from Comment
+ xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"}))
+ self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" )
- # test Hide then Show Comment
- xComment1.executeAction("HIDE", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
- xComment1.executeAction("SHOW", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
+ # test Hide then Show Comment
+ xComment1.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
+ xComment1.executeAction("SHOW", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
- # test delete Comment
- xComment1.executeAction("DELETE", mkPropertyValues({}))
- self.assertTrue("Comment1" not in xMainWindow.getChildren())
+ # test delete Comment
+ xComment1.executeAction("DELETE", mkPropertyValues({}))
+ self.assertTrue("Comment1" not in xMainWindow.getChildren())
- self.ui_test.close_doc()
def test_multi_comments(self):
- xMainDoc = self.ui_test.create_doc_in_start_center("writer")
-
- xMainWindow = self.xUITest.getTopFocusWindow()
-
- xwriter_edit = xMainWindow.getChild("writer_edit")
-
- # adding 3 new Comment
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"}))
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- # wait until the comment is available
- xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
- xEditView1 = xComment1.getChild("editview")
- xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
- xComment1.executeAction("LEAVE", mkPropertyValues({}))
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"}))
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- # wait until the comment is available
- xComment2 = self.ui_test.wait_until_child_is_available('Comment2')
- xEditView2 = xComment2.getChild("editview")
- xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
- xComment2.executeAction("LEAVE", mkPropertyValues({}))
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"}))
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- # wait until the comment is available
- xComment3 = self.ui_test.wait_until_child_is_available('Comment3')
- xEditView3 = xComment3.getChild("editview")
- xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"}))
- xComment3.executeAction("LEAVE", mkPropertyValues({}))
- xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-
- # Check text
- self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" )
- self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" )
- self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" )
-
- xComment2.executeAction("RESOLVE", mkPropertyValues({}))
- xComment3.executeAction("RESOLVE", mkPropertyValues({}))
-
- # Check Resolved
- self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
- self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" )
- self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" )
-
- # Check ReadOnly
- self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
- self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" )
- self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" )
-
- # Check Select
- xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
- self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" )
-
- xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"}))
- self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" )
-
- xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
- self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" )
-
- # Check that they all are Visible
- self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
- self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
- self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" )
-
- # Hide all
- xComment1.executeAction("HIDE", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
- xComment2.executeAction("HIDE", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" )
- xComment3.executeAction("HIDE", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" )
-
- # Show comment 2 only
- xComment2.executeAction("SHOW", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
-
- # Then remove the 3 comments
- xComment1.executeAction("DELETE", mkPropertyValues({}))
- xComment2.executeAction("DELETE", mkPropertyValues({}))
- xComment3.executeAction("DELETE", mkPropertyValues({}))
- self.assertTrue("Comment1" not in xMainWindow.getChildren())
- self.assertTrue("Comment2" not in xMainWindow.getChildren())
- self.assertTrue("Comment3" not in xMainWindow.getChildren())
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+
+ xwriter_edit = xMainWindow.getChild("writer_edit")
+
+ # adding 3 new Comment
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
+ xComment1.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment2 = self.ui_test.wait_until_child_is_available('Comment2')
+ xEditView2 = xComment2.getChild("editview")
+ xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
+ xComment2.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment3 = self.ui_test.wait_until_child_is_available('Comment3')
+ xEditView3 = xComment3.getChild("editview")
+ xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"}))
+ xComment3.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # Check text
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" )
+ self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" )
+ self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" )
+
+ xComment2.executeAction("RESOLVE", mkPropertyValues({}))
+ xComment3.executeAction("RESOLVE", mkPropertyValues({}))
+
+ # Check Resolved
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
+ self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" )
+ self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" )
+
+ # Check ReadOnly
+ self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
+ self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" )
+ self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" )
+
+ # Check Select
+ xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
+ self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" )
+
+ xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"}))
+ self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" )
+
+ xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
+ self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" )
+
+ # Check that they all are Visible
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
+ self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" )
+
+ # Hide all
+ xComment1.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
+ xComment2.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" )
+ xComment3.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" )
+
+ # Show comment 2 only
+ xComment2.executeAction("SHOW", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
+
+ # Then remove the 3 comments
+ xComment1.executeAction("DELETE", mkPropertyValues({}))
+ xComment2.executeAction("DELETE", mkPropertyValues({}))
+ xComment3.executeAction("DELETE", mkPropertyValues({}))
+ self.assertTrue("Comment1" not in xMainWindow.getChildren())
+ self.assertTrue("Comment2" not in xMainWindow.getChildren())
+ self.assertTrue("Comment3" not in xMainWindow.getChildren())
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
index 97436a54f73f..20fe7dc3e786 100644
--- a/sw/qa/uitest/writer_tests/insertCaption.py
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -11,51 +11,49 @@ from uitest.uihelper.common import select_pos
class insertCaption(UITestCase):
def test_insert_caption(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialogFr:
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertEqual(document.TextFrames.getCount(), 1)
+ self.assertEqual(document.TextFrames.getCount(), 1)
- with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+ with self.ui_test.execute_dialog_through_command(".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"}))
- xFrame = document.TextFrames[0]
+ xFrame = document.TextFrames[0]
- self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption")
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption")
- with self.ui_test.execute_dialog_through_command(".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":"-"}))
+ with self.ui_test.execute_dialog_through_command(".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":"-"}))
- self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.execute_dialog_through_command(".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")
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py
index 0bd8f1678612..7a3c78ebce2e 100644
--- a/sw/qa/uitest/writer_tests/tdf134734.py
+++ b/sw/qa/uitest/writer_tests/tdf134734.py
@@ -13,71 +13,69 @@ import importlib
class TestClass(UITestCase):
def test_master_page_background(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- # set margins and fill color
- with self.ui_test.execute_dialog_through_command(".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())
+ # set margins and fill color
+ with self.ui_test.execute_dialog_through_command(".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"]
+ xStyle = document.StyleFamilies["PageStyles"]["Standard"]
- self.assertEqual(xStyle.FillStyle, SOLID)
- self.assertEqual(xStyle.LeftMargin, 2997)
- self.assertEqual(xStyle.RightMargin, 2743)
- self.assertEqual(xStyle.TopMargin, 2489)
- self.assertEqual(xStyle.BottomMargin, 2235)
- self.assertEqual(xStyle.BackgroundFullSize, True)
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, True)
- # uncheck it
- with self.ui_test.execute_dialog_through_command(".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())
+ # uncheck it
+ with self.ui_test.execute_dialog_through_command(".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)
- self.assertEqual(xStyle.RightMargin, 2743)
- self.assertEqual(xStyle.TopMargin, 2489)
- self.assertEqual(xStyle.BottomMargin, 2235)
- self.assertEqual(xStyle.BackgroundFullSize, False)
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, False)
- # check it again
- with self.ui_test.execute_dialog_through_command(".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())
+ # check it again
+ with self.ui_test.execute_dialog_through_command(".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)
- self.assertEqual(xStyle.RightMargin, 2743)
- self.assertEqual(xStyle.TopMargin, 2489)
- self.assertEqual(xStyle.BottomMargin, 2235)
- self.assertEqual(xStyle.BackgroundFullSize, True)
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, True)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
index 9adbd2047d37..72ccb4a65692 100644
--- a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
+++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
@@ -15,21 +15,20 @@ class tdf137459(UITestCase):
def test_tdf137459(self):
- xMainDoc = self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- # adding new Comment
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- # wait until the comment is available
- xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+ # adding new Comment
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
- xEditView1 = xComment1.getChild("editview")
- sText = "Ctrl+Del should not delete BACKWARDS"
- xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText}))
- self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
+ xEditView1 = xComment1.getChild("editview")
+ sText = "Ctrl+Del should not delete BACKWARDS"
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
- xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"}))
- self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
+ xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf53460.py b/sw/qa/uitest/writer_tests/tdf53460.py
index 5c3fda7b6371..661c08cd1c77 100644
--- a/sw/qa/uitest/writer_tests/tdf53460.py
+++ b/sw/qa/uitest/writer_tests/tdf53460.py
@@ -12,63 +12,61 @@ class tdf53460(UITestCase):
def test_resize_table_with_keyboard_tdf53460(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- #-insert a table (by default 2x2)
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #-insert a table (by default 2x2)
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- #-put the cursor inside first cell top left for example
- #-insert an inner table (by default 2x2) inside this cell
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ #-put the cursor inside first cell top left for example
+ #-insert an inner table (by default 2x2) inside this cell
+ with self.ui_test.execute_dialog_through_command(".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"}))
- #- <ALT>+up key => crash
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
+ #-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"}))
+ #- <ALT>+up key => crash
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
- self.assertEqual(document.TextTables.getCount(), 2)
- self.ui_test.close_doc()
+ self.assertEqual(document.TextTables.getCount(), 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf78068.py b/sw/qa/uitest/writer_tests/tdf78068.py
index 46497f621028..ff6080622fd2 100644
--- a/sw/qa/uitest/writer_tests/tdf78068.py
+++ b/sw/qa/uitest/writer_tests/tdf78068.py
@@ -12,18 +12,16 @@ from uitest.uihelper.common import select_pos
class tdf78068(UITestCase):
def test_tdf78068_format_paragraph_crash(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #- add some text
- type_text(xWriterEdit, "Test")
- #- go to Format > Paragraph
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #- add some text
+ type_text(xWriterEdit, "Test")
+ #- go to Format > Paragraph
+ with self.ui_test.execute_dialog_through_command(".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()
+ self.assertEqual(document.Text.String[0:4], "Test")
# 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 2d2830cb1c81..dc7a13b870db 100644
--- a/sw/qa/uitest/writer_tests/tdf93068.py
+++ b/sw/qa/uitest/writer_tests/tdf93068.py
@@ -10,40 +10,38 @@ class tdf93068(UITestCase):
def test_tdf93068(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- document = self.ui_test.get_component()
- self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- # tdf#135950: Character dialog crashes if multiple cells in a
- # table are selected
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ # tdf#135950: Character dialog crashes if multiple cells in a
+ # table are selected
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- # Check the table is selected
- self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
+ # Check the table is selected
+ self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog"):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel"):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xFontDlg:
- xDiscardBtn = xFontDlg.getChild("reset")
- xDiscardBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xFontDlg:
+ xDiscardBtn = xFontDlg.getChild("reset")
+ xDiscardBtn.executeAction("CLICK", tuple())
- self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- # Check the table is still selected after closing the dialog
- self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
+ # Check the table is still selected after closing the dialog
+ self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
- self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
- # Check the table is no longer selected
- self.assertNotEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
+ # Check the table is no longer selected
+ self.assertNotEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName())
- self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
index b723b0c445dc..ed79c53b86d7 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -12,143 +12,132 @@ class trackedchanges(UITestCase):
def test_tdf91270(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "Test")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ type_text(xWriterEdit, "Test")
- self.xUITest.executeCommand(".uno:TrackChanges")
+ self.xUITest.executeCommand(".uno:TrackChanges")
- selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
- self.xUITest.executeCommand(".uno:Cut") #cut text
+ selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ self.xUITest.executeCommand(".uno:Cut") #cut text
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
- self.ui_test.close_doc()
def test_tracked_changes_accept(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, "Test LibreOffice")
- self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xAccBtn = xTrackDlg.getChild("accept")
- xAccBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
- self.ui_test.close_doc()
+ self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
def test_tracked_changes_acceptall(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, "Test LibreOffice")
- self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
- xAccBtn = xTrackDlg.getChild("acceptall")
- xAccBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
- self.ui_test.close_doc()
+ self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
def test_tracked_changes_reject(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, "Test LibreOffice")
- self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
- xRejBtn = xTrackDlg.getChild("reject")
- xRejBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ xRejBtn = xTrackDlg.getChild("reject")
+ xRejBtn.executeAction("CLICK", tuple())
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:1], "")
- self.ui_test.close_doc()
+ self.assertEqual(document.Text.String[0:1], "")
def test_tracked_changes_rejectall(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, "Test LibreOffice")
- self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
- xAccBtn = xTrackDlg.getChild("rejectall")
- xAccBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:1], "")
- self.ui_test.close_doc()
+ self.assertEqual(document.Text.String[0:1], "")
def test_tracked_changes_zprev_next(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, "Test LibreOffice")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, " Test2")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, " Test3")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, " Test4")
- self.xUITest.executeCommand(".uno:TrackChanges")
- type_text(xWriterEdit, " Test5")
- self.xUITest.executeCommand(".uno:PreviousTrackedChange")
- self.xUITest.executeCommand(".uno:RejectTrackedChange")
- self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
-
- self.xUITest.executeCommand(".uno:PreviousTrackedChange")
- self.xUITest.executeCommand(".uno:PreviousTrackedChange")
- self.xUITest.executeCommand(".uno:AcceptTrackedChange")
- self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
-
- self.xUITest.executeCommand(".uno:NextTrackedChange")
- self.xUITest.executeCommand(".uno:RejectTrackedChange")
- self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test2")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test3")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test4")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test5")
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:RejectTrackedChange")
+ self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
+
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:AcceptTrackedChange")
+ self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
+
+ self.xUITest.executeCommand(".uno:NextTrackedChange")
+ self.xUITest.executeCommand(".uno:RejectTrackedChange")
+ self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4")
+
def test_list_of_changes(self):
with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
diff --git a/sw/qa/uitest/writer_tests/watermark.py b/sw/qa/uitest/writer_tests/watermark.py
index 3e701c271e49..a61863626e06 100644
--- a/sw/qa/uitest/writer_tests/watermark.py
+++ b/sw/qa/uitest/writer_tests/watermark.py
@@ -12,40 +12,38 @@ from uitest.uihelper.common import get_state_as_dict
class watermark(UITestCase):
def test_insert_watermark(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:Watermark") as xDialog:
- xTextInput = xDialog.getChild("TextInput")
- xAngle = xDialog.getChild("Angle")
- xTransparency = xDialog.getChild("Transparency")
+ with self.ui_test.execute_dialog_through_command(".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())
+ xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"}))
+ xAngle.executeAction("UP", tuple())
+ xTransparency.executeAction("UP", tuple())
- with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog:
- xTextInput = xDialog.getChild("TextInput")
- xAngle = xDialog.getChild("Angle")
- xTransparency = xDialog.getChild("Transparency")
+ with self.ui_test.execute_dialog_through_command(".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%")
+ 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(".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(".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(".uno:Watermark", close_button="cancel") as xDialog:
- xTextInput = xDialog.getChild("TextInput")
+ with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
- self.assertEqual(get_state_as_dict(xTextInput)["Text"], "")
+ 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_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py
index 0ed42d1563c3..60e573f88b8a 100644
--- a/sw/qa/uitest/writer_tests/wordCount.py
+++ b/sw/qa/uitest/writer_tests/wordCount.py
@@ -13,38 +13,36 @@ class writerWordCount(UITestCase):
def test_word_count_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
-
- type_text(xWriterEdit, "Test for word count dialog") #type text
- xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "Test for word count dialog") #type text
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
def test_tdf68347(self):
#Bug 68347 - Incorrect word count in a document with recorded changes
@@ -78,16 +76,14 @@ class writerWordCount(UITestCase):
self.ui_test.close_dialog_through_button(xCloseBtn)
def test_tdf91100(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
- self.ui_test.close_doc()
def test_tdf58050(self):
with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as writer_doc:
@@ -117,125 +113,121 @@ class writerWordCount(UITestCase):
def test_word_count_interpunction_counted_tdf56975_a(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- #Open writer, enter "Testing one two! Test?"
- type_text(xWriterEdit, "Testing one two! Test?")
- #-> LO says: 4 words. SUCCESS! :)
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #Open writer, enter "Testing one two! Test?"
+ type_text(xWriterEdit, "Testing one two! Test?")
+ #-> LO says: 4 words. SUCCESS! :)
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
def test_word_count_interpunction_counted_tdf56975_b(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- #1. Create a new text document.
- #2. Type-in the words:
- # This is a test sentence.
- type_text(xWriterEdit, "This is a test sentence.")
- #3. Open the word count dialogue.
- # Word count in both, dialogue and status line, shows 5 words.
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
- #4. Select the space between 'a' and 'test'.
- xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"}))
- #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor.
- self.xUITest.executeCommand(".uno:InsertNonBreakingSpace")
- # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words.
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
- #6. Move the cursor by pressing Left.
- self.xUITest.executeCommand(".uno:GoLeft")
- # Word count in both, dialogue and status line, shows 5 words.
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Create a new text document.
+ #2. Type-in the words:
+ # This is a test sentence.
+ type_text(xWriterEdit, "This is a test sentence.")
+ #3. Open the word count dialogue.
+ # Word count in both, dialogue and status line, shows 5 words.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+ #4. Select the space between 'a' and 'test'.
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"}))
+ #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor.
+ self.xUITest.executeCommand(".uno:InsertNonBreakingSpace")
+ # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+ #6. Move the cursor by pressing Left.
+ self.xUITest.executeCommand(".uno:GoLeft")
+ # Word count in both, dialogue and status line, shows 5 words.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
def test_tdf51816(self):
with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc:
diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
index 39ba7eb3595a..11f417907120 100644
--- a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
+++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
@@ -11,31 +11,29 @@ from uitest.uihelper.common import select_by_text
class asianPhoneticGuide(UITestCase):
def test_asian_phonetic_guide(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- xLeft1ED = xDialog.getChild("Left1ED")
- xRight1ED = xDialog.getChild("Right1ED")
- xadjustlb = xDialog.getChild("adjustlb")
- xpositionlb = xDialog.getChild("positionlb")
- xstylelb = xDialog.getChild("stylelb")
+ xLeft1ED = xDialog.getChild("Left1ED")
+ xRight1ED = xDialog.getChild("Right1ED")
+ xadjustlb = xDialog.getChild("adjustlb")
+ xpositionlb = xDialog.getChild("positionlb")
+ xstylelb = xDialog.getChild("stylelb")
- xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
- xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"}))
- select_by_text(xadjustlb, "Right")
- select_by_text(xpositionlb, "Right")
- select_by_text(xstylelb, "Quotation")
+ xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"}))
+ select_by_text(xadjustlb, "Right")
+ select_by_text(xpositionlb, "Right")
+ select_by_text(xstylelb, "Quotation")
- xApplyBtn = xDialog.getChild("ok")
- xApplyBtn.executeAction("CLICK", tuple())
+ xApplyBtn = xDialog.getChild("ok")
+ xApplyBtn.executeAction("CLICK", tuple())
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
- self.assertEqual(document.Text.String[0:1], "a")
- self.ui_test.close_doc()
+ self.assertEqual(document.Text.String[0:1], "a")
# 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 acd2bac7747c..c097f1f87896 100644
--- a/sw/qa/uitest/writer_tests2/bookmark.py
+++ b/sw/qa/uitest/writer_tests2/bookmark.py
@@ -15,83 +15,80 @@ class bookmarkDialog(UITestCase):
def test_bookmark_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
- with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close"):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
- xBmk = xBookDlg.getChild("bookmarks")
- self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks
+ with self.ui_test.execute_dialog_through_command(".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(".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(".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(".uno:InsertBookmark", close_button="close") as xBookDlg:
- xBmk2 = xBookDlg.getChild("bookmarks")
- self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark
+ with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
- with self.ui_test.execute_dialog_through_command(".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_dialog_through_command(".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"}))
- 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"
- self.ui_test.close_doc()
def test_bookmark_dialog_goto(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
- pass
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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(".uno:InsertBookmark", close_button="insert"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
- with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py b/sw/qa/uitest/writer_tests2/deleteAllComments.py
index e6832af6cb62..da37822130b9 100644
--- a/sw/qa/uitest/writer_tests2/deleteAllComments.py
+++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py
@@ -11,42 +11,38 @@ class DeleteAllComments(UITestCase):
def test_comments_delete(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "Test LibreOffice")
+ type_text(xWriterEdit, "Test LibreOffice")
- document = self.ui_test.get_component()
- selection = self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- cursor = document.getCurrentController().getViewCursor()
- type_text(xWriterEdit, "EEEEE")
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- self.xUITest.executeCommand(".uno:DeleteAllNotes")
- self.assertEqual(document.Text.String[0:4], "Test")
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ cursor = document.getCurrentController().getViewCursor()
+ type_text(xWriterEdit, "EEEEE")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
+ self.assertEqual(document.Text.String[0:4], "Test")
- self.ui_test.close_doc()
def test_comment_trackchanges(self):
#tdf111524
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "foo")
+ type_text(xWriterEdit, "foo")
- document = self.ui_test.get_component()
- selection = self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:InsertAnnotation")
- self.xUITest.executeCommand(".uno:TrackChanges")
- self.xUITest.executeCommand(".uno:DeleteAllNotes")
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
- self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py
index 384dc1e1ef62..896cdb2f9e26 100644
--- a/sw/qa/uitest/writer_tests2/documentProperties.py
+++ b/sw/qa/uitest/writer_tests2/documentProperties.py
@@ -29,96 +29,95 @@ class documentProperties(UITestCase):
self.assertEqual(aExpected, get_state_as_dict(xRemoveBtn)['ReallyVisible'])
def test_open_documentProperties_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
- xResetBtn = xDialog.getChild("reset")
- xResetBtn.executeAction("CLICK", tuple())
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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())
#now open the dialog again and read the properties
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.execute_dialog_through_command(".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())
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
index 1cf43237c3b8..6a1df21dfd97 100644
--- a/sw/qa/uitest/writer_tests2/exchangeDatabase.py
+++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
@@ -12,34 +12,32 @@ class exchangeDB(UITestCase):
def test_exchange_database(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close"):
+ pass
- self.ui_test.close_doc()
def test_exchange_database2(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") as xExDBDlg:
- xTreelist = xExDBDlg.getChild("availablelb")
+ with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close") as xExDBDlg:
- xLabeldb = xExDBDlg.getChild("dbnameft")
- self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
+ with self.ui_test.execute_dialog_through_command(".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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/fontworks.py b/sw/qa/uitest/writer_tests2/fontworks.py
index b9ab330dfda0..f62acabe49b8 100644
--- a/sw/qa/uitest/writer_tests2/fontworks.py
+++ b/sw/qa/uitest/writer_tests2/fontworks.py
@@ -15,26 +15,25 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class fontWorksDialog(UITestCase):
def test_fontwork_selector(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- with self.ui_test.execute_dialog_through_command(".uno:FontworkGalleryFloater", close_button="cancel") as xDialog:
- FontWorkSelector = xDialog.getChild("ctlFavoriteswin")
- # Select element with id (3)
- element3 = FontWorkSelector.getChild("2")
- element3.executeAction("SELECT", mkPropertyValues({}))
- print(get_state_as_dict(FontWorkSelector))
- self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2")
- self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3")
- self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36")
+ with self.ui_test.execute_dialog_through_command(".uno:FontworkGalleryFloater", close_button="cancel") as xDialog:
+ FontWorkSelector = xDialog.getChild("ctlFavoriteswin")
+ # Select element with id (3)
+ element3 = FontWorkSelector.getChild("2")
+ element3.executeAction("SELECT", mkPropertyValues({}))
+ print(get_state_as_dict(FontWorkSelector))
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36")
- # Select element with id (7)
- element7 = FontWorkSelector.getChild("6")
- element7.executeAction("SELECT", mkPropertyValues({}))
- self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6")
- self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7")
+ # Select element with id (7)
+ element7 = FontWorkSelector.getChild("6")
+ element7.executeAction("SELECT", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index 0d0f7dcf1b9f..162b7ec9491e 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -15,265 +15,253 @@ from uitest.uihelper.common import change_measurement_unit
class formatBulletsNumbering(UITestCase):
def test_bullets_and_numbering_dialog_tab_position(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- change_measurement_unit(self, "Millimeter")
+ change_measurement_unit(self, "Millimeter")
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.execute_dialog_through_command(".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())
+ 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(".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")
+ with self.ui_test.execute_dialog_through_command(".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.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()
def test_bullets_and_numbering_dialog_tab_position2(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
- 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(".uno:BulletsAndNumberingDialog") as xDialog:
+ 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(".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")
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
def test_bullets_and_numbering_dialog_tab_customize(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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(".uno:BulletsAndNumberingDialog", close_button="user") as xDialog:
- pass
-
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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(".uno:BulletsAndNumberingDialog", close_button="user") as xDialog:
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".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")
+
+
def test_bullets_and_numbering_tab_move(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- change_measurement_unit(self, "Millimeter")
-
- with self.ui_test.execute_dialog_through_command(".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]
-
-
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right
- with self.ui_test.execute_dialog_through_command(".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"}))
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ change_measurement_unit(self, "Millimeter")
+
+ with self.ui_test.execute_dialog_through_command(".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]
+
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right
+ with self.ui_test.execute_dialog_through_command(".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"}))
+ with self.ui_test.execute_dialog_through_command(".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)
+
def test_bullets_and_numbering_button_move(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- change_measurement_unit(self, "Millimeter")
+ change_measurement_unit(self, "Millimeter")
- with self.ui_test.execute_dialog_through_command(".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]
+ with self.ui_test.execute_dialog_through_command(".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]
- self.xUITest.executeCommand(".uno:DecrementSubLevels")
- with self.ui_test.execute_dialog_through_command(".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:DecrementSubLevels")
+ with self.ui_test.execute_dialog_through_command(".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")
- with self.ui_test.execute_dialog_through_command(".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.xUITest.executeCommand(".uno:IncrementLevel")
+ with self.ui_test.execute_dialog_through_command(".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()
def test_bullets_and_numbering_selection(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # Test Bullet Page
- with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # Test Bullet Page
+ with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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")
+
+
# 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 e6829b7f8c84..eb68e3dc0dde 100644
--- a/sw/qa/uitest/writer_tests2/formatCharacter.py
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -14,232 +14,220 @@ from uitest.uihelper.common import select_by_text
class formatCharacter(UITestCase):
def test_format_character_tab_font(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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]")
+
+
def test_format_character_tab_font_effects(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_character_tab_hyperlink(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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"}))
-
- xVisited = xDialog.getChild("visitedlb")
- select_by_text(xVisited, "Bullets")
- xUnVisited = xDialog.getChild("unvisitedlb")
- select_by_text(xUnVisited, "Bullets")
-
-
- self.xUITest.executeCommand(".uno:GoLeft")
- self.assertEqual(document.Text.String[0:11], "LibreOffice")
-
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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"}))
+
+ xVisited = xDialog.getChild("visitedlb")
+ select_by_text(xVisited, "Bullets")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+ select_by_text(xUnVisited, "Bullets")
+
+
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+
+ with self.ui_test.execute_dialog_through_command(".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")
+
def test_format_character_tab_asian_layout(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
- xTwolines = xDialog.getChild("twolines")
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
+ self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
def test_format_character_tab_position(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_character_tab_position_scalewidthsb(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".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%")
+ with self.ui_test.execute_dialog_through_command(".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%")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py
index ffd583e937af..bc6a30475b3d 100644
--- a/sw/qa/uitest/writer_tests2/formatParagraph.py
+++ b/sw/qa/uitest/writer_tests2/formatParagraph.py
@@ -15,544 +15,524 @@ from uitest.uihelper.common import change_measurement_unit
class formatParagraph(UITestCase):
def test_format_paragraph_tab_indents_spacing(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_paragraph_tab_alignment(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_paragraph_tab_text_flow(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_paragraph_tab_asian_typography(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
def test_format_paragraph_tab_outline_numbering(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
def test_format_paragraph_tab_tabs(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- change_measurement_unit(self, "Centimeter")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".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")
+ change_measurement_unit(self, "Centimeter")
- 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(".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(".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")
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
- 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")
+ 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(".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")
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
- xCentered.executeAction("CLICK", tuple())
- xUnderscore.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
+ xCentered.executeAction("CLICK", tuple())
+ xUnderscore.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
- 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(".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(".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")
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
- xRight.executeAction("CLICK", tuple())
- xDashLine.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
+ xRight.executeAction("CLICK", tuple())
+ xDashLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
- 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(".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(".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")
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
- xLeft.executeAction("CLICK", tuple())
- xPointsLine.executeAction("CLICK", tuple())
- xNewButtn.executeAction("CLICK", tuple())
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "5")
+ xLeft.executeAction("CLICK", tuple())
+ xPointsLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
- 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")
+ with self.ui_test.execute_dialog_through_command(".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()
def test_format_paragraph_tab_drop_caps(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
+
def test_format_paragraph_tab_borders(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- change_measurement_unit(self, "Centimeter")
-
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
def test_format_paragraph_area(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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())
def test_format_paragraph_transparency(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
- xTran = xDialog.getChild("RBT_TRANS_LINEAR")
- xTranText = xDialog.getChild("MTR_TRANSPARENT")
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
- xTran.executeAction("CLICK", tuple())
- xTranText.executeAction("UP", tuple())
+ xTran.executeAction("CLICK", tuple())
+ xTranText.executeAction("UP", tuple())
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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%")
+ 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(".uno:ParagraphDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
+ with self.ui_test.execute_dialog_through_command(".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 = 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())
+ 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(".uno:ParagraphDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "9")
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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.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 641210c2dff0..d54a273e239a 100644
--- a/sw/qa/uitest/writer_tests2/horizontalLine.py
+++ b/sw/qa/uitest/writer_tests2/horizontalLine.py
@@ -11,24 +11,23 @@ from uitest.uihelper.common import get_state_as_dict, type_text
class WriterInsertHorizontalLine(UITestCase):
def test_insert_horizontal_line(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "Test horizontal line") #write the text
+ type_text(xWriterEdit, "Test horizontal line") #write the text
- self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
- with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
- xStyleNametxt = xDialog.getChild("name")
- self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+ with self.ui_test.execute_dialog_through_command(".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.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
- with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
- xStyleNametxt = xDialog.getChild("name")
- self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+ with self.ui_test.execute_dialog_through_command(".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/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py
index e391f6520477..17f9d354ac31 100644
--- a/sw/qa/uitest/writer_tests2/insertFootnote.py
+++ b/sw/qa/uitest/writer_tests2/insertFootnote.py
@@ -10,26 +10,24 @@ from uitest.uihelper.common import type_text
class insertFootnote(UITestCase):
def test_insert_footnote(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:InsertFootnote")
+ self.xUITest.executeCommand(".uno:InsertFootnote")
- type_text(xWriterEdit, "LibreOffice")
- self.assertEqual(document.Footnotes[0].String, "LibreOffice")
- self.assertEqual(document.Footnotes.getCount(), 1)
+ type_text(xWriterEdit, "LibreOffice")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Footnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Footnotes[0].String, "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Footnotes.getCount(), 0)
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(document.Footnotes[0].String, "")
- self.assertEqual(document.Footnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
- 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 b080d7f86ab8..97da454d3e4a 100644
--- a/sw/qa/uitest/writer_tests2/pasteSpecial.py
+++ b/sw/qa/uitest/writer_tests2/pasteSpecial.py
@@ -10,29 +10,27 @@ from uitest.uihelper.common import type_text
class PasteSpecial(UITestCase):
def test_pasteSpecial(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "test")
+ type_text(xWriterEdit, "test")
- for i in range(5):
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
+ for i in range(5):
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
- with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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())
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Text.String, "test")
+ self.assertEqual(document.Text.String, "test")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
index c56c8c1052e0..947a30921d1b 100644
--- a/sw/qa/uitest/writer_tests2/tdf116474.py
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -11,34 +11,32 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf116474(UITestCase):
def test_tdf116474_insert_caption_undo(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- text = document.getText()
- cursor = text.createTextCursor()
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- #select image
- document.getCurrentController().select(document.getDrawPage()[0])
-
- with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
-
- xCapt = xDialogCaption.getChild("caption_edit")
- xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
-
-
- xFrame = document.TextFrames[0]
- self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
- self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
- #Undo, redo
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
- #Verify
- self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
- self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ text = document.getText()
+ cursor = text.createTextCursor()
+ textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
+ provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+ graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
+ textGraphic.Graphic = graphic
+ text.insertTextContent(cursor, textGraphic, False)
+ #select image
+ document.getCurrentController().select(document.getDrawPage()[0])
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+
+
+ xFrame = document.TextFrames[0]
+ self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
+ self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
+ #Undo, redo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+ #Verify
+ self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
+ self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py
index fb306b32c54b..f766b25ad684 100644
--- a/sw/qa/uitest/writer_tests3/autoredactDialog.py
+++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py
@@ -38,23 +38,71 @@ class AutoRedactDialog(UITestCase):
self.assertEqual(len(xTargetsListbox.getChildren()), 0)
def test_add_target(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".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.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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
+
+
+
+ def test_edit_target(self):
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xAddBtn = xDialog.getChild("add")
+ xEditBtn = xDialog.getChild("edit")
+
+ # Make sure we are starting with an empty targets list
+ self.clearTargetsbox(xDialog)
+
+ # 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")
@@ -63,90 +111,40 @@ class AutoRedactDialog(UITestCase):
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])
+ type_text(xNewNameTxt, "TestTarget")
+ type_text(xNewContentTxt, "TestContent")
- # 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 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)
- # 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
+ # Select the added target
+ target_entry = xTargetsListbox.getChild(0)
+ target_entry.executeAction("SELECT", tuple())
- # Now let's make sure the dialog remembers last state
- with self.ui_test.execute_dialog_through_command(".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))
+ # 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")
- # 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
+ xNameTxt.executeAction("CLEAR", tuple())
+ xContentTxt.executeAction("CLEAR", tuple())
- self.ui_test.close_doc()
+ type_text(xNameTxt, "TestTargetEdited")
+ type_text(xContentTxt, "TestContentEdited")
+ # 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)
+
+ # 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
- def test_edit_target(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
- xAddBtn = xDialog.getChild("add")
- xEditBtn = xDialog.getChild("edit")
-
- # Make sure we are starting with an empty targets list
- self.clearTargetsbox(xDialog)
-
- # 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
-
- select_pos(xTypeList, 0) #Text
- self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
-
- type_text(xNewNameTxt, "TestTarget")
- type_text(xNewContentTxt, "TestContent")
-
- # 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)
-
- # Select the added target
- target_entry = xTargetsListbox.getChild(0)
- target_entry.executeAction("SELECT", 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")
-
- xNameTxt.executeAction("CLEAR", tuple())
- xContentTxt.executeAction("CLEAR", tuple())
-
- type_text(xNameTxt, "TestTargetEdited")
- type_text(xContentTxt, "TestContentEdited")
-
- # 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)
-
- # 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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py
index 187ff67a3f59..19a66401567a 100644
--- a/sw/qa/uitest/writer_tests3/customizeDialog.py
+++ b/sw/qa/uitest/writer_tests3/customizeDialog.py
@@ -15,103 +15,98 @@ class ConfigureDialog(UITestCase):
def test_open_ConfigureDialog_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"):
- pass
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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")
- with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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)
- self.ui_test.close_doc()
def test_category_listbox(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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)
- self.ui_test.close_doc()
def test_tdf133862(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- self.xUITest.executeCommand(".uno:InsertObjectStarMath")
+ self.xUITest.executeCommand(".uno:InsertObjectStarMath")
- # Without the fix in place, calling customize dialog after inserting
- # a formula object would crash
- with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"):
- pass
+ # Without the fix in place, calling customize dialog after inserting
+ # a formula object would crash
+ with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
- # 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 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
- 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
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
index 82c4d9d92817..36ba00303a2b 100644
--- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -18,61 +18,59 @@ class HyperlinkDialog(UITestCase):
def test_hyperlink_dialog_vertical_tab(self):
- self.ui_test.create_doc_in_start_center("writer")
- MainWindow = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ MainWindow = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
def test_insert_hyperlink(self):
- self.ui_test.create_doc_in_start_center("writer")
- xMainWindow = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xMainWindow = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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")
- # Check that the link is added
- xMainWindow = self.xUITest.getTopFocusWindow()
- xedit = xMainWindow.getChild("writer_edit")
- xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"}))
- self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link")
+ # Check that the link is added
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xedit = xMainWindow.getChild("writer_edit")
+ xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"}))
+ self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link")
- self.ui_test.close_doc()
def test_tdf141166(self):
# Skip this test for --with-help=html and --with-help=online, as that would fail with a
@@ -89,18 +87,17 @@ class HyperlinkDialog(UITestCase):
if re.compile(r'XMLHELP\b').search(os.getenv('BUILD_TYPE')):
return
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="") as xDialog:
- xHelp = xDialog.getChild("help")
- xHelp.executeAction('FOCUS', tuple())
+ with self.ui_test.execute_dialog_through_command(".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/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py
index 54dd15e346b5..464a4cf2ad34 100644
--- a/sw/qa/uitest/writer_tests3/insertEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertEndnote.py
@@ -10,26 +10,24 @@ from uitest.uihelper.common import type_text
class insertEndnote(UITestCase):
def test_insert_endnote(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:InsertEndnote")
+ self.xUITest.executeCommand(".uno:InsertEndnote")
- type_text(xWriterEdit, "LibreOffice")
+ type_text(xWriterEdit, "LibreOffice")
- self.assertEqual(document.Endnotes[0].String, "LibreOffice")
- self.assertEqual(document.Endnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Endnotes[0].String, "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Endnotes.getCount(), 0)
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(document.Endnotes[0].String, "")
- self.assertEqual(document.Endnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(document.Endnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Endnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes[0].String, "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Endnotes[0].String, "")
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Endnotes[0].String, "LibreOffice")
- 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 2de03efa94e4..e5b351aa142a 100644
--- a/sw/qa/uitest/writer_tests3/insertEnvelope.py
+++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py
@@ -14,26 +14,24 @@ from uitest.uihelper.common import get_state_as_dict
class WriterInsertEnvelope(UITestCase):
def test_insert_envelope(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- with self.ui_test.execute_dialog_through_command(".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(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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(".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")
+
# 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 88570af7c0e1..7ec5f99b81d4 100644
--- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
@@ -10,53 +10,51 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class insertFootEndnote(UITestCase):
def test_insert_foot_endnote(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
#Automatic - Footnote
- with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
+ pass
- self.assertEqual(document.Footnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Footnotes.getCount(), 0)
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
#Automatic - Endnote
- with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
- xEndnote = xDialog.getChild("endnote")
- xEndnote.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
+ xEndnote = xDialog.getChild("endnote")
+ xEndnote.executeAction("CLICK", tuple())
- self.assertEqual(document.Endnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Endnotes.getCount(), 0)
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
#Character - Footnote
- with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
- 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(".uno:InsertFootnoteDialog") as xDialog:
+ xChar = xDialog.getChild("character")
+ xChar.executeAction("CLICK", tuple())
+ xCharentry = xDialog.getChild("characterentry")
+ xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- self.assertEqual(document.Footnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Footnotes.getCount(), 0)
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
#Character - Endnote
- with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
- 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(".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())
- self.assertEqual(document.Endnotes.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Endnotes.getCount(), 0)
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
#Cancel button
- with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog", close_button="cancel"):
- pass
+ with self.ui_test.execute_dialog_through_command(".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 a471268a054c..a230519618a6 100644
--- a/sw/qa/uitest/writer_tests3/insertPageFooter.py
+++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py
@@ -35,31 +35,28 @@ class WriterInsertPageFooter(UITestCase):
document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
def test_footer(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- self.insert_footer()
+ self.insert_footer()
- self.delete_footer()
+ self.delete_footer()
- self.ui_test.close_doc()
def test_tdf107427(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- self.insert_footer()
+ self.insert_footer()
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- document = self.ui_test.get_component()
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[0].getColumns()), 2)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[0].getColumns()), 2)
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.delete_footer()
+ self.delete_footer()
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
index 6fe58c90a47e..5ca2fce954e0 100644
--- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
+++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
@@ -11,59 +11,55 @@ from com.sun.star.lang import IndexOutOfBoundsException
class insertQrCode(UITestCase):
def test_insert_qr_code(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- # cancel the dialog without doing anything
- with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode", close_button="cancel") as xDialog:
+ # cancel the dialog without doing anything
+ with self.ui_test.execute_dialog_through_command(".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")
- with self.assertRaises(IndexOutOfBoundsException):
- document.DrawPage.getByIndex(0)
+ with self.assertRaises(IndexOutOfBoundsException):
+ document.DrawPage.getByIndex(0)
- # Reopen the dialog box
- with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog:
+ # Reopen the dialog box
+ with self.ui_test.execute_dialog_through_command(".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())
+ 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")
- self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1)
- self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1)
+ # check the QR code in the document
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org")
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1)
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1)
- self.ui_test.close_doc()
def test_insert_qr_code_gen2(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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())
+ 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")
- self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1)
- self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1)
+ #check the QR Code in the document
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org")
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1)
+ self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
index f1aa3146fb73..102c0e584f74 100644
--- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py
+++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
@@ -11,76 +11,72 @@ from com.sun.star.lang import IndexOutOfBoundsException
class insertSignatureLine(UITestCase):
def test_insert_signature_line(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # cancel the dialog without doing anything
- with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine", close_button="cancel") as xDialog:
-
- xName = xDialog.getChild("edit_name")
- xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
-
- with self.assertRaises(IndexOutOfBoundsException):
- document.DrawPage.getByIndex(0)
-
- # set the signature line
- with self.ui_test.execute_dialog_through_command(".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)
- self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
- self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
- self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")
- self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
- self.assertEqual(element.SignatureLineCanAddComment, False)
- self.assertEqual(element.SignatureLineShowSignDate, True)
- self.assertEqual(element.SignatureLineSigningInstructions, "Instructions")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # cancel the dialog without doing anything
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine", close_button="cancel") as xDialog:
+
+ xName = xDialog.getChild("edit_name")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+
+ with self.assertRaises(IndexOutOfBoundsException):
+ document.DrawPage.getByIndex(0)
+
+ # set the signature line
+ with self.ui_test.execute_dialog_through_command(".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)
+ self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineCanAddComment, False)
+ self.assertEqual(element.SignatureLineShowSignDate, True)
+ self.assertEqual(element.SignatureLineSigningInstructions, "Instructions")
+
def test_insert_signature_line2(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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)
- self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
- self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
- self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")
- self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
- self.assertEqual(element.SignatureLineCanAddComment, False)
- self.assertEqual(element.SignatureLineShowSignDate, False)
- self.assertEqual(element.SignatureLineSigningInstructions, "Instructions")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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)
+ self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineCanAddComment, False)
+ self.assertEqual(element.SignatureLineShowSignDate, False)
+ self.assertEqual(element.SignatureLineSigningInstructions, "Instructions")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py
index 374e40c1f57f..68092a554f98 100644
--- a/sw/qa/uitest/writer_tests3/lineNumbering.py
+++ b/sw/qa/uitest/writer_tests3/lineNumbering.py
@@ -14,78 +14,74 @@ from uitest.uihelper.common import change_measurement_unit
class WriterLineNumbering(UITestCase):
def test_line_numbering_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.execute_dialog_through_command(".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())
+ 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())
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.execute_dialog_through_command(".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")
- self.ui_test.close_doc()
+ 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")
def test_tdf86185(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog:
- xshownumbering = xDialog.getChild("shownumbering")
- xformatdropdown = xDialog.getChild("formatdropdown")
+ with self.ui_test.execute_dialog_through_command(".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])
- self.ui_test.close_doc()
+ 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])
# 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 b509a106b2a1..d613b9436091 100644
--- a/sw/qa/uitest/writer_tests3/pageDialog.py
+++ b/sw/qa/uitest/writer_tests3/pageDialog.py
@@ -113,27 +113,26 @@ class WriterPageDialog(UITestCase):
def test_area_tab(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
- for index, button in enumerate(buttons):
+ buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
+ for index, button in enumerate(buttons):
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
- self.click_button(xDialog, button)
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+ self.click_button(xDialog, button)
- self.check_default_area(button)
+ self.check_default_area(button)
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
- self.click_button(xDialog, 'btnnone')
+ self.click_button(xDialog, 'btnnone')
- self.check_default_area('btnnone')
+ self.check_default_area('btnnone')
- self.ui_test.close_doc()
def test_paper_format(self):
@@ -143,80 +142,72 @@ class WriterPageDialog(UITestCase):
"C5 Envelope", "C4 Envelope", "#6¾ Envelope", "#7¾ (Monarch) Envelope",
"#9 Envelope", "#10 Envelope", "#11 Envelope", "#12 Envelope", "Japanese Postcard"]
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- for i in range(30):
- with self.subTest(i=i):
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- xFormatList = xDialog.getChild("comboPageFormat")
- select_pos(xFormatList, str(i))
+ for i in range(30):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ xFormatList = xDialog.getChild("comboPageFormat")
+ select_pos(xFormatList, str(i))
- self.assertEqual(
- get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i])
+ self.assertEqual(
+ get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i])
- self.ui_test.close_doc()
def test_orientation(self):
- self.ui_test.create_doc_in_start_center("writer")
-
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- self.assertEqual(
- document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- self.click_button(xDialog, 'radiobuttonLandscape')
+ with self.ui_test.execute_dialog_through_command(".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)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, True)
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- self.click_button(xDialog, 'radiobuttonPortrait')
+ with self.ui_test.execute_dialog_through_command(".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)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
- self.ui_test.close_doc()
def test_text_direction(self):
lTextDirection = ['Left-to-right (horizontal)', 'Right-to-left (horizontal)',
'Right-to-left (vertical)', 'Left-to-right (vertical)']
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- document = self.ui_test.get_component()
+ for i in range(4):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- for i in range(4):
- with self.subTest(i=i):
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ xTextDirectionList = xDialog.getChild("comboTextFlowBox")
+ select_pos(xTextDirectionList, str(i))
- xTextDirectionList = xDialog.getChild("comboTextFlowBox")
- select_pos(xTextDirectionList, str(i))
+ self.assertEqual(
+ get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i])
self.assertEqual(
- get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i])
-
- self.assertEqual(
- document.StyleFamilies.PageStyles.Standard.WritingMode, i)
+ document.StyleFamilies.PageStyles.Standard.WritingMode, i)
- self.ui_test.close_doc()
def test_cancel_button_page_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ pass
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py
index 5bd2f70d4df6..ab857885e723 100644
--- a/sw/qa/uitest/writer_tests3/sort.py
+++ b/sw/qa/uitest/writer_tests3/sort.py
@@ -12,51 +12,47 @@ from uitest.uihelper.common import type_text
class WriterSort(UITestCase):
def test_sort(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- type_text(xWriterEdit, "a")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- type_text(xWriterEdit, "c")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- type_text(xWriterEdit, "v")
-
- selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
- #Tools - Sort
- with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog:
- xDown = xDialog.getChild("down1")
- xDown.executeAction("CLICK", tuple())
- #check
- self.assertEqual(document.Text.String[0:1], "v")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "a")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "c")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "v")
+
+ selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ #Tools - Sort
+ with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xDown.executeAction("CLICK", tuple())
+ #check
+ self.assertEqual(document.Text.String[0:1], "v")
+
def test_sort_numerical(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- type_text(xWriterEdit, "1;2;3")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- type_text(xWriterEdit, "2;8;3")
-
- selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
- #Tools - Sort
- with self.ui_test.execute_dialog_through_command(".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")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "1;2;3")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "2;8;3")
+
+ selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ #Tools - Sort
+ with self.ui_test.execute_dialog_through_command(".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")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py
index d0617bc8baea..527901e95506 100644
--- a/sw/qa/uitest/writer_tests3/specialCharacter.py
+++ b/sw/qa/uitest/writer_tests3/specialCharacter.py
@@ -15,70 +15,68 @@ from uitest.uihelper.common import select_pos
class specialCharacter(UITestCase):
def test_special_character(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog:
- xCharSet = xDialog.getChild("showcharset") # default charset
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog:
+ xCharSet = xDialog.getChild("showcharset") # default charset
- xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected
+ xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected
- xHexText = xDialog.getChild("hexvalue")
- xDecText = xDialog.getChild("decimalvalue")
+ 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")
+ 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(".uno:InsertSymbol", close_button="cancel") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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
+ 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"}))
+ 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'
+ # 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")
+ # 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
+ # xAddFavBtn = xDialog.getChild("favbtn")
+ # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button
- # xInsrBtn = xDialog.getChild("insert")
- # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
+ # xInsrBtn = xDialog.getChild("insert")
+ # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
- # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
+ # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
- # self.xUITest.executeCommand(".uno:Undo")
- # self.xUITest.executeCommand(".uno:Redo") #undo, redo
+ # 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.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 9f23d035da77..3c0fc827f165 100644
--- a/sw/qa/uitest/writer_tests3/tdf79236.py
+++ b/sw/qa/uitest/writer_tests3/tdf79236.py
@@ -11,107 +11,105 @@ class tdf79236(UITestCase):
def test_paragraph(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, "Test for tdf79236")
+ type_text(xWriterEdit, "Test for tdf79236")
- document = self.ui_test.get_component()
- selection = self.xUITest.executeCommand(".uno:SelectAll")
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
+ self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
- 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())
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
- with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
- 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())
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
- self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
+ self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
index 3af079774dc4..835318ff4d01 100644
--- a/sw/qa/uitest/writer_tests4/insertBreakDialog.py
+++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
@@ -16,55 +16,51 @@ class WriterInsertBreakDialog(UITestCase):
def test_insert_line_break(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
- xOption = xDialog.getChild("linerb")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("linerb")
+ xOption.executeAction("CLICK", tuple())
- self.getPages(1)
+ self.getPages(1)
- self.ui_test.close_doc()
def test_insert_column_break(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
- xOption = xDialog.getChild("columnrb")
- xOption.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("columnrb")
+ xOption.executeAction("CLICK", tuple())
- self.getPages(1)
+ self.getPages(1)
- self.ui_test.close_doc()
def test_insert_page_break(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- for i in range(9):
- with self.subTest(i=i):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+ for i in range(9):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
- xOption = xDialog.getChild("pagerb")
- xOption.executeAction("CLICK", tuple())
+ xOption = xDialog.getChild("pagerb")
+ xOption.executeAction("CLICK", tuple())
- xStyleList = xDialog.getChild("stylelb")
- xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)}))
+ xStyleList = xDialog.getChild("stylelb")
+ xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)}))
- self.getPages(i + 2)
+ self.getPages(i + 2)
- self.ui_test.close_doc()
def test_cancel_button_insert_line_break_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertBreak", close_button="cancel"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak", close_button="cancel"):
+ pass
- self.getPages(1)
+ self.getPages(1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py
index ebe94b145f8c..e9a239e0e247 100644
--- a/sw/qa/uitest/writer_tests4/insertPageHeader.py
+++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py
@@ -34,31 +34,28 @@ class WriterInsertPageHeader(UITestCase):
document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
def test_header(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- self.insert_header()
+ self.insert_header()
- self.delete_header()
+ self.delete_header()
- self.ui_test.close_doc()
def test_tdf107427(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- self.insert_header()
+ self.insert_header()
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
- document = self.ui_test.get_component()
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[0].getColumns()), 2)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[0].getColumns()), 2)
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.delete_header()
+ self.delete_header()
- self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index 0ef25c2d413d..6b014326e12d 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -59,46 +59,46 @@ frog, dogg, catt"""
# This automates the steps described in the bug report tdf#46852
# Step 1: Create a document with repetitious misspelled words
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- cursor = document.getCurrentController().getViewCursor()
- # Inserted text must be en_US, so make sure to set language in current location
- cursor.CharLocale = Locale("en", "US", "")
- input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break
- document.Text.insertString(cursor, input_text, False)
-
- # Step 2: Place cursor on 4th line after second "frogg"
- cursor.goUp(2, False)
- cursor.goLeft(1, False)
-
- # Step 3: Initiate spellchecking, and make sure "Check grammar" is
- # unchecked
- spell_dialog = self.launch_dialog()
- checkgrammar = spell_dialog.getChild('checkgrammar')
- if get_state_as_dict(checkgrammar)['Selected'] == 'true':
- checkgrammar.executeAction('CLICK', ())
- self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
-
- # Step 4: Repetitively click on "Correct all" for each misspelling
- # prompt until end of document is reached.
- changeall = spell_dialog.getChild('changeall')
- changeall.executeAction("CLICK", ())
- changeall.executeAction("CLICK", ())
- # The third time we click on changeall, the click action is going to
- # block while two message boxes are shown, so we need to do this third
- # click specially
- # Use empty close_button to open consecutive dialogs
- with self.ui_test.execute_blocking_action(
- changeall.executeAction, args=('CLICK', ()), close_button="") as dialog:
- # Step 5: Confirm to "Continue check at beginning of document"
- xYesBtn = dialog.getChild("yes")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ cursor = document.getCurrentController().getViewCursor()
+ # Inserted text must be en_US, so make sure to set language in current location
+ cursor.CharLocale = Locale("en", "US", "")
+ input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break
+ document.Text.insertString(cursor, input_text, False)
+
+ # Step 2: Place cursor on 4th line after second "frogg"
+ cursor.goUp(2, False)
+ cursor.goLeft(1, False)
+
+ # Step 3: Initiate spellchecking, and make sure "Check grammar" is
+ # unchecked
+ spell_dialog = self.launch_dialog()
+ checkgrammar = spell_dialog.getChild('checkgrammar')
+ if get_state_as_dict(checkgrammar)['Selected'] == 'true':
+ checkgrammar.executeAction('CLICK', ())
+ self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
+ # Step 4: Repetitively click on "Correct all" for each misspelling
+ # prompt until end of document is reached.
+ changeall = spell_dialog.getChild('changeall')
+ changeall.executeAction("CLICK", ())
+ changeall.executeAction("CLICK", ())
+ # The third time we click on changeall, the click action is going to
+ # block while two message boxes are shown, so we need to do this third
+ # click specially
+ # Use empty close_button to open consecutive dialogs
with self.ui_test.execute_blocking_action(
- xYesBtn.executeAction, args=('CLICK', ())):
- pass
+ changeall.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ # Step 5: Confirm to "Continue check at beginning of document"
+ xYesBtn = dialog.getChild("yes")
+
+ with self.ui_test.execute_blocking_action(
+ xYesBtn.executeAction, args=('CLICK', ())):
+ pass
+
+ output_text = document.Text.getString().replace('\r\n', '\n')
+ self.assertTrue(re.match(self.TDF46852_REGEX, output_text))
- output_text = document.Text.getString().replace('\r\n', '\n')
- self.assertTrue(re.match(self.TDF46852_REGEX, output_text))
def test_tdf66043(self):
supported_locale = self.is_supported_locale("en", "US")
diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py
index 1ee80f604013..c70fffe5fffa 100644
--- a/sw/qa/uitest/writer_tests4/start.py
+++ b/sw/qa/uitest/writer_tests4/start.py
@@ -14,36 +14,34 @@ class SimpleWriterTest(UITestCase):
def test_start_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
+ xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
- self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200")
- self.ui_test.close_doc()
def test_goto_first_page(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- state = get_state_as_dict(xWriterEdit)
- while state["CurrentPage"] == "1":
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
state = get_state_as_dict(xWriterEdit)
+ while state["CurrentPage"] == "1":
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ state = get_state_as_dict(xWriterEdit)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py
index 8bcd3736ffec..97ae278f4d12 100644
--- a/sw/qa/uitest/writer_tests4/tdf113252.py
+++ b/sw/qa/uitest/writer_tests4/tdf113252.py
@@ -12,25 +12,23 @@ from uitest.uihelper.common import select_pos
class tdf113252(UITestCase):
def test_tdf113252_macro_dialog(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
- with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="close") as xDialog:
+ #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
+ with self.ui_test.execute_dialog_through_command(".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.
+ #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")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf115572.py b/sw/qa/uitest/writer_tests4/tdf115572.py
index 1f1a0e6e1850..11cf993e51db 100644
--- a/sw/qa/uitest/writer_tests4/tdf115572.py
+++ b/sw/qa/uitest/writer_tests4/tdf115572.py
@@ -15,53 +15,49 @@ class tdf115572(UITestCase):
tableText.setString( text )
def test_tdf115572_table_format_gets_reset_deleting_row(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #go to second row - arrow down
- self.xUITest.executeCommand(".uno:GoDown")
- #delete row
- self.xUITest.executeCommand(".uno:DeleteRows")
- #now the cursor is in the second column - go left
- 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
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #go to second row - arrow down
+ self.xUITest.executeCommand(".uno:GoDown")
+ #delete row
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ #now the cursor is in the second column - go left
+ 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
+ with self.ui_test.execute_dialog_through_command(".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()
def test_tdf115572_table_format_gets_reset_deleting_column(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #go to second column
- self.xUITest.executeCommand(".uno:GoRight")
- #delete column
- self.xUITest.executeCommand(".uno:DeleteColumns")
- #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #go to second column
+ self.xUITest.executeCommand(".uno:GoRight")
+ #delete column
+ self.xUITest.executeCommand(".uno:DeleteColumns")
+ #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
+ with self.ui_test.execute_dialog_through_command(".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 cbbf8ea48367..c7b6316b110b 100644
--- a/sw/qa/uitest/writer_tests4/tdf115573.py
+++ b/sw/qa/uitest/writer_tests4/tdf115573.py
@@ -15,101 +15,93 @@ class tdf115573(UITestCase):
tableText.setString( text )
def test_tdf115573_Table_loses_formatting_inserting_row_before(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #go to second row - arrow down
- self.xUITest.executeCommand(".uno:GoDown")
- #insert row
- self.xUITest.executeCommand(".uno:InsertRowsBefore")
- #go up
- 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
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #go to second row - arrow down
+ self.xUITest.executeCommand(".uno:GoDown")
+ #insert row
+ self.xUITest.executeCommand(".uno:InsertRowsBefore")
+ #go up
+ 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
+ with self.ui_test.execute_dialog_through_command(".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()
def test_tdf115573_Table_loses_formatting_inserting_row_after(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #go to second row - arrow down
- self.xUITest.executeCommand(".uno:GoDown")
- #insert row
- self.xUITest.executeCommand(".uno:InsertRowsAfter")
- #go up
- 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
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #go to second row - arrow down
+ self.xUITest.executeCommand(".uno:GoDown")
+ #insert row
+ self.xUITest.executeCommand(".uno:InsertRowsAfter")
+ #go up
+ 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
+ with self.ui_test.execute_dialog_through_command(".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()
def test_tdf115573_Table_loses_formatting_inserting_column_left(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #insert column left
- self.xUITest.executeCommand(".uno:InsertColumnsBefore")
- #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #insert column left
+ self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+ #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
+ with self.ui_test.execute_dialog_through_command(".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()
def test_tdf115573_Table_loses_formatting_inserting_column_right(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert table 2x2
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #select font format - Bold and write text "abc"
- self.xUITest.executeCommand(".uno:Bold")
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "abc" )
- #insert column left
- self.xUITest.executeCommand(".uno:InsertColumnsAfter")
- #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
- with self.ui_test.execute_dialog_through_command(".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")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert table 2x2
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #select font format - Bold and write text "abc"
+ self.xUITest.executeCommand(".uno:Bold")
+ tables = document.getTextTables()
+ self.insertTextIntoCell(tables[0], "A1", "abc" )
+ #insert column left
+ self.xUITest.executeCommand(".uno:InsertColumnsAfter")
+ #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
+ with self.ui_test.execute_dialog_through_command(".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/tdf51352.py b/sw/qa/uitest/writer_tests4/tdf51352.py
index 9382c8ef7792..c685cc11330d 100644
--- a/sw/qa/uitest/writer_tests4/tdf51352.py
+++ b/sw/qa/uitest/writer_tests4/tdf51352.py
@@ -12,35 +12,33 @@ class tdf51352(UITestCase):
def test_convert_nested_table_to_text_tdf51352(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- #1. New a text document
- #2. Insert a table and then in one cell create another table
- #-insert a table (by default 2x2)
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #-put the cursor inside first cell top left for example
- #-insert an inner table (by default 2x2) inside this cell
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
- pass
- #3. Select the first table
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- self.assertEqual(document.TextTables.getCount(), 2)
- #4. From menu "Table->Convert->Table to Text
- with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText"):
- pass
- self.assertEqual(document.TextTables.getCount(), 0)
- #5. Undo/Redo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 2)
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(document.TextTables.getCount(), 0)
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. New a text document
+ #2. Insert a table and then in one cell create another table
+ #-insert a table (by default 2x2)
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #-put the cursor inside first cell top left for example
+ #-insert an inner table (by default 2x2) inside this cell
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+ #3. Select the first table
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ self.assertEqual(document.TextTables.getCount(), 2)
+ #4. From menu "Table->Convert->Table to Text
+ with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText"):
+ pass
+ self.assertEqual(document.TextTables.getCount(), 0)
+ #5. Undo/Redo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 2)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.TextTables.getCount(), 0)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf92611.py b/sw/qa/uitest/writer_tests4/tdf92611.py
index 8fee6143c4c7..559f9b6ebc41 100644
--- a/sw/qa/uitest/writer_tests4/tdf92611.py
+++ b/sw/qa/uitest/writer_tests4/tdf92611.py
@@ -10,12 +10,11 @@ class tdf92611(UITestCase):
def test_launch_and_close_bibliography(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- self.xUITest.executeCommand(".uno:BibliographyComponent")
+ self.xUITest.executeCommand(".uno:BibliographyComponent")
- self.xUITest.executeCommand(".uno:CloseWin")
+ self.xUITest.executeCommand(".uno:CloseWin")
- self.ui_test.close_doc()
# 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 83117572d72e..e04eb70ad4ff 100644
--- a/sw/qa/uitest/writer_tests5/about_test.py
+++ b/sw/qa/uitest/writer_tests5/about_test.py
@@ -11,11 +11,10 @@ class AboutDlgTest(UITestCase):
def test_about_dlg(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"):
+ pass
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
index 4417837d33e7..14eaf2c822e6 100644
--- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py
+++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
@@ -12,86 +12,84 @@ from uitest.uihelper.common import select_pos
class autocorrectOptions(UITestCase):
def test_autocorrect_options_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- with self.ui_test.execute_dialog_through_command(".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()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".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
+
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py
index fc3827fc5d85..60b5653631fc 100644
--- a/sw/qa/uitest/writer_tests5/columns.py
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -12,37 +12,35 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class columns(UITestCase):
def test_columns(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- #dialog Columns
- with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".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())
- #verify
- with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
- colsnf = xDialog.getChild("colsnf")
- spacing1mf = xDialog.getChild("spacing1mf")
- autowidth = xDialog.getChild("autowidth")
+ 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
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py
index c1a066c5586c..402d1b5e068a 100644
--- a/sw/qa/uitest/writer_tests5/tdf107494.py
+++ b/sw/qa/uitest/writer_tests5/tdf107494.py
@@ -12,72 +12,68 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf107494(UITestCase):
def test_tdf107494_delete_header_with_image(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert header
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
- self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true")
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
- #insert image
- text = document.getText()
- cursor = text.createTextCursor()
- oStyleFamilies = document.getStyleFamilies()
- #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
- obj2 = oStyleFamilies.getByName("PageStyles")
- obj3 = obj2.getByName("Standard")
- oHeaderText = obj3.HeaderText
- oHeaderText.setString("New text for header") #write text to header
- obj4 = oHeaderText.createTextCursor()
- text = obj4.getText()
- cursor = text.createTextCursor()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert header
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+ self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true")
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
+ #insert image
+ text = document.getText()
+ cursor = text.createTextCursor()
+ oStyleFamilies = document.getStyleFamilies()
+ #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
+ obj2 = oStyleFamilies.getByName("PageStyles")
+ obj3 = obj2.getByName("Standard")
+ oHeaderText = obj3.HeaderText
+ oHeaderText.setString("New text for header") #write text to header
+ obj4 = oHeaderText.createTextCursor()
+ text = obj4.getText()
+ cursor = text.createTextCursor()
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- # Delete the header
- with self.ui_test.execute_dialog_through_command(
- ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
- pass
+ textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
+ provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+ graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
+ textGraphic.Graphic = graphic
+ text.insertTextContent(cursor, textGraphic, False)
+ # Delete the header
+ with self.ui_test.execute_dialog_through_command(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
- self.ui_test.close_doc()
def test_tdf107494_delete_footer_with_image(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert footer
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
- self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true")
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
- #insert image
- text = document.getText()
- cursor = text.createTextCursor()
- oStyleFamilies = document.getStyleFamilies()
- #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
- obj2 = oStyleFamilies.getByName("PageStyles")
- obj3 = obj2.getByName("Standard")
- oFooterText = obj3.FooterText
- oFooterText.setString("New text for footer") #write text to footer
- obj4 = oFooterText.createTextCursor()
- text = obj4.getText()
- cursor = text.createTextCursor()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #insert footer
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+ self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true")
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
+ #insert image
+ text = document.getText()
+ cursor = text.createTextCursor()
+ oStyleFamilies = document.getStyleFamilies()
+ #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
+ obj2 = oStyleFamilies.getByName("PageStyles")
+ obj3 = obj2.getByName("Standard")
+ oFooterText = obj3.FooterText
+ oFooterText.setString("New text for footer") #write text to footer
+ obj4 = oFooterText.createTextCursor()
+ text = obj4.getText()
+ cursor = text.createTextCursor()
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- # Delete the footer
- with self.ui_test.execute_dialog_through_command(
- ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
- pass
+ textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
+ provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+ graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
+ textGraphic.Graphic = graphic
+ text.insertTextContent(cursor, textGraphic, False)
+ # Delete the footer
+ with self.ui_test.execute_dialog_through_command(
+ ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+ self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py
index a6b3a6348516..10f5ef169e67 100644
--- a/sw/qa/uitest/writer_tests5/tdf122045.py
+++ b/sw/qa/uitest/writer_tests5/tdf122045.py
@@ -12,28 +12,26 @@ class tdf122045(UITestCase):
def test_tdf122045(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".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))
- 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))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py
index 090337dd2273..d3234b0932da 100644
--- a/sw/qa/uitest/writer_tests5/tdf122722.py
+++ b/sw/qa/uitest/writer_tests5/tdf122722.py
@@ -12,55 +12,53 @@ from uitest.uihelper.common import select_pos
class tdf122722(UITestCase):
def test_tdf122722_format_character_hidden(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #1. Start LibreOffice
- #2. Create New Writer Document
- #3. Type "LibreOffice" in Writer
- type_text(xWriterEdit, "LibreOffice")
- #4. Select "LibreOffice" with mouse, and right click
- self.xUITest.executeCommand(".uno:SelectAll")
- self.assertEqual(document.Text.String[0:11], "LibreOffice")
- #5. Appear Context Menu, Character -> Character
- #6. Opened Character, Select "Font Effect" tab
- #7. Check Hidden, and click [OK]
- #8. Crash a LibreOffice
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Start LibreOffice
+ #2. Create New Writer Document
+ #3. Type "LibreOffice" in Writer
+ type_text(xWriterEdit, "LibreOffice")
+ #4. Select "LibreOffice" with mouse, and right click
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+ #5. Appear Context Menu, Character -> Character
+ #6. Opened Character, Select "Font Effect" tab
+ #7. Check Hidden, and click [OK]
+ #8. Crash a LibreOffice
+ with self.ui_test.execute_dialog_through_command(".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())
- #un-hidden
- with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ #un-hidden
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertEqual(document.Text.String[0:11], "LibreOffice")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py b/sw/qa/uitest/writer_tests5/tdf123378.py
index d7b832e25c8c..7ad20fc33523 100644
--- a/sw/qa/uitest/writer_tests5/tdf123378.py
+++ b/sw/qa/uitest/writer_tests5/tdf123378.py
@@ -12,16 +12,14 @@ class tdf123378(UITestCase):
def test_tdf123378_print_sets_modified(self):
# FIXME unstable test
return
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:Print")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOK)
+ self.xUITest.executeCommand(".uno:Print")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xOK)
- self.assertEqual(document.isModified(), False)
+ self.assertEqual(document.isModified(), False)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py
index a337efafe840..c4792cc9fcfa 100644
--- a/sw/qa/uitest/writer_tests5/tdf123446.py
+++ b/sw/qa/uitest/writer_tests5/tdf123446.py
@@ -11,31 +11,29 @@ from uitest.uihelper.common import type_text
class tdf123446(UITestCase):
def test_tsd123446_undo_redo_ToC_crash(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #- Add a word to an empty document.
- type_text(xWriterEdit, "LibreOffice")
- #- Change its style to Heading 2.
- self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
- #- Position cursor somewhere in the middle of the word, and add Table of Contents
- #(no need to change anything in the dialog).
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #- Add a word to an empty document.
+ type_text(xWriterEdit, "LibreOffice")
+ #- Change its style to Heading 2.
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
+ #- Position cursor somewhere in the middle of the word, and add Table of Contents
+ #(no need to change anything in the dialog).
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
- with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"):
- pass
- #- Undo the ToC insertion.
- self.xUITest.executeCommand(".uno:Undo")
- #- Redo the ToC insertion.
- self.xUITest.executeCommand(".uno:Redo")
- #=> Crash. Now we verify the text
- # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Text.String[0:7], "LibreOf")
+ with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"):
+ pass
+ #- Undo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Undo")
+ #- Redo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Redo")
+ #=> Crash. Now we verify the text
+ # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Text.String[0:7], "LibreOf")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py
index 06b8b8ea3eb0..01617c42ec98 100644
--- a/sw/qa/uitest/writer_tests5/titlePage.py
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -9,23 +9,21 @@ from uitest.framework import UITestCase
class titlePage(UITestCase):
def test_title_page(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #dialog Title Page
- with self.ui_test.execute_dialog_through_command(".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)
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog", close_button="cancel"):
- pass
- self.assertEqual(document.CurrentController.PageCount, 3)
+ # check cancel button
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog", close_button="cancel"):
+ pass
+ self.assertEqual(document.CurrentController.PageCount, 3)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py
index cdacffcb70ae..f02d8c861c05 100644
--- a/sw/qa/uitest/writer_tests5/xwindow.py
+++ b/sw/qa/uitest/writer_tests5/xwindow.py
@@ -76,101 +76,99 @@ class XWindow(UITestCase):
def test_listeners(self):
global mouseListenerCount
- self.ui_test.create_doc_in_start_center("writer")
- xDoc = self.ui_test.get_component()
-
- # create new mouse listener
- xFrame = xDoc.getCurrentController().getFrame()
- self.assertIsNotNone(xFrame)
- xWindow = xFrame.getContainerWindow()
- self.assertIsNotNone(xWindow)
-
- # add new mouse listener
- xMouseListener = XMouseListenerExtended()
- self.assertIsNotNone(xMouseListener)
- xWindow.addMouseListener(xMouseListener)
- self.assertEqual(1, mouseListenerCount)
-
- # add new key listener
- xKeyListener = XKeyListenerExtended()
- self.assertIsNotNone(xKeyListener)
- xWindow.addKeyListener(xKeyListener)
-
- # create dummy mouse event
- xMouseEvent = MouseEvent()
- xMouseEvent.Modifiers = 0
- xMouseEvent.Buttons = MouseButton.LEFT
- xMouseEvent.X = 10
- xMouseEvent.Y = 10
- xMouseEvent.ClickCount = 1
- xMouseEvent.PopupTrigger = False
- xMouseEvent.Source = xWindow
-
- xMouseEvent2 = MouseEvent()
- xMouseEvent2.Modifiers = 0
- xMouseEvent2.Buttons = MouseButton.LEFT
- xMouseEvent2.X = 300
- xMouseEvent2.Y = 300
- xMouseEvent2.ClickCount = 1
- xMouseEvent2.PopupTrigger = False
- xMouseEvent2.Source = xWindow
-
- # send mouse event
- xToolkitRobot = xWindow.getToolkit()
- self.assertIsNotNone(xToolkitRobot)
-
- # Click in the menubar/toolbar area
- xToolkitRobot.mouseMove(xMouseEvent)
- xToolkitRobot.mousePress(xMouseEvent)
- xToolkitRobot.mouseRelease(xMouseEvent)
-
- # Click into the document content
- xToolkitRobot.mousePress(xMouseEvent2)
- xToolkitRobot.mouseRelease(xMouseEvent2)
-
- # send key press event
- xKeyEvent = KeyEvent()
- xKeyEvent.Modifiers = 0
- xKeyEvent.KeyCode = 70
- xKeyEvent.KeyChar = 70
- xKeyEvent.Source = xWindow
-
- xToolkitRobot.keyPress(xKeyEvent)
- xToolkitRobot.keyRelease(xKeyEvent)
-
- # Wait for async events to be processed
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- # remove mouse listener
- xWindow.removeMouseListener(xMouseListener)
- self.assertEqual(1, mouseListenerCount)
- del xMouseListener
-
- # remove key listener
- xWindow.removeKeyListener(xKeyListener)
- del xKeyListener
-
- global keymousePressedEventsIntercepted
- # Not expected any interceptions
- self.assertEqual(0, keymousePressedEventsIntercepted)
-
- global keymouseReleasedEventsIntercepted
- # Not expected any interceptions
- self.assertEqual(0, keymouseReleasedEventsIntercepted)
-
- global mousePressedEventsIntercepted
- self.assertEqual(0, mousePressedEventsIntercepted)
-
- global mouseReleasedEventsIntercepted
- self.assertEqual(0, mouseReleasedEventsIntercepted)
-
- global mouseEventsIntercepted
- # Not expected 3 interceptions
- self.assertEqual(0, mouseEventsIntercepted)
-
- # close document
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as xDoc:
+
+ # create new mouse listener
+ xFrame = xDoc.getCurrentController().getFrame()
+ self.assertIsNotNone(xFrame)
+ xWindow = xFrame.getContainerWindow()
+ self.assertIsNotNone(xWindow)
+
+ # add new mouse listener
+ xMouseListener = XMouseListenerExtended()
+ self.assertIsNotNone(xMouseListener)
+ xWindow.addMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+
+ # add new key listener
+ xKeyListener = XKeyListenerExtended()
+ self.assertIsNotNone(xKeyListener)
+ xWindow.addKeyListener(xKeyListener)
+
+ # create dummy mouse event
+ xMouseEvent = MouseEvent()
+ xMouseEvent.Modifiers = 0
+ xMouseEvent.Buttons = MouseButton.LEFT
+ xMouseEvent.X = 10
+ xMouseEvent.Y = 10
+ xMouseEvent.ClickCount = 1
+ xMouseEvent.PopupTrigger = False
+ xMouseEvent.Source = xWindow
+
+ xMouseEvent2 = MouseEvent()
+ xMouseEvent2.Modifiers = 0
+ xMouseEvent2.Buttons = MouseButton.LEFT
+ xMouseEvent2.X = 300
+ xMouseEvent2.Y = 300
+ xMouseEvent2.ClickCount = 1
+ xMouseEvent2.PopupTrigger = False
+ xMouseEvent2.Source = xWindow
+
+ # send mouse event
+ xToolkitRobot = xWindow.getToolkit()
+ self.assertIsNotNone(xToolkitRobot)
+
+ # Click in the menubar/toolbar area
+ xToolkitRobot.mouseMove(xMouseEvent)
+ xToolkitRobot.mousePress(xMouseEvent)
+ xToolkitRobot.mouseRelease(xMouseEvent)
+
+ # Click into the document content
+ xToolkitRobot.mousePress(xMouseEvent2)
+ xToolkitRobot.mouseRelease(xMouseEvent2)
+
+ # send key press event
+ xKeyEvent = KeyEvent()
+ xKeyEvent.Modifiers = 0
+ xKeyEvent.KeyCode = 70
+ xKeyEvent.KeyChar = 70
+ xKeyEvent.Source = xWindow
+
+ xToolkitRobot.keyPress(xKeyEvent)
+ xToolkitRobot.keyRelease(xKeyEvent)
+
+ # Wait for async events to be processed
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ # remove mouse listener
+ xWindow.removeMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+ del xMouseListener
+
+ # remove key listener
+ xWindow.removeKeyListener(xKeyListener)
+ del xKeyListener
+
+ global keymousePressedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymousePressedEventsIntercepted)
+
+ global keymouseReleasedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymouseReleasedEventsIntercepted)
+
+ global mousePressedEventsIntercepted
+ self.assertEqual(0, mousePressedEventsIntercepted)
+
+ global mouseReleasedEventsIntercepted
+ self.assertEqual(0, mouseReleasedEventsIntercepted)
+
+ global mouseEventsIntercepted
+ # Not expected 3 interceptions
+ self.assertEqual(0, mouseEventsIntercepted)
+
+ # close document
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py
index 7e647e622fbd..2fc6d636b2c4 100644
--- a/sw/qa/uitest/writer_tests5/zoom.py
+++ b/sw/qa/uitest/writer_tests5/zoom.py
@@ -11,76 +11,74 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class writerZoom(UITestCase):
def test_zoom_writer(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #dialog View-Zoom-Zoom
- with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #dialog View-Zoom-Zoom
+ with self.ui_test.execute_dialog_through_command(".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())
+ #select Optimal & Automatic - OK - open and verify
+ optimal = xDialog.getChild("optimal")
+ optimal.executeAction("CLICK", tuple())
+ automatic = xDialog.getChild("automatic")
+ automatic.executeAction("CLICK", tuple())
- with self.ui_test.execute_dialog_through_command(".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())
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".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"}))
+ with self.ui_test.execute_dialog_through_command(".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"}))
- with self.ui_test.execute_dialog_through_command(".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())
+ with self.ui_test.execute_dialog_through_command(".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())
- with self.ui_test.execute_dialog_through_command(".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"}))
+ with self.ui_test.execute_dialog_through_command(".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"}))
- with self.ui_test.execute_dialog_through_command(".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%")
+ with self.ui_test.execute_dialog_through_command(".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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/infobar.py b/sw/qa/uitest/writer_tests6/infobar.py
index 84dfdb3ac887..f0a03790e710 100644
--- a/sw/qa/uitest/writer_tests6/infobar.py
+++ b/sw/qa/uitest/writer_tests6/infobar.py
@@ -16,45 +16,44 @@ from com.sun.star.container import NoSuchElementException
class tdf97926(UITestCase):
def test_infobar_add(self):
- self.ui_test.create_doc_in_start_center("writer")
- controller = self.ui_test.get_component().getCurrentController()
- buttons = [StringPair("Close", ".uno:CloseDoc")]
- controller.appendInfobar(
- "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
-
- # Adding another infobar with the same ID should throw an exception
- with self.assertRaises(IllegalArgumentException):
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
controller.appendInfobar(
"my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
- self.ui_test.close_doc()
+
+ # Adding another infobar with the same ID should throw an exception
+ with self.assertRaises(IllegalArgumentException):
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
def test_infobar_update(self):
- self.ui_test.create_doc_in_start_center("writer")
- controller = self.ui_test.get_component().getCurrentController()
- buttons = [StringPair("Close", ".uno:CloseDoc")]
- controller.appendInfobar(
- "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
- controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING)
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
+ controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING)
- # Updating non-existing infobars should throw an exception
- with self.assertRaises(NoSuchElementException):
- controller.updateInfobar("notexisting", "", "", InfobarType.WARNING)
+ # Updating non-existing infobars should throw an exception
+ with self.assertRaises(NoSuchElementException):
+ controller.updateInfobar("notexisting", "", "", InfobarType.WARNING)
- # Passing invalid values for InfobarType should throw an exception
- with self.assertRaises(IllegalArgumentException):
- controller.updateInfobar("my", "", "", 120)
+ # Passing invalid values for InfobarType should throw an exception
+ with self.assertRaises(IllegalArgumentException):
+ controller.updateInfobar("my", "", "", 120)
def test_infobar_remove(self):
- self.ui_test.create_doc_in_start_center("writer")
- controller = self.ui_test.get_component().getCurrentController()
- buttons = [StringPair("Close", ".uno:CloseDoc")]
- controller.appendInfobar(
- "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
-
- controller.removeInfobar("my")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
- # Removing an already removed infobar should throw an exception
- with self.assertRaises(NoSuchElementException):
controller.removeInfobar("my")
+ # Removing an already removed infobar should throw an exception
+ with self.assertRaises(NoSuchElementException):
+ controller.removeInfobar("my")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py
index 9fc02be4e8ac..79c4633d113d 100644
--- a/sw/qa/uitest/writer_tests6/tdf107847.py
+++ b/sw/qa/uitest/writer_tests6/tdf107847.py
@@ -11,23 +11,21 @@ from uitest.uihelper.common import select_pos
class tdf107847(UITestCase):
def test_tdf_107847_macro_tab_crash(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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")
- self.assertEqual(document.TextFrames.getCount(), 0)
- self.ui_test.close_doc()
+ self.assertEqual(document.TextFrames.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextFrames.getCount(), 0)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py
index 65a8ada64885..675bbe8675f6 100644
--- a/sw/qa/uitest/writer_tests6/tdf118883.py
+++ b/sw/qa/uitest/writer_tests6/tdf118883.py
@@ -10,23 +10,22 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class Tdf118883(UITestCase):
def test_tdf118883(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as writer_document:
- # Insert shape with Ctrl key
- xArgs = mkPropertyValues({"KeyModifier": 8192})
- self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs)
+ # Insert shape with Ctrl key
+ xArgs = mkPropertyValues({"KeyModifier": 8192})
+ self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs)
- writer_document = self.ui_test.get_component()
- self.assertEqual(1, writer_document.DrawPage.getCount())
+ self.assertEqual(1, writer_document.DrawPage.getCount())
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- with self.ui_test.load_empty_file("calc") as calc_document:
+ with self.ui_test.load_empty_file("calc") as calc_document:
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- # Without the fix in place, this test would have failed with
- # AssertionError: 1 != 0
- self.assertEqual(1, calc_document.DrawPages[0].getCount())
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1 != 0
+ self.assertEqual(1, calc_document.DrawPages[0].getCount())
# 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 c27482195753..fbe9964883a7 100644
--- a/sw/qa/uitest/writer_tests6/tdf125104.py
+++ b/sw/qa/uitest/writer_tests6/tdf125104.py
@@ -18,45 +18,43 @@ class tdf125104(UITestCase):
select_by_text(comboLayoutFormat, format)
def test_tdf125104_pageFormat_numbering(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
-
- # insert page numbers on multiple pages
- self.xUITest.executeCommand(".uno:InsertPageNumberField")
- self.xUITest.executeCommand(".uno:InsertPagebreak")
- self.xUITest.executeCommand(".uno:InsertPageNumberField")
- text = document.Text.String.replace('\r\n', '\n')
- self.assertEqual(text[0:1], "1")
- self.assertEqual(text[2:3], "2")
-
- # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
- with self.ui_test.execute_dialog_through_command(".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")
-
- with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".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
- with self.ui_test.execute_dialog_through_command(".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], "२")
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+
+ # insert page numbers on multiple pages
+ self.xUITest.executeCommand(".uno:InsertPageNumberField")
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.xUITest.executeCommand(".uno:InsertPageNumberField")
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "1")
+ self.assertEqual(text[2:3], "2")
+
+ # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
+ with self.ui_test.execute_dialog_through_command(".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")
+
+ with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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
+ with self.ui_test.execute_dialog_through_command(".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], "२")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py
index 8c9794a17545..dd7454e16a50 100644
--- a/sw/qa/uitest/writer_tests6/tdf126168.py
+++ b/sw/qa/uitest/writer_tests6/tdf126168.py
@@ -11,33 +11,31 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf126168(UITestCase):
def test_tdf126168_frame_undo_redo_crash(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- #2) Menu > Insert > Frame > Frame
- #3) Press OK in Frame dialog
- with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"):
- pass
- self.assertEqual(document.TextFrames.getCount(), 1)
- #New Style from Selection [uno:StyleNewByExample]
- with self.ui_test.execute_dialog_through_command(".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")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextFrames.getCount(), 0)
- #7) shift+ctrl+z 3 times
- self.xUITest.executeCommand(".uno:Redo")
- self.xUITest.executeCommand(".uno:Redo")
- self.xUITest.executeCommand(".uno:Redo")
+ #2) Menu > Insert > Frame > Frame
+ #3) Press OK in Frame dialog
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"):
+ pass
+ self.assertEqual(document.TextFrames.getCount(), 1)
+ #New Style from Selection [uno:StyleNewByExample]
+ with self.ui_test.execute_dialog_through_command(".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")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextFrames.getCount(), 0)
+ #7) shift+ctrl+z 3 times
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
- #Results: crash
- self.assertEqual(document.CurrentController.PageCount, 1)
+ #Results: crash
+ self.assertEqual(document.CurrentController.PageCount, 1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py
index f09d23597fcd..ddfec671bc3d 100644
--- a/sw/qa/uitest/writer_tests6/tdf128431.py
+++ b/sw/qa/uitest/writer_tests6/tdf128431.py
@@ -12,29 +12,27 @@ from uitest.uihelper.common import change_measurement_unit
class tdf128431(UITestCase):
def test_tdf128431_pageFormat_sync_padding(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, 6) #borders
+ with self.ui_test.execute_dialog_through_command(".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")
+ 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.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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py
index 4c07a5516d6f..a049ef845797 100644
--- a/sw/qa/uitest/writer_tests6/tdf131041.py
+++ b/sw/qa/uitest/writer_tests6/tdf131041.py
@@ -10,34 +10,32 @@ from uitest.uihelper.common import select_pos, get_state_as_dict
class tdf131041(UITestCase):
def test_run(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, 4) #header
+ with self.ui_test.execute_dialog_through_command(".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
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py
index 9373d6c89901..ee2f194f9051 100644
--- a/sw/qa/uitest/writer_tests6/tdf44837.py
+++ b/sw/qa/uitest/writer_tests6/tdf44837.py
@@ -12,33 +12,31 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf44837(UITestCase):
def test_tdf448373_Replace_All_clears_current_selection(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
-
- type_text(xWriterEdit, "asd asd")
- self.xUITest.executeCommand(".uno:SelectAll")
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox
-
- selectionOnly = xDialog.getChild("selection")
- selectionOnly.executeAction("CLICK", tuple())
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple())
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.assertEqual(document.Text.String[0:8], "bsd bsd")
- self.assertEqual(len(document.CurrentSelection[0].String) > 1, True)
- #follow-up bug 125663
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "asd asd")
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox
+
+ selectionOnly = xDialog.getChild("selection")
+ selectionOnly.executeAction("CLICK", tuple())
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+
+ self.assertEqual(document.Text.String[0:8], "bsd bsd")
+ self.assertEqual(len(document.CurrentSelection[0].String) > 1, True)
+ #follow-up bug 125663
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf109083.py b/sw/qa/uitest/writer_tests7/tdf109083.py
index 500bc7150ddc..c06f7d16ac33 100644
--- a/sw/qa/uitest/writer_tests7/tdf109083.py
+++ b/sw/qa/uitest/writer_tests7/tdf109083.py
@@ -12,50 +12,49 @@ from uitest.uihelper.common import select_pos
#Bug 109083 - Updating table style: changes didn't propagate to other tables when selection was over two columns at the moment of updating
class tdf109083(UITestCase):
def test_tdf109083(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #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):
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
- formatlbinstable = xDialog.getChild("formatlbinstable")
- entry = formatlbinstable.getChild("1")
- entry.executeAction("SELECT", tuple())
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #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):
+ with self.ui_test.execute_dialog_through_command(".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
- for i in range (0,2):
- self.xUITest.executeCommand(".uno:GoDown")
- for i in range (0,2):
- self.xUITest.executeCommand(".uno:CharRightSel")
- #set a specific color on the selected cells (last row)
- self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }))
+ #select the last row of the first table
+ for i in range (0,2):
+ self.xUITest.executeCommand(".uno:GoDown")
+ for i in range (0,2):
+ self.xUITest.executeCommand(".uno:CharRightSel")
+ #set a specific color on the selected cells (last row)
+ self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }))
- #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected)
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
- xLeft = xWriterEdit.getChild('left')
- xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
- xRight = xWriterEdit.getChild('right')
- xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
- #select the second table
- for i in range (0,2):
- self.xUITest.executeCommand(".uno:GoDown")
+ #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected)
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
+ xLeft = xWriterEdit.getChild('left')
+ xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+ xRight = xWriterEdit.getChild('right')
+ xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ #select the second table
+ for i in range (0,2):
+ self.xUITest.executeCommand(".uno:GoDown")
- #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):
- with self.ui_test.execute_dialog_through_command(".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()
+ #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):
+ with self.ui_test.execute_dialog_through_command(".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")
# 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 fb0a0966a27c..bb86662b1cf5 100644
--- a/sw/qa/uitest/writer_tests7/tdf115853.py
+++ b/sw/qa/uitest/writer_tests7/tdf115853.py
@@ -15,27 +15,26 @@ from uitest.uihelper.common import select_pos
class tdf115853(UITestCase):
def test_tdf115853(self):
- self.ui_test.create_doc_in_start_center("writer")
- with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.execute_dialog_through_command(".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'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py
index a761bb88ceab..b756f9fb9b00 100644
--- a/sw/qa/uitest/writer_tests7/tdf119661.py
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -15,67 +15,67 @@ class tdf119661(UITestCase):
def test_tdf119661(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog:
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
+ with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog:
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
- xLink = xOpenDialog.getChild("link")
- self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
+ xLink = xOpenDialog.getChild("link")
+ self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
- xLink.executeAction("CLICK", tuple())
+ xLink.executeAction("CLICK", tuple())
- xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn = xOpenDialog.getChild("open")
- #Confirmation dialog is displayed
- with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'):
- pass
+ #Confirmation dialog is displayed
+ with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
- sLinks = "TB_LINKS"
- xLinks = xDialog.getChild(sLinks)
- self.assertEqual(1, len(xLinks.getChildren()))
+ sLinks = "TB_LINKS"
+ xLinks = xDialog.getChild(sLinks)
+ self.assertEqual(1, len(xLinks.getChildren()))
- sFileName = "FULL_FILE_NAME"
- xFileName = xDialog.getChild(sFileName)
- self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
- sBreakLink = "BREAK_LINK"
- xBreakLink = xDialog.getChild(sBreakLink)
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
- with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
- args=("CLICK", tuple()), close_button="yes"):
- pass
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
- # Save Copy as
- with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xDialog:
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command(".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}))
- # Close the Writer document
- self.ui_test.close_doc()
+ # Close the Writer document
+ self.ui_test.close_doc()
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- self.xUITest.executeCommand(".uno:LinkDialog")
+ self.xUITest.executeCommand(".uno:LinkDialog")
- # Since the image is no longer linked, the link dialog is not open.
- # Without the fix in place, this dialog would have been opened
- xMainWin = self.xUITest.getTopFocusWindow()
- self.assertTrue(sLinks not in xMainWin.getChildren())
- self.assertTrue(sFileName not in xMainWin.getChildren())
- self.assertTrue(sBreakLink not in xMainWin.getChildren())
- self.assertTrue("writer_edit" in xMainWin.getChildren())
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("writer_edit" in xMainWin.getChildren())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py
index a479b408a856..e3fc5764e218 100644
--- a/sw/qa/uitest/writer_tests7/tdf133348.py
+++ b/sw/qa/uitest/writer_tests7/tdf133348.py
@@ -10,51 +10,49 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf133348(UITestCase):
def test_tdf133348(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- selection = self.xUITest.executeCommand(".uno:SelectAll")
- xArgs = mkPropertyValues({"Text": "C1"})
- self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
+ xArgs = mkPropertyValues({"Text": "C1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
- with self.ui_test.execute_dialog_through_command(".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)
+ with self.ui_test.execute_dialog_through_command(".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"})
- self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs)
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xArgs = mkPropertyValues({"Text": "C2"})
+ self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs)
- # Wait for async events to be processed
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
+ # Wait for async events to be processed
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
- xEnum = document.TextFields.createEnumeration()
- self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author')
- self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author')
+ xEnum = document.TextFields.createEnumeration()
+ self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author')
+ self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author')
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- # Without the fix in place, it would have crashed here
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Undo")
+ # Without the fix in place, it would have crashed here
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- # all comments have been deleted
- self.assertFalse(document.TextFields.createEnumeration().hasMoreElements())
+ # all comments have been deleted
+ self.assertFalse(document.TextFields.createEnumeration().hasMoreElements())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf140731.py b/sw/qa/uitest/writer_tests7/tdf140731.py
index 79972c8ad7f8..db1744231c2e 100644
--- a/sw/qa/uitest/writer_tests7/tdf140731.py
+++ b/sw/qa/uitest/writer_tests7/tdf140731.py
@@ -11,47 +11,45 @@ from uitest.uihelper.common import type_text
class tdf140731(UITestCase):
def test_tdf140731(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- type_text(xWriterEdit, 'Lorem')
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F3"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
- #generating a big text with ~60k words and several paragraphs
- for i in range(0,8):
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ type_text(xWriterEdit, 'Lorem')
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F3"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ #generating a big text with ~60k words and several paragraphs
+ for i in range(0,8):
+ self.xUITest.executeCommand(".uno:SelectAll")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"}))
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
+
+ #Format->Text operations on small selections (which would generate <~500 redlines), changetracking still working
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "1", "END_POS": "1000"}))
+ self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
+ self.assertTrue(document.Redlines.createEnumeration().hasMoreElements())
+
+ #Removing all the redlines.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ #Without the fix in place, on big selections writer would freeze. Now it ignores change tracking.
self.xUITest.executeCommand(".uno:SelectAll")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"}))
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
-
- #Format->Text operations on small selections (which would generate <~500 redlines), changetracking still working
- self.xUITest.executeCommand(".uno:TrackChanges")
- xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "1", "END_POS": "1000"}))
- self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
- document = self.ui_test.get_component()
- self.assertTrue(document.Redlines.createEnumeration().hasMoreElements())
-
- #Removing all the redlines.
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xAccBtn = xTrackDlg.getChild("rejectall")
- xAccBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
-
- #Without the fix in place, on big selections writer would freeze. Now it ignores change tracking.
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
- self.assertFalse(document.Redlines.createEnumeration().hasMoreElements())
-
- #The patch has no effects on the Format->Text operations
- self.assertEqual(document.Text.String[0:26], "Lorem Ipsum Dolor Sit Amet")
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:ChangeCaseToUpper")
- self.assertEqual(document.Text.String[0:26], "LOREM IPSUM DOLOR SIT AMET")
-
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
+ self.assertFalse(document.Redlines.createEnumeration().hasMoreElements())
+
+ #The patch has no effects on the Format->Text operations
+ self.assertEqual(document.Text.String[0:26], "Lorem Ipsum Dolor Sit Amet")
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:ChangeCaseToUpper")
+ self.assertEqual(document.Text.String[0:26], "LOREM IPSUM DOLOR SIT AMET")
+
# 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 a1a926af8223..8bcef79fbf49 100644
--- a/sw/qa/uitest/writer_tests7/tdf140863.py
+++ b/sw/qa/uitest/writer_tests7/tdf140863.py
@@ -12,49 +12,47 @@ class tdf140863(UITestCase):
def test_tdf140863(self):
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.create_doc_in_start_center_guarded("writer") as document:
- # Insert one section
- with self.ui_test.execute_dialog_through_command(".uno:InsertSection"):
- pass
+ # Insert one section
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSection"):
+ pass
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- # Insert a page break in the section
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- self.xUITest.executeCommand(".uno:InsertPagebreak")
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ # Insert a page break in the section
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- document = self.ui_test.get_component()
- self.assertEqual(1, len(document.TextSections))
- self.assertTrue(document.TextSections.Section1.IsVisible)
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
- with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
- xHide = xDialog.getChild('hide')
- self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertEqual(1, len(document.TextSections))
- self.assertFalse(document.TextSections.Section1.IsVisible)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+ self.assertEqual(1, len(document.TextSections))
+ self.assertFalse(document.TextSections.Section1.IsVisible)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
- xHide = xDialog.getChild('hide')
- self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
+ with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
- xHide.executeAction('CLICK', tuple())
+ xHide.executeAction('CLICK', tuple())
- self.assertEqual(1, len(document.TextSections))
- self.assertTrue(document.TextSections.Section1.IsVisible)
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
- # Without the fix in place, this test would have failed with
- # AssertionError: '1' != '2'
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '1' != '2'
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index 98a9064b6304..c09783638fd3 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -86,6 +86,5 @@ class tdf90401(UITestCase):
# This was 'NL\t11/03/2020 19:19:05\t', containing personal info
self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t')
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: