summaryrefslogtreecommitdiff
path: root/sw/qa/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-02-01 14:24:04 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-02-01 14:44:27 +0000
commit9b68c5ed1ca7936d97c581f1a9fd3c07708bf3d6 (patch)
tree3641f35cd5ca635dcd2532bdd11ba0fb19f4e15c /sw/qa/uitest
parentd09996a0d66c51908103afef9c56679b891570d8 (diff)
sw: restructure tests a bit
Follow-up to 3ac5bfec2f73c55e99c4410f7559db86b875a269 "uitest: Always change doc info setting back to false" it seems it fails sometimes when using .uno:CloseDoc Seen in https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/132728/consoleFull#-45932801048ce9c26-9d0a-43a8-83d8-c44f54920d59 Change-Id: I384e40a31735738c622277ccdbdb75babb185d85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146448 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r--sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py
index 992b564adbe4..38d5ec818a38 100644
--- a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py
+++ b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py
@@ -35,10 +35,10 @@ class edit_file_properties_before_saving(UITestCase):
with TemporaryDirectory() as tempdir:
xFilePath = os.path.join(tempdir, "tdf117895-temp.odt")
- with self.ui_test.create_doc_in_start_center("writer"):
+ try:
+ self.change_doc_info_setting("true")
- try:
- self.change_doc_info_setting("true")
+ with self.ui_test.create_doc_in_start_center("writer"):
# Save Copy as
with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog:
@@ -52,23 +52,23 @@ class edit_file_properties_before_saving(UITestCase):
xReadOnly = xPropertiesDialog.getChild("readonly")
xReadOnly.executeAction("CLICK", tuple())
self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected'])
- finally:
- # Put this setting back to false, otherwise it might affect other tests
- self.change_doc_info_setting("false")
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
- # Without the fix in place, this test would have failed here
- self.assertTrue(doc2.isReadonly())
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+ # Without the fix in place, this test would have failed here
+ self.assertTrue(doc2.isReadonly())
+ finally:
+ # Put this setting back to false, otherwise it might affect other tests
+ self.change_doc_info_setting("false")
def test_tdf119206(self):
with TemporaryDirectory() as tempdir:
xFilePath = os.path.join(tempdir, "tdf119206-temp.odt")
- with self.ui_test.create_doc_in_start_center("writer"):
+ try:
+ self.change_doc_info_setting("true")
- try:
- self.change_doc_info_setting("true")
+ with self.ui_test.create_doc_in_start_center("writer"):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
@@ -90,11 +90,12 @@ class edit_file_properties_before_saving(UITestCase):
xReadOnly = xPropertiesDialog.getChild("readonly")
xReadOnly.executeAction("CLICK", tuple())
self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected'])
- finally:
- # Put this setting back to false, otherwise it might affect other tests
- self.change_doc_info_setting("false")
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
- self.assertTrue(doc2.isReadonly())
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+ self.assertTrue(doc2.isReadonly())
+
+ finally:
+ # Put this setting back to false, otherwise it might affect other tests
+ self.change_doc_info_setting("false")
# vim: set shiftwidth=4 softtabstop=4 expandtab: