diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sc/qa/uitest/calc_tests7 | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
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/tdf106667.py | 37 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf120660.py | 66 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf122509.py | 61 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf123052.py | 72 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf123122.py | 72 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf123479.py | 51 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf124818.py | 39 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf124822.py | 37 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf124896.py | 39 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf125030.py | 36 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf132173.py | 33 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf31805.py | 47 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf45020.py | 38 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests7/tdf91425.py | 43 |
14 files changed, 671 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests7/tdf106667.py b/sc/qa/uitest/calc_tests7/tdf106667.py new file mode 100644 index 000000000..5475c7680 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -0,0 +1,37 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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.debug import sleep + +class tdf106667(UITestCase): + + def test_tdf106667_about_dlg_all(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) + + self.xUITest.executeCommand(".uno:FillDown") + + self.xUITest.executeCommand(".uno:SelectAll") + + self.ui_test.execute_dialog_through_command(".uno:About") + xAboutDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf120660.py b/sc/qa/uitest/calc_tests7/tdf120660.py new file mode 100644 index 000000000..d36ad13bc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf120660.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 120660 - cells not recalculated after copy/paste different range of cells + +class tdf120660(UITestCase): + def test_tdf120660_undo_recalculate(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120660.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Make sure that tools-options-LibreOffice Calc-General-Input settings-Show overwrite warning when pasting data is unselected + #turn off message: You are pasting data into cells that already contain data + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xWriterEntry = xPages.getChild('3') # Calc + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb + xreplwarncb = xDialogOpt.getChild("replwarncb") + if (get_state_as_dict(xreplwarncb)["Selected"]) == "true": + xreplwarncb.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:E8"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:E4"})) + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1200) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2200) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:D8"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:D4"})) + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1200) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2200) + + self.ui_test.close_doc() +# 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 000000000..87b28cb69 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf122509.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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 + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122509.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + 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 + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123052.py b/sc/qa/uitest/calc_tests7/tdf123052.py new file mode 100644 index 000000000..f3e7f8796 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123052.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +#Bug 123052 - [regression] Shift+Tab not working +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf123052(UITestCase): + def test_tdf123052_shit_tab(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123052.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Holding the Shift key and repeated pressing the Tab key does not correctly cycle though the unprotected cells + #I'm at 7, hold TAB for cycling + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + self.assertEqual(gridWinState["CurrentColumn"], "5") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + self.assertEqual(gridWinState["CurrentColumn"], "3") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + self.assertEqual(gridWinState["CurrentColumn"], "4") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "5") + self.assertEqual(gridWinState["CurrentColumn"], "5") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "7") + self.assertEqual(gridWinState["CurrentColumn"], "0") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "8") + self.assertEqual(gridWinState["CurrentColumn"], "4") + #now shift + tab + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "7") + self.assertEqual(gridWinState["CurrentColumn"], "0") + + self.ui_test.close_doc() + +# 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 000000000..f489f3c2f --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123122.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +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 + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + 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 + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + 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") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123479.py b/sc/qa/uitest/calc_tests7/tdf123479.py new file mode 100644 index 000000000..046bf8303 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123479.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 123479 - Crash in: ScFormulaResult::GetMatrixFormulaCellToken() + +class tdf123479(UITestCase): + def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self): + #numberingformatpage.ui + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123479.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select D14:D16 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"})) + #Open Formula Wizard (Ctrl+F2) + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + xDialog = self.xUITest.getTopFocusWindow() + edArg1 = xDialog.getChild("ED_ARG1") + edArg2 = xDialog.getChild("ED_ARG2") + formulaRes = xDialog.getChild("formula_result") + + #check formula wizard data + self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)") + self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)") + self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}") + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Pass/Fail") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124818.py b/sc/qa/uitest/calc_tests7/tdf124818.py new file mode 100644 index 000000000..134548426 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124818.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 124818 - CRASH: selecting all and switching spreadsheet + +class tdf124818(UITestCase): + def test_tdf124818_crash_select_all_and_switch_spreadsheet(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124818.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Select all ( Ctrl + A );Go to sheet Graph2;Select all;Crash + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:JumpToPrevTable") + self.xUITest.executeCommand(".uno:SelectAll") + + #verify; no crashes + self.assertEqual(document.Sheets.getCount(), 3) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124822.py b/sc/qa/uitest/calc_tests7/tdf124822.py new file mode 100644 index 000000000..8c438df79 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124822.py @@ -0,0 +1,37 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +# Bug 124822 - CRASH: cutting and undoing + +class tdf124822(UITestCase): + def test_tdf124822_crash_cut_undo(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124822.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Select all ( Ctrl + A ) ; Cut ( Ctrl + X );Undo + self.xUITest.executeCommand(".uno:selectAll") + self.xUITest.executeCommand(".uno:Cut") + self.xUITest.executeCommand(".uno:Undo") + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 2, 0, 0).getString(), "X") + self.ui_test.close_doc() +# 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 000000000..b2f016847 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124896.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +# Bug 124896 - CRASH: deleting sheet + +class tdf124896(UITestCase): + def test_tdf124896_crash_delete_sheet(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124896.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # Remove X Bar R Chart (2) sheet + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + #verify; no crashes + self.assertEqual(document.Sheets.getCount(), 2) + + self.ui_test.close_doc() +# 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 000000000..5aaa81abc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf125030.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 +import os +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +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): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #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") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf132173.py b/sc/qa/uitest/calc_tests7/tdf132173.py new file mode 100644 index 000000000..d74f7dc74 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf132173.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf132173(UITestCase): + def test_tdf132173(self): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xFormula = xDialog.getChild("ed_formula") + xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) + + self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + document = self.ui_test.get_component() + + #Without the fix in place, cell's value would have been #NAME? + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "2") + + self.ui_test.close_doc() + +# 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 000000000..76d30cf22 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf31805.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +#Bug 31805 - Deleting a column or row from merged cells +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf31805(UITestCase): + def test_tdf31805_delete_column_merged(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #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(document, 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(document, 0, 2, 4).getIsMerged(), True) #C5 + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False) #G5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"})) + self.xUITest.executeCommand(".uno:DeleteRows") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:DeleteColumns") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5 + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf45020.py b/sc/qa/uitest/calc_tests7/tdf45020.py new file mode 100644 index 000000000..270446941 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf45020.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf45020(UITestCase): + def test_tdf45020_hide_rows_select(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #in cell A1-A4: apple pear melon mango + enter_text_to_cell(gridwin, "A1", "apple") + enter_text_to_cell(gridwin, "A1", "pear") + enter_text_to_cell(gridwin, "A1", "melon") + enter_text_to_cell(gridwin, "A1", "mango") + #select A2 and A3 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + #format > Row > Hide + self.ui_test._xUITest.executeCommand(".uno:HideRow") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #press Shift+down + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+DOWN"})) + #verify A1:A4 selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + + self.ui_test.close_doc() +# 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 000000000..cacd96726 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf91425.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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, type_text +from libreoffice.calc.document import get_cell_by_position +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + + +#Bug 91425 - CRASH - Calc Insert Columns Left + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf91425(UITestCase): + def test_tdf91425_insert_columns_left(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #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(document, 0, 3, 0).getString(), "C") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "C") + #redo + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: |