diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-08-25 20:52:19 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-08-26 10:38:02 +0200 |
commit | ccd2de75987bae25b34a0d7d22322cada796bb3e (patch) | |
tree | 1309c4411d299e0684f3cdc0b38e34aaa28eecfb | |
parent | a0edcc68f94915a78fcc08e70d2cdd752abd9ebb (diff) |
tdf#144089: sw: Add UItest
Change-Id: I6ffa476180a58ba47268b4f4a8bc59f75738be29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121046
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/qa/uitest/findReplace/tdf144089.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sw/qa/uitest/findReplace/tdf144089.py b/sw/qa/uitest/findReplace/tdf144089.py new file mode 100644 index 000000000000..2957867aa338 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf144089.py @@ -0,0 +1,50 @@ +# +# 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 uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf144089(UITestCase): + + def test_tdf144089(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "This is a test") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "10", "END_POS": "14"})) + + self.assertEqual("test", document.CurrentSelection[0].String) + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^."})) + + xReplaceterm = xDialog.getChild("replaceterm") + xReplaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + xSelectionOnly = xDialog.getChild("selection") + xSelectionOnly.executeAction("CLICK", tuple()) + + xRegexp = xDialog.getChild("regexp") + xRegexp.executeAction("CLICK", tuple()) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + # Without the fix in place, this test would have failed with + # AssertionError: 'This is a test' != 'This is a AAAA' + self.assertEqual("This is a test", document.Text.String) + + self.assertEqual("test", document.CurrentSelection[0].String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |