[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/combobox.py |9 +++-- uitest/demo_ui/edit.py | 28 +++- uitest/demo_ui/tabcontrol.py |9 +++-- uitest/demo_ui/treelist.py | 17 +++-- 4 files changed, 24 insertions(+), 39 deletions(-) New commits: commit 714278ce47692d57965b06e8b83de632e6e97d2d Author: Xisco Fauli AuthorDate: Sun Sep 12 21:13:00 2021 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 13 10:37:55 2021 +0200 uitest: guard the remaining execute_modeless_dialog_through_command Change-Id: I239fe94cc8983e679c82aa43d74d8099b13e73b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122011 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index 50aa2b40d6ff..d2e8491c161c 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -16,14 +16,11 @@ class ComboBoxTest(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") -xAddNameDlg = self.xUITest.getTopFocusWindow() +with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: -scopeCB = xAddNameDlg.getChild("scope") -select_pos(scopeCB, "1") +scopeCB = xAddNameDlg.getChild("scope") +select_pos(scopeCB, "1") -xCancelBtn = xAddNameDlg.getChild("cancel") -self.ui_test.close_dialog_through_button(xCancelBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 75d20b6afc6f..94b86c639d0a 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -18,36 +18,30 @@ class EditTest(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") -xAddNameDlg = self.xUITest.getTopFocusWindow() +with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: -xEdit = xAddNameDlg.getChild("edit") +xEdit = xAddNameDlg.getChild("edit") -type_text(xEdit, "simpleRangeName") +type_text(xEdit, "simpleRangeName") -xAddBtn = xAddNameDlg.getChild("cancel") -self.ui_test.close_dialog_through_button(xAddBtn) def test_select_text(self): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") -xAddNameDlg = self.xUITest.getTopFocusWindow() +with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: -xEdit = xAddNameDlg.getChild("edit") +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"]) +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"]) +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) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py index eb93339eb391..505bd5690b87 100644 --- a/uitest/demo_ui/tabcontrol.py +++ b/uitest/demo_ui/tabcontrol.py @@ -23,15 +23,12 @@ class TabControlTest(UITestCase): 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") +with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: -xFunctionDlg = self.xUITest.getTopFocusWindow() -xTabs = xFunctionDlg.getChild("tabcontrol") -select_pos(xTabs, "1") +xTabs = xFunctionDlg.getChild("tabcontrol") +select_pos(xTabs, "1") -xCancelBtn = xFunctionDlg.getChild("cancel") -
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/command_with_parameters.py |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit cdd4f1cafef2c1592f6cb4ad1f4bca8db4225cbf Author: Caolán McNamara AuthorDate: Wed Mar 25 09:09:40 2020 + Commit: Caolán McNamara CommitDate: Wed Mar 25 14:34:07 2020 +0100 Defect type: IDENTIFIER_TYPO identifier_typo: Using "Libreoffice" appears to be a typo: "Libreoffice" is only known to be referenced here, or in copies of this code. Identifier "LibreOffice" is referenced elsewhere at least 19 times. Change-Id: I201bcc7e226dde52eed2c0281d2b9839a234af1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91033 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/uitest/demo_ui/command_with_parameters.py b/uitest/demo_ui/command_with_parameters.py index 3fd8c85e3ca7..c82d3359559a 100644 --- a/uitest/demo_ui/command_with_parameters.py +++ b/uitest/demo_ui/command_with_parameters.py @@ -17,8 +17,8 @@ class CommandWithParametersTest(UITestCase): self.xUITest.executeCommandWithParameters(".uno:Color", mkPropertyValues({"Color": 16776960})) xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit") -type_text(xWriterEdit, "Libreoffice") +type_text(xWriterEdit, "LibreOffice") self.ui_test.close_doc() -# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file +# vim: set shiftwidth=4 softtabstop=4 expandtab: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui uitest/UITest_demo_ui.mk
uitest/UITest_demo_ui.mk|4 uitest/demo_ui/handle_multiple_files.py |5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) New commits: commit a183955acacbc1a3e8579f360f12fd37536120fc Author: Stephan Bergmann AuthorDate: Wed Apr 10 16:41:31 2019 +0200 Commit: Stephan Bergmann CommitDate: Wed Apr 10 18:16:41 2019 +0200 Fix one more get_url_for_data_file Change-Id: I22d556fe4719fc8e7b53c66b778f6b4196f8f024 Reviewed-on: https://gerrit.libreoffice.org/70523 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/uitest/UITest_demo_ui.mk b/uitest/UITest_demo_ui.mk index 11432f9175a1..bb67e21b8bca 100644 --- a/uitest/UITest_demo_ui.mk +++ b/uitest/UITest_demo_ui.mk @@ -13,4 +13,8 @@ $(eval $(call gb_UITest_add_modules,demo_ui,$(SRCDIR)/uitest,\ demo_ui/ \ )) +$(eval $(call gb_UITest_set_defs,demo_ui, \ +TDOC="$(SRCDIR)/uitest/demo_ui/data" \ +)) + # vim: set noet sw=4 ts=4: diff --git a/uitest/demo_ui/handle_multiple_files.py b/uitest/demo_ui/handle_multiple_files.py index a69cf0723fe2..e60d3884b63e 100644 --- a/uitest/demo_ui/handle_multiple_files.py +++ b/uitest/demo_ui/handle_multiple_files.py @@ -11,13 +11,14 @@ from libreoffice.uno.eventlistener import EventListener from uitest.framework import UITestCase from uitest.debug import sleep -from uitest.path import get_srcdir_url import time +import org.libreoffice.unotest import os +import pathlib def get_url_for_data_file(file_name): -return get_srcdir_url() + "/uitest/demo_ui/data/" + file_name +return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class HandleFiles(UITestCase): ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui uitest/uitest
uitest/demo_ui/edit.py |4 ++-- uitest/uitest/uihelper/common.py |3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) New commits: commit dbf83d315acc454b576355f2e5bd8412586827ac Author: Markus MohrhardDate: Sun Jan 7 20:07:42 2018 +0100 uitest: add a shared helper method for selecting text Change-Id: I15d059ea51ec1e7f0923dab5326a9bb8433e664c Reviewed-on: https://gerrit.libreoffice.org/47550 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 6da14333a4d5..48ada3b1d15e 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -8,7 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase -from uitest.uihelper.common import type_text, get_state_as_dict +from uitest.uihelper.common import type_text, get_state_as_dict, select_text import time @@ -44,7 +44,7 @@ class EditTest(UITestCase): type_text(xEdit, "otherChars") self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"]) -xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "12"})) +select_text(xEdit, from_pos="2", to="12") self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"]) xAddBtn = xAddNameDlg.getChild("cancel") diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py index a83230b5a723..5056ef764983 100644 --- a/uitest/uitest/uihelper/common.py +++ b/uitest/uitest/uihelper/common.py @@ -16,4 +16,7 @@ def type_text(ui_object, text): def select_pos(ui_object, pos): ui_object.executeAction("SELECT", mkPropertyValues({"POS": pos})) +def select_text(ui_object, from_pos, to): +ui_object.executeAction("SELECT", mkPropertyValues({"FROM": from_pos, "TO": to})) + # vim: set shiftwidth=4 softtabstop=4 expandtab: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/edit.py | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) New commits: commit 02df8d4a7f9d35da1b8cb56dbb18e8e0effeec1e Author: Markus MohrhardDate: Sun Jan 7 20:04:21 2018 +0100 uitest: add demo showing how to select text in Edit Change-Id: I8abb09e7e7b22934648bf0f295155a85da151cf8 Reviewed-on: https://gerrit.libreoffice.org/47549 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 135a72447ea7..6da14333a4d5 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -8,7 +8,9 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase -from uitest.uihelper.common import type_text +from uitest.uihelper.common import type_text, get_state_as_dict + +import time class EditTest(UITestCase): @@ -28,4 +30,26 @@ class EditTest(UITestCase): 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"]) + +xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "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: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/char_dialog.py |2 +- uitest/demo_ui/checkbox.py|2 +- uitest/demo_ui/combobox.py|2 +- uitest/demo_ui/edit.py|2 +- uitest/demo_ui/hierarchy.py | 35 +++ uitest/demo_ui/listbox.py |4 ++-- uitest/demo_ui/spinfield.py |6 +++--- 7 files changed, 44 insertions(+), 9 deletions(-) New commits: commit 19d52e56a4581bb12bc271765feec7b8ab78c45b Author: Markus MohrhardDate: Sat Feb 18 03:32:41 2017 +0100 uitest: use the correct method to close a dialog through a button Change-Id: I210c1d9a99a93b7a21478f679f440c270375bedc Reviewed-on: https://gerrit.libreoffice.org/34398 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py index 4c77163..d2b1fb0 100644 --- a/uitest/demo_ui/char_dialog.py +++ b/uitest/demo_ui/char_dialog.py @@ -29,7 +29,7 @@ class CharDialogText(UITestCase): sleep(5) xCancelBtn = xCharDialog.getChild("cancel") -xCancelBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(xCancelBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py index 2138cf6..114473d 100644 --- a/uitest/demo_ui/checkbox.py +++ b/uitest/demo_ui/checkbox.py @@ -21,7 +21,7 @@ class CheckBoxTest(UITestCase): xNegativeNumRedCB.executeAction("CLICK",tuple()) okBtn = xCellsDlg.getChild("ok") -okBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(okBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index 32e6402..8b47f83 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -23,7 +23,7 @@ class ComboBoxTest(UITestCase): select_pos(scopeCB, "1") xCancelBtn = xAddNameDlg.getChild("cancel") -xCancelBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(xCancelBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 5eff4e0..135a724 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -24,7 +24,7 @@ class EditTest(UITestCase): type_text(xEdit, "simpleRangeName") xAddBtn = xAddNameDlg.getChild("cancel") -xAddBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(xAddBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py new file mode 100644 index 000..5f7b3c2 --- /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("close") +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 index 15bd8ab..780da1f 100644 --- a/uitest/demo_ui/listbox.py +++ b/uitest/demo_ui/listbox.py @@ -23,7 +23,7 @@ class ListBoxTest(UITestCase): select_pos(categoryLB, "4") xOkBtn = xCellsDlg.getChild("ok") -xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(xOkBtn) self.ui_test.close_doc() @@ -41,7 +41,7 @@ class ListBoxTest(UITestCase): categoryLB.executeAction("SELECT", actionProps) xOkBtn = xCellsDlg.getChild("ok") -xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_dialog_through_button(xOkBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py index a36189a..3f73006 100644 --- a/uitest/demo_ui/spinfield.py +++ b/uitest/demo_ui/spinfield.py @@ -29,7 +29,7 @@ class SpinFieldTest(UITestCase): assert(decimal_places_state["Text"] == "2") okBtn = xCellsDlg.getChild("ok") -okBtn.executeAction("CLICK", tuple()) +
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/data/test.ods |binary uitest/demo_ui/data/test2.ods |binary 2 files changed New commits: commit 0fff0211fbdbd23c8e9511f9e352ec65305e4fa2 Author: Markus MohrhardDate: Wed Sep 28 04:02:41 2016 +0200 add missing test files Change-Id: Idab1e1649b016d99ccd32158d36dc1d3e56a44b9 Reviewed-on: https://gerrit.libreoffice.org/29371 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard diff --git a/uitest/demo_ui/data/test.ods b/uitest/demo_ui/data/test.ods new file mode 100644 index 000..571291d Binary files /dev/null and b/uitest/demo_ui/data/test.ods differ diff --git a/uitest/demo_ui/data/test2.ods b/uitest/demo_ui/data/test2.ods new file mode 100644 index 000..550115c Binary files /dev/null and b/uitest/demo_ui/data/test2.ods differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/char_dialog.py | 37 + 1 file changed, 37 insertions(+) New commits: commit 02f43b0ad3865ef7af17fe51bc87680ffe881dc0 Author: Markus MohrhardDate: Sat Jun 25 10:25:47 2016 +0200 uitest: add special char widget demo Change-Id: I513ae293cfed488723e221a7eec37f103efefa92 diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py new file mode 100644 index 000..0cf545f --- /dev/null +++ b/uitest/demo_ui/char_dialog.py @@ -0,0 +1,37 @@ +# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-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_helper import UITest + +from helper import mkPropertyValues +from UITestCase import UITestCase + +import time + +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() +print(xCharDialog.getChildren()) + +time.sleep(5) + +xCharSet = xCharDialog.getChild("showcharset") + +xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"})) + +time.sleep(5) + +xCancelBtn = xCharDialog.getChild("cancel") +xCancelBtn.executeAction("CLICK", tuple()) + +self.ui_test.close_doc() + +# vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: uitest/demo_ui
uitest/demo_ui/demo_ui.txt |3 + uitest/demo_ui/spinfield.py | 103 2 files changed, 106 insertions(+) New commits: commit bbe41a5ef65ee9c3e08a1eeaf7e63fa3392db7f5 Author: Markus MohrhardDate: Mon Jun 20 03:05:30 2016 +0200 uitest: add demo for spinfield Change-Id: I45751598df2c14c1e8e3a7f17705fe52321b0c89 Reviewed-on: https://gerrit.libreoffice.org/26493 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/uitest/demo_ui/demo_ui.txt b/uitest/demo_ui/demo_ui.txt index 6db5b79..67600ef 100644 --- a/uitest/demo_ui/demo_ui.txt +++ b/uitest/demo_ui/demo_ui.txt @@ -8,3 +8,6 @@ demo_ui.listbox.select_entry_pos demo_ui.listbox.select_entry_text demo_ui.tabdialog.select_tab_page_pos demo_ui.tabdialog.select_tab_page_name +demo_ui.spinfield.up +demo_ui.spinfield.down +demo_ui.spinfield.text diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py new file mode 100644 index 000..4adde0c --- /dev/null +++ b/uitest/demo_ui/spinfield.py @@ -0,0 +1,103 @@ +# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-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_helper import UITest + +from helper import mkPropertyValues +from uitest_helper import get_state_as_dict + +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 + +def up(xContext): +xUITest = xContext.ServiceManager.createInstanceWithContext( +"org.libreoffice.uitest.UITest", xContext) + +ui_test = UITest(xUITest, xContext) + +ui_test.create_doc_in_start_center("calc") + +ui_test.execute_dialog_through_command(".uno:FormatCellDialog") +xCellsDlg = xUITest.getTopFocusWindow() + +# select the numbers tab page +xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "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") +okBtn.executeAction("CLICK", tuple()) + +ui_test.close_doc() + +def down(xContext): +xUITest = xContext.ServiceManager.createInstanceWithContext( +"org.libreoffice.uitest.UITest", xContext) + +ui_test = UITest(xUITest, xContext) + +ui_test.create_doc_in_start_center("calc") + +ui_test.execute_dialog_through_command(".uno:FormatCellDialog") +xCellsDlg = xUITest.getTopFocusWindow() + +# select the numbers tab page +xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "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") +okBtn.executeAction("CLICK", tuple()) + +ui_test.close_doc() + +def text(xContext): +xUITest = xContext.ServiceManager.createInstanceWithContext( +"org.libreoffice.uitest.UITest", xContext) + +ui_test = UITest(xUITest, xContext) + +ui_test.create_doc_in_start_center("calc") + +ui_test.execute_dialog_through_command(".uno:FormatCellDialog") +xCellsDlg = xUITest.getTopFocusWindow() + +xDecimalPlaces = xCellsDlg.getChild("leadzerosed") +xDecimalPlaces.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + +decimal_places_state = get_state_as_dict(xDecimalPlaces) +assert(decimal_places_state["Text"] == "41") + +okBtn = xCellsDlg.getChild("ok") +okBtn.executeAction("CLICK", tuple()) + +ui_test.close_doc() + +# vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits