diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-01 12:46:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-01 16:00:33 +0200 |
commit | 94dcb3b1a5b38b7b35cb75b068836d78134a6b7b (patch) | |
tree | adcec8c6e4c74ccb2b37ef51fe9bd67246a4e6bf /sc/qa/uitest/calc_tests3 | |
parent | 403a8674e3ba46caaaa5734f62d57b3bf8dbd603 (diff) |
UITest_calc_tests: split this into 4 parts
Before: make -sr UITest_calc_tests -> 10m48.934s
After: make -sr -j4 UITest_calc_tests UITest_calc_tests2 UITest_calc_tests3 UITest_calc_tests4 -> 5m40.113s
As a start just split based on the number of .py files in the
directories, one could improve this further by making them even more
equal based on number of lines or something.
Change-Id: I7a98a29e5d18a7600575956a7d8a0ec81e804269
Reviewed-on: https://gerrit.libreoffice.org/55174
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sc/qa/uitest/calc_tests3')
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf57274.py | 50 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf62267.py | 60 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf63805.py | 67 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf64001.py | 40 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf65856.py | 105 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf68290.py | 38 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf69450.py | 63 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf69981.py | 93 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf71339.py | 35 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf73006.py | 43 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf79983.py | 71 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf80693.py | 58 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf81351.py | 82 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf82398.py | 63 |
14 files changed, 868 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests3/tdf57274.py b/sc/qa/uitest/calc_tests3/tdf57274.py new file mode 100644 index 000000000000..9074daf1e2ee --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf57274.py @@ -0,0 +1,50 @@ +# -*- 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.path import get_srcdir_url +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: Paste Special Link Checkbox fails to insert cell references when the source cell is blank +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + +class tdf57274(UITestCase): + + def test_tdf57274_tdf116385_row_only(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57274.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #* Source Cells, range B6..E6 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + #We paste here using Paste Special with 'Link' Checkbox activated + xLink = xDialog.getChild("link") + xLink.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + # self.ui_test.close_dialog_through_button(xOkBtn) + def handle_confirm_dlg(dialog): + xOKBtn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_confirm_dlg) + #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank. + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6") + 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_tests3/tdf62267.py b/sc/qa/uitest/calc_tests3/tdf62267.py new file mode 100644 index 000000000000..5671028ec5fb --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf62267.py @@ -0,0 +1,60 @@ +# -*- 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 org.libreoffice.unotest +import os +import pathlib +from uitest.uihelper.common import get_state_as_dict +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.uno.propertyvalue import mkPropertyValues + +#Bug 62267 - Conditional formatting lost after paste special of text, numbers and dates. +#If you have a cell with conditional formatting and you use paste special only inserting only text, +#numbers and dates the formatting is lost. Undo do not recover the conditional formatting. + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf62267(UITestCase): + + def test_tdf62267(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62267.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #* Copy A1, then paste special to C1; + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + #it's the default - text, numbers and dates + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #--> Cell formatting should stay as before + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly 1 conditional format + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + xTreeEntry = xList.getChild('0') + self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value is = 1") + + xCancelBtn = xCondFormatMgr.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + 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_tests3/tdf63805.py b/sc/qa/uitest/calc_tests3/tdf63805.py new file mode 100644 index 000000000000..bdc7f8775542 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf63805.py @@ -0,0 +1,67 @@ +# -*- 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 +#Bug 63805 - EDITING: 'Autofill - Date - Months' wrong if day of month exceeds max. days of month + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf63805(UITestCase): + + def test_tdf63805_autofill_Date_Months(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf63805.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #1 - A1: 2012-10-31 + enter_text_to_cell(gridwin, "A1", "2012-10-31") + #2 - Select A1:A20 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) + #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok> + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #5 -Expected: All Cells show last day of month / Actual: some months skipped + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41243) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41274) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41305) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41333) + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 41364) + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 41394) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 41425) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 41455) + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 41486) + self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 41517) + self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 41547) + self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 41578) + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 41608) + self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 41639) + self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 41670) + self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 41698) + self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 41729) + self.assertEqual(get_cell_by_position(document, 0, 0, 18).getValue(), 41759) + self.assertEqual(get_cell_by_position(document, 0, 0, 19).getValue(), 41790) + #4 - undo. + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0) + 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_tests3/tdf64001.py b/sc/qa/uitest/calc_tests3/tdf64001.py new file mode 100644 index 000000000000..4c19f32c9adc --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf64001.py @@ -0,0 +1,40 @@ +# -*- 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.calc import enter_text_to_cell +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf64001(UITestCase): + + def test_tdf64001(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() + #1) Type TRUE in cell A1 + enter_text_to_cell(gridwin, "A1", "TRUE") + #2) Autofill/drag A1 to A10, all cells show TRUE + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #3) Type FALSE in A11 + enter_text_to_cell(gridwin, "A11", "FALSE") + #4) Enter in B1: =COUNTIF(A1:A11,TRUE) , hit enter + enter_text_to_cell(gridwin, "B1", "=COUNTIF(A1:A11,TRUE)") + #The formula changes to =COUNTIF(A1:A11,1) and displays result of 1 not 10. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 10) + 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_tests3/tdf65856.py b/sc/qa/uitest/calc_tests3/tdf65856.py new file mode 100644 index 000000000000..c3e03ec7a95c --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf65856.py @@ -0,0 +1,105 @@ +# -*- 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 org.libreoffice.unotest +import os +import pathlib +from uitest.uihelper.common import get_state_as_dict +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.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf65856(UITestCase): + + def test_tdf65856_paste_special_shift_right(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #- mark D1:E14; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14") + self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14") + self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14") + self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14") + self.ui_test.close_doc() + + def test_tdf65856_paste_special_shift_right_2(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #- select range C2:D4; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell B2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests3/tdf68290.py b/sc/qa/uitest/calc_tests3/tdf68290.py new file mode 100644 index 000000000000..b186efa8897b --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf68290.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.path import get_srcdir_url +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 +#Enhancement: EDITING: cursor moves with Enter key +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + +class tdf68290(UITestCase): + + def test_tdf68290_cursor_moves_with_Enter_key(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf68290.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + self.assertEqual(gridWinState["CurrentColumn"], "12") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf69450.py b/sc/qa/uitest/calc_tests3/tdf69450.py new file mode 100644 index 000000000000..ad375fecf079 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf69450.py @@ -0,0 +1,63 @@ +# -*- 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_sheet_from_doc +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position + +class tdf69450(UITestCase): + + def test_tdf69450(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() + + #add text to A1 and B1 + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xtext = xDialog.getChild("text") + xnumbers = xDialog.getChild("numbers") + xdatetime = xDialog.getChild("datetime") + xformats = xDialog.getChild("formats") + + xtext.executeAction("CLICK", tuple()) + xnumbers.executeAction("CLICK", tuple()) + xdatetime.executeAction("CLICK", tuple()) + xformats.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() #previous settings should be remembered (only format) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests3/tdf69981.py b/sc/qa/uitest/calc_tests3/tdf69981.py new file mode 100644 index 000000000000..34a4852b8aa3 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf69981.py @@ -0,0 +1,93 @@ +# -*- 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() + +class tdf69981(UITestCase): + + def test_tdf69981_text_to_columns(self): + + # FIXME flaky test, passed once, but broke multiple times. + return + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf69981.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged. + 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"]) == "false": + xreplwarncb.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Select A2:A7 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"})) + #Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xtab = xDialog.getChild("tab") + xcomma = xDialog.getChild("comma") + xtab.executeAction("CLICK", tuple()) + xcomma.executeAction("CLICK", tuple()) + #Click Ok + #overwrite warning come up + #press Ok. + xOK = xDialog.getChild("ok") + def handle_warn_dlg(dialog): + xyesBtn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xyesBtn) + + self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), + dialog_handler=handle_warn_dlg) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Original") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "a") + + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Copy") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "") + + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "c") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf71339.py b/sc/qa/uitest/calc_tests3/tdf71339.py new file mode 100644 index 000000000000..0935d3168278 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf71339.py @@ -0,0 +1,35 @@ +# -*- 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.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: EDITING sigma icon (sum function) operating on selected range + +class tdf71339(UITestCase): + + def test_tdf71339_autosum_on_selected_range(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, "A2", "1") + enter_text_to_cell(gridwin, "A3", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getFormula(), "=SUM(A1:A3)") + + 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_tests3/tdf73006.py b/sc/qa/uitest/calc_tests3/tdf73006.py new file mode 100644 index 000000000000..8124bb4209d0 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf73006.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 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 +#Bug 73006 - EDITING: Results filled in wrong cells after Text to Columns + +class tdf73006(UITestCase): + def test_tdf73006_text_to_columns(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() + + #Add data + enter_text_to_cell(gridwin, "A2", "A B") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xspace = xDialog.getChild("space") + if (get_state_as_dict(xspace)["Selected"]) == "false": + xspace.executeAction("CLICK", tuple()) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + 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_tests3/tdf79983.py b/sc/qa/uitest/calc_tests3/tdf79983.py new file mode 100644 index 000000000000..f4afc77eaf26 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf79983.py @@ -0,0 +1,71 @@ +# -*- 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.debug import sleep +#Bug 79983 - Calc sort lists aren't case sensitive + +class tdf79983(UITestCase): + def test_tdf79983_sort_list_case_sensitive(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", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + enter_text_to_cell(gridwin, "A3", "CCC") + enter_text_to_cell(gridwin, "A4", "DDD") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + #Tools / Options / LibreOffice Calc / Sort Lists + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcSortEntry = xCalcEntry.getChild('5') + xCalcSortEntry.executeAction("SELECT", tuple()) #Sort List + #copy new list from selected cells + xcopy = xDialogOpt.getChild("copy") + xcopy.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + + enter_text_to_cell(gridwin, "A1", "AAA") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #fill down + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "CCC") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "DDD") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + + 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_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py new file mode 100644 index 000000000000..f416fce81514 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf80693.py @@ -0,0 +1,58 @@ +# -*- 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 80693 - EDITING: fill cell with random numbers with min = max +class tdf80693(UITestCase): + def test_tdf80693_random_numbers_min_max(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() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + props = {"TEXT": "Uniform"} + actionProps = mkPropertyValues(props) + xdistributioncombo.executeAction("SELECT", actionProps) + + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 2) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + 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_tests3/tdf81351.py b/sc/qa/uitest/calc_tests3/tdf81351.py new file mode 100644 index 000000000000..520f1c3c64c8 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf81351.py @@ -0,0 +1,82 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from libreoffice.calc.document import get_cell_by_position +import org.libreoffice.unotest +import pathlib +import time + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf81351(UITestCase): + + def test_tdf81351(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + self.xUITest.executeCommand(".uno:SortAscending") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + def test_tdf81351_comment4(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + + self.xUITest.executeCommand(".uno:SortAscending") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + def test_sort_descending(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + self.xUITest.executeCommand(".uno:SortDescending") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf82398.py b/sc/qa/uitest/calc_tests3/tdf82398.py new file mode 100644 index 000000000000..66e8d57840ea --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf82398.py @@ -0,0 +1,63 @@ +# -*- 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 +#Bug 82398 - EDITING: "Text to Columns" not applied to selected cells after change 'Format Cells' + +class tdf82398(UITestCase): + def test_tdf82398_text_to_columns(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() + + #Add data + enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") + enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") + enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") + enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") + #select column A1:A4 / .uno:NumberFormatDate + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + self.xUITest.executeCommand(".uno:NumberFormatDate") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xother = xDialog.getChild("other") + xinputother = xDialog.getChild("inputother") + + if (get_state_as_dict(xother)["Selected"]) == "false": + xother.executeAction("CLICK", tuple()) + xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file |