diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-30 09:50:25 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-30 13:17:33 +0200 |
commit | adf59322c651e8e6740a8d97d963dcf0972bdc54 (patch) | |
tree | a6728276e58544f87167a4bbb69a846584596afd /sw/qa/uitest/writer_tests5 | |
parent | f7300b2f07f308118967c797206dbc4a1e9a61a4 (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>
Diffstat (limited to 'sw/qa/uitest/writer_tests5')
-rw-r--r-- | sw/qa/uitest/writer_tests5/about_test.py | 7 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/autocorrectOptions.py | 160 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/columns.py | 52 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/tdf107494.py | 116 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/tdf122045.py | 28 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/tdf122722.py | 84 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/tdf123378.py | 16 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/tdf123446.py | 48 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/titlePage.py | 30 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/xwindow.py | 188 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/zoom.py | 126 |
11 files changed, 416 insertions, 439 deletions
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: |