1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: ch2_insert_ctl.inc,v $
11 '* $Revision: 1.1.2.2 $
13 '* last change: $Author: jsi $ $Date: 2008/11/12 15:01:38 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : oliver.craemer@sun.com
36 '* short description : Chart resource test - CTL features
38 '************************************************************************
40 ' #1 tTitleTextDirection
41 ' #1 tLegendTextDirection
42 ' #1 tXAxisTextDirection
43 ' #1 tDataSeriesTextDirection
44 ' #1 tEquationTextDirection
45 ' #1 tDataPointTextDirection
46 ' #0 sValidateTextDirection
48 '\************************************************************************
50 testcase tTitleTextDirection
51 Dim bCTLSupBefore as boolean
53 if fLoadVerySimpleChartAndSaveLocal() > 0 then
54 warnlog "Loading test document seems to have failed -> Check this out!"
57 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
59 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
60 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
61 printlog "Select the first OLE object in the document."
63 printlog "Edit / Object / Edit"
65 Kontext "DocumentChart"
66 printlog "Select the Main Title by using the ChartElememtSelectorListBox in the toolbar (4th entry)"
67 call fChartSelectElement (4)
68 printlog "Open the properties dialog by using the FormatSelection button in the toolbar"
71 printlog "Select the tab page Alignment"
72 Active.SetPage TabFormatChartTitleAlignment
73 Kontext "TabFormatChartTitleAlignment"
74 call DialogTest(TabFormatChartTitleAlignment)
75 sValidateTextDirection(TextDirection)
76 TabFormatChartTitleAlignment.Cancel
77 printlog "Leave the tab page dialog with Cancel"
78 if bCTLSupBefore <> gCTLSup then
79 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
80 printlog "Reset the state of CTL support to the default before this test case has been executed"
82 printlog "File / Close"
86 '-------------------------------------------------------------------------
88 testcase tLegendTextDirection
89 Dim bCTLSupBefore as boolean
91 if fLoadVerySimpleChartAndSaveLocal() > 0 then
92 warnlog "Loading test document seems to have failed -> Check this out!"
95 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
97 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
98 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
100 printlog "Select the first OLE object"
102 printlog "Edit / Object Edit"
103 printlog "Format / Legend"
106 printlog "Select the tab page Position"
107 Active.SetPage TabLegendPosition
108 Kontext "TabLegendPosition"
109 call DialogTest(TabLegendPosition)
110 sValidateTextDirection(TextDirection)
111 TabLegendPosition.Cancel
112 if bCTLSupBefore <> gCTLSup then
113 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
114 printlog "Reset the state of CTL support to the default before this test case has been executed"
116 printlog "File / Close"
120 '-------------------------------------------------------------------------
122 testcase tXAxisTextDirection
123 Dim bCTLSupBefore as boolean
125 if fLoadVerySimpleChartAndSaveLocal() > 0 then
126 warnlog "Loading test document seems to have failed -> Check this out!"
129 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
131 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
132 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
133 printlog "Select the first OLE object"
135 printlog "Edit / Object Edit"
137 printlog "Format / Axis / X Axis"
140 printlog "Select the tab page Label"
141 Active.SetPage TabChartAxisLabel
142 Kontext "TabChartAxisLabel"
143 call DialogTest(TabChartAxisLabel)
144 sValidateTextDirection(TextDirection)
145 TabChartAxisLabel.Cancel
146 printlog "Leave the tab dialog with Cancel"
147 if bCTLSupBefore <> gCTLSup then
148 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
149 printlog "Reset the state of CTL support to the default before this test case has been executed"
151 printlog "File / Close"
155 '-------------------------------------------------------------------------
157 testcase tDataSeriesTextDirection
158 Dim bCTLSupBefore as boolean
159 Dim oControlToCheck as object
160 Dim oControlToCheck2 as object
161 Dim oControlToCheck3 as object
162 Dim iCombination as integer
165 if fLoadVerySimpleChartAndSaveLocal() > 0 then
166 warnlog "Loading test document seems to have failed -> Check this out!"
169 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
171 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
172 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
174 printlog "Select the first OLE object"
175 printlog "Edit / Object Edit"
177 printlog "Select DataSeries A by toolbar selectorbox"
178 call fChartSelectElement (8)
179 printlog "Insert DataLabels"
180 Kontext "DocumentChart"
183 Active.Setpage TabDataSeriesLabels
184 Kontext "TabDataSeriesLabels"
185 for iCombination = 1 to 7
186 select case iCombination
187 'Check-box combinations with 1, 2 or 3 enabled check-boxes.
188 case 1 : oControlToCheck = ShowValue
189 sText = "Show value as number"
190 case 2 : oControlToCheck = AsPercentage
191 sText = "Show value as percentage"
192 case 3 : oControlToCheck = ShowLabelText
193 sText = "Show category"
195 case 4 : oControlToCheck = ShowValue
196 oControlToCheck2 = AsPercentage
197 sText = "Show value as number and Show value as percentage"
198 case 5 : oControlToCheck = ShowValue
199 oControlToCheck2 = ShowLabelText
200 sText = "Show value as number Show category"
201 case 6 : oControlToCheck2 = AsPercentage
202 oControlToCheck2 = ShowLabelText
203 sText = "Show value as percentage and Show category"
205 case 7 : oControlToCheck = ShowValue
206 oControlToCheck2 = AsPercentage
207 oControlToCheck3 = ShowLabelText
208 sText = "Show value as number and Show value as percentage and Show category"
210 case else : warnlog "Wrong combination entered. Exiting!"
211 TabDataSeriesLabels.Cancel
215 'One checked check-box
216 if iCombination > 0 AND iCombination < 4 then
217 if fSetCheckBox(oControlToCheck, TRUE) > 0 then
218 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
219 TabDataSeriesLabels.Cancel
223 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
224 sValidateTextDirection(TextDirection)
227 'Two checked check-boxes
228 if iCombination > 3 AND iCombination < 7 then
229 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 then
230 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
231 TabDataSeriesLabels.Cancel
235 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
236 sValidateTextDirection(TextDirection)
238 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
239 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
240 TabDataSeriesLabels.Cancel
245 'Three checked check-boxes
246 if iCombination = 7 then
247 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 AND fSetCheckBox(oControlToCheck3, TRUE) > 0 then
248 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
249 TabDataSeriesLabels.Cancel
253 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
254 sValidateTextDirection(TextDirection)
256 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
257 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
258 TabDataSeriesLabels.Cancel
262 if fSetCheckBox(oControlToCheck3, FALSE) > 0 then
263 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
264 TabDataSeriesLabels.Cancel
269 if fSetCheckBox(oControlToCheck, FALSE) > 0 then
270 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
271 TabDataSeriesLabels.Cancel
276 TabDataSeriesLabels.Cancel
277 if bCTLSupBefore <> gCTLSup then
278 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
279 printlog "Reset the state of CTL support to the default before this test case has been executed"
281 printlog "File / Close"
285 '-------------------------------------------------------------------------
287 testcase tEquationTextDirection
288 Dim bCTLSupBefore as boolean
290 if fLoadVerySimpleChartAndSaveLocal() > 0 then
291 warnlog "Loading test document seems to have failed -> Check this out!"
294 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
296 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
297 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
298 printlog "Select the first OLE object"
300 printlog "Edit / Object Edit"
302 printlog "Select DataSeries A by toolbar selectorbox"
303 call fChartSelectElement (8)
304 Kontext "DocumentChart"
305 if fInvokeTrendLinesDialog() > 0 then
306 warnlog "Something went wrong trying to invoke Trend Lines dialog -> Check this out!"
310 Kontext "TabTrendLineType"
311 Call DialogTest(TabTrendLineType)
312 printlog "Select Linear radio-button"
314 printlog "Check Show Equation check-box"
316 printlog "Leave the dialog with OK"
318 Kontext "DocumentChart"
319 printlog "Select Equation by toolbar selectorbox"
320 call fChartSelectElement (10)
321 printlog "Format / Object properties"
322 FormatSelection.Click
324 printlog "Count the numbers of tab pages. It should be 7 in CTL mode."
325 if Active.GetPageCount <> 7 then
326 warnlog "The count of tab pages is not 7, it is " & Active.GetPageCount & "!"
328 printlog "Select the Alignment tab page (only available in CTL mode!)"
329 Active.SetPage TabFormatChartTitleAlignment
330 Kontext "TabFormatChartTitleAlignment"
331 Call DialogTest(TabFormatChartTitleAlignment)
332 printlog "Check that the text direction list-box contains 3 entries."
333 sValidateTextDirection(TextDirection2)
334 printlog "Leave the dialog with cancel"
335 TabFormatChartTitleAlignment.Cancel
336 if bCTLSupBefore <> gCTLSup then
337 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
338 printlog "Reset the state of CTL support to the default before this test case has been executed"
340 printlog "File / Close"
344 '-------------------------------------------------------------------------
346 testcase tDataPointTextDirection
347 Dim bCTLSupBefore as boolean
348 Dim oControlToCheck as object
349 Dim oControlToCheck2 as object
350 Dim oControlToCheck3 as object
351 Dim iCombination as integer
354 if fLoadVerySimpleChartAndSaveLocal() > 0 then
355 warnlog "Loading test document seems to have failed -> Check this out!"
358 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
360 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
361 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
363 printlog "Select the first OLE object"
365 printlog "Edit / Object Edit"
366 printlog "Select DataSeries A by toolbar selectorbox"
367 call fChartSelectElement (8)
368 Kontext "DocumentChart"
369 printlog "Press F3-key to enter the data series."
370 DocumentChart.TypeKeys "<F3>"
371 printlog "Insert / DataLabels"
374 Active.Setpage TabDataPointLabels
375 Kontext "TabDataPointLabels"
376 for iCombination = 1 to 7
377 select case iCombination
378 'Check-box combinations with 1, 2 or 3 enabled check-boxes.
379 case 1 : oControlToCheck = ShowValue
380 sText = "Show value as number"
381 case 2 : oControlToCheck = AsPercentage
382 sText = "Show value as percentage"
383 case 3 : oControlToCheck = ShowLabelText
384 sText = "Show category"
386 case 4 : oControlToCheck = ShowValue
387 oControlToCheck2 = AsPercentage
388 sText = "Show value as number and Show value as percentage"
389 case 5 : oControlToCheck = ShowValue
390 oControlToCheck2 = ShowLabelText
391 sText = "Show value as number Show category"
392 case 6 : oControlToCheck2 = AsPercentage
393 oControlToCheck2 = ShowLabelText
394 sText = "Show value as percentage and Show category"
396 case 7 : oControlToCheck = ShowValue
397 oControlToCheck2 = AsPercentage
398 oControlToCheck3 = ShowLabelText
399 sText = "Show value as number and Show value as percentage and Show category"
401 case else : warnlog "Wrong combination entered. Exiting!"
402 TabDataPointLabels.Cancel
406 'One checked check-box
407 if iCombination > 0 AND iCombination < 4 then
408 if fSetCheckBox(oControlToCheck, TRUE) > 0 then
409 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
410 TabDataPointLabels.Cancel
414 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
415 sValidateTextDirection(TextDirection)
418 'Two checked check-boxes
419 if iCombination > 3 AND iCombination < 7 then
420 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 then
421 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
422 TabDataPointLabels.Cancel
426 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
427 sValidateTextDirection(TextDirection)
429 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
430 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
431 TabDataPointLabels.Cancel
436 'Three checked check-boxes
437 if iCombination = 7 then
438 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 AND fSetCheckBox(oControlToCheck3, TRUE) > 0 then
439 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
440 TabDataPointLabels.Cancel
444 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
445 sValidateTextDirection(TextDirection)
447 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
448 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
449 TabDataPointLabels.Cancel
453 if fSetCheckBox(oControlToCheck3, FALSE) > 0 then
454 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
455 TabDataPointLabels.Cancel
460 if fSetCheckBox(oControlToCheck, FALSE) > 0 then
461 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
462 TabDataPointLabels.Cancel
467 TabDataPointLabels.Cancel
468 if bCTLSupBefore <> gCTLSup then
469 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
470 printlog "Reset the state of CTL support to the default before this test case has been executed"
472 printlog "File / Close"
476 '-------------------------------------------------------------------------
478 sub sValidateTextDirection (oThisListtBox as OBJECT)
479 Dim iEntries as integer
482 if oThisListtBox.IsEnabled then
483 printlog "Get the count of the list-box entries."
484 iEntries = oThisListtBox.GetItemCount
485 if iEntries <> 3 then
486 warnlog "There are " & iEntries &" and not 3 entries in the text direction list-box!"
488 printlog "3 entries in the text direction list-box"
491 warnlog "Text direction is not enabled!"