[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 26 08:38:36 UTC 2021


 sw/qa/uitest/findReplace/tdf144089.py |   50 ++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

New commits:
commit ccd2de75987bae25b34a0d7d22322cada796bb3e
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Aug 25 20:52:19 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Aug 26 10:38:02 2021 +0200

    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 at libreoffice.org>

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:


More information about the Libreoffice-commits mailing list