sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py |   40 
+++++-----
 1 file changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 5fa860ddddf26c0b02e68a7840f1a74471b6ec98
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Feb 1 14:24:04 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Feb 3 10:07:20 2023 +0000

    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 <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146457
    Tested-by: Jenkins
    (cherry picked from commit 06fc2f919bfa22d976aadbb89b05fedf8fa3da7a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146412
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

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 0df0dc504dde..d8d30d0aff74 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,25 +52,26 @@ 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")
 
-            self.ui_test.wait_until_file_is_available(xFilePath)
+                self.ui_test.wait_until_file_is_available(xFilePath)
 
-            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")
@@ -92,13 +93,14 @@ 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")
 
-            self.ui_test.wait_until_file_is_available(xFilePath)
+                self.ui_test.wait_until_file_is_available(xFilePath)
+
+                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:

Reply via email to