diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-01 12:40:04 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-01 18:35:11 +0200 |
commit | a2d3b5721fc723608cea13a78ce09f959d0b9b9f (patch) | |
tree | 443e9e9764537eedb2ea478016bdb1e2fa7c7d9d /uitest | |
parent | 46abe9243091c72b271f0f316796947527eeb562 (diff) |
uitest: factor out common duplicated code
Change-Id: Ib6d4edaf3bd1b0a4078c277d1139d7b0db479e2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103757
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/uihelper/common.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py index 5056ef764983..5d4c448f22a2 100644 --- a/uitest/uitest/uihelper/common.py +++ b/uitest/uitest/uihelper/common.py @@ -19,4 +19,29 @@ def select_pos(ui_object, pos): def select_text(ui_object, from_pos, to): ui_object.executeAction("SELECT", mkPropertyValues({"FROM": from_pos, "TO": to})) +def change_measurement_unit(UITestCase, unit): + UITestCase.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = UITestCase.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xAppEntry = xPages.getChild('3') + xAppEntry.executeAction("EXPAND", tuple()) + xGeneralEntry = xAppEntry.getChild('0') + xGeneralEntry.executeAction("SELECT", tuple()) + + # Calc + if 'unitlb' in xDialogOpt.getChildren(): + xUnit = xDialogOpt.getChild("unitlb") + + # Writer + elif 'metric' in xDialogOpt.getChildren(): + xUnit = xDialogOpt.getChild("metric") + + props = {"TEXT": unit} + actionProps = mkPropertyValues(props) + xUnit.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + UITestCase.ui_test.close_dialog_through_button(xOKBtn) + # vim: set shiftwidth=4 softtabstop=4 expandtab: |