summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests7/tdf128744.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/qa/uitest/writer_tests7/tdf128744.py
parentInitial commit. (diff)
downloadlibreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.tar.xz
libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests7/tdf128744.py')
-rw-r--r--sw/qa/uitest/writer_tests7/tdf128744.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf128744.py b/sw/qa/uitest/writer_tests7/tdf128744.py
new file mode 100644
index 000000000..34201e858
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf128744.py
@@ -0,0 +1,71 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf128744(UITestCase):
+
+ def test_tdf128744(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf128744.docx")):
+
+ # first try to unprotect Record Changes with an invalid password
+
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3") #tab Security
+ xProtectBtn = xDialog.getChild("protect")
+
+ # No close_button: click on the "Ok" inside to check the "Invalid password" infobox
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), close_button="") as xPasswordDialog:
+ self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password")
+ xPassword = xPasswordDialog.getChild("pass1ed")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "bad password"}))
+ print(xPasswordDialog.getChildren())
+ xOkBtn = xPasswordDialog.getChild("ok")
+ with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xInfoBox:
+ # "Invalid password" infobox
+ self.assertEqual(get_state_as_dict(xInfoBox)["DisplayText"], 'Information')
+
+ # now open the dialog again and read the properties, Record Changes checkbox is still enabled
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+ # unprotect Record Changes with the valid password "test"
+
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3") #tab Security
+ xProtectBtn = xDialog.getChild("protect")
+
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as xPasswordDialog:
+ self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password")
+ xPassword = xPasswordDialog.getChild("pass1ed")
+ # give the correct password
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "test"}))
+
+ # now open the dialog again and read the properties, Record Changes checkbox is disabled now
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "false")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: