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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu May 28 18:26:05 UTC 2020


 sw/qa/uitest/writer_tests7/tdf133348.py |   59 ++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

New commits:
commit 9af6c96ced9c564a3625473cde732b0e366f668d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu May 28 14:45:04 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu May 28 20:25:22 2020 +0200

    tdf#133348: sw: Add UItest
    
    Change-Id: I8074efe8f65131c6f1ebb030c9e8cf8b9c60aaa0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95039
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py
new file mode 100644
index 000000000000..629c0d70912b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf133348.py
@@ -0,0 +1,59 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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
+
+class tdf133348(UITestCase):
+    def test_tdf133348(self):
+
+        self.ui_test.create_doc_in_start_center("writer")
+
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+        document = self.ui_test.get_component()
+
+        selection = self.xUITest.executeCommand(".uno:SelectAll")
+        xArgs = mkPropertyValues({"Text": "C1"})
+        self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+        xDialogOpt = self.xUITest.getTopFocusWindow()
+        xPages = xDialogOpt.getChild("pages")
+        xEntry = xPages.getChild('0')
+        xEntry.executeAction("EXPAND", tuple())
+        xGeneralEntry = xEntry.getChild('0')
+        xGeneralEntry.executeAction("SELECT", tuple())
+        xFirstName = xDialogOpt.getChild("firstname")
+        props = {"TEXT": "Known Author"}
+        actionProps = mkPropertyValues(props)
+        xFirstName.executeAction("TYPE", actionProps)
+        xOKBtn = xDialogOpt.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xArgs = mkPropertyValues({"Text": "C2"})
+        self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs)
+
+        xEnum = document.TextFields.createEnumeration()
+        self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author')
+        self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author')
+
+        self.xUITest.executeCommand(".uno:Undo")
+        self.xUITest.executeCommand(".uno:Undo")
+
+        # Without the fix in place, it would have crashed here
+        self.xUITest.executeCommand(".uno:Undo")
+        self.xUITest.executeCommand(".uno:Undo")
+
+        # all comments have been deleted
+        self.assertFalse(document.TextFields.createEnumeration().hasMoreElements())
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
+


More information about the Libreoffice-commits mailing list