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 @@ ...@@ -8,7 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase from uitest.framework import UITestCase
from uitest.uihelper.common import type_text from uitest.uihelper.common import type_text, select_pos
class CreateRangeNameTest(UITestCase): class CreateRangeNameTest(UITestCase):
...@@ -40,9 +40,7 @@ class CreateRangeNameTest(UITestCase): ...@@ -40,9 +40,7 @@ class CreateRangeNameTest(UITestCase):
type_text(xEdit, "simpleRangeName") type_text(xEdit, "simpleRangeName")
xScope = xAddNameDlg.getChild("scope") xScope = xAddNameDlg.getChild("scope")
props = {"POS": "1"} select_pos(xScope, "1")
scopeProps = mkPropertyValues(props)
xScope.executeAction("SELECT", scopeProps)
xAddBtn = xAddNameDlg.getChild("add") xAddBtn = xAddNameDlg.getChild("add")
xAddBtn.executeAction("CLICK", tuple()) xAddBtn.executeAction("CLICK", tuple())
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
class ComboBoxTest(UITestCase): class ComboBoxTest(UITestCase):
...@@ -19,9 +20,7 @@ class ComboBoxTest(UITestCase): ...@@ -19,9 +20,7 @@ class ComboBoxTest(UITestCase):
xAddNameDlg = self.xUITest.getTopFocusWindow() xAddNameDlg = self.xUITest.getTopFocusWindow()
scopeCB = xAddNameDlg.getChild("scope") scopeCB = xAddNameDlg.getChild("scope")
props = {"POS": "1"} select_pos(scopeCB, "1")
actionProps = mkPropertyValues(props)
scopeCB.executeAction("SELECT", actionProps)
xCancelBtn = xAddNameDlg.getChild("cancel") xCancelBtn = xAddNameDlg.getChild("cancel")
xCancelBtn.executeAction("CLICK", tuple()) xCancelBtn.executeAction("CLICK", tuple())
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
class ListBoxTest(UITestCase): class ListBoxTest(UITestCase):
...@@ -19,9 +20,7 @@ class ListBoxTest(UITestCase): ...@@ -19,9 +20,7 @@ class ListBoxTest(UITestCase):
xCellsDlg = self.xUITest.getTopFocusWindow() xCellsDlg = self.xUITest.getTopFocusWindow()
categoryLB = xCellsDlg.getChild("categorylb") categoryLB = xCellsDlg.getChild("categorylb")
props = {"POS": "4"} select_pos(categoryLB, "4")
actionProps = mkPropertyValues(props)
categoryLB.executeAction("SELECT", actionProps)
xOkBtn = xCellsDlg.getChild("ok") xOkBtn = xCellsDlg.getChild("ok")
xOkBtn.executeAction("CLICK", tuple()) xOkBtn.executeAction("CLICK", tuple())
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase 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): class SpinFieldTest(UITestCase):
...@@ -20,7 +20,7 @@ class SpinFieldTest(UITestCase): ...@@ -20,7 +20,7 @@ class SpinFieldTest(UITestCase):
xCellsDlg = self.xUITest.getTopFocusWindow() xCellsDlg = self.xUITest.getTopFocusWindow()
# select the numbers tab page # select the numbers tab page
xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) select_pos(xCellsDlg, "0")
xDecimalPlaces = xCellsDlg.getChild("leadzerosed") xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
xDecimalPlaces.executeAction("UP", tuple()) xDecimalPlaces.executeAction("UP", tuple())
...@@ -41,7 +41,7 @@ class SpinFieldTest(UITestCase): ...@@ -41,7 +41,7 @@ class SpinFieldTest(UITestCase):
xCellsDlg = self.xUITest.getTopFocusWindow() xCellsDlg = self.xUITest.getTopFocusWindow()
# select the numbers tab page # select the numbers tab page
xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) select_pos(xCellsDlg, "0")
xDecimalPlaces = xCellsDlg.getChild("leadzerosed") xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
xDecimalPlaces.executeAction("UP", tuple()) xDecimalPlaces.executeAction("UP", tuple())
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell from uitest.uihelper.calc import enter_text_to_cell
from uitest.uihelper.common import select_pos
from uitest.framework import UITestCase from uitest.framework import UITestCase
...@@ -27,7 +28,7 @@ class TabControlTest(UITestCase): ...@@ -27,7 +28,7 @@ class TabControlTest(UITestCase):
xFunctionDlg = self.xUITest.getTopFocusWindow() xFunctionDlg = self.xUITest.getTopFocusWindow()
xTabs = xFunctionDlg.getChild("tabs") xTabs = xFunctionDlg.getChild("tabs")
xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) select_pos(xTabs, "1")
xCancelBtn = xFunctionDlg.getChild("cancel") xCancelBtn = xFunctionDlg.getChild("cancel")
xCancelBtn.executeAction("CLICK", tuple()) xCancelBtn.executeAction("CLICK", tuple())
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
class TabDialogTest(UITestCase): class TabDialogTest(UITestCase):
...@@ -18,9 +19,7 @@ class TabDialogTest(UITestCase): ...@@ -18,9 +19,7 @@ class TabDialogTest(UITestCase):
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
xCellsDlg = self.xUITest.getTopFocusWindow() xCellsDlg = self.xUITest.getTopFocusWindow()
props = {"POS": "1"} select_pos(xCellsDlg, "1")
propsUNO = mkPropertyValues(props)
xCellsDlg.executeAction("SELECT", propsUNO)
xOkBtn = xCellsDlg.getChild("ok") xOkBtn = xCellsDlg.getChild("ok")
xOkBtn.executeAction("CLICK", tuple()) xOkBtn.executeAction("CLICK", tuple())
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell 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 from uitest.framework import UITestCase
...@@ -28,7 +28,7 @@ class TreeListTest(UITestCase): ...@@ -28,7 +28,7 @@ class TreeListTest(UITestCase):
xFunctionDlg = self.xUITest.getTopFocusWindow() xFunctionDlg = self.xUITest.getTopFocusWindow()
xTabs = xFunctionDlg.getChild("tabs") xTabs = xFunctionDlg.getChild("tabs")
xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) select_pos(xTabs, "1")
xTreelist = xTabs.getChild("struct") xTreelist = xTabs.getChild("struct")
......
...@@ -10,7 +10,7 @@ from uitest.uihelper.common import get_state_as_dict ...@@ -10,7 +10,7 @@ from uitest.uihelper.common import get_state_as_dict
from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase 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 from uitest.debug import sleep
import unittest import unittest
...@@ -34,7 +34,7 @@ class SimpleMathTest(UITestCase): ...@@ -34,7 +34,7 @@ class SimpleMathTest(UITestCase):
xList = xMathDoc.getChild("listbox") xList = xMathDoc.getChild("listbox")
state = get_state_as_dict(xList) state = get_state_as_dict(xList)
self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
xList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) select_pos(xList, "1")
state = get_state_as_dict(xList) state = get_state_as_dict(xList)
self.assertEqual(state["SelectEntryText"], "Relations") self.assertEqual(state["SelectEntryText"], "Relations")
...@@ -72,7 +72,7 @@ class SimpleMathTest(UITestCase): ...@@ -72,7 +72,7 @@ class SimpleMathTest(UITestCase):
xList = xMathDoc.getChild("listbox") xList = xMathDoc.getChild("listbox")
state = get_state_as_dict(xList) state = get_state_as_dict(xList)
self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
xList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) select_pos(xList, "1")
xMathSelector = xMathDoc.getChild("element_selector") xMathSelector = xMathDoc.getChild("element_selector")
......
...@@ -13,4 +13,7 @@ def get_state_as_dict(ui_object): ...@@ -13,4 +13,7 @@ def get_state_as_dict(ui_object):
def type_text(ui_object, text): def type_text(ui_object, text):
ui_object.executeAction("TYPE", mkPropertyValues({"TEXT": 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: # 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