[Libreoffice-commits] core.git: uitest/calc_tests uitest/demo_ui uitest/math_tests uitest/uitest

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Dec 24 17:12:59 UTC 2016


 uitest/calc_tests/create_range_name.py |    6 ++----
 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 ++--
 uitest/math_tests/start.py             |    6 +++---
 uitest/uitest/uihelper/common.py       |    3 +++
 9 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit 85a1dda8ef9d5970adf881dca2bf9d1a652f7245
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Dec 22 03:58:26 2016 +0100

    uitest: write a helper method for selecting based on position
    
    Change-Id: Ia7c4450f83a5a7cebd9d518c9ccac1ce07045570
    Reviewed-on: https://gerrit.libreoffice.org/32407
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py
index 5f3b8c3..1ab7805 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 9b677a4..32e6402 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 5c56c10..15bd8ab 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 c093cf5..a36189a 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 79a2948..2dbe3ef 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 217ee8e..f925117 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 91c18ea..cbda8e2 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 2842c1f..425cb96 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 b05bec7..a83230b 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:


More information about the Libreoffice-commits mailing list