sw/qa/uitest/findReplace/tdf118208.py | 63 ++++++++++++++-------------------- 1 file changed, 26 insertions(+), 37 deletions(-)
New commits: commit 621d4b0afc34646cec59b53e192be47eefe6062d Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Feb 6 17:42:29 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Feb 7 12:15:24 2023 +0000 sw: use try/finally to reset the changes in OptionsTreeDialog Otherwise it might affect other tests if it hits an assert Change-Id: Ic8e35f6f9f029ea6ae4620946edb69ca7a6618bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146591 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py index aadc50eca059..eab70452510c 100644 --- a/sw/qa/uitest/findReplace/tdf118208.py +++ b/sw/qa/uitest/findReplace/tdf118208.py @@ -15,52 +15,41 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class tdf118208(UITestCase): + def change_default_languages(self, enabled): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') # Language Settings + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language + + asianlanguage = xDialog.getChild("asiansupport") + complexlanguage = xDialog.getChild("ctlsupport") + if (get_state_as_dict(asianlanguage)["Selected"]) != enabled: + asianlanguage.executeAction("CLICK", tuple()) + if (get_state_as_dict(complexlanguage)["Selected"]) != enabled: + complexlanguage.executeAction("CLICK", tuple()) + def test_tdf118208_search_dialog_format_crash(self): with self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) as writer_doc: # 1. Open the attached file. # 2. Press ctrl-H to show the search and replace dialog. # 3. Press the "Format..." button. #Libreoffice immediately crashed. - with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: - - xPages = xDialog.getChild("pages") - xLanguageEntry = xPages.getChild('2') # Language Settings - xLanguageEntry.executeAction("EXPAND", tuple()) - xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') - xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language - - asianlanguage = xDialog.getChild("asiansupport") - complexlanguage = xDialog.getChild("ctlsupport") - if (get_state_as_dict(asianlanguage)["Selected"]) == "true": - asianlanguage.executeAction("CLICK", tuple()) - if (get_state_as_dict(complexlanguage)["Selected"]) == "true": - complexlanguage.executeAction("CLICK", tuple()) - - - with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: - - format = xDialog.getChild("format") - with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())): - pass + try: + self.change_default_languages("false") - #verify - self.assertEqual(writer_doc.Text.String[0:14], "Aaaaaaaaaaaaaa") + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: - #enable lang support again - with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + format = xDialog.getChild("format") - xPages = xDialog.getChild("pages") - xLanguageEntry = xPages.getChild('2') # Language Settings - xLanguageEntry.executeAction("EXPAND", tuple()) - xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') - xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())): + pass - asianlanguage = xDialog.getChild("asiansupport") - complexlanguage = xDialog.getChild("ctlsupport") - if (get_state_as_dict(asianlanguage)["Selected"]) == "false": - asianlanguage.executeAction("CLICK", tuple()) - if (get_state_as_dict(complexlanguage)["Selected"]) == "false": - complexlanguage.executeAction("CLICK", tuple()) + #verify + self.assertEqual(writer_doc.Text.String[0:14], "Aaaaaaaaaaaaaa") + finally: + self.change_default_languages("true") -# vim: set shiftwidth=4 softtabstop=4 expandtab: