From 991b3b3945790bb2699493e6645b4a3228f8a195 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 18 Jan 2021 10:16:44 +0100 Subject: uitest: sw: Add test for paste special dialog Change-Id: I470731d4e8c40077d63e8ed49d30f946ab9ab8b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109533 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/qa/uitest/writer_dialogs/openDialogs.py | 2 +- sw/qa/uitest/writer_tests2/pasteSpecial.py | 41 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 sw/qa/uitest/writer_tests2/pasteSpecial.py (limited to 'sw') diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py index 343c2aec8f60..07f127830404 100644 --- a/sw/qa/uitest/writer_dialogs/openDialogs.py +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -24,7 +24,7 @@ dialogs = [ # {"command": ".uno:SetDocumentProperties", "closeButton": "cancel"}, # tested in sw/qa/uitest/writer_tests2/documentProperties.py # {"command": ".uno:PasteSpecial", "closeButton": "cancel"}, - # would need to copy first something into the clipboard + # tested in sw/qa/uitest/writer_tests2/pasteSpecial.py # {"command": ".uno:SearchDialog", "closeButton": "close"}, # tested in sw/qa/uitest/findReplace/findReplace.py # {"command": ".uno:GotoPage", "closeButton": "cancel"}, diff --git a/sw/qa/uitest/writer_tests2/pasteSpecial.py b/sw/qa/uitest/writer_tests2/pasteSpecial.py new file mode 100644 index 000000000000..2af43215d99d --- /dev/null +++ b/sw/qa/uitest/writer_tests2/pasteSpecial.py @@ -0,0 +1,41 @@ +# -*- 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 uitest.uihelper.common import type_text + +class PasteSpecial(UITestCase): + + def test_pasteSpecial(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "test") + + for i in range(5): + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xList = xDialog.getChild('list') + xChild = xList.getChild(str(i)) + + xChild.executeAction("SELECT", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.Text.String, "test") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit