1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from uitest
.uihelper
.common
import get_state_as_dict
9 from uitest
.uihelper
.common
import select_pos
10 from uitest
.uihelper
.common
import change_measurement_unit
11 from uitest
.uihelper
.calc
import enter_text_to_cell
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
15 from uitest
.debug
import sleep
16 import org
.libreoffice
.unotest
19 def get_url_for_data_file(file_name
):
20 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
22 #Bug 93506 - Crash when selecting chart containing a trend line
23 # test all dialog items - trend Line dialog
25 class tdf93506(UITestCase
):
26 def test_tdf93506_chart_trendline_dialog(self
):
27 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf93506.ods"))
28 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
29 gridwin
= xCalcDoc
.getChild("grid_window")
30 document
= self
.ui_test
.get_component()
32 change_measurement_unit(self
, "Centimeter")
34 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
35 gridwin
.executeAction("ACTIVATE", tuple())
36 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
37 xChartMain
= xChartMainTop
.getChild("chart_window")
38 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
39 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
40 xDialog
= self
.xUITest
.getTopFocusWindow()
42 tabcontrol
= xDialog
.getChild("tabcontrol")
43 select_pos(tabcontrol
, "0")
45 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
46 xentryname
= xDialog
.getChild("entry_name") #add name
47 extrapolateForward
= xDialog
.getChild("extrapolateForward")
48 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
49 setIntercept
= xDialog
.getChild("setIntercept")
50 interceptValue
= xDialog
.getChild("interceptValue")
51 showEquation
= xDialog
.getChild("showEquation")
52 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
53 xVarname
= xDialog
.getChild("entry_Xname")
54 yVarName
= xDialog
.getChild("entry_Yname")
56 logarithmic
.executeAction("CLICK", tuple())
57 xentryname
.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"}))
58 extrapolateForward
.executeAction("UP", tuple())
59 extrapolateBackward
.executeAction("UP", tuple())
60 showEquation
.executeAction("CLICK", tuple())
61 showCorrelationCoefficient
.executeAction("CLICK", tuple())
62 xVarname
.executeAction("CLEAR", tuple())
63 xVarname
.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
64 yVarName
.executeAction("CLEAR", tuple())
65 yVarName
.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"}))
68 select_pos(tabcontrol
, "1")
70 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
71 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
73 xWidth
.executeAction("UP", tuple())
74 xTransparent
.executeAction("UP", tuple())
75 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
76 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
78 xOKBtn
= xDialog
.getChild("ok")
79 self
.ui_test
.close_dialog_through_button(xOKBtn
)
82 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
83 gridwin
.executeAction("ACTIVATE", tuple())
84 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
85 xChartMain
= xChartMainTop
.getChild("chart_window")
86 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
87 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
88 xDialog
= self
.xUITest
.getTopFocusWindow()
90 tabcontrol
= xDialog
.getChild("tabcontrol")
91 select_pos(tabcontrol
, "0")
93 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
94 xentryname
= xDialog
.getChild("entry_name") #add name
95 extrapolateForward
= xDialog
.getChild("extrapolateForward")
96 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
97 setIntercept
= xDialog
.getChild("setIntercept")
98 interceptValue
= xDialog
.getChild("interceptValue")
99 showEquation
= xDialog
.getChild("showEquation")
100 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
101 xVarname
= xDialog
.getChild("entry_Xname")
102 yVarName
= xDialog
.getChild("entry_Yname")
104 self
.assertEqual(get_state_as_dict(logarithmic
)["Checked"], "true")
105 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Name")
106 self
.assertEqual(get_state_as_dict(extrapolateForward
)["Text"], "1")
107 self
.assertEqual(get_state_as_dict(extrapolateBackward
)["Text"], "1")
108 self
.assertEqual(get_state_as_dict(showEquation
)["Selected"], "true")
109 self
.assertEqual(get_state_as_dict(showCorrelationCoefficient
)["Selected"], "true")
110 self
.assertEqual(get_state_as_dict(xVarname
)["Text"], "a")
111 self
.assertEqual(get_state_as_dict(yVarName
)["Text"], "f(a)")
113 #Click on tab "Line".
114 select_pos(tabcontrol
, "1")
115 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
116 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
118 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
119 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
121 xOKBtn
= xDialog
.getChild("ok")
122 self
.ui_test
.close_dialog_through_button(xOKBtn
)
124 #Now change regression Type to Exponential
125 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
126 gridwin
.executeAction("ACTIVATE", tuple())
127 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
128 xChartMain
= xChartMainTop
.getChild("chart_window")
129 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
130 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
131 xDialog
= self
.xUITest
.getTopFocusWindow()
132 #Click on tab "Type".
133 tabcontrol
= xDialog
.getChild("tabcontrol")
134 select_pos(tabcontrol
, "0")
135 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
136 exponential
= xDialog
.getChild("exponential") #type regression exponential
137 xentryname
= xDialog
.getChild("entry_name") #add name
138 extrapolateForward
= xDialog
.getChild("extrapolateForward")
139 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
140 setIntercept
= xDialog
.getChild("setIntercept")
141 interceptValue
= xDialog
.getChild("interceptValue")
142 showEquation
= xDialog
.getChild("showEquation")
143 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
144 xVarname
= xDialog
.getChild("entry_Xname")
145 yVarName
= xDialog
.getChild("entry_Yname")
147 exponential
.executeAction("CLICK", tuple()) #set exponential
149 setIntercept
.executeAction("CLICK", tuple())
150 interceptValue
.executeAction("UP", tuple())
152 #Click on tab "Line".
153 select_pos(tabcontrol
, "1")
154 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
155 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
157 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
158 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
160 xOKBtn
= xDialog
.getChild("ok")
161 self
.ui_test
.close_dialog_through_button(xOKBtn
)
163 #reopen and verify Exponential
164 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
165 gridwin
.executeAction("ACTIVATE", tuple())
166 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
167 xChartMain
= xChartMainTop
.getChild("chart_window")
168 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
169 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
170 xDialog
= self
.xUITest
.getTopFocusWindow()
171 #Click on tab "Type".
172 tabcontrol
= xDialog
.getChild("tabcontrol")
173 select_pos(tabcontrol
, "0")
175 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
176 exponential
= xDialog
.getChild("exponential") #type regression exponential
177 xentryname
= xDialog
.getChild("entry_name") #add name
178 extrapolateForward
= xDialog
.getChild("extrapolateForward")
179 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
180 setIntercept
= xDialog
.getChild("setIntercept")
181 interceptValue
= xDialog
.getChild("interceptValue")
182 showEquation
= xDialog
.getChild("showEquation")
183 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
184 xVarname
= xDialog
.getChild("entry_Xname")
185 yVarName
= xDialog
.getChild("entry_Yname")
187 self
.assertEqual(get_state_as_dict(exponential
)["Checked"], "true")
188 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Name")
189 self
.assertEqual(get_state_as_dict(extrapolateForward
)["Text"], "1")
190 self
.assertEqual(get_state_as_dict(extrapolateBackward
)["Text"], "1")
191 self
.assertEqual(get_state_as_dict(showEquation
)["Selected"], "true")
192 self
.assertEqual(get_state_as_dict(setIntercept
)["Selected"], "true")
193 self
.assertEqual(get_state_as_dict(interceptValue
)["Text"], "1")
194 self
.assertEqual(get_state_as_dict(showCorrelationCoefficient
)["Selected"], "true")
195 self
.assertEqual(get_state_as_dict(xVarname
)["Text"], "a")
196 self
.assertEqual(get_state_as_dict(yVarName
)["Text"], "f(a)")
198 #Click on tab "Line".
199 select_pos(tabcontrol
, "1")
200 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
201 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
203 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
204 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
206 xOKBtn
= xDialog
.getChild("ok")
207 self
.ui_test
.close_dialog_through_button(xOKBtn
)
209 #Now change regression Type to Power
210 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
211 gridwin
.executeAction("ACTIVATE", tuple())
212 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
213 xChartMain
= xChartMainTop
.getChild("chart_window")
214 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
215 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
216 xDialog
= self
.xUITest
.getTopFocusWindow()
217 #Click on tab "Type".
218 tabcontrol
= xDialog
.getChild("tabcontrol")
219 select_pos(tabcontrol
, "0")
220 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
221 exponential
= xDialog
.getChild("exponential") #type regression exponential
222 power
= xDialog
.getChild("exponential") #type regression power
223 xentryname
= xDialog
.getChild("entry_name") #add name
224 extrapolateForward
= xDialog
.getChild("extrapolateForward")
225 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
226 setIntercept
= xDialog
.getChild("setIntercept")
227 interceptValue
= xDialog
.getChild("interceptValue")
228 showEquation
= xDialog
.getChild("showEquation")
229 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
230 xVarname
= xDialog
.getChild("entry_Xname")
231 yVarName
= xDialog
.getChild("entry_Yname")
233 power
.executeAction("CLICK", tuple()) #set power
235 #Click on tab "Line".
236 select_pos(tabcontrol
, "1")
237 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
238 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
240 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
241 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
243 xOKBtn
= xDialog
.getChild("ok")
244 self
.ui_test
.close_dialog_through_button(xOKBtn
)
246 #reopen and verify Power
247 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
248 gridwin
.executeAction("ACTIVATE", tuple())
249 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
250 xChartMain
= xChartMainTop
.getChild("chart_window")
251 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
252 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
253 xDialog
= self
.xUITest
.getTopFocusWindow()
254 #Click on tab "Type".
255 tabcontrol
= xDialog
.getChild("tabcontrol")
256 select_pos(tabcontrol
, "0")
258 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
259 exponential
= xDialog
.getChild("exponential") #type regression exponential
260 power
= xDialog
.getChild("exponential") #type regression power
261 xentryname
= xDialog
.getChild("entry_name") #add name
262 extrapolateForward
= xDialog
.getChild("extrapolateForward")
263 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
264 setIntercept
= xDialog
.getChild("setIntercept")
265 interceptValue
= xDialog
.getChild("interceptValue")
266 showEquation
= xDialog
.getChild("showEquation")
267 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
268 xVarname
= xDialog
.getChild("entry_Xname")
269 yVarName
= xDialog
.getChild("entry_Yname")
271 self
.assertEqual(get_state_as_dict(power
)["Checked"], "true")
272 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Name")
273 self
.assertEqual(get_state_as_dict(extrapolateForward
)["Text"], "1")
274 self
.assertEqual(get_state_as_dict(extrapolateBackward
)["Text"], "1")
275 self
.assertEqual(get_state_as_dict(showEquation
)["Selected"], "true")
276 # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
277 # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
278 self
.assertEqual(get_state_as_dict(showCorrelationCoefficient
)["Selected"], "true")
279 self
.assertEqual(get_state_as_dict(xVarname
)["Text"], "a")
280 self
.assertEqual(get_state_as_dict(yVarName
)["Text"], "f(a)")
282 #Click on tab "Line".
283 select_pos(tabcontrol
, "1")
284 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
285 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
287 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
288 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
290 xOKBtn
= xDialog
.getChild("ok")
291 self
.ui_test
.close_dialog_through_button(xOKBtn
)
293 #Now change regression Type to Polynomial
294 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
295 gridwin
.executeAction("ACTIVATE", tuple())
296 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
297 xChartMain
= xChartMainTop
.getChild("chart_window")
298 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
299 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
300 xDialog
= self
.xUITest
.getTopFocusWindow()
301 #Click on tab "Type".
302 tabcontrol
= xDialog
.getChild("tabcontrol")
303 select_pos(tabcontrol
, "0")
304 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
305 exponential
= xDialog
.getChild("exponential") #type regression exponential
306 power
= xDialog
.getChild("exponential") #type regression power
307 polynomial
= xDialog
.getChild("polynomial") #type regression polynomial
308 degree
= xDialog
.getChild("degree")
309 xentryname
= xDialog
.getChild("entry_name") #add name
310 extrapolateForward
= xDialog
.getChild("extrapolateForward")
311 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
312 setIntercept
= xDialog
.getChild("setIntercept")
313 interceptValue
= xDialog
.getChild("interceptValue")
314 showEquation
= xDialog
.getChild("showEquation")
315 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
316 xVarname
= xDialog
.getChild("entry_Xname")
317 yVarName
= xDialog
.getChild("entry_Yname")
319 polynomial
.executeAction("CLICK", tuple()) #set polynomial
320 degree
.executeAction("UP", tuple())
322 #Click on tab "Line".
323 select_pos(tabcontrol
, "1")
324 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
325 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
327 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
328 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
330 xOKBtn
= xDialog
.getChild("ok")
331 self
.ui_test
.close_dialog_through_button(xOKBtn
)
333 #reopen and verify Polynomial
334 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
335 gridwin
.executeAction("ACTIVATE", tuple())
336 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
337 xChartMain
= xChartMainTop
.getChild("chart_window")
338 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
339 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
340 xDialog
= self
.xUITest
.getTopFocusWindow()
341 #Click on tab "Type".
342 tabcontrol
= xDialog
.getChild("tabcontrol")
343 select_pos(tabcontrol
, "0")
345 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
346 exponential
= xDialog
.getChild("exponential") #type regression exponential
347 power
= xDialog
.getChild("exponential") #type regression power
348 polynomial
= xDialog
.getChild("polynomial") #type regression polynomial
349 degree
= xDialog
.getChild("degree")
350 xentryname
= xDialog
.getChild("entry_name") #add name
351 extrapolateForward
= xDialog
.getChild("extrapolateForward")
352 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
353 setIntercept
= xDialog
.getChild("setIntercept")
354 interceptValue
= xDialog
.getChild("interceptValue")
355 showEquation
= xDialog
.getChild("showEquation")
356 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
357 xVarname
= xDialog
.getChild("entry_Xname")
358 yVarName
= xDialog
.getChild("entry_Yname")
360 self
.assertEqual(get_state_as_dict(polynomial
)["Checked"], "true")
361 self
.assertEqual(get_state_as_dict(degree
)["Text"], "3")
362 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Name")
363 self
.assertEqual(get_state_as_dict(extrapolateForward
)["Text"], "1")
364 self
.assertEqual(get_state_as_dict(extrapolateBackward
)["Text"], "1")
365 self
.assertEqual(get_state_as_dict(showEquation
)["Selected"], "true")
366 self
.assertEqual(get_state_as_dict(setIntercept
)["Selected"], "true")
367 self
.assertEqual(get_state_as_dict(interceptValue
)["Text"], "1")
368 self
.assertEqual(get_state_as_dict(showCorrelationCoefficient
)["Selected"], "true")
369 self
.assertEqual(get_state_as_dict(xVarname
)["Text"], "a")
370 self
.assertEqual(get_state_as_dict(yVarName
)["Text"], "f(a)")
372 #Click on tab "Line".
373 select_pos(tabcontrol
, "1")
374 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
375 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
377 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
378 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
380 xOKBtn
= xDialog
.getChild("ok")
381 self
.ui_test
.close_dialog_through_button(xOKBtn
)
383 #Now change regression Type to Moving average
384 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
385 gridwin
.executeAction("ACTIVATE", tuple())
386 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
387 xChartMain
= xChartMainTop
.getChild("chart_window")
388 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
389 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
390 xDialog
= self
.xUITest
.getTopFocusWindow()
391 #Click on tab "Type".
392 tabcontrol
= xDialog
.getChild("tabcontrol")
393 select_pos(tabcontrol
, "0")
394 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
395 exponential
= xDialog
.getChild("exponential") #type regression exponential
396 power
= xDialog
.getChild("exponential") #type regression power
397 movingAverage
= xDialog
.getChild("movingAverage") #type regression Moving average
398 period
= xDialog
.getChild("period")
399 xentryname
= xDialog
.getChild("entry_name") #add name
400 extrapolateForward
= xDialog
.getChild("extrapolateForward")
401 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
402 setIntercept
= xDialog
.getChild("setIntercept")
403 interceptValue
= xDialog
.getChild("interceptValue")
404 showEquation
= xDialog
.getChild("showEquation")
405 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
406 xVarname
= xDialog
.getChild("entry_Xname")
407 yVarName
= xDialog
.getChild("entry_Yname")
409 movingAverage
.executeAction("CLICK", tuple()) #set polynomial
410 period
.executeAction("UP", tuple())
412 #Click on tab "Line".
413 select_pos(tabcontrol
, "1")
414 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
415 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
417 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
418 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
420 xOKBtn
= xDialog
.getChild("ok")
421 self
.ui_test
.close_dialog_through_button(xOKBtn
)
423 #reopen and verify Moving average
424 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
425 gridwin
.executeAction("ACTIVATE", tuple())
426 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
427 xChartMain
= xChartMainTop
.getChild("chart_window")
428 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
429 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
430 xDialog
= self
.xUITest
.getTopFocusWindow()
431 #Click on tab "Type".
432 tabcontrol
= xDialog
.getChild("tabcontrol")
433 select_pos(tabcontrol
, "0")
435 logarithmic
= xDialog
.getChild("logarithmic") #type regression logarithmic
436 exponential
= xDialog
.getChild("exponential") #type regression exponential
437 power
= xDialog
.getChild("exponential") #type regression power
438 polynomial
= xDialog
.getChild("polynomial") #type regression polynomial
439 movingAverage
= xDialog
.getChild("movingAverage") #type regression Moving average
440 degree
= xDialog
.getChild("degree")
441 period
= xDialog
.getChild("period")
442 xentryname
= xDialog
.getChild("entry_name") #add name
443 extrapolateForward
= xDialog
.getChild("extrapolateForward")
444 extrapolateBackward
= xDialog
.getChild("extrapolateBackward")
445 setIntercept
= xDialog
.getChild("setIntercept")
446 interceptValue
= xDialog
.getChild("interceptValue")
447 showEquation
= xDialog
.getChild("showEquation")
448 showCorrelationCoefficient
= xDialog
.getChild("showCorrelationCoefficient")
449 xVarname
= xDialog
.getChild("entry_Xname")
450 yVarName
= xDialog
.getChild("entry_Yname")
452 self
.assertEqual(get_state_as_dict(movingAverage
)["Checked"], "true")
453 self
.assertEqual(get_state_as_dict(period
)["Text"], "3")
454 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Name")
456 #Click on tab "Line".
457 select_pos(tabcontrol
, "1")
458 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
459 xTransparent
= xDialog
.getChild("MTR_LINE_TRANSPARENT")
461 self
.assertEqual(get_state_as_dict(xWidth
)["Text"], "0.10 cm")
462 self
.assertEqual(get_state_as_dict(xTransparent
)["Text"], "5%")
464 xOKBtn
= xDialog
.getChild("ok")
465 self
.ui_test
.close_dialog_through_button(xOKBtn
)
467 self
.ui_test
.close_doc()
468 # vim: set shiftwidth=4 softtabstop=4 expandtab: