diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py index 5f3b8c381d61f2acceb2f04171b1eb5be8b78e21..1ab7805bf9709a9bd2a480c8d4c5e048704cdd55 100644 --- a/uitest/calc_tests/create_range_name.py +++ b/uitest/calc_tests/create_range_name.py @@ -8,7 +8,7 @@ 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, select_pos class CreateRangeNameTest(UITestCase): @@ -40,9 +40,7 @@ class CreateRangeNameTest(UITestCase): type_text(xEdit, "simpleRangeName") xScope = xAddNameDlg.getChild("scope") - props = {"POS": "1"} - scopeProps = mkPropertyValues(props) - xScope.executeAction("SELECT", scopeProps) + select_pos(xScope, "1") xAddBtn = xAddNameDlg.getChild("add") xAddBtn.executeAction("CLICK", tuple()) diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index 9b677a4a680bed22fa3ba1f1e65dc7f8a9943441..32e64027e55a597774eaaf9df478206a71a9245e 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -8,6 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos class ComboBoxTest(UITestCase): @@ -19,9 +20,7 @@ class ComboBoxTest(UITestCase): xAddNameDlg = self.xUITest.getTopFocusWindow() scopeCB = xAddNameDlg.getChild("scope") - props = {"POS": "1"} - actionProps = mkPropertyValues(props) - scopeCB.executeAction("SELECT", actionProps) + select_pos(scopeCB, "1") xCancelBtn = xAddNameDlg.getChild("cancel") xCancelBtn.executeAction("CLICK", tuple()) diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py index 5c56c1014a23e95a245b5c5f4ae4e1f23425c526..15bd8ab133d934920e1f7540b7595749fc3e3855 100644 --- a/uitest/demo_ui/listbox.py +++ b/uitest/demo_ui/listbox.py @@ -8,6 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos class ListBoxTest(UITestCase): @@ -19,9 +20,7 @@ class ListBoxTest(UITestCase): xCellsDlg = self.xUITest.getTopFocusWindow() categoryLB = xCellsDlg.getChild("categorylb") - props = {"POS": "4"} - actionProps = mkPropertyValues(props) - categoryLB.executeAction("SELECT", actionProps) + select_pos(categoryLB, "4") xOkBtn = xCellsDlg.getChild("ok") xOkBtn.executeAction("CLICK", tuple()) diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py index c093cf5d4d7c2ac8f4680a6bc6922f9a95b4355e..a36189afeb1690df5a7eff2f63bf4e3221a28010 100644 --- a/uitest/demo_ui/spinfield.py +++ b/uitest/demo_ui/spinfield.py @@ -8,7 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import get_state_as_dict, type_text, select_pos class SpinFieldTest(UITestCase): @@ -20,7 +20,7 @@ class SpinFieldTest(UITestCase): xCellsDlg = self.xUITest.getTopFocusWindow() # select the numbers tab page - xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + select_pos(xCellsDlg, "0") xDecimalPlaces = xCellsDlg.getChild("leadzerosed") xDecimalPlaces.executeAction("UP", tuple()) @@ -41,7 +41,7 @@ class SpinFieldTest(UITestCase): xCellsDlg = self.xUITest.getTopFocusWindow() # select the numbers tab page - xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + select_pos(xCellsDlg, "0") xDecimalPlaces = xCellsDlg.getChild("leadzerosed") xDecimalPlaces.executeAction("UP", tuple()) diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py index 79a2948cb4585ca9e34dc60ada2fc24e01e0976a..2dbe3ef842bf09030eb17e670e34aa4c8e2d169c 100644 --- a/uitest/demo_ui/tabcontrol.py +++ b/uitest/demo_ui/tabcontrol.py @@ -8,6 +8,7 @@ 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 @@ -27,7 +28,7 @@ class TabControlTest(UITestCase): xFunctionDlg = self.xUITest.getTopFocusWindow() xTabs = xFunctionDlg.getChild("tabs") - xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) + select_pos(xTabs, "1") xCancelBtn = xFunctionDlg.getChild("cancel") xCancelBtn.executeAction("CLICK", tuple()) diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py index 217ee8ea16188f9b368d836c59de8480a8e80413..f9251178d259c872c5e3557ab78c07f878cd43ac 100644 --- a/uitest/demo_ui/tabdialog.py +++ b/uitest/demo_ui/tabdialog.py @@ -8,6 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos class TabDialogTest(UITestCase): @@ -18,9 +19,7 @@ class TabDialogTest(UITestCase): self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") xCellsDlg = self.xUITest.getTopFocusWindow() - props = {"POS": "1"} - propsUNO = mkPropertyValues(props) - xCellsDlg.executeAction("SELECT", propsUNO) + select_pos(xCellsDlg, "1") xOkBtn = xCellsDlg.getChild("ok") xOkBtn.executeAction("CLICK", tuple()) diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py index 91c18ea7d299c01f665718a50c7b9142d2617487..cbda8e2c1532312bbf3db017b08abeed2750f03a 100644 --- a/uitest/demo_ui/treelist.py +++ b/uitest/demo_ui/treelist.py @@ -8,7 +8,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.calc import enter_text_to_cell -from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import get_state_as_dict, select_pos from uitest.framework import UITestCase @@ -28,7 +28,7 @@ class TreeListTest(UITestCase): xFunctionDlg = self.xUITest.getTopFocusWindow() xTabs = xFunctionDlg.getChild("tabs") - xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) + select_pos(xTabs, "1") xTreelist = xTabs.getChild("struct") diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py index 2842c1f1ef71f49d52cdb48aa2548d00e5287ba2..425cb9679f57af839cb1480085088a1948e961f9 100644 --- a/uitest/math_tests/start.py +++ b/uitest/math_tests/start.py @@ -10,7 +10,7 @@ from uitest.uihelper.common import get_state_as_dict 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, select_pos from uitest.debug import sleep import unittest @@ -34,7 +34,7 @@ class SimpleMathTest(UITestCase): xList = xMathDoc.getChild("listbox") state = get_state_as_dict(xList) self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - xList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + select_pos(xList, "1") state = get_state_as_dict(xList) self.assertEqual(state["SelectEntryText"], "Relations") @@ -72,7 +72,7 @@ class SimpleMathTest(UITestCase): xList = xMathDoc.getChild("listbox") state = get_state_as_dict(xList) self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - xList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + select_pos(xList, "1") xMathSelector = xMathDoc.getChild("element_selector") diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py index b05bec7167f67440d59be953b0f8fae338bfe07b..a83230b5a723ad217cb6b8df98e57b96aed46e7f 100644 --- a/uitest/uitest/uihelper/common.py +++ b/uitest/uitest/uihelper/common.py @@ -13,4 +13,7 @@ def get_state_as_dict(ui_object): def type_text(ui_object, text): ui_object.executeAction("TYPE", mkPropertyValues({"TEXT": text})) +def select_pos(ui_object, pos): + ui_object.executeAction("SELECT", mkPropertyValues({"POS": pos})) + # vim: set shiftwidth=4 softtabstop=4 expandtab: