diff options
Diffstat (limited to 'sc/qa/uitest/calc_tests9')
-rw-r--r-- | sc/qa/uitest/calc_tests9/tdf121949.py | 30 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests9/tdf126673.py | 66 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests9/tdf130371.py | 72 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests9/tdf91217.py | 45 |
4 files changed, 213 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests9/tdf121949.py b/sc/qa/uitest/calc_tests9/tdf121949.py new file mode 100644 index 000000000..92dd66866 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf121949.py @@ -0,0 +1,30 @@ +# -*- 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 + +class tdf121949 (UITestCase): + + def test_tdf121949_copy_block_with_single_cell_not_included(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # mark a range with a single cell left our and copy to clipboard + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B1", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B3:B3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C3", "EXTEND":"1"})) + self.ui_test.execute_dialog_through_command(".uno:Copy") + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests9/tdf126673.py b/sc/qa/uitest/calc_tests9/tdf126673.py new file mode 100644 index 000000000..8eb99a123 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf126673.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_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 126673 - Calc: Auto-fit column and auto-fit row don't work with line break + +class tdf126673(UITestCase): + def test_tdf126673_auto_fit_row_height(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf126673.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #set cm Tools-options-StarOffice Calc-General + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #optimal row height + self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") + xDialog = self.xUITest.getTopFocusWindow() + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 0.45 cm, + self.assertEqual(heightVal > '0.45', True) #new value is bigger then default + # Click Ok + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf130371.py b/sc/qa/uitest/calc_tests9/tdf130371.py new file mode 100644 index 000000000..6a8f00cbf --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf130371.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +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() + +class namedRanges(UITestCase): + + def test_tdf130371(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130371.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + text1 = "value\t$Sheet2.$B$2\tSheet2" + text2 = "value\t$Sheet3.$B$2\tSheet3" + text3 = "value\t$Sheet4.$B$2\tSheet4" + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(2, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + self.xUITest.executeCommand(".uno:Copy") + + self.xUITest.executeCommand(".uno:JumpToNextTable") + self.xUITest.executeCommand(".uno:JumpToNextTable") + + self.xUITest.executeCommand(".uno:Paste") + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(3, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + self.assertEqual(get_state_as_dict(namesList.getChild('2'))["Text"], text3) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.xUITest.executeCommand(".uno:Undo") + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(2, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + + xCancelBtn = xDialog.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf91217.py b/sc/qa/uitest/calc_tests9/tdf91217.py new file mode 100644 index 000000000..54f56a9fd --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf91217.py @@ -0,0 +1,45 @@ +# -*- 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 + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 91217 - Crash when deleting rows + +class tdf91217(UITestCase): + def test_tdf91217_crash_deleting_rows(self): + # FIXME disable this will it's clear what existing problem did this test uncover. + return + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91217.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select rows 76-1125 in sheet 3 (Daily), right click, Delete Rows. Instant crash. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A76:A1125"})) + self.xUITest.executeCommand(".uno:SelectRow") + #delete rows + self.xUITest.executeCommand(".uno:DeleteRows") + #A1 should be "Dist" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + #- Undo-redo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |