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: g_character.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:39 $
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 : wolfram.garten@sun.com
36 '* short description :
38 '*******************************************************************
42 ' #1 tSetFormatCharacter
43 ' #1 tGetFormatCharacter
45 '\*******************************************************************
46 testcase tFormatCharacter
51 '/// open application ///'
55 '/// create a textframe with content ///'
56 hTextrahmenErstellen ("This is a check, a check, a check.",10,10,60,30)
57 '/// type with keys [strg]+[home] [shift]+[end] to select the inserted text ///'
58 hTypeKeys "<MOD1 HOME><shift end>"
61 '/// Format->Character ///'
64 '/// switch to tabpage 'Font' ///'
66 Messagebox.SetPage TabFont
70 '/// switch to tabpage 'Font Effects' ///'
72 Messagebox.SetPage TabFontEffects
73 kontext "TabFontEffects"
76 '/// switch to tabpage 'Position' ///'
78 Messagebox.SetPage TabFontPosition
79 Kontext "TabFontPosition"
82 '/// close dialog 'Character' with 'OK' ///'
84 '/// close application ///'
87 endcase 'tFormatCharacter
88 '---------------------------------------------------------
89 testcase tDialogCharacter
94 Dim CountOfThem as integer
95 Dim CountOfColors as integer
98 Dim TestColorString as string
99 Dim ThisIsMyTextFromControl as string
100 Dim Asiansupportsetting as string
102 Printlog "DialogCharacter starts"
108 hToolsOptions ( "LanguageSettings", "Languages" )
110 if Aktivieren.IsChecked then '/// Check in what state Asian support is ///'
111 Asiansupportsetting = TRUE
113 Asiansupportsetting = FALSE
114 Aktivieren.Check '/// Activate if not already activated ///'
117 Kontext "ExtrasOptionenDlg"
123 Call hTextrahmenErstellen ( "Some text in a box.", 20, 20, 50, 50 )
127 Kontext '"Active" ' insert this, perhaps another
128 Active.SetPage TabFont ' tabpage is active at open
130 CountOfThem = FontWest.GetItemCount
131 for y = 1 to CountOfThem
133 Xtext = FontWest.GetSelText
134 ' printlog "This FontWest is: " & Xtext
137 CountOfThem = StyleWest.GetItemCount
138 for y = 1 to CountOfThem
140 Xtext = StyleWest.GetSelText
141 ' printlog "This StyleWest is: " & Xtext
144 CountOfThem = SizeWest.GetItemCount
145 for y = 1 to CountOfThem
147 Xtext = SizeWest.GetSelText
148 ' printlog "This SizeWest is: " & Xtext
151 CountOfThem = LanguageWest.GetItemCount
152 for y = 1 to CountOfThem
153 LanguageWest.Select y
154 Xtext = LanguageWest.GetSelText
155 ' printlog "This LanguageWest is: " & Xtext
158 CountOfThem = FontEast.GetItemCount
159 for y = 1 to CountOfThem
161 Xtext = FontEast.GetSelText
162 ' printlog "This FontEast is: " & Xtext
165 CountOfThem = StyleEast.GetItemCount
166 for y = 1 to CountOfThem
168 Xtext = StyleEast.GetSelText
169 ' printlog "This StyleEast is: " & Xtext
172 CountOfThem = SizeEast.GetItemCount
173 for y = 1 to CountOfThem
175 Xtext = SizeEast.GetSelText
176 ' printlog "This SizeEast is: " & Xtext
179 CountOfThem = LanguageEast.GetItemCount
180 for y = 1 to CountOfThem
181 LanguageEast.Select y
182 Xtext = LanguageEast.GetSelText
183 ' printlog "This LanguageEast is: " & Xtext
187 Active.SetPage TabFontEffects
188 Kontext "TabFontEffects"
189 if NOT Outline.IsChecked then
193 if NOT Shadow.IsChecked then
197 CountOfThem = Underline.GetItemCount
198 CountOfColors = Color.GetItemCount
200 for y = 2 to CountOfThem
202 Xtext = Underline.GetSelText
203 ' printlog "This Underline is: " & Xtext
205 for i = 1 to CountOfColors
207 TestColorString = Color.GetSelText
208 ' printlog "This Color is: " & TestColorString
212 CountOfThem = StrikeThrough.GetItemCount
213 for y = 2 to CountOfThem
214 StrikeThrough.Select y
215 IndividualWords.UnCheck
216 Xtext = StrikeThrough.GetSelText
217 ' printlog "The StrikeThrough is: " & Xtext
219 for i = 1 to CountOfColors
221 TestColorString = Color.GetSelText
222 ' printlog "And the Color is: " & TestColorString
226 IndividualWords.Check
227 printlog "Individual Words = On"
229 CountOfThem = StrikeThrough.GetItemCount
230 for y = 2 to CountOfThem
231 StrikeThrough.Select y
232 Xtext = StrikeThrough.GetSelText
233 ' printlog "The StrikeThrough is: " & Xtext
235 for i = 1 to CountOfColors
237 TestColorString = Color.GetSelText
238 ' printlog "And the Color is: " & TestColorString
242 CountOfThem = Emphasis.GetItemCount
243 for y = 2 to CountOfThem
245 Xtext = Emphasis.GetSelText
246 ' printlog "The Emphasis is: " & Xtext
248 for i = 1 to CountOfColors
250 TestColorString = Color.GetSelText
251 ' printlog "And the Color is: " & TestColorString
255 CountOfThem = Position.GetItemCount
256 for y = 1 to CountOfThem
258 Xtext = Position.GetSelText
259 ' printlog "The Position is: " & Xtext
260 for i = 1 to CountOfColors
262 TestColorString = Color.GetSelText
263 ' printlog "And the Color is: " & TestColorString
267 CountOfThem = FontColor.GetItemCount
268 for z = 1 to CountOfThem
270 TestColorString = FontColor.GetSelText
271 ' printlog "The FontColor is: " & TestColorString
274 CountOfThem = Relief.GetItemCount
275 TestColorString = Color.GetSelText
276 for y = 1 to CountOfThem
278 Xtext = Relief.GetSelText
279 TestColorString = Color.GetSelText
280 ' printlog "The Relief is: " & Xtext
284 Active.SetPage TabFontPosition '/// Changes the active tab to "Position"
285 Kontext "TabFontPosition"
286 printlog "TabFontPosition"
289 RelativeFontSize.ToMin '/// Testing the "Relative Font Size"-Listbox
290 ThisIsMyTextFromControl = RelativeFontSize.GetText
291 ' printlog "The Relative Font Size minimum is: " & ThisIsMyTextFromControl
293 RelativeFontSize.TypeKeys "<UP>"
294 ThisIsMyTextFromControl = RelativeFontSize.GetText
295 ' printlog "The Relative Font Size is: " & ThisIsMyTextFromControl
299 ScaleWith.ToMin '/// Testing the "Scale With"-Listbox
300 ThisIsMyTextFromControl = ScaleWith.GetText
301 printlog "ScaleWith minimum is:" & ThisIsMyTextFromControl
302 ' ScaleWith.TypeKeys "<TAB>"
304 ScaleWith.TypeKeys "<UP>"
305 ThisIsMyTextFromControl = ScaleWith.GetText
306 ' printlog "ScaleWith is:" & ThisIsMyTextFromControl
312 RelativeFontSize.ToMin '/// Testing the "Reliative Font Size"-Listbox again but this time
313 ThisIsMyTextFromControl = RelativeFontSize.GetText '/// with "Subscript" and "Normal" Checked
314 printlog "The Relative Font Size minimum is: " & ThisIsMyTextFromControl
316 RelativeFontSize.TypeKeys "<UP>"
317 ThisIsMyTextFromControl = RelativeFontSize.GetText
318 ' printlog "The Relative Font Size is: " & ThisIsMyTextFromControl
323 ScaleWith.ToMin '/// Testing the "ScaleWith"-Listbox
324 ThisIsMyTextFromControl = ScaleWith.GetText
325 printlog "The ScaleWith Size is: " & ThisIsMyTextFromControl
327 ScaleWith.TypeKeys "<UP>"
328 ThisIsMyTextFromControl = ScaleWith.GetText
329 ' printlog "The ScaleWith Size is: " & ThisIsMyTextFromControl
332 ThisIsMyTextFromControl = Spacing.GetSelText '/// Testing the "Spacing"-ListBox
333 printlog "The Spacing is first: " & ThisIsMyTextFromControl
336 ThisIsMyTextFromControl = Spacing.GetSelText
337 printlog "The Spacing is: " & ThisIsMyTextFromControl
338 ThisIsMyTextFromControl = SpacingBy.GetText '/// Testing the "Spacing By"-Scrollbox
339 ' printlog "The SpacingBy Size minimum is: " & ThisIsMyTextFromControl
343 ThisIsMyTextFromControl = SpacingBy.GetText
344 ' printlog "The SpacingBy Size is: " & ThisIsMyTextFromControl
349 Kontext "TabFontPosition"
352 if Asiansupportsetting = FALSE then
355 hToolsOptions ( "LanguageSettings", "Languages" )
356 Aktivieren.UnCheck '/// Deactivate if not already deactivated ///'
357 Printlog "Reseted the Asiansupport-value to it's original state"
359 Kontext "ExtrasOptionenDlg"
363 ' ActiveDeactivateAsianSupport = FALSE
366 Printlog "DialogCharacter Ends"
369 endcase 'tDialogCharacter
370 '--------------------------------------------------------
371 testcase tSetFormatCharacter
373 if iSprache = 48 then
374 qaerrorlog "Test not adapted to polish, 48."
379 dim iAsian as integer
380 dim iComplex as integer
381 dim bAsian as boolean
382 dim bComplex as boolean
383 dim sLanguage(500) as string
387 if (gApplication = "IMPRESS") then
388 ExtensionString = "odp"
390 ExtensionString = "odg"
393 sFile = convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + "."+ExtensionString)
394 '/// create document, if it doesn't exist, else skip this case :-) ///'
395 if (dir(sFile)="") then
396 '/// open application ///'
399 '/// activate all languages in options ///'
400 '///+ Tools->Options ///'
402 '///+ select tabpage 'Languages' from set 'Language Settings' ///'
403 hToolsOptions("LANGUAGESETTINGS","Languages")
404 kontext "TabSprachen"
405 '///+ save state and check checkbox 'Asian languages support' ///'
406 '/// if the language is Asian, skip this part ///'
407 printlog "iSprache = " + iSprache
408 if bAsianLan = FALSE then
409 bAsian = Aktivieren.isEnabled
412 '///+ save state and check checkbox 'Complex text layout (CTL) support' ///'
413 bComplex = ComplexScriptEnabled.isEnabled
414 ComplexScriptEnabled.check
415 '///+ close dialog 'Options' with OK ///'
416 Kontext "ExtrasOptionenDlg"
419 '/// get count of languages ///'
420 '///+ Format->Character ///'
424 '///+ switch to tabpage 'Font' ///'
425 Messagebox.SetPage TabFont
428 '///+ get count of languages for Western/Asian/CTL fonts ///'
429 iWest = LanguageWest.getItemCount
430 iAsian = LanguageEast.getItemCount
431 iComplex = LanguageCTL.getItemCount
432 if bAsianLan = True then
433 if (iWest <> 144) then
434 Warnlog "Western text font languages count wrong; expected: '113' is: '" + iWest + "'"
436 Printlog "Western text font languages count: " + iWest
438 if (iAsian <> 8) then
439 Warnlog "Asian text font languages count wrong; expected: '9' is: '" + iAsian + "'"
441 Printlog "Asian text font languages count : " + iAsian
443 if (iComplex <> 50) then
444 Warnlog "CTL font languages count wrong; expected: '30' is: '" + iComplex + "'"
446 Printlog "CTL font languages count : " + iComplex
449 if (iWest <> 113) then
450 Warnlog "Western text font languages count wrong; expected: '113' is: '" + iWest + "'"
452 Printlog "Western text font languages count: " + iWest
454 if (iAsian <> 9) then
455 Warnlog "Asian text font languages count wrong; expected: '9' is: '" + iAsian + "'"
457 Printlog "Asian text font languages count : " + iAsian
459 if (iComplex <> 30) then
460 Warnlog "CTL font languages count wrong; expected: '30' is: '" + iComplex + "'"
462 Printlog "CTL font languages count : " + iComplex
465 '///+ close dialog 'Character' with OK ///'
468 WL_SD_TextEinfuegenDraw
469 gMouseMove ( 1, 1, 100, 100 )
471 '///+ print the language counts into the first line of the document ///'
472 hTypeKeys(" "+iWest+" "+iAsian+" "+iComplex+"<return>")
475 '/// set all languages to '[None]' ///'
476 '///+ Format->Character ///'
479 '///+ select '[None]' (should be the first entry in every listbox) ///'
480 LanguageWest.select 1
481 LanguageEast.select 1
483 '///+ close dialog 'Character' with OK ///'
486 '/// print one line with language formated text for every language ///'
488 '///+ Format->Character ///'
491 '///+ select the next language ///'
492 LanguageWest.select i
493 sTemp = LanguageWest.getItemText (i)
494 ListAppend(sLanguage(), sTemp)
495 '///+ close dialog 'Character' with OK ///'
497 '///+ type [return][number of language in list][Tab][Language name][Tab] ///'
498 hTypeKeys(""+i+"<tab>"+sTemp+"<tab><return>")
503 LanguageWest.select 1
504 LanguageEast.select 1
512 LanguageEast.select i
513 sTemp = LanguageEast.getItemText (i)
514 ListAppend(sLanguage(), sTemp)
516 hTypeKeys(""+i+"<tab>"+sTemp+"<tab><return>")
521 LanguageWest.select 1
522 LanguageEast.select 1
526 for i = 1 to iComplex
531 sTemp = LanguageCTL.getItemText (i)
532 ListAppend(sLanguage(), sTemp)
534 hTypeKeys(""+i+"<tab>"+sTemp+"<tab><return>")
537 '/// save the created document & the languages list if they don't exists ///'
539 qaErrorLog "Created file. Please check it and then commit it! " + sTemp
540 sTemp = convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + ".txt")
541 if (dir(sTemp)="") then
542 ListWrite(sLanguage(), sTemp,"utf8")
545 '/// restore the options ///'
546 '///+ Tools->Options ///'
548 '///+ select tabpage 'Languages' from set 'Language Settings' ///'
549 hToolsOptions("LANGUAGESETTINGS","Languages")
550 kontext "TabSprachen"
552 '///+ restore state of checkbox 'Asian languages support' ///'
553 '/// if the language is Asian, skip this part ///'
554 if bAsianLan = FALSE then
555 if (bAsian <> TRUE) then
559 '///+ restore state of checkbox 'Complex text layout (CTL) support' ///'
560 if (bComplex <> TRUE) then
561 ComplexScriptEnabled.UNcheck
563 '///+ close dialog 'Options' with OK ///'
564 Kontext "ExtrasOptionenDlg"
567 '/// close application ///'
571 endcase 'tSetFormatCharacter
572 '--------------------------------------------------------
573 testcase tGetFormatCharacter
575 qaerrorlog "tGetFormatCharacter outcommented due to too many qaerrorlogs"
578 dim iWest(2) as integer
579 dim iAsian(2) as integer
580 dim iComplex(2) as integer
581 dim bAsian as boolean
582 dim bComplex as boolean
583 dim sLanguage(500) as string
584 dim sLanguageR(500) as string
587 dim sSpellBooks(30) as string
589 if (gApplication = "IMPRESS") then
590 ExtensionString = "odp"
592 ExtensionString = "odg"
595 '/// open the english document with all languages ///'
596 hDateiOeffnen (convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + "."+ExtensionString)
597 ListRead(sLanguageR(), convertPath(gTesttoolpath + "graphics\required\input\spellb_1.txt"),"utf8")
599 '/// activate all languages in options ///'
600 '///+ Tools->Options ///'
602 '///+ select tabpage 'Languages' from set 'Language Settings' ///'
603 hToolsOptions("LANGUAGESETTINGS","Languages")
604 kontext "TabSprachen"
605 '///+ save state and check checkbox 'Asian languages support' ///'
606 bAsian = Aktivieren.isEnabled
608 '///+ save state and check checkbox 'Complex text layout (CTL) support' ///'
609 bComplex = ComplexScriptEnabled.isEnabled
610 ComplexScriptEnabled.check
611 '///+ close dialog 'Options' with OK ///'
612 Kontext "ExtrasOptionenDlg"
615 '/// get count of languages ///'
616 hTypeKeys("<tab><f2>")
617 '///+ first how many are in the reference document (printed in the first line)///'
618 hTypeKeys("<mod1 home><shift end>")
622 iTemp = inStr(2,sTemp, " ")
623 iWest(1) = mid(sTemp, 2, iTemp-2)
624 i = inStr(iTemp+1,sTemp, " ")
625 iAsian(1) = mid(sTemp, iTemp+1, iTemp-i)
626 iComplex(1) = right(sTemp, Len(sTemp) - i)
628 '///+ Format->Character ///'
632 '///+ switch to tabpage 'Font' ///'
633 Messagebox.SetPage TabFont
636 '///+ get count of languages for Western/Asian/CTL fonts ///'
637 iWest(2) = LanguageWest.getItemCount
638 iAsian(2) = LanguageEast.getItemCount
639 iComplex(2) = LanguageCTL.getItemCount
640 if (iWest(2) <> iWest(1)) then
641 Warnlog "Western text font languages count wrong; expected: '" + iWest(1) + "' is: '" + iWest(2) + "'"
643 Printlog "Western text font languages count: " + iWest(2)
645 if (iAsian(2) <> iAsian(1)) then
646 Warnlog "Asian text font languages count wrong; expected: '" + iAsian(1) + "' is: '" + iAsian(2) + "'"
648 Printlog "Asian text font languages count : " + iAsian(2)
650 if (iComplex(2) <> iComplex(1)) then
651 Warnlog "CTL font languages count wrong; expected: '" + iComplex(1) + "' is: '" + iComplex(2) + "'"
653 Printlog "CTL font languages count : " + iComplex(2)
655 '///+ close dialog 'Character' with OK ///'
658 '/// write the language for every line in the current language ///'
659 hTypeKeys("<mod1 home><down><home>")
660 for i = 1 to iWest(2)
664 iTemp = LanguageWest.getSelIndex
665 sTemp = LanguageWest.getSelText
666 ListAppend(sLanguage(), sTemp)
668 '///+ type [end][number of language in list][Tab][Language name][down][home] ///'
669 hTypeKeys("<end>"+iTemp+"<tab>"+sTemp+"<down><home>")
672 for i = 1 to iAsian(2)
676 iTemp = LanguageEast.getSelIndex
677 sTemp = LanguageEast.getSelText
678 ListAppend(sLanguage(), sTemp)
680 hTypeKeys("<end>"+iTemp+"<tab>"+sTemp+"<down><home>")
683 for i = 1 to iComplex(2)
687 iTemp = LanguageCTL.getSelIndex
688 sTemp = LanguageCTL.getSelText
689 ListAppend(sLanguage(), sTemp)
691 hTypeKeys("<end>"+iTemp+"<tab>"+sTemp+"<down><home>")
694 '/// save the created document & the languages list ///'
695 sTemp = convertPath(gOfficePath + "user\work\spellb_" + iSprache)
696 hFileSaveAsKill (sTemp)
697 sTemp = convertPath(gOfficePath + "user\work\spellb_" + iSprache + ".txt")
698 if (dir(sTemp)<>"") then
701 ListWrite(sLanguage(), sTemp,"utf8")
703 for i = 1 to ListCount(sLanguageR())
705 case 1:printlog " * Western text font languages"
706 case iWest(2)+1:printlog " * Asian text font languages"
707 case iWest(2)+iAsian(2)+1:printlog " * CTL font languages"
709 if (sLanguageR(i) <> sLanguage(i)) then
710 if (instr(sLanguage(i), "[") > 0) then ' [None] - Entry ?
711 qaErrorlog "#i15863# - " + i + " '" + sLanguageR(i) + "' : '" + sLanguage(i) + "'"
713 qaErrorlog "#112362# - " + i + " '" + sLanguageR(i) + "' : '" + sLanguage(i) + "'"
718 '/// close application ///'
720 endcase 'tGetFormatCharacter