From 85a1dda8ef9d5970adf881dca2bf9d1a652f7245 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 22 Dec 2016 03:58:26 +0100 Subject: uitest: write a helper method for selecting based on position Change-Id: Ia7c4450f83a5a7cebd9d518c9ccac1ce07045570 Reviewed-on: https://gerrit.libreoffice.org/32407 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- uitest/demo_ui/combobox.py | 5 ++--- uitest/demo_ui/listbox.py | 5 ++--- uitest/demo_ui/spinfield.py | 6 +++--- uitest/demo_ui/tabcontrol.py | 3 ++- uitest/demo_ui/tabdialog.py | 5 ++--- uitest/demo_ui/treelist.py | 4 ++-- 6 files changed, 13 insertions(+), 15 deletions(-) (limited to 'uitest/demo_ui') 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") -- cgit