diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sc/qa/uitest/calc_tests7 | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests7')
-rw-r--r-- | sc/qa/uitest/calc_tests7/save_readonly_with_password.py | 93 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf106667.py | 34 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf117987.py | 29 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf122509.py | 43 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf123122.py | 48 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf124896.py | 24 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf125030.py | 33 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf137397.py | 41 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf150044.py | 65 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf150288.py | 57 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf31805.py | 41 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf91425.py | 36 |
12 files changed, 544 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py new file mode 100644 index 0000000000..c7d2f829e3 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py @@ -0,0 +1,93 @@ +# -*- 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 com.sun.star.beans import PropertyValue +from org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from tempfile import TemporaryDirectory +import os.path + +class save_readonly_with_password(UITestCase): + + def test_save_to_xlsx(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_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()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + 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), [PropertyValue(Name="Silent", Value=True)]) 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()) + + def test_save_to_ods(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.ods") + + 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})) + 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"})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) 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: diff --git a/sc/qa/uitest/calc_tests7/tdf106667.py b/sc/qa/uitest/calc_tests7/tdf106667.py new file mode 100644 index 0000000000..8d3c4599ce --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -0,0 +1,34 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf106667(UITestCase): + + def test_tdf106667_about_dlg_all(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) + + self.xUITest.executeCommand(".uno:FillDown") + + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"): + pass + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf117987.py b/sc/qa/uitest/calc_tests7/tdf117987.py new file mode 100644 index 0000000000..2a15dedcb8 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf117987.py @@ -0,0 +1,29 @@ +# -*- 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 libreoffice.calc.document import get_cell_by_position + +class tdf117987(UITestCase): + + def test_highlight_cell_after_moving_cursor(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).CellBackColor, 16776960) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/calc_tests7/tdf122509.py b/sc/qa/uitest/calc_tests7/tdf122509.py new file mode 100644 index 0000000000..c0d9f5a2a9 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf122509.py @@ -0,0 +1,43 @@ +# -*- 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_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 122509 - EDITING Calc crashes when manipulating Negative numbers in red on Currency ( not gtk3 ) + +class tdf122509(UITestCase): + def test_tdf122509_format_cell_negative_numbers(self): + #numberingformatpage.ui + with self.ui_test.load_file(get_url_for_data_file("tdf122509.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xnegnumred = xDialog.getChild("negnumred") + xformatted = xDialog.getChild("formatted") + + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]") + #click negative + xnegnumred.executeAction("CLICK", tuple()) + #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7 + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]") + # click negative + xnegnumred.executeAction("CLICK", tuple()) + #OK + #verify; no crashes + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123122.py b/sc/qa/uitest/calc_tests7/tdf123122.py new file mode 100644 index 0000000000..8d1d6daebc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123122.py @@ -0,0 +1,48 @@ +# -*- 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_state_as_dict +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 123122 - Invoking the number format dialog the format code field is blank for a user-defined date+time format. + +class tdf123122(UITestCase): + def test_tdf123122_format_cell_datetime(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xformatted = xDialog.getChild("formatted") + + #Format cells and enter NN MMM DD YYYY HH:MM as format code + xformatted.executeAction("CLEAR", tuple()) #clear textbox + xformatted.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"})) + #save - OK + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xformatted = xDialog.getChild("formatted") + + + self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Date") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "NN MMM DD YYYY HH:MM") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124896.py b/sc/qa/uitest/calc_tests7/tdf124896.py new file mode 100644 index 0000000000..44c6ba4b28 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124896.py @@ -0,0 +1,24 @@ +# -*- 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 + +# Bug 124896 - CRASH: deleting sheet + +class tdf124896(UITestCase): + def test_tdf124896_crash_delete_sheet(self): + with self.ui_test.load_file(get_url_for_data_file("tdf124896.ods")) as calc_doc: + # Remove X Bar R Chart (2) sheet + with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): + pass + + #verify; no crashes + self.assertEqual(calc_doc.Sheets.getCount(), 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf125030.py b/sc/qa/uitest/calc_tests7/tdf125030.py new file mode 100644 index 0000000000..cc49edd210 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf125030.py @@ -0,0 +1,33 @@ +# -*- 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 libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +#Bug 125030 - nice crash by repeating apply style (Ctrl+Shft+Y) + +class tdf125030(UITestCase): + def test_tdf125030_repeat_crash(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #enter data + enter_text_to_cell(gridwin, "A1", "aaaa") + enter_text_to_cell(gridwin, "B1", "bbbb") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=CellStyles") + #focus on A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #repeat (Ctrl+Shft+Y) + self.xUITest.executeCommand(".uno:Repeat") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aaaa") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf137397.py b/sc/qa/uitest/calc_tests7/tdf137397.py new file mode 100644 index 0000000000..f1d84bf37a --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf137397.py @@ -0,0 +1,41 @@ +# -*- 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_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit + +class tdf137397(UITestCase): + + def test_tdf137397(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137397.ods")): + + with change_measurement_unit(self, 'Centimeter'): + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"})) + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"})) + + xChild = self.ui_test.wait_until_child_is_available('selectwidth') + self.assertEqual(get_state_as_dict(xChild)['Text'], '6.00 cm') + + # Without the fix in place, this test would have failed with + # AssertionError: '-14,585,309.84 cm' != '2.00 cm' + xChild = self.ui_test.wait_until_child_is_available('selectheight') + self.assertEqual(get_state_as_dict(xChild)['Text'], '2.00 cm') + + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf150044.py b/sc/qa/uitest/calc_tests7/tdf150044.py new file mode 100644 index 0000000000..ffa0077879 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf150044.py @@ -0,0 +1,65 @@ +# -*- 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 tempfile import TemporaryDirectory +import os.path + +class save_shared_readonly_with_password(UITestCase): + + def test_save_to_shared_ods(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "shared_readonly_with_password_tmp.ods") + + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="") as xShareDocumentDialog: + xShareCheckButton = xShareDocumentDialog.getChild("share") + xShareCheckButton.executeAction("CLICK", tuple()) + xOk = xShareDocumentDialog.getChild("ok") + # Save the document + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="") as xOpenDialog: + # Open document + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) + + xDialog = self.ui_test.wait_for_top_focus_window('SharedWarningDialog') + xOk = xDialog.getChild("ok") + xOk.executeAction("CLICK", tuple()) + + document = self.ui_test.get_component() + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + # check that we have a password dialog for editing the shared document + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf150288.py b/sc/qa/uitest/calc_tests7/tdf150288.py new file mode 100644 index 0000000000..c7078089cd --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf150288.py @@ -0,0 +1,57 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_by_text + +class tdf150288(UITestCase): + + def change_date_pattern(self, pattern): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + xDatePatterns = xDialog.getChild("datepatterns") + xLocaleSetting = xDialog.getChild("localesetting") + + select_by_text(xLocaleSetting, "English (USA)") + + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT": pattern})) + + def test_tdf150288(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + try: + self.change_date_pattern("D/M/Y;D/M") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(xGridWin, "A1", "31/8/22") + enter_text_to_cell(xGridWin, "A2", "1/8/22") + + self.assertEqual("08/31/22", get_cell_by_position(document, 0, 0, 0).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '08/01/22' != '01/08/22' + self.assertEqual("08/01/22", get_cell_by_position(document, 0, 0, 1).getString()) + + finally: + # reset date pattern to default + self.change_date_pattern("M/D/Y;M/D") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf31805.py b/sc/qa/uitest/calc_tests7/tdf31805.py new file mode 100644 index 0000000000..81d15200fd --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf31805.py @@ -0,0 +1,41 @@ +# -*- 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 libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 31805 - Deleting a column or row from merged cells + +class tdf31805(UITestCase): + def test_tdf31805_delete_column_merged(self): + with self.ui_test.load_file(get_url_for_data_file("tdf31805.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #1. open "sample.ods" + #2. click 'G1' + #3. Menu 'edit -> Delete Cell - Delete entire Column' + #expected: Column with cell containing "g" will be deleted, + # a merged cell range will remain left row 1 + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) + self.xUITest.executeCommand(".uno:DeleteColumns") + #verify. C5:F11 should be merged + #isMerged returns true if this cell is merged with another cell. + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getIsMerged(), False) #G5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"})) + self.xUITest.executeCommand(".uno:DeleteRows") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:DeleteColumns") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf91425.py b/sc/qa/uitest/calc_tests7/tdf91425.py new file mode 100644 index 0000000000..d8acdd8c16 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf91425.py @@ -0,0 +1,36 @@ +# -*- 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_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +#Bug 91425 - CRASH - Calc Insert Columns Left + +class tdf91425(UITestCase): + def test_tdf91425_insert_columns_left(self): + with self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #1) Open test file provided in report + #2) Move mouse pointer over Column A header, the right mouse button click + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #3) Insert columns left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "C") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "C") + #redo + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "C") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |