sw/qa/uitest/fieldDialog/insertField.py | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
New commits: commit c5a30375519da720a2a228b506cae5fe0b10e9f9 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Jan 29 11:55:16 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Jan 29 13:13:35 2026 +0100 sw: Add UItest for Input List field Change-Id: I062607f91e98ce00bd1a78a30a63d8aa14364bd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198350 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/uitest/fieldDialog/insertField.py b/sw/qa/uitest/fieldDialog/insertField.py new file mode 100644 index 000000000000..b69d13fa6bbd --- /dev/null +++ b/sw/qa/uitest/fieldDialog/insertField.py @@ -0,0 +1,59 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class InsertField(UITestCase): + + def test_inputListField(self): + + with self.ui_test.create_doc_in_start_center("writer") as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "2") + + xType = xDialog.getChild("type-func") + xType.getChild('1').executeAction("SELECT", tuple()) + self.assertEqual("Input list", get_state_as_dict(xType)['SelectEntryText']) + + xItem = xDialog.getChild("item") + xAdd = xDialog.getChild("add") + + xItem.executeAction("TYPE", mkPropertyValues({"TEXT":"Item1"})) + xAdd.executeAction("CLICK", tuple()) + + xItem.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xItem.executeAction("TYPE", mkPropertyValues({"TEXT":"Item2"})) + xAdd.executeAction("CLICK", tuple()) + + xItem.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xItem.executeAction("TYPE", mkPropertyValues({"TEXT":"Item3"})) + xAdd.executeAction("CLICK", tuple()) + + xListItem = xDialog.getChild("listitems") + self.assertEqual('3', get_state_as_dict(xListItem)['Children']) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + # Select the field + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:FieldDialog") as xDialog: + xType = xDialog.getChild("type-func") + self.assertEqual("Input list", get_state_as_dict(xType)['SelectEntryText']) + + xListItem = xDialog.getChild("listitems") + self.assertEqual('3', get_state_as_dict(xListItem)['Children']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
