summaryrefslogtreecommitdiff
path: root/sw/qa/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r--sw/qa/uitest/writer_dialogs/openDialogs.py137
-rw-r--r--sw/qa/uitest/writer_tests3/insertFootEndnote.py6
-rw-r--r--sw/qa/uitest/writer_tests3/insertSignatureLine.py14
-rw-r--r--sw/qa/uitest/writer_tests5/columns.py2
-rw-r--r--sw/qa/uitest/writer_tests5/titlePage.py7
5 files changed, 165 insertions, 1 deletions
diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py
new file mode 100644
index 000000000000..b0643e8474f1
--- /dev/null
+++ b/sw/qa/uitest/writer_dialogs/openDialogs.py
@@ -0,0 +1,137 @@
+# -*- 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
+import unittest
+from uitest.uihelper.testDialog import testDialog
+
+dialogs = [
+ {"command": ".uno:OpenRemote", "closeButton": "cancel"},
+ {"command": ".uno:NewDoc", "closeButton": "cancel"},
+ {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"},
+ {"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True},
+ # export needs filesystem
+ {"command": ".uno:ExportToEPUB", "closeButton": "cancel", "skipTestOK": True},
+ # export needs filesystem
+ {"command": ".uno:Print", "closeButton": "cancel", "skipTestOK": True},
+ # no printer in CI
+ # tested in sw/qa/uitest/writer_tests5/tdf123378.py
+ {"command": ".uno:PrinterSetup", "closeButton": "cancel"},
+ # {"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
+ # {"command": ".uno:SearchDialog", "closeButton": "close"},
+ # tested in sw/qa/uitest/findReplace/findReplace.py
+ # {"command": ".uno:GotoPage", "closeButton": "cancel"},
+ # tested in uitest/writer_tests/goToPage.py
+ # {"command": ".uno:AcceptTrackedChanges", "closeButton": "close"},
+ # tested in sw/qa/uitest/writer_tests/trackedChanges.py
+ {"command": ".uno:ProtectTraceChangeMode", "closeButton": "cancel"},
+ # {"command": ".uno:ChangeDatabaseField", "closeButton": "close"},
+ # tested in sw/qa/uitest/writer_tests2/exchangeDatabase.py
+ # {"command": ".uno:InsertBreak", "closeButton": "cancel"},
+ # tested in uitest/writer_tests/insertBreakDialog.py
+ {"command": ".uno:InsertObject", "closeButton": "cancel"},
+ {"command": ".uno:InsertSection", "closeButton": "cancel"},
+ {"command": ".uno:InsertFrame", "closeButton": "cancel"},
+ {"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"},
+ {"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"},
+ # {"command": ".uno:HyperlinkDialog", "closeButton": "close"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ # {"command": ".uno:InsertBookmark", "closeButton": "close"},
+ # tested in sw/qa/uitest/writer_tests2/bookmark.py
+ # {"command": ".uno:InsertReferenceField", "closeButton": "close"},
+ # dialog not closed
+ # {"command": ".uno:InsertSymbol", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests3/specialCharacter.py
+ # {"command": ".uno:InsertFootnoteDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests3/insertFootEndnote.py
+ {"command": ".uno:InsertIndexesEntry", "closeButton": "close"},
+ {"command": ".uno:InsertAuthoritiesEntry", "closeButton": "close"},
+ {"command": ".uno:InsertMultiIndex", "closeButton": "cancel"},
+ # button is labeled "Close" but is called "cancel"
+ {"command": ".uno:InsertFieldCtrl", "closeButton": "cancel", "skipTestOK": True},
+ # when running the test through the make command the OK button (insert) is enabled for some reason
+ # {"command": ".uno:InsertEnvelope", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests3/insertEnvelope.py
+ # {"command": ".uno:InsertSignatureLine", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests3/insertSignatureLine.py
+ # {"command": ".uno:FontDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests2/formatCharacter.py
+ # {"command": ".uno:ParagraphDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests2/formatParagraph.py
+ # {"command": ".uno:BulletsAndNumberingDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+ # {"command": ".uno:PageDialog", "closeButton": "cancel"},
+ # tested in uitest/writer_tests/pageDialog.py
+ # {"command": ".uno:TitlePageDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests5/titlePage.py
+ # {"command": ".uno:RubyDialog", "closeButton": "close"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ # {"command": ".uno:FormatColumns", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests5/columns.py
+ # {"command": ".uno:Watermark", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests/watermark.py
+ # {"command": ".uno:EditStyle", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests2/horizontalLine.py
+ {"command": ".uno:LoadStyles", "closeButton": "cancel"},
+ # {"command": ".uno:InsertTable", "closeButton": "cancel"},
+ # tested in uitest/writer_tests/insertTableDialog.py
+ # {"command": ".uno:SpellDialog", "closeButton": "close"},
+ # an extra dialog appears
+ # {"command": ".uno:ThesaurusDialog", "closeButton": "cancel"},
+ # fails in CI, but works fine locally
+ {"command": ".uno:Hyphenate", "closeButton": "ok", "skipTestOK": True},
+ # do not test the OK buttong twice
+ {"command": ".uno:ChineseConversion", "closeButton": "cancel"},
+ # {"command": ".uno:WordCountDialog", "closeButton": "close"},
+ # tested in sw/qa/uitest/writer_tests/wordCount.py
+ # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests5/autocorrectOptions.py
+ {"command": ".uno:EditGlossary", "closeButton": "close"},
+ # {"command": ".uno:ChapterNumberingDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/chapterNumbering/chapterNumbering.py
+ # {"command": ".uno:LineNumberingDialog", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests3/lineNumbering.py
+ {"command": ".uno:FootnoteDialog", "closeButton": "cancel"},
+ {"command": ".uno:MailMergeWizard", "closeButton": "cancel"},
+ {"command": ".uno:AddressBookSource", "closeButton": "cancel"},
+ {"command": ".uno:RunMacro", "closeButton": "cancel"},
+ {"command": ".uno:ScriptOrganizer", "closeButton": "close"},
+ {"command": ".uno:OpenXMLFilterSettings", "closeButton": "close"},
+ {"command": "service:com.sun.star.deployment.ui.PackageManagerDialog", "closeButton": "close"},
+ # {"command": ".uno:ConfigureDialog", "closeButton": "cancel"},
+ # tested in uitest/writer_tests/customizeDialog.py
+ {"command": ".uno:OptionsTreeDialog", "closeButton": "cancel"},
+ {"command": ".uno:ShowLicense", "closeButton": "close"},
+ # {"command": ".uno:About", "closeButton": "close"},
+ # tested in sw/qa/uitest/writer_tests5/about_test.py
+]
+
+def load_tests(loader, tests, pattern):
+ return unittest.TestSuite(openDialogs(dialog)
+ for dialog in dialogs)
+
+# Test to open all listed dialogs one by one, close it with the given close button
+# and if there is an "OK" button open the dialog again and close it by using the OK button
+# the test only checks if writer crashes by opening the dialog
+class openDialogs(UITestCase):
+ def check(self, dialog):
+ testDialog(self, "writer", dialog)
+
+dialogCount = 0
+for dialog in dialogs:
+ dialogCount = dialogCount + 1
+
+
+ def ch(dialog):
+ return lambda self: self.check(dialog)
+
+
+ setattr(openDialogs, "test_%02d_%s" % (dialogCount, dialog["command"]), ch(dialog))
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
index 397e98e5ff40..a069d776372d 100644
--- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
@@ -72,5 +72,11 @@ class insertFootEndnote(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
+#Cancel button
+ self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
index c4a021d4b464..f1aecc799015 100644
--- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py
+++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
@@ -8,6 +8,7 @@ from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from libreoffice.uno.propertyvalue import mkPropertyValues
+from com.sun.star.lang import IndexOutOfBoundsException
class insertSignatureLine(UITestCase):
@@ -17,6 +18,19 @@ class insertSignatureLine(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # cancel the dialog without doing anything
+ self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xName = xDialog.getChild("edit_name")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+
+ xCloseBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.assertRaises(IndexOutOfBoundsException):
+ document.DrawPage.getByIndex(0)
+
+ # set the signature line
self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
xDialog = self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py
index 3c09ef02f789..b3bce59b2db5 100644
--- a/sw/qa/uitest/writer_tests5/columns.py
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -64,7 +64,7 @@ class columns(UITestCase):
self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
- xOKBtn = xDialog.getChild("ok")
+ xOKBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py
index 4df2cb1f3a14..a1a3b02117b2 100644
--- a/sw/qa/uitest/writer_tests5/titlePage.py
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -32,6 +32,13 @@ class titlePage(UITestCase):
self.ui_test.close_dialog_through_button(xOKBtn)
self.assertEqual(document.CurrentController.PageCount, 3)
+ # check cancel button
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+ self.assertEqual(document.CurrentController.PageCount, 3)
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: