summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/writer_tests6
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-01-30 14:17:43 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-01-30 19:16:21 +0000
commit86558061332e9828d5a69fe97b439bf49560f552 (patch)
tree5c3eeebae5e9a1542155dad31b948c89de923f2b /sw/qa/uitest/writer_tests6
parent440230f1802ce03f83aa92d1b56806e068ce4800 (diff)
sw: blind fix for uitest hang
in sw/qa/uitest/writer_tests6/ there is another test document called edit_file_properties_before_saving.py that changes the option "Edit document properties before saving" to True. My theory is that it might affect save_readonly_with_password.py so let's move it to another folder to make sure this is not affecting the test Change-Id: Ib75361be31aceeec33df76ae31a9ee8c261a2c7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146357 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests6')
-rw-r--r--sw/qa/uitest/writer_tests6/save_readonly_with_password.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/sw/qa/uitest/writer_tests6/save_readonly_with_password.py b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
deleted file mode 100644
index 46fa527d6d90..000000000000
--- a/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from org.libreoffice.unotest import systemPathToFileUrl
-from uitest.uihelper.common import select_by_text
-from uitest.uihelper.common import get_state_as_dict
-from tempfile import TemporaryDirectory
-import os.path
-
-
-class save_readonly_with_password(UITestCase):
-
- #Bug 144374 - Writer: FILESAVE to DOCX as read-only with additional password protection for editing not working
- def test_save_to_docx(self):
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "tdf144374-tmp.docx")
-
- with self.ui_test.create_doc_in_start_center("writer"):
- # Save the document
- with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog:
- xFileName = xSaveDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
- xFileTypeCombo = xSaveDialog.getChild("file_type")
- select_by_text(xFileTypeCombo, "Office Open XML Text (Transitional) (.docx)")
- xPasswordCheckButton = xSaveDialog.getChild("password")
- xPasswordCheckButton.executeAction("CLICK", tuple())
- xOpen = xSaveDialog.getChild("open")
-
- with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog:
- xReadonly = xPasswordDialog.getChild("readonly")
- xReadonly.executeAction("CLICK", tuple())
- xNewPassword = xPasswordDialog.getChild("newpassroEntry")
- xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
- xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry")
- xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
-
- xOk = xPasswordDialog.getChild("ok")
- # DOCX confirmation dialog is displayed
- with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"):
- pass
-
- win = self.xUITest.getTopFocusWindow()
- print(get_state_as_dict(win))
- print(win.getChildren())
- self.ui_test.wait_until_file_is_available(xFilePath)
-
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
-
- self.assertTrue(document.isReadonly())
-
- #Without the fix in place, this dialog wouldn't have been displayed
- with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
- xPassword = xDialog.getChild("newpassEntry")
- xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
-
- self.assertFalse(document.isReadonly())
-
- def test_save_to_odt(self):
-
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.odt")
-
- with self.ui_test.create_doc_in_start_center("writer"):
- # Save the document
- with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog:
- xFileName = xSaveDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
- xPasswordCheckButton = xSaveDialog.getChild("password")
- xPasswordCheckButton.executeAction("CLICK", tuple())
- xOpen = xSaveDialog.getChild("open")
-
- with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog:
- xReadonly = xPasswordDialog.getChild("readonly")
- xReadonly.executeAction("CLICK", tuple())
- xNewPassword = xPasswordDialog.getChild("newpassroEntry")
- xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
- xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry")
- xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
-
- self.ui_test.wait_until_file_is_available(xFilePath)
-
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
-
- self.assertTrue(document.isReadonly())
-
- with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
- xPassword = xDialog.getChild("newpassEntry")
- xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
-
- self.assertFalse(document.isReadonly())
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: