sc/qa/uitest/calc_tests9/tdf118938.py | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-)
New commits: commit 708b1aa962dd667a9de6d6131cfc63937212536e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Sep 8 17:43:53 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Sep 8 18:51:03 2021 +0200 related: tdf#118938: simplify uitest use execute_dialog_through_command like every other test and remove the try/except complexity Change-Id: Ie9cb68e56174516002c15afe89e4314e4c16a755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121826 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/calc_tests9/tdf118938.py b/sc/qa/uitest/calc_tests9/tdf118938.py index 7444f65780ea..67647ba6d940 100644 --- a/sc/qa/uitest/calc_tests9/tdf118938.py +++ b/sc/qa/uitest/calc_tests9/tdf118938.py @@ -12,38 +12,23 @@ from libreoffice.uno.propertyvalue import mkPropertyValues # with additional password protection for editing not working (Calc) class tdf118938(UITestCase): + def test_tdf118938(self): with self.ui_test.load_file(get_url_for_data_file("tdf118938.xlsx")): #The document was created in Calc after this fix. calcDoc = self.xUITest.getTopFocusWindow() gridwin = calcDoc.getChild("grid_window") - incorrectPass = False; + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(document.isReadonly()) - try: - self.xUITest.executeDialog(".uno:EditDoc") - xDialog = self.xUITest.getTopFocusWindow(); + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: xPassword = xDialog.getChild("newpassEntry") xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - try: - xWarnDialog = self.xUITest.getTopFocusWindow() - xOK = xWarnDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - xDialog2 = self.xUITest.getTopFocusWindow(); - xCancelBtn = xDialog2.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - incorrectPass = True; - except: - pass - except: - assert False, "The password dialog hasn't appeared." - - if incorrectPass: - assert False, "Incorrect password." + + self.assertFalse(document.isReadonly()) # vim: set shiftwidth=4 softtabstop=4 expandtab: