diff options
-rw-r--r-- | sc/Module_sc.mk | 2 | ||||
-rw-r--r-- | sc/UITest_calc_dialogs.mk (renamed from sc/UITest_dialogs.mk) | 8 | ||||
-rw-r--r-- | sc/qa/uitest/calc_dialogs/openDialogs.py (renamed from sc/qa/uitest/dialogs/openDialogs.py) | 26 | ||||
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/UITest_writer_dialogs.mk | 20 | ||||
-rw-r--r-- | sw/qa/uitest/writer_dialogs/openDialogs.py | 137 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertFootEndnote.py | 6 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertSignatureLine.py | 14 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/columns.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/titlePage.py | 7 | ||||
-rw-r--r-- | uitest/uitest/uihelper/testDialog.py | 39 | ||||
-rw-r--r-- | uitest/writer_tests/goToPage.py | 8 | ||||
-rw-r--r-- | uitest/writer_tests/insertBreakDialog.py | 13 | ||||
-rw-r--r-- | uitest/writer_tests/insertTableDialog.py | 9 | ||||
-rw-r--r-- | uitest/writer_tests/pageDialog.py | 10 |
15 files changed, 272 insertions, 30 deletions
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 3b4cf0aa687f..50fc8c3d7b8c 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -253,7 +253,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sc,\ UITest_chart \ UITest_pageFormat \ UITest_calc_tests8 \ - UITest_dialogs \ + UITest_calc_dialogs \ )) endif diff --git a/sc/UITest_dialogs.mk b/sc/UITest_calc_dialogs.mk index 9498a6cb9488..42ed785b6000 100644 --- a/sc/UITest_dialogs.mk +++ b/sc/UITest_calc_dialogs.mk @@ -7,13 +7,13 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -$(eval $(call gb_UITest_UITest,dialogs)) +$(eval $(call gb_UITest_UITest,calc_dialogs)) -$(eval $(call gb_UITest_add_modules,dialogs,$(SRCDIR)/sc/qa/uitest,\ - dialogs/ \ +$(eval $(call gb_UITest_add_modules,calc_dialogs,$(SRCDIR)/sc/qa/uitest,\ + calc_dialogs/ \ )) -$(eval $(call gb_UITest_set_defs,dialogs, \ +$(eval $(call gb_UITest_set_defs,calc_dialogs, \ TDOC="$(SRCDIR)/sc/qa/uitest/calc_tests/data" \ )) diff --git a/sc/qa/uitest/dialogs/openDialogs.py b/sc/qa/uitest/calc_dialogs/openDialogs.py index 341a9e1f9998..94a7ca916c14 100644 --- a/sc/qa/uitest/dialogs/openDialogs.py +++ b/sc/qa/uitest/calc_dialogs/openDialogs.py @@ -7,7 +7,7 @@ from uitest.framework import UITestCase import unittest -from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.testDialog import testDialog dialogs = [ {"command": ".uno:OpenRemote", "closeButton": "cancel"}, @@ -165,29 +165,7 @@ def load_tests(loader, tests, pattern): # the test only checks if calc crashes by opening the dialog, see e.g. tdf#120227, tdf#125985, tdf#125982 class openDialogs(UITestCase): def check(self, dialog): - calc_doc = self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(dialog['command']) - xDialog = self.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild(dialog['closeButton']) - if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: - xOKBtn = None - else: - try: - xOKBtn = xDialog.getChild("ok") - if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): - xOKBtn = None - except: - xOKBtn = None - - self.ui_test.close_dialog_through_button(xCloseBtn) - if (xOKBtn != None): - print("check also OK button") - self.ui_test.execute_dialog_through_command(dialog['command']) - xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.close_doc() - + testDialog(self, "calc", dialog) dialogCount = 0 for dialog in dialogs: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 549047d9e9ec..f72ce87f6653 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -157,6 +157,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\ UITest_options \ UITest_classification \ UITest_writer_macro_tests \ + UITest_writer_dialogs \ )) endif diff --git a/sw/UITest_writer_dialogs.mk b/sw/UITest_writer_dialogs.mk new file mode 100644 index 000000000000..2f8d647097e6 --- /dev/null +++ b/sw/UITest_writer_dialogs.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# 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/. +# + +$(eval $(call gb_UITest_UITest,writer_dialogs)) + +$(eval $(call gb_UITest_add_modules,writer_dialogs,$(SRCDIR)/sw/qa/uitest,\ + writer_dialogs/ \ +)) + +$(eval $(call gb_UITest_set_defs,writer_dialogs, \ + TDOC="$(SRCDIR)/sw/qa/uitest/writer_tests/data" \ +)) + +# vim: set noet sw=4 ts=4: 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: diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py new file mode 100644 index 000000000000..43f0a5bc0794 --- /dev/null +++ b/uitest/uitest/uihelper/testDialog.py @@ -0,0 +1,39 @@ +# -*- 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 get_state_as_dict + +# opens the dialogs, closes 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 LibreOffice crashes by opening the dialog +def testDialog(UITestCase, app, dialog): + doc = UITestCase.ui_test.create_doc_in_start_center(app) + UITestCase.ui_test.execute_dialog_through_command(dialog['command']) + xDialog = UITestCase.xUITest.getTopFocusWindow() + + xCloseBtn = xDialog.getChild(dialog['closeButton']) + if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: + xOKBtn = None + else: + try: + xOKBtn = xDialog.getChild("ok") + if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): + xOKBtn = None + except: + xOKBtn = None + + UITestCase.ui_test.close_dialog_through_button(xCloseBtn) + if (xOKBtn != None): + print("check also OK button") + UITestCase.ui_test.execute_dialog_through_command(dialog['command']) + xDialog = UITestCase.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + UITestCase.ui_test.close_dialog_through_button(xOKBtn) + UITestCase.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests/goToPage.py b/uitest/writer_tests/goToPage.py index 63a21f04d840..d20f042dfb9a 100644 --- a/uitest/writer_tests/goToPage.py +++ b/uitest/writer_tests/goToPage.py @@ -37,4 +37,12 @@ class GoToPage_dialog(UITestCase): self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + # check cancel button + self.ui_test.execute_dialog_through_command(".uno:GotoPage") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + self.ui_test.close_doc() diff --git a/uitest/writer_tests/insertBreakDialog.py b/uitest/writer_tests/insertBreakDialog.py index 1ec61aff2368..291ffdac53b4 100644 --- a/uitest/writer_tests/insertBreakDialog.py +++ b/uitest/writer_tests/insertBreakDialog.py @@ -69,4 +69,17 @@ class WriterInsertBreakDialog(UITestCase): self.ui_test.close_doc() + def test_cancel_button_insert_line_break_dialog(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertBreak") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.getPages(1) + + self.ui_test.close_doc() + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests/insertTableDialog.py b/uitest/writer_tests/insertTableDialog.py index 60bd9d3342a6..60d427954a4c 100644 --- a/uitest/writer_tests/insertTableDialog.py +++ b/uitest/writer_tests/insertTableDialog.py @@ -118,4 +118,13 @@ class WriterInsertTableDialog(UITestCase): self.ui_test.close_doc() + def test_cancel_button_insert_line_break_dialog(self): + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + Dialog = self.xUITest.getTopFocusWindow() + CancelBtn = Dialog.getChild("cancel") + self.ui_test.close_dialog_through_button(CancelBtn) + + self.ui_test.close_doc() + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests/pageDialog.py b/uitest/writer_tests/pageDialog.py index 8165008d4f2b..233c269d891f 100644 --- a/uitest/writer_tests/pageDialog.py +++ b/uitest/writer_tests/pageDialog.py @@ -226,4 +226,14 @@ class WriterPageDialog(UITestCase): self.ui_test.close_doc() + def test_cancel_button_page_dialog(self): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + 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: |