diff options
Diffstat (limited to '')
-rw-r--r-- | uitest/calc_tests/__init__.py | 0 | ||||
-rw-r--r-- | uitest/calc_tests/about_test.py | 25 | ||||
-rw-r--r-- | uitest/calc_tests/autofilter.py | 49 | ||||
-rw-r--r-- | uitest/calc_tests/create_chart.py | 148 | ||||
-rw-r--r-- | uitest/calc_tests/create_range_name.py | 50 | ||||
-rw-r--r-- | uitest/calc_tests/data/autofilter.ods | bin | 0 -> 7791 bytes | |||
-rw-r--r-- | uitest/calc_tests/data/tdf96453.ods | bin | 0 -> 8157 bytes | |||
-rw-r--r-- | uitest/calc_tests/edit_chart.py | 69 | ||||
-rw-r--r-- | uitest/calc_tests/function_wizard.py | 29 | ||||
-rw-r--r-- | uitest/calc_tests/gridwin.py | 48 | ||||
-rw-r--r-- | uitest/calc_tests/gridwindow.py | 43 | ||||
-rw-r--r-- | uitest/calc_tests/input_window.py | 33 | ||||
-rw-r--r-- | uitest/calc_tests/tdf117987.py | 25 |
13 files changed, 519 insertions, 0 deletions
diff --git a/uitest/calc_tests/__init__.py b/uitest/calc_tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/uitest/calc_tests/__init__.py diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py new file mode 100644 index 000000000..c6dc75b93 --- /dev/null +++ b/uitest/calc_tests/about_test.py @@ -0,0 +1,25 @@ +# -*- 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 + +class AboutDlgTest(UITestCase): + + def test_about_dlg(self): + + self.ui_test.create_doc_in_start_center("calc") + + 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.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/autofilter.py b/uitest/calc_tests/autofilter.py new file mode 100644 index 000000000..431043b02 --- /dev/null +++ b/uitest/calc_tests/autofilter.py @@ -0,0 +1,49 @@ +# -*- 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.path import get_srcdir_url + +from libreoffice.uno.propertyvalue import mkPropertyValues + +import time + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/uitest/calc_tests/data/" + file_name + +class AutofilterTest(UITestCase): + + def test_launch_autofilter(self): + doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "1"})) + + time.sleep(1) + + self.ui_test.close_doc() + + def test_hierarchy(self): + doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + + xTreeList = xCheckListMenu.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/create_chart.py b/uitest/calc_tests/create_chart.py new file mode 100644 index 000000000..cced0ac63 --- /dev/null +++ b/uitest/calc_tests/create_chart.py @@ -0,0 +1,148 @@ +# -*- 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 uitest.uihelper.calc import enter_text_to_cell + +import time +import unittest + +class CalcChartUIDemo(UITestCase): + + def create_insert_chart_dialog(self): + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + # time.sleep(1) # ideally wait for a creation event + return self.xUITest.getTopFocusWindow() + + def fill_spreadsheet(self): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(xGridWindow, "A1", "col1") + enter_text_to_cell(xGridWindow, "B1", "col2") + enter_text_to_cell(xGridWindow, "C1", "col3") + enter_text_to_cell(xGridWindow, "A2", "1") + enter_text_to_cell(xGridWindow, "B2", "3") + enter_text_to_cell(xGridWindow, "C2", "5") + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C2"})) + + def test_cancel_immediately(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xChartDlg = self.create_insert_chart_dialog(); + + xCancelBtn = xChartDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_create_from_first_page(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xChartDlg = self.create_insert_chart_dialog(); + + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() + + def test_create_from_second_page(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xChartDlg = self.create_insert_chart_dialog(); + + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + + xDataInRows = xChartDlg.getChild("RB_DATAROWS") + xDataInRows.executeAction("CLICK", tuple()) + + xDataInCols = xChartDlg.getChild("RB_DATACOLS") + xDataInCols.executeAction("CLICK", tuple()) + + xCancelBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_deselect_chart(self): + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + xChartDlg = self.create_insert_chart_dialog(); + + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + time.sleep(2) + + self.ui_test.close_doc() + + def test_activate_chart(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + xChartDlg = self.create_insert_chart_dialog(); + + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + self.ui_test.close_doc() + + def select_chart_element(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + xChartDlg = self.create_insert_chart_dialog(); + + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) + + xCalcDoc = self.xUITest.getTopFocusWindow() + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py new file mode 100644 index 000000000..1babca7c0 --- /dev/null +++ b/uitest/calc_tests/create_range_name.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text, select_pos + +class CreateRangeNameTest(UITestCase): + + def test_create_range_name(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + + xAddNameDlg = self.xUITest.getTopFocusWindow() + + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "simpleRangeName") + + xAddBtn = xAddNameDlg.getChild("add") + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() + + def test_create_local_range_name(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + + xAddNameDlg = self.xUITest.getTopFocusWindow() + + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "simpleRangeName") + + xScope = xAddNameDlg.getChild("scope") + select_pos(xScope, "1") + + xAddBtn = xAddNameDlg.getChild("add") + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/data/autofilter.ods b/uitest/calc_tests/data/autofilter.ods Binary files differnew file mode 100644 index 000000000..a03dba608 --- /dev/null +++ b/uitest/calc_tests/data/autofilter.ods diff --git a/uitest/calc_tests/data/tdf96453.ods b/uitest/calc_tests/data/tdf96453.ods Binary files differnew file mode 100644 index 000000000..89114f636 --- /dev/null +++ b/uitest/calc_tests/data/tdf96453.ods diff --git a/uitest/calc_tests/edit_chart.py b/uitest/calc_tests/edit_chart.py new file mode 100644 index 000000000..d74a8c2ec --- /dev/null +++ b/uitest/calc_tests/edit_chart.py @@ -0,0 +1,69 @@ +# -*- 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 uitest.uihelper.calc import enter_text_to_cell + +import unittest + +class CalcChartEditUIDemo(UITestCase): + + def fill_spreadsheet(self): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(xGridWindow, "A1", "col1") + enter_text_to_cell(xGridWindow, "B1", "col2") + enter_text_to_cell(xGridWindow, "C1", "col3") + enter_text_to_cell(xGridWindow, "A2", "1") + enter_text_to_cell(xGridWindow, "B2", "3") + enter_text_to_cell(xGridWindow, "C2", "5") + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C2"})) + + def test_select_secondary_axis(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + + xChartDlg = self.xUITest.getTopFocusWindow() + + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + + xGridWindow.executeAction("ACTIVATE", tuple()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) + + xSeriesFormatDlg = self.xUITest.getTopFocusWindow() + xAxis2 = xSeriesFormatDlg.getChild("RBT_OPT_AXIS_2") + xAxis2.executeAction("CLICK", tuple()) + + xCancelBtn = xSeriesFormatDlg.getChild("ok") + xCancelBtn.executeAction("CLICK", tuple()) + + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/function_wizard.py b/uitest/calc_tests/function_wizard.py new file mode 100644 index 000000000..13b833509 --- /dev/null +++ b/uitest/calc_tests/function_wizard.py @@ -0,0 +1,29 @@ +# -*- 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 + +class FunctionWizardTest(UITestCase): + # tdf#98427 + def test_open_function_wizard(self): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + + xFunctionDlg = self.xUITest.getTopFocusWindow() + + xArrayChkBox = xFunctionDlg.getChild("array") + xArrayChkBox.executeAction("CLICK", tuple()) + + xCancelBtn = xFunctionDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/gridwin.py b/uitest/calc_tests/gridwin.py new file mode 100644 index 000000000..7c9c87de0 --- /dev/null +++ b/uitest/calc_tests/gridwin.py @@ -0,0 +1,48 @@ +# -*- 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.uihelper.common import get_state_as_dict + +from uitest.framework import UITestCase + +class GridWinTest(UITestCase): + + def test_select_object(self): + + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + selectProps = mkPropertyValues({"CELL": "B10"}) + xGridWindow.executeAction("SELECT", selectProps) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + + xGridWindow.executeAction("ACTIVATE", tuple()) + + xGridWindow.executeAction("DESELECT", tuple()) + + self.ui_test.close_doc() + + def test_select_sheet(self): + + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + for i in range(3): + self.ui_test.execute_dialog_through_command(".uno:Insert") + current_dialog = self.xUITest.getTopFocusWindow() + + xOkButton = current_dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkButton) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + self.assertEqual(get_state_as_dict(xGridWindow)["SelectedTable"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/gridwindow.py b/uitest/calc_tests/gridwindow.py new file mode 100644 index 000000000..37afacd00 --- /dev/null +++ b/uitest/calc_tests/gridwindow.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.uihelper.calc import enter_text_to_cell + +from uitest.framework import UITestCase + +class GridWindowTest(UITestCase): + + def test_input(self): + + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + xGridWindow = xTopWindow.getChild("grid_window") + + enter_text_to_cell(xGridWindow, "C3", "=A1") + enter_text_to_cell(xGridWindow, "A1", "2") + + self.ui_test.close_doc() + + def test_special_keys(self): + + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + xGridWindow = xTopWindow.getChild("grid_window") + + selectProps = mkPropertyValues({"CELL": "C3"}) + xGridWindow.executeAction("SELECT", selectProps) + + typeProps = mkPropertyValues({"KEYCODE": "CTRL+DOWN"}) + xGridWindow.executeAction("TYPE", typeProps) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/input_window.py b/uitest/calc_tests/input_window.py new file mode 100644 index 000000000..eea8b53d9 --- /dev/null +++ b/uitest/calc_tests/input_window.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, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +from libreoffice.calc.document import get_cell_by_position + +import time + +class InputWindowTest(UITestCase): + + def test_input_window(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + xInputWin = xCalcDoc.getChild("sc_input_window") + + type_text(xInputWin, "test") + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "test") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/calc_tests/tdf117987.py b/uitest/calc_tests/tdf117987.py new file mode 100644 index 000000000..3de0b176e --- /dev/null +++ b/uitest/calc_tests/tdf117987.py @@ -0,0 +1,25 @@ +# +# 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): + self.ui_test.create_doc_in_start_center("calc") + 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) + + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 0, 1).CellBackColor, 16776960) + self.ui_test.close_doc() |