summaryrefslogtreecommitdiff
path: root/sc/qa/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-05-19 11:52:47 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-05-19 14:46:55 +0200
commit0bd22c4fa1d5b0eac92678d5adec54cdc85f913e (patch)
treef0a26eaef069ca9278f3b8b16625f5d14d8ed0df /sc/qa/uitest
parentb213abcb77e19fa5d22af45c7ecd17c8a63af554 (diff)
uitest: sc: Rename UItest and extend it
The test was added in 6af4c1d097dfba897e305a1e57d1e920f36ce264 "tdf#123877 sc XLSX: don't freeze during saving recovery" Hoewever, as discussed in https://gerrit.libreoffice.org/c/core/+/134409 the UItest doesn't cover the fix itself but a regression introduced in the first version of the fix, thus, remove the reference to tdf#123877 in the test. I've also extended the test to check the document can be saved when the password is introduced to the retry password dialog Finally, I replaced the sample file by the minimal example added by Gabor to https://bugs.documentfoundation.org/show_bug.cgi?id=123877 Change-Id: I2242ebd36072ce147de7eb9fc3d735298ac476b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134607 Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest')
-rw-r--r--sc/qa/uitest/calc_tests9/hashIncompatible.py71
-rw-r--r--sc/qa/uitest/calc_tests9/tdf123877.py52
-rw-r--r--sc/qa/uitest/data/hashIncompatible.xlsxbin0 -> 9651 bytes
-rw-r--r--sc/qa/uitest/data/tdf123877.xlsxbin15892 -> 0 bytes
4 files changed, 71 insertions, 52 deletions
diff --git a/sc/qa/uitest/calc_tests9/hashIncompatible.py b/sc/qa/uitest/calc_tests9/hashIncompatible.py
new file mode 100644
index 000000000000..9e6828ba9e4e
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/hashIncompatible.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 uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from tempfile import TemporaryDirectory
+import os.path
+
+class hashIncompatible(UITestCase):
+
+ def test_hashIncompatible(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "hashIncompatible-temp.ods")
+
+ with self.ui_test.load_file(get_url_for_data_file("hashIncompatible.xlsx")) as document:
+
+ # Save the XLSX document as ODS with a sheet protected with an unsupported hash format
+ with self.ui_test.execute_dialog_through_command(".uno:SaveAs", 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, "ODF Spreadsheet (.ods)")
+
+ xOpen = xSaveDialog.getChild("open")
+
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xRetypePasswordDialog:
+ # hash error dialog is still displayed (only disabled for the recovery file)
+ xCancel = xRetypePasswordDialog.getChild("cancel")
+
+ with self.ui_test.execute_dialog_through_action(xCancel, "CLICK"):
+ # Write error dialog is displayed
+ pass
+
+ # Check the document is not created
+ self.assertFalse(os.path.isfile(xFilePath))
+
+ # Now check it can be saved to ODS using the correct password
+ with self.ui_test.execute_dialog_through_command(".uno:SaveAs", 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, "ODF Spreadsheet (.ods)")
+
+ xOpen = xSaveDialog.getChild("open")
+
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xRetypePasswordDialog:
+ xRetypeBtn = xRetypePasswordDialog.getChild("button")
+
+ with self.ui_test.execute_blocking_action(
+ xRetypeBtn.executeAction, args=('CLICK', ())) as xPasswordDialog:
+ xNewPassEntry = xPasswordDialog.getChild("newpassEntry")
+ xConfirmPassEntry = xPasswordDialog.getChild("confirmpassEntry")
+ xNewPassEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+ xConfirmPassEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
+
+ self.assertTrue(os.path.isfile(xFilePath))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf123877.py b/sc/qa/uitest/calc_tests9/tdf123877.py
deleted file mode 100644
index 5162f88d9b78..000000000000
--- a/sc/qa/uitest/calc_tests9/tdf123877.py
+++ /dev/null
@@ -1,52 +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 uitest.uihelper.calc import enter_text_to_cell
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-from uitest.uihelper.common import select_by_text
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from org.libreoffice.unotest import systemPathToFileUrl
-from tempfile import TemporaryDirectory
-import os.path
-
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_cell_by_position
-
-
-class tdf123877(UITestCase):
-
- def test_tdf123877(self):
-
- xFilePath = get_url_for_data_file("tdf123877.xlsx")
-
- with self.ui_test.load_file(xFilePath) as document:
-
- # Save the XLSX document as ODS with a sheet protected with an unsupported hash format
- with self.ui_test.execute_dialog_through_command(".uno:SaveAs", 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, "ODF Spreadsheet (.ods)")
-
- xOpen = xSaveDialog.getChild("open")
-
- with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xRetypePasswordDialog:
- # hash error dialog is still displayed (only disabled for the recovery file)
- xCancel = xRetypePasswordDialog.getChild("cancel")
-
- with self.ui_test.execute_dialog_through_action(xCancel, "CLICK", close_button="ok"):
- # Write error dialog is displayed
- pass
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/hashIncompatible.xlsx b/sc/qa/uitest/data/hashIncompatible.xlsx
new file mode 100644
index 000000000000..6ffeab242e0a
--- /dev/null
+++ b/sc/qa/uitest/data/hashIncompatible.xlsx
Binary files differ
diff --git a/sc/qa/uitest/data/tdf123877.xlsx b/sc/qa/uitest/data/tdf123877.xlsx
deleted file mode 100644
index 64167ca474fb..000000000000
--- a/sc/qa/uitest/data/tdf123877.xlsx
+++ /dev/null
Binary files differ