diff options
Diffstat (limited to 'uitest/demo_ui')
-rw-r--r-- | uitest/demo_ui/char_dialog.py | 28 | ||||
-rw-r--r-- | uitest/demo_ui/checkbox.py | 28 | ||||
-rw-r--r-- | uitest/demo_ui/combobox.py | 30 | ||||
-rw-r--r-- | uitest/demo_ui/command_with_parameters.py | 24 | ||||
-rw-r--r-- | uitest/demo_ui/data/test.ods | bin | 0 -> 7598 bytes | |||
-rw-r--r-- | uitest/demo_ui/data/test2.ods | bin | 0 -> 7339 bytes | |||
-rw-r--r-- | uitest/demo_ui/edit.py | 55 | ||||
-rw-r--r-- | uitest/demo_ui/gridwin.py | 51 | ||||
-rw-r--r-- | uitest/demo_ui/handle_multiple_files.py | 62 | ||||
-rw-r--r-- | uitest/demo_ui/hierarchy.py | 35 | ||||
-rw-r--r-- | uitest/demo_ui/listbox.py | 48 | ||||
-rw-r--r-- | uitest/demo_ui/radiobutton.py | 40 | ||||
-rw-r--r-- | uitest/demo_ui/spinfield.py | 81 | ||||
-rw-r--r-- | uitest/demo_ui/tabcontrol.py | 38 | ||||
-rw-r--r-- | uitest/demo_ui/tabdialog.py | 45 | ||||
-rw-r--r-- | uitest/demo_ui/treelist.py | 46 |
16 files changed, 611 insertions, 0 deletions
diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py new file mode 100644 index 000000000..5dd0212ee --- /dev/null +++ b/uitest/demo_ui/char_dialog.py @@ -0,0 +1,28 @@ +# -*- 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 CharDialogText(UITestCase): + + def test_select_char(self): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") + xCharDialog = self.xUITest.getTopFocusWindow() + + xCharSet = xCharDialog.getChild("showcharset") + + xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"})) + + xCancelBtn = xCharDialog.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/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py new file mode 100644 index 000000000..114473d53 --- /dev/null +++ b/uitest/demo_ui/checkbox.py @@ -0,0 +1,28 @@ +# -*- 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 CheckBoxTest(UITestCase): + + def test_toggle_checkbox(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) + + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py new file mode 100644 index 000000000..8b47f8338 --- /dev/null +++ b/uitest/demo_ui/combobox.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos + +class ComboBoxTest(UITestCase): + + def test_select_entry_pos(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() + + scopeCB = xAddNameDlg.getChild("scope") + select_pos(scopeCB, "1") + + xCancelBtn = xAddNameDlg.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/demo_ui/command_with_parameters.py b/uitest/demo_ui/command_with_parameters.py new file mode 100644 index 000000000..c82d33595 --- /dev/null +++ b/uitest/demo_ui/command_with_parameters.py @@ -0,0 +1,24 @@ +# -*- 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 type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class CommandWithParametersTest(UITestCase): + + def test_text_color_change(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.xUITest.executeCommandWithParameters(".uno:Color", + mkPropertyValues({"Color": 16776960})) + xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit") + type_text(xWriterEdit, "LibreOffice") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/data/test.ods b/uitest/demo_ui/data/test.ods Binary files differnew file mode 100644 index 000000000..571291d26 --- /dev/null +++ b/uitest/demo_ui/data/test.ods diff --git a/uitest/demo_ui/data/test2.ods b/uitest/demo_ui/data/test2.ods Binary files differnew file mode 100644 index 000000000..550115cb9 --- /dev/null +++ b/uitest/demo_ui/data/test2.ods diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py new file mode 100644 index 000000000..48ada3b1d --- /dev/null +++ b/uitest/demo_ui/edit.py @@ -0,0 +1,55 @@ +# -*- 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, get_state_as_dict, select_text + +import time + +class EditTest(UITestCase): + + def test_type_text(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("cancel") + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() + + def test_select_text(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") + xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"})) + type_text(xEdit, "otherChars") + self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"]) + + select_text(xEdit, from_pos="2", to="12") + self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"]) + + xAddBtn = xAddNameDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py new file mode 100644 index 000000000..ddfb13273 --- /dev/null +++ b/uitest/demo_ui/gridwin.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase + +class GridWinTest(UITestCase): + + def test_select_cell(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) + + self.ui_test.close_doc() + + def test_select_range(self): + + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) + + self.ui_test.close_doc() + + def test_extend_range(self): + + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + xGridWindow = xTopWindow.getChild("grid_window") + + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) + + select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"}) + xGridWindow.executeAction("SELECT", select2Props) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/handle_multiple_files.py b/uitest/demo_ui/handle_multiple_files.py new file mode 100644 index 000000000..e60d3884b --- /dev/null +++ b/uitest/demo_ui/handle_multiple_files.py @@ -0,0 +1,62 @@ +# -*- 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 libreoffice.uno.eventlistener import EventListener + +from uitest.framework import UITestCase + +from uitest.debug import sleep + +import time +import org.libreoffice.unotest +import os +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class HandleFiles(UITestCase): + + def test_load_file(self): + + calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods")) + + calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods")) + + frames = self.ui_test.get_frames() + self.assertEqual(len(frames), 2) + + self.ui_test.close_doc() + + frames = self.ui_test.get_frames() + self.assertEqual(len(frames), 1) + + # this is currently still necessary as otherwise + # the command is not forwarded to the correct frame + # TODO: provide an additional event that we can use + # and get rid of the sleep + time.sleep(1) + + self.ui_test.close_doc() + + def test_select_frame(self): + calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods")) + + calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods")) + frames = self.ui_test.get_frames() + self.assertEqual(len(frames), 2) + frames[0].activate() + + self.ui_test.close_doc() + + frames = self.ui_test.get_frames() + self.assertEqual(len(frames), 1) + + self.assertTrue(frames[0].getTitle().startswith("test2.ods")) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py new file mode 100644 index 000000000..f5434366f --- /dev/null +++ b/uitest/demo_ui/hierarchy.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase + +import json + +class CheckBoxTest(UITestCase): + + def test_get_json(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:About") + + xAboutDlg = self.xUITest.getTopFocusWindow() + + json_string = xAboutDlg.getHierarchy() + print(json_string) + json_content = json.loads(json_string) + print(json_content) + print(json.dumps(json_content, indent=4)) + + closeBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(closeBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py new file mode 100644 index 000000000..780da1ff2 --- /dev/null +++ b/uitest/demo_ui/listbox.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.framework import UITestCase +from uitest.uihelper.common import select_pos + +class ListBoxTest(UITestCase): + + def test_select_entry_pos(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + categoryLB = xCellsDlg.getChild("categorylb") + select_pos(categoryLB, "4") + + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() + + def test_select_entry_text(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + categoryLB = xCellsDlg.getChild("categorylb") + props = {"TEXT": "Time"} + + actionProps = mkPropertyValues(props) + categoryLB.executeAction("SELECT", actionProps) + + xOkBtn = xCellsDlg.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/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py new file mode 100644 index 000000000..bb2f5bd07 --- /dev/null +++ b/uitest/demo_ui/radiobutton.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase + +import time + +try: + import pyuno + import uno + import unohelper +except ImportError: + print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables") + print("PYTHONPATH=/installation/opt/program") + print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") + raise + +class RadioButtonTest(UITestCase): + + def test_toggle_radiobutton(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) + + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py new file mode 100644 index 000000000..3f73006b1 --- /dev/null +++ b/uitest/demo_ui/spinfield.py @@ -0,0 +1,81 @@ +# -*- 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 get_state_as_dict, type_text, select_pos + +class SpinFieldTest(UITestCase): + + def test_up(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + # select the numbers tab page + select_pos(xCellsDlg, "0") + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") + + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + + def test_down(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + # select the numbers tab page + select_pos(xCellsDlg, "0") + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) + xDecimalPlaces.executeAction("UP", tuple()) + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "3") + + xDecimalPlaces.executeAction("DOWN", tuple()) + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") + + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + + def test_text(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + type_text(xDecimalPlaces, "4") + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "41") + + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py new file mode 100644 index 000000000..47b3f33a3 --- /dev/null +++ b/uitest/demo_ui/tabcontrol.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_pos + +from uitest.framework import UITestCase + +class TabControlTest(UITestCase): + + def test_select_pos(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + + xFunctionDlg = self.xUITest.getTopFocusWindow() + + xTabs = xFunctionDlg.getChild("tabcontrol") + select_pos(xTabs, "1") + + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py new file mode 100644 index 000000000..ed46379ab --- /dev/null +++ b/uitest/demo_ui/tabdialog.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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos + +class TabDialogTest(UITestCase): + + def test_select_tab_page_pos(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + select_pos(xCellsDlg, "1") + + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() + + def test_select_tab_page_name(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + props = {"NAME": "Borders"} + propsUNO = mkPropertyValues(props) + xCellsDlg.executeAction("SELECT", propsUNO) + + xOkBtn = xCellsDlg.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/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py new file mode 100644 index 000000000..265fa8b97 --- /dev/null +++ b/uitest/demo_ui/treelist.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import get_state_as_dict, select_pos + +from uitest.framework import UITestCase + +class TreeListTest(UITestCase): + + def test_expand(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + + xFunctionDlg = self.xUITest.getTopFocusWindow() + + xTabs = xFunctionDlg.getChild("tabcontrol") + select_pos(xTabs, "1") + + xTreelist = xTabs.getChild("struct") + + xTreeEntry = xTreelist.getChild('0') + + xTreeEntry.executeAction("COLLAPSE", tuple()) + + xTreeEntry.executeAction("EXPAND", tuple()) + + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |