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 "Type in the Chart document <TAB>"
67 DocumentChart.TypeKeys "<TAB>"
68 printlog "Format / Object properties"
69 FormatObjectProperties
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"
176 printlog "Edit / Object Edit"
177 Kontext "DocumentChart"
178 printlog "Type thrice in the Chart document <TAB>"
179 DocumentChart.TypeKeys "<TAB>" , 3
180 printlog "Format / Object properties"
181 FormatObjectProperties
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 Kontext "DocumentChart"
303 printlog "Type thrice in the Chart document <TAB>"
304 DocumentChart.TypeKeys "<TAB>" , 3
305 printlog "Press F3-key to enter the data series."
306 DocumentChart.TypeKeys "<F3>"
307 if fInvokeTrendLinesDialog() > 0 then
308 warnlog "Something went wrong trying to invoke Trend Lines dialog -> Check this out!"
312 Kontext "InsertTrendlinesDialog"
313 Call DialogTest(InsertTrendlinesDialog)
314 printlog "Select Linear radio-button"
316 printlog "Check Show Equation check-box"
318 printlog "Leave the dialog with OK"
319 InsertTrendlinesDialog.OK
320 Kontext "DocumentChart"
321 printlog "Leave Chart by ESC and reenter Chart"
322 DocumentChart.TypeKeys "<ESC>" , 2
325 Kontext "DocumentChart"
326 printlog "Type <TAB> thrice in the Chart document, press F3 and <TAB> to select the equation"
327 DocumentChart.TypeKeys "<TAB>" , 3
328 DocumentChart.TypeKeys "<F3>"
329 DocumentChart.TypeKeys "<TAB>"
330 printlog "Format / Object properties"
331 FormatObjectProperties
333 printlog "Count the numbers of tab pages. It should be 7 in CTL mode."
334 if Active.GetPageCount <> 7 then
335 warnlog "The count of tab pages is not 7, it is " & Active.GetPageCount & "!"
337 printlog "Select the Alignment tab page (only available in CTL mode!)"
338 Active.SetPage TabFormatChartTitleAlignment
339 Kontext "TabFormatChartTitleAlignment"
340 Call DialogTest(TabFormatChartTitleAlignment)
341 printlog "Check that the text direction list-box contains 3 entries."
342 sValidateTextDirection(TextDirection2)
343 printlog "Leave the dialog with cancel"
344 TabFormatChartTitleAlignment.Cancel
345 if bCTLSupBefore <> gCTLSup then
346 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
347 printlog "Reset the state of CTL support to the default before this test case has been executed"
349 printlog "File / Close"
353 '-------------------------------------------------------------------------
355 testcase tDataPointTextDirection
356 Dim bCTLSupBefore as boolean
357 Dim oControlToCheck as object
358 Dim oControlToCheck2 as object
359 Dim oControlToCheck3 as object
360 Dim iCombination as integer
363 if fLoadVerySimpleChartAndSaveLocal() > 0 then
364 warnlog "Loading test document seems to have failed -> Check this out!"
367 printlog "Load test document and save it local as ../user/work/verySimpleChart.ods"
369 printlog "Enable the complex text layout (CTL) support under Tools / Options / Language Settings / Languages / Enhanced language support"
370 bCTLSupBefore = ActiveDeactivateCTLSupport(TRUE)
372 printlog "Select the first OLE object"
374 printlog "Edit / Object Edit"
375 Kontext "DocumentChart"
376 printlog "Type thrice in the Chart document <TAB>"
377 DocumentChart.TypeKeys "<TAB>" , 3
378 printlog "Press F3-key to enter the data series."
379 DocumentChart.TypeKeys "<F3>"
380 printlog "Format / Object properties"
381 FormatObjectProperties
383 Active.Setpage TabDataPointLabels
384 Kontext "TabDataPointLabels"
385 for iCombination = 1 to 7
386 select case iCombination
387 'Check-box combinations with 1, 2 or 3 enabled check-boxes.
388 case 1 : oControlToCheck = ShowValue
389 sText = "Show value as number"
390 case 2 : oControlToCheck = AsPercentage
391 sText = "Show value as percentage"
392 case 3 : oControlToCheck = ShowLabelText
393 sText = "Show category"
395 case 4 : oControlToCheck = ShowValue
396 oControlToCheck2 = AsPercentage
397 sText = "Show value as number and Show value as percentage"
398 case 5 : oControlToCheck = ShowValue
399 oControlToCheck2 = ShowLabelText
400 sText = "Show value as number Show category"
401 case 6 : oControlToCheck2 = AsPercentage
402 oControlToCheck2 = ShowLabelText
403 sText = "Show value as percentage and Show category"
405 case 7 : oControlToCheck = ShowValue
406 oControlToCheck2 = AsPercentage
407 oControlToCheck3 = ShowLabelText
408 sText = "Show value as number and Show value as percentage and Show category"
410 case else : warnlog "Wrong combination entered. Exiting!"
411 TabDataPointLabels.Cancel
415 'One checked check-box
416 if iCombination > 0 AND iCombination < 4 then
417 if fSetCheckBox(oControlToCheck, TRUE) > 0 then
418 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
419 TabDataPointLabels.Cancel
423 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
424 sValidateTextDirection(TextDirection)
427 'Two checked check-boxes
428 if iCombination > 3 AND iCombination < 7 then
429 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 then
430 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
431 TabDataPointLabels.Cancel
435 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
436 sValidateTextDirection(TextDirection)
438 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
439 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
440 TabDataPointLabels.Cancel
445 'Three checked check-boxes
446 if iCombination = 7 then
447 if fSetCheckBox(oControlToCheck, TRUE) > 0 AND fSetCheckBox(oControlToCheck2, TRUE) > 0 AND fSetCheckBox(oControlToCheck3, TRUE) > 0 then
448 warnlog "Setting check-box '" & sText & "' failed. Exiting test case"
449 TabDataPointLabels.Cancel
453 printlog "Check '" & sText & "' and check that text direction-list-box contains 3 entries."
454 sValidateTextDirection(TextDirection)
456 if fSetCheckBox(oControlToCheck2, FALSE) > 0 then
457 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
458 TabDataPointLabels.Cancel
462 if fSetCheckBox(oControlToCheck3, FALSE) > 0 then
463 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
464 TabDataPointLabels.Cancel
469 if fSetCheckBox(oControlToCheck, FALSE) > 0 then
470 warnlog "Unchecking check-box '" & sText & "' failed. Exiting test case"
471 TabDataPointLabels.Cancel
476 TabDataPointLabels.Cancel
477 if bCTLSupBefore <> gCTLSup then
478 Call ActiveDeactivateCTLSupport(bCTLSupBefore)
479 printlog "Reset the state of CTL support to the default before this test case has been executed"
481 printlog "File / Close"
485 '-------------------------------------------------------------------------
487 sub sValidateTextDirection (oThisListtBox as OBJECT)
488 Dim iEntries as integer
491 if oThisListtBox.IsEnabled then
492 printlog "Get the count of the list-box entries."
493 iEntries = oThisListtBox.GetItemCount
494 if iEntries <> 3 then
495 warnlog "There are " & iEntries &" and not 3 entries in the text direction list-box!"
497 printlog "3 entries in the text direction list-box"
500 warnlog "Text direction is not enabled!"