diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-22 03:58:26 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-24 17:12:38 +0000 |
commit | 85a1dda8ef9d5970adf881dca2bf9d1a652f7245 (patch) | |
tree | b322ef90f81127f1c96e06dc76459778ed1ba99f | |
parent | 57e785e1cf52e422ac60cb259a2f53b696d3c4cc (diff) |
uitest: write a helper method for selecting based on position
Change-Id: Ia7c4450f83a5a7cebd9d518c9ccac1ce07045570
Reviewed-on: https://gerrit.libreoffice.org/32407
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | uitest/calc_tests/create_range_name.py | 6 | ||||
-rw-r--r-- | uitest/demo_ui/combobox.py | 5 | ||||
-rw-r--r-- | uitest/demo_ui/listbox.py | 5 | ||||
-rw-r--r-- | uitest/demo_ui/spinfield.py | 6 | ||||
-rw-r--r-- | uitest/demo_ui/tabcontrol.py | 3 | ||||
-rw-r--r-- | uitest/demo_ui/tabdialog.py | 5 | ||||
-rw-r--r-- | uitest/demo_ui/treelist.py | 4 | ||||
-rw-r--r-- | uitest/math_tests/start.py | 6 | ||||
-rw-r--r-- | uitest/uitest/uihelper/common.py | 3 |
9 files changed, 21 insertions, 22 deletions
diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py index 5f3b8c381d61..1ab7805bf970 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 9b677a4a680b..32e64027e55a 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 5c56c1014a23..15bd8ab133d9 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 c093cf5d4d7c..a36189afeb16 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 79a2948cb458..2dbe3ef842bf 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 217ee8ea1618..f9251178d259 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 91c18ea7d299..cbda8e2c1532 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 2842c1f1ef71..425cb9679f57 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 b05bec7167f6..a83230b5a723 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: |