Kaydet (Commit) 85a1dda8 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

uitest: write a helper method for selecting based on position

Change-Id: Ia7c4450f83a5a7cebd9d518c9ccac1ce07045570
Reviewed-on: https://gerrit.libreoffice.org/32407Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 57e785e1
......@@ -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())
......
......@@ -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())
......
......@@ -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())
......
......@@ -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())
......
......@@ -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())
......
......@@ -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())
......
......@@ -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")
......
......@@ -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")
......
......@@ -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:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment