summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-09-08 17:43:53 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-09-08 18:51:03 +0200
commit708b1aa962dd667a9de6d6131cfc63937212536e (patch)
tree8fe8890a1f183d46fe9561743424c0dac1b2c77c
parent2c0e5d8b2e53921f09b2e5036cc25f8b0a177dd6 (diff)
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 <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/uitest/calc_tests9/tdf118938.py33
1 files changed, 9 insertions, 24 deletions
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: