diff options
Diffstat (limited to 'sc/qa/uitest')
-rw-r--r-- | sc/qa/uitest/calc_tests/autofill.py | 30 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/insertQrCodeGen.py | 40 | ||||
-rwxr-xr-x | sc/qa/uitest/calc_tests8/tdf147086.py | 55 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests9/tdf123877.py | 52 | ||||
-rw-r--r-- | sc/qa/uitest/data/autofill.ods | bin | 9873 -> 24109 bytes | |||
-rw-r--r-- | sc/qa/uitest/data/tdf123877.xlsx | bin | 0 -> 15892 bytes | |||
-rw-r--r-- | sc/qa/uitest/signatureLine/insertSignatureLine.py | 56 |
7 files changed, 149 insertions, 84 deletions
diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py index cdd92ea30947..594d29872a47 100644 --- a/sc/qa/uitest/calc_tests/autofill.py +++ b/sc/qa/uitest/calc_tests/autofill.py @@ -47,6 +47,36 @@ class CalcAutofill(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getValue(), 17.34) self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getValue(), 18.34) + #Test that hidden cells are not affected / skipped in the increment process. + #Simulate selecting cell A26 and dragging the fill handle in the bottom right corner of the cell down to A32 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A26:A32"})) + with self.ui_test.execute_dialog_through_command(".uno:FillSeries"): + pass + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 25).getValue(), 18.34) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 26).getValue(), 19.34) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 27).getValue(), 5.0) #hidden + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 28).getValue(), 5.0) #hidden + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 29).getString(), "hiddenA30") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 30).getValue(), 20.34) #overwrite "rows" + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 31).getValue(), 21.34) + #Simulate selecting cell A26 and dragging the fill handle in the bottom right corner of the cell up to A19 + # Note: start at empty cell A19 so Sheet - Fill Cells - Fill Series has good defaults + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A19:A26"})) + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xup = xDialog.getChild("up") + xincrement = xDialog.getChild("increment") + xup.executeAction("CLICK", tuple()) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 19).getString(), "hiddenA20") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getValue(), 15.34) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 21).getValue(), 5.0) #hidden + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 22).getValue(), 16.34) #overwrite "testing" + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 23).getValue(), 5.0) #hidden + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 24).getValue(), 17.34) #overwrite "hidden" + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 25).getValue(), 18.34) + #Continue with the next cells with grey background gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"})) with self.ui_test.execute_dialog_through_command(".uno:FillSeries"): diff --git a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py index ffc2dd37047f..0fe70f1febc0 100644 --- a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py +++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py @@ -6,7 +6,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import type_text -from com.sun.star.lang import IndexOutOfBoundsException class insertQrCode(UITestCase): @@ -15,16 +14,6 @@ class insertQrCode(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode", close_button="cancel") as xDialog: - - xURL = xDialog.getChild("edit_text") - type_text(xURL, "www.libreoffice.org") - - with self.assertRaises(IndexOutOfBoundsException): - document.Sheets.getByIndex(0).DrawPage.getByIndex(0) - - # Reopen the dialog box with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: # Get elements in the Dialog Box @@ -38,30 +27,9 @@ class insertQrCode(UITestCase): xBorder.executeAction("DOWN", tuple()) # check the QR code in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Border, 1) - - - def test_insert_qr_code_gen2(self): - with self.ui_test.create_doc_in_start_center("calc") as document: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: - - xURL = xDialog.getChild("edit_text") - xECC_Low = xDialog.getChild("button_low") - xBorder = xDialog.getChild("edit_margin") - - type_text(xURL, "www.libreoffice.org") #set the QR code - xECC_Low.executeAction("CLICK", tuple()) - xBorder.executeAction("UP", tuple()) - xBorder.executeAction("DOWN", tuple()) - - #check the QR Code in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Border, 1) + element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1) + self.assertEqual(element.BarCodeProperties.Border, 1) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py b/sc/qa/uitest/calc_tests8/tdf147086.py new file mode 100755 index 000000000000..906f79075b59 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf147086.py @@ -0,0 +1,55 @@ +# -*- 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 tempfile import TemporaryDirectory +import os.path + +#Bug 147086 - Password in .xlsx creates readonly sheet + +class tdf147086(UITestCase): + + def test_tdf147086(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx") + + with self.ui_test.create_doc_in_start_center("calc"): + # 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, "Excel 2007–365 (.xlsx)") + 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()) + + xOk = xPasswordDialog.getChild("ok") + # XLSX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertTrue(document.isReadonly()) + + self.xUITest.executeCommand(".uno:EditDoc") + + self.assertFalse(document.isReadonly()) + +# 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 new file mode 100644 index 000000000000..5162f88d9b78 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf123877.py @@ -0,0 +1,52 @@ +# -*- 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/autofill.ods b/sc/qa/uitest/data/autofill.ods Binary files differindex 4456e33338c8..90bf933c0c26 100644 --- a/sc/qa/uitest/data/autofill.ods +++ b/sc/qa/uitest/data/autofill.ods diff --git a/sc/qa/uitest/data/tdf123877.xlsx b/sc/qa/uitest/data/tdf123877.xlsx Binary files differnew file mode 100644 index 000000000000..64167ca474fb --- /dev/null +++ b/sc/qa/uitest/data/tdf123877.xlsx diff --git a/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py index 26e259a5d2f1..8dde04e1c875 100644 --- a/sc/qa/uitest/signatureLine/insertSignatureLine.py +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -8,7 +8,6 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from libreoffice.uno.propertyvalue import mkPropertyValues -from com.sun.star.lang import IndexOutOfBoundsException #Bug 117903 - Allow signature lines in Calc @@ -19,15 +18,6 @@ class insertSignatureLineCalc(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine", close_button="cancel") as xDialog: - - xName = xDialog.getChild("edit_name") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - - with self.assertRaises(IndexOutOfBoundsException): - document.Sheets.getByIndex(0).DrawPage.getByIndex(0) - # set the signature line with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: @@ -44,43 +34,13 @@ class insertSignatureLineCalc(UITestCase): xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) #check the signature Line in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") - - - def test_insert_signature_line2_calc(self): - with self.ui_test.create_doc_in_start_center("calc") as document: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: - - xName = xDialog.getChild("edit_name") - xTitle = xDialog.getChild("edit_title") - xEmail = xDialog.getChild("edit_email") - xComment = xDialog.getChild("checkbox_can_add_comments") - xDate = xDialog.getChild("checkbox_show_sign_date") - xInstructions = xDialog.getChild("edit_instructions") - - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) - xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) - xDate.executeAction("CLICK", tuple()) - xComment.executeAction("CLICK", tuple()) - xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) - - #check the signature Line in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, True) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") # vim: set shiftwidth=4 softtabstop=4 expandtab: |