summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorArtur Neumann <artur@jankaritech.com>2019-06-19 12:15:08 +0545
committerZdenek Crhonek <zcrhonek@gmail.com>2019-07-03 07:08:05 +0200
commit25bf2c5c0074fbcc162c02593d896705e225b5b5 (patch)
tree08ac12619509ea6087cccfacd70379a0fef82913 /sc
parentaf4d86a664e36cd8a0a985dd13f95300b9b48fbd (diff)
UI tests opening all dialogs in calc and see if it crashes
Open a dialog, close it by the given button e.g. "cancel" or "close". If the dialog has an enabled "OK" button open the dialog again and try to close it also using the OK button. For every dialog a complete new document is opened to ensure test-separation, otherwise one action could hamper the next action. E.g. ".uno:Protect" would hamper any edit action. For dialogs that already have other tests a "cancel/close" test was added to the previous test. As far as possible opening new documents was avoided in those cases. And in some cases a simple check was added to check if the "cancel" button does not change anything. Change-Id: I727cad43603770245f27baf752a1985f9a754847 Reviewed-on: https://gerrit.libreoffice.org/74333 Tested-by: Jenkins Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/UITest_dialogs.mk20
-rw-r--r--sc/qa/uitest/calc_tests/columns.py6
-rw-r--r--sc/qa/uitest/calc_tests/fillRandomNumber.py9
-rw-r--r--sc/qa/uitest/calc_tests/printRange.py6
-rw-r--r--sc/qa/uitest/calc_tests/sheetRename.py6
-rw-r--r--sc/qa/uitest/calc_tests2/consolidate.py6
-rw-r--r--sc/qa/uitest/calc_tests2/subtotals.py7
-rw-r--r--sc/qa/uitest/calc_tests3/clearCells.py24
-rw-r--r--sc/qa/uitest/calc_tests6/moveCopySheet.py10
-rw-r--r--sc/qa/uitest/dialogs/openDialogs.py202
-rw-r--r--sc/qa/uitest/pageFormat/tdf123508.py4
-rw-r--r--sc/qa/uitest/protect/protectSheet.py8
-rw-r--r--sc/qa/uitest/protect/protectSpreadsheet.py4
-rw-r--r--sc/qa/uitest/range_name/tdf119954.py6
-rw-r--r--sc/qa/uitest/signatureLine/insertSignatureLine.py15
-rw-r--r--sc/qa/uitest/statistics/anova.py6
-rw-r--r--sc/qa/uitest/statistics/chiSquare.py8
-rw-r--r--sc/qa/uitest/statistics/correlation.py8
-rw-r--r--sc/qa/uitest/statistics/covariance.py8
-rw-r--r--sc/qa/uitest/statistics/descriptiveStatistics.py8
-rw-r--r--sc/qa/uitest/statistics/exponentialSmoothing.py6
-rw-r--r--sc/qa/uitest/statistics/fTest.py8
-rw-r--r--sc/qa/uitest/statistics/movingAverage.py8
-rw-r--r--sc/qa/uitest/statistics/regression.py9
-rw-r--r--sc/qa/uitest/statistics/sampling.py7
-rw-r--r--sc/qa/uitest/statistics/tTest.py8
-rw-r--r--sc/qa/uitest/statistics/zTest.py8
-rw-r--r--sc/qa/uitest/validity/validity.py6
29 files changed, 407 insertions, 25 deletions
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 7d4928f41599..3b4cf0aa687f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -253,6 +253,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sc,\
UITest_chart \
UITest_pageFormat \
UITest_calc_tests8 \
+ UITest_dialogs \
))
endif
diff --git a/sc/UITest_dialogs.mk b/sc/UITest_dialogs.mk
new file mode 100644
index 000000000000..9498a6cb9488
--- /dev/null
+++ b/sc/UITest_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,dialogs))
+
+$(eval $(call gb_UITest_add_modules,dialogs,$(SRCDIR)/sc/qa/uitest,\
+ dialogs/ \
+))
+
+$(eval $(call gb_UITest_set_defs,dialogs, \
+ TDOC="$(SRCDIR)/sc/qa/uitest/calc_tests/data" \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py
index 259bf09fcc00..09d6990686f1 100644
--- a/sc/qa/uitest/calc_tests/columns.py
+++ b/sc/qa/uitest/calc_tests/columns.py
@@ -63,8 +63,8 @@ class CalcColumns(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
xvalue = xDialog.getChild("value")
self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ xCancel = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancel)
self.ui_test.close_doc()
@@ -338,4 +338,4 @@ class CalcColumns(UITestCase):
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/fillRandomNumber.py b/sc/qa/uitest/calc_tests/fillRandomNumber.py
index a2c55fb353d5..2f9635184e97 100644
--- a/sc/qa/uitest/calc_tests/fillRandomNumber.py
+++ b/sc/qa/uitest/calc_tests/fillRandomNumber.py
@@ -54,5 +54,12 @@ class fillRandomNumber(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False)
self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False)
+ #close dialog without doing anything
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+ self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False)
+ self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False)
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/printRange.py b/sc/qa/uitest/calc_tests/printRange.py
index 4e99a30d29b9..2a5f26410955 100644
--- a/sc/qa/uitest/calc_tests/printRange.py
+++ b/sc/qa/uitest/calc_tests/printRange.py
@@ -49,8 +49,8 @@ class printRange(UITestCase):
self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20")
self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1")
self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A")
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ xCancel = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancel)
#delete print ranges
self.xUITest.executeCommand(".uno:DeletePrintArea")
@@ -115,4 +115,4 @@ class printRange(UITestCase):
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/sheetRename.py b/sc/qa/uitest/calc_tests/sheetRename.py
index b5382a28bc77..28acb90cfe8d 100644
--- a/sc/qa/uitest/calc_tests/sheetRename.py
+++ b/sc/qa/uitest/calc_tests/sheetRename.py
@@ -31,8 +31,8 @@ class sheetRename(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
xname_entry = xDialog.getChild("name_entry")
self.assertEqual(get_state_as_dict(xname_entry)["Text"], "NewName")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
self.ui_test.close_doc()
@@ -108,4 +108,4 @@ class sheetRename(UITestCase):
# self.ui_test.close_dialog_through_button(xOKBtn)
# self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests2/consolidate.py b/sc/qa/uitest/calc_tests2/consolidate.py
index 508ac7aaee83..b52e3be8f10b 100644
--- a/sc/qa/uitest/calc_tests2/consolidate.py
+++ b/sc/qa/uitest/calc_tests2/consolidate.py
@@ -119,6 +119,12 @@ class consolidate(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 210)
self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 212)
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate")
+ 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/sc/qa/uitest/calc_tests2/subtotals.py b/sc/qa/uitest/calc_tests2/subtotals.py
index c18dd8ba4af0..31e87d9acdf3 100644
--- a/sc/qa/uitest/calc_tests2/subtotals.py
+++ b/sc/qa/uitest/calc_tests2/subtotals.py
@@ -45,6 +45,13 @@ class Subtotals(UITestCase):
self.ui_test.close_dialog_through_button(xOKBtn)
self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1)
self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "")
+
+ # check cancel button
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
def test_tdf88792(self):
diff --git a/sc/qa/uitest/calc_tests3/clearCells.py b/sc/qa/uitest/calc_tests3/clearCells.py
index 0c53947c99c4..162ac86e1f6b 100644
--- a/sc/qa/uitest/calc_tests3/clearCells.py
+++ b/sc/qa/uitest/calc_tests3/clearCells.py
@@ -284,4 +284,28 @@ class clearCells(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "")
self.ui_test.close_doc()
+
+ def test_cancel_clear_cells_all(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ enter_text_to_cell(gridwin, "A1", "aa")
+ enter_text_to_cell(gridwin, "A2", "1")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+ self.ui_test.execute_dialog_through_command(".uno:Delete")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xdeleteall = xDialog.getChild("deleteall")
+
+ if (get_state_as_dict(xdeleteall)["Selected"]) == "false":
+ xdeleteall.executeAction("CLICK", tuple())
+
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "1")
+
+ self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py
index 8660e167fa3f..7c5d50256f51 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -52,6 +52,16 @@ class moveCopySheet(UITestCase):
self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
+ #verify that the cancel button does not do anything
+ self.ui_test.execute_dialog_through_command(".uno:Move")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.assertEqual(document.Sheets.getCount(), 2)
+ self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
+ self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/dialogs/openDialogs.py b/sc/qa/uitest/dialogs/openDialogs.py
new file mode 100644
index 000000000000..341a9e1f9998
--- /dev/null
+++ b/sc/qa/uitest/dialogs/openDialogs.py
@@ -0,0 +1,202 @@
+# -*- 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.common import get_state_as_dict
+
+dialogs = [
+ {"command": ".uno:OpenRemote", "closeButton": "cancel"},
+ {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"},
+ {"command": ".uno:SaveAsRemote", "closeButton": "cancel"},
+ {"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True},
+ # export needs filesystem
+ {"command": ".uno:Print", "closeButton": "cancel", "skipTestOK": True},
+ # no printer in CI
+ {"command": ".uno:PrinterSetup", "closeButton": "cancel"},
+ # {"command": ".uno:SetDocumentProperties", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/documentProperties.py
+ # {"command": ".uno:PasteSpecial", "closeButton": "cancel"},
+ # would need to copy first something into the clipboard
+ # {"command": ".uno:SearchDialog", "closeButton": "close"},
+ # tested in sc/qa/uitest/search_replace/*
+ # {"command": ".uno:InsertObjectChart", "closeButton": "cancel"},
+ # tested in uitest/calc_tests/create_chart.py
+ {"command": ".uno:DataDataPilotRun", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:FunctionDialog", "closeButton": "cancel"},
+ # Cancel button tested in uitest/calc_tests/function_wizard.py
+ # OK button tested in sc/qa/uitest/calc_tests7/tdf123479.py
+ {"command": ".uno:InsertName", "closeButton": "close"},
+ {"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"},
+ {"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"},
+ # {"command": ".uno:HyperlinkDialog", "closeButton": "ok"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ {"command": ".uno:InsertSymbol", "closeButton": "cancel"},
+ {"command": ".uno:EditHeaderAndFooter", "closeButton": "cancel"},
+ # {"command": ".uno:InsertSignatureLine", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/signatureLine/insertSignatureLine.py
+ # {"command": ".uno:FormatCellDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/formatCells.py
+ # {"command": ".uno:RowHeight", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/rows.py
+ {"command": ".uno:SetOptimalRowHeight", "closeButton": "cancel"},
+ # {"command": ".uno:ColumnWidth", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/columns.py
+ {"command": ".uno:SetOptimalColumnWidth", "closeButton": "cancel"},
+ # {"command": ".uno:PageFormatDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/pageFormat/tdf123508.py
+ {"command": ".uno:EditPrintArea", "closeButton": "cancel", "skipTestOK": True},
+ # tested in sc/qa/uitest/calc_tests/printRange.py
+ # {"command": ".uno:ConditionalFormatMenu", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:AutoFormat", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:ChooseDesign", "closeButton": "cancel"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ {"command": ".uno:StyleNewByExample", "closeButton": "cancel"},
+ {"command": ".uno:InsertCell", "closeButton": "cancel"},
+ {"command": ".uno:DeleteCell", "closeButton": "cancel"},
+ {"command": ".uno:Insert", "closeButton": "cancel", "skipTestOK": True},
+ # OK button tested in uitest/calc_tests/gridwin.py
+ {"command": ".uno:Add", "closeButton": "cancel"},
+ # {"command": ".uno:InsertExternalDataSource", "closeButton": "cancel"},
+ # dialog opens and closes, but is not recognized as closed by close_dialog_through_button
+ # {"command": ".uno:Delete", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests3/clearCells.py
+ # {"command": ".uno:RandomNumberGeneratorDialog", "closeButton": "close"},
+ # tested in sc/qa/uitest/calc_tests/fillRandomNumber.py
+ # {"command": ".uno:AddName", "closeButton": "cancel"},
+ # Cancel button tested in uitest/demo_ui/edit.py
+ # "add" button tested in uitest/calc_tests/create_range_name.py
+ {"command": ".uno:DefineName", "closeButton": "cancel"},
+ # {"command": ".uno:SheetInsertName", "closeButton": "close"},
+ # dialog does not open
+ {"command": ".uno:CreateNames", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ {"command": ".uno:DefineLabelRange", "closeButton": "cancel"},
+ # {"command": ".uno:RenameTable", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/sheetRename.py
+ # {"command": ".uno:Move", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/moveCopySheet.py
+ {"command": ".uno:SetTabBgColor", "closeButton": "cancel"},
+ {"command": ".uno:TableEvents", "closeButton": "cancel"},
+ # {"command": ".uno:DataSort", "closeButton": "cancel"},
+ # cancel button tested in sc/qa/uitest/calc_tests/sorting.py
+ # OK button tested in sc/qa/uitest/calc_tests/naturalSort.py
+ # {"command": ".uno:DataFilterAutoFilter", "closeButton": "ok", "skipTestOK": True},
+ # tested in sc/qa/uitest/autofilter/autofilterBugs.py
+ # {"command": ".uno:DataFilterStandardFilter", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/standardFilter.py
+ {"command": ".uno:DataFilterSpecialFilter", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:DefineDBName", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/range_name/tdf119954.py
+ {"command": ".uno:SelectDB", "closeButton": "cancel"},
+ # {"command": ".uno:InsertPivotTable", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:Validation", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/validity/validity.py
+ # {"command": ".uno:DataSubTotals", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/subtotals.py
+ {"command": ".uno:DataForm", "closeButton": "close"},
+ # {"command": ".uno:DataConsolidate", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/consolidate.py
+ {"command": ".uno:Group", "closeButton": "cancel"},
+ # {"command": ".uno:SamplingDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/sampling.py
+ # {"command": ".uno:DescriptiveStatisticsDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/descriptiveStatistics.py
+ # {"command": ".uno:AnalysisOfVarianceDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/anova.py
+ # {"command": ".uno:CorrelationDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/correlation.py
+ # {"command": ".uno:CovarianceDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/covariance.py
+ # {"command": ".uno:ExponentialSmoothingDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/exponentialSmoothing.py
+ # {"command": ".uno:MovingAverageDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/movingAverage.py
+ # {"command": ".uno:RegressionDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/regression.py
+ # {"command": ".uno:TTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/tTest.py
+ # {"command": ".uno:FTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/fTest.py
+ # {"command": ".uno:ZTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/zTest.py
+ # {"command": ".uno:ChiSquareTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/chiSquare.py:53
+ {"command": ".uno:FourierAnalysisDialog", "closeButton": "cancel"},
+ # {"command": ".uno:SpellDialog", "closeButton": "close"},
+ # an extra dialog appears
+ {"command": ".uno:Hyphenate", "closeButton": "cancel"},
+ {"command": ".uno:ChineseConversion", "closeButton": "cancel"},
+ # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/autocorrectOptions.py
+ {"command": ".uno:GoalSeekDialog", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ {"command": ".uno:SolverDialog", "closeButton": "close", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:ShareDocument", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/shareSpreadsheet.py
+ # {"command": ".uno:Protect", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/protect/protectSheet.py
+ # {"command": ".uno:ToolProtectionDocument", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/protect/protectSpreadsheet.py
+ {"command": ".uno:RunMacro", "closeButton": "cancel"},
+ {"command": ".uno:ScriptOrganizer", "closeButton": "close"},
+ {"command": ".uno:ShowLicense", "closeButton": "close"},
+ # {"command": ".uno:About", "closeButton": "close"},
+ # tested in sc/qa/uitest/calc_tests7/tdf106667.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 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()
+
+
+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/sc/qa/uitest/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py
index c99ec01eaa2a..37d309815c5f 100644
--- a/sc/qa/uitest/pageFormat/tdf123508.py
+++ b/sc/qa/uitest/pageFormat/tdf123508.py
@@ -57,8 +57,8 @@ class tdf123508(UITestCase):
self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2")
self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ 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/sc/qa/uitest/protect/protectSheet.py b/sc/qa/uitest/protect/protectSheet.py
index faeee55121ad..90030b5322e7 100644
--- a/sc/qa/uitest/protect/protectSheet.py
+++ b/sc/qa/uitest/protect/protectSheet.py
@@ -49,6 +49,14 @@ class protectSheet(UITestCase):
enter_text_to_cell(gridwin, "B2", "A")
self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "A")
+ # test cancel button
+ self.ui_test.execute_dialog_through_command(".uno:Protect")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+ enter_text_to_cell(gridwin, "B2", "B")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B")
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/protect/protectSpreadsheet.py b/sc/qa/uitest/protect/protectSpreadsheet.py
index 2aee4d315121..c0b78943fa05 100644
--- a/sc/qa/uitest/protect/protectSpreadsheet.py
+++ b/sc/qa/uitest/protect/protectSpreadsheet.py
@@ -38,8 +38,8 @@ class protectSpreadsheet(UITestCase):
xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
self.ui_test.close_doc()
diff --git a/sc/qa/uitest/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py
index abda0088218c..c7ac8d56ce8b 100644
--- a/sc/qa/uitest/range_name/tdf119954.py
+++ b/sc/qa/uitest/range_name/tdf119954.py
@@ -78,5 +78,11 @@ class tdf119954(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "")
self.assertEqual(get_cell_by_position(document, 0, 1, 1).getFormula(), "")
+ # check cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName")
+ xDefineNameDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDefineNameDlg.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/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py
index e1de00b1b5bc..51a321b34a64 100644
--- a/sc/qa/uitest/signatureLine/insertSignatureLine.py
+++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py
@@ -8,6 +8,8 @@ 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
+
#Bug 117903 - Allow signature lines in Calc
class insertSignatureLineCalc(UITestCase):
@@ -18,6 +20,19 @@ class insertSignatureLineCalc(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
+ # 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.Sheets.getByIndex(0).DrawPage.getByIndex(0)
+
+ # set the signature line
self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
xDialog = self.xUITest.getTopFocusWindow()
diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py
index 135c091a2100..50237ef928f9 100644
--- a/sc/qa/uitest/statistics/anova.py
+++ b/sc/qa/uitest/statistics/anova.py
@@ -137,5 +137,11 @@ class anova(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog")
+ 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/sc/qa/uitest/statistics/chiSquare.py b/sc/qa/uitest/statistics/chiSquare.py
index bc922c4d0ea0..5016e71f861c 100644
--- a/sc/qa/uitest/statistics/chiSquare.py
+++ b/sc/qa/uitest/statistics/chiSquare.py
@@ -84,6 +84,12 @@ class chiSquare(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog")
+ 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: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/correlation.py b/sc/qa/uitest/statistics/correlation.py
index 44059ca433eb..a005e7830c40 100644
--- a/sc/qa/uitest/statistics/correlation.py
+++ b/sc/qa/uitest/statistics/correlation.py
@@ -98,6 +98,12 @@ class correlation(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
def test_statistic_correlation_row(self):
@@ -193,4 +199,4 @@ class correlation(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/covariance.py b/sc/qa/uitest/statistics/covariance.py
index 2c8404723d9e..3787a458648e 100644
--- a/sc/qa/uitest/statistics/covariance.py
+++ b/sc/qa/uitest/statistics/covariance.py
@@ -96,6 +96,12 @@ class covariance(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
def test_statistic_covariance_row(self):
@@ -191,4 +197,4 @@ class covariance(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py
index aa2c10ff01fd..112803418dac 100644
--- a/sc/qa/uitest/statistics/descriptiveStatistics.py
+++ b/sc/qa/uitest/statistics/descriptiveStatistics.py
@@ -153,5 +153,11 @@ class descriptiveStatistics(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog")
+ 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: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/exponentialSmoothing.py b/sc/qa/uitest/statistics/exponentialSmoothing.py
index aac281d22af8..7ea2c23ec62f 100644
--- a/sc/qa/uitest/statistics/exponentialSmoothing.py
+++ b/sc/qa/uitest/statistics/exponentialSmoothing.py
@@ -107,6 +107,12 @@ class exponentialSmoothing(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
def test_exponential_smoothing_row(self):
diff --git a/sc/qa/uitest/statistics/fTest.py b/sc/qa/uitest/statistics/fTest.py
index 81a946812bb8..1f2762c4f796 100644
--- a/sc/qa/uitest/statistics/fTest.py
+++ b/sc/qa/uitest/statistics/fTest.py
@@ -110,6 +110,12 @@ class tTest(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog")
+ 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: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/movingAverage.py b/sc/qa/uitest/statistics/movingAverage.py
index ebb819fbfa3e..9f94aaf29856 100644
--- a/sc/qa/uitest/statistics/movingAverage.py
+++ b/sc/qa/uitest/statistics/movingAverage.py
@@ -103,6 +103,12 @@ class movingAverage(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
self.ui_test.close_doc()
def test_moving_average_row(self):
@@ -173,4 +179,4 @@ class movingAverage(UITestCase):
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py
index e04614e48b07..db9c3a08cb6d 100644
--- a/sc/qa/uitest/statistics/regression.py
+++ b/sc/qa/uitest/statistics/regression.py
@@ -109,4 +109,13 @@ class regression(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
+ def test_regression_cancel(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog")
+ 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/sc/qa/uitest/statistics/sampling.py b/sc/qa/uitest/statistics/sampling.py
index da69e03ae864..dd3fd2698c5b 100644
--- a/sc/qa/uitest/statistics/sampling.py
+++ b/sc/qa/uitest/statistics/sampling.py
@@ -104,5 +104,12 @@ class sampling(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 0)
self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 0)
self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0)
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog")
+ 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/sc/qa/uitest/statistics/tTest.py b/sc/qa/uitest/statistics/tTest.py
index 9a7447720bc0..035bb4ef6d89 100644
--- a/sc/qa/uitest/statistics/tTest.py
+++ b/sc/qa/uitest/statistics/tTest.py
@@ -111,6 +111,12 @@ class tTest(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog")
+ 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: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py
index 3c305d1ca9b9..a7f791e1a898 100644
--- a/sc/qa/uitest/statistics/zTest.py
+++ b/sc/qa/uitest/statistics/zTest.py
@@ -101,6 +101,12 @@ class zTest(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog")
+ 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: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/validity.py b/sc/qa/uitest/validity/validity.py
index d357b77acfe8..93cd2461e7a7 100644
--- a/sc/qa/uitest/validity/validity.py
+++ b/sc/qa/uitest/validity/validity.py
@@ -54,8 +54,8 @@ class validity(UITestCase):
self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range")
self.assertEqual(get_state_as_dict(xmin)["Text"], "1")
self.assertEqual(get_state_as_dict(xmax)["Text"], "2")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
self.ui_test.close_doc()
@@ -140,4 +140,4 @@ class validity(UITestCase):
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab: