summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/calc_dialogs/openDialogs.py
blob: db37d38bc918bd4ba192cf6a192806b46bcb9dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# -*- 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: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"},
        # tested in sc/qa/uitest/calc_tests9/tdf130371.py
    # {"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"},
        # tested in sc/qa/uitest/calc_tests4/tdf131170.py
    # {"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"},
        # tested in sc/qa/uitest/calc_tests2/dataform.py
    # {"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):
        testDialog(self, "calc", 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: