Update ooo320-m1
[ooovba.git] / testautomation / writer / optional / w_table.bas
blob4a953f09c222095a9ecd1e959961685a6fe5906e
1 '**************************************************************************
2 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 '*
4 '* Copyright 2008 by Sun Microsystems, Inc.
5 '*
6 '* OpenOffice.org - a multi-platform office productivity suite
7 '*
8 '* $RCSfile: w_table.bas,v $
9 '*
10 '* $Revision: 1.2 $
12 '* last change: $Author: vg $ $Date: 2008-08-18 12:22:57 $
14 '* This file is part of OpenOffice.org.
16 '* OpenOffice.org is free software: you can redistribute it and/or modify
17 '* it under the terms of the GNU Lesser General Public License version 3
18 '* only, as published by the Free Software Foundation.
20 '* OpenOffice.org is distributed in the hope that it will be useful,
21 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 '* GNU Lesser General Public License version 3 for more details
24 '* (a copy is included in the LICENSE file that accompanied this code).
26 '* You should have received a copy of the GNU Lesser General Public License
27 '* version 3 along with OpenOffice.org. If not, see
28 '* <http://www.openoffice.org/license.html>
29 '* for a copy of the LGPLv3 License.
31 '/************************************************************************
33 '* owner : helge.delfs@sun.com
35 '* short description : Writer Table test
37 '\***********************************************************************
39 global mUnit as string
40 global cDecSep as string 'Decimal Seperator init in 'sub w_204_'
41 global cSep as string 'Seperator for numbers formated as text init in 'sub w_204_'
42 global gLocaleDefault as string
43 global gDocumentLanguage as string
45 sub main
47 Dim StartZeit
48 StartZeit = Now()
50 use "writer\tools\includes\w_tools.inc"
51 use "writer\tools\includes\w_tool5.inc"
52 use "writer\tools\includes\w_tool6.inc"
54 use "writer\optional\includes\table\w_204_.inc"
55 use "writer\optional\includes\table\w_204a_.inc"
56 use "writer\optional\includes\table\w_204b_.inc"
58 printlog Chr(13) & "Loading of Include - Files takes: " & Wielange ( StartZeit )
60 Printlog ""
61 Printlog "----------------------------------------------"
62 Printlog "| Writer Table Test |"
63 Printlog "----------------------------------------------"
64 Printlog ""
66 'Checking for supported language
67 if fLocaleString("LocaleText") = "Abortion" then
68 warnlog "This test does not support language " & iSprache
69 exit sub
70 end if
71 'First some settings to verify a stable run
72 Call TableConfiguration
74 Call hStatusIn("writer","w_table.bas","Writer Table test")
75 Call w_204_
76 Call w_204a_
77 Call w_204b_
78 Call hStatusOut
80 'Restoring default settings after testrun
81 Call RestoreSettings
83 Printlog "Duration: "& WieLange ( StartZeit )
84 Printlog "Date: " & Date & " Time: " & Time
85 end sub
87 '---------------------------------------------------------------------------------------------------------------------
89 sub LoadIncludeFiles
90 use "global\system\includes\master.inc"
91 use "global\system\includes\gvariabl.inc"
92 use "global\tools\includes\optional\t_locale_strings1.inc"
93 Call GetUseFiles
94 gApplication = "WRITER"
95 end sub
97 sub TableConfiguration
98 Call wOptionsUndo("Tabelle")
99 Call hNewDocument
100 if iSprache = iSystemSprache then
101 printlog "Systemlocale matches UI-language"
102 else qaerrorlog "Systemlocale does not match UI-language, locale settings have to be adjusted"
103 ToolsOptions
104 Call hToolsOptions ("LanguageSettings", "Languages")
105 gLocaleDefault = Gebietsschema.GetSelText
106 Gebietsschema.Select(fLocaleString("LocaleLocaleSettings"))
107 Kontext "ExtrasOptionenDlg"
108 ExtrasOptionenDlg.OK
109 end if
110 'Verifiing if documentlanguage matches UI language
111 ToolsOptions
112 Call hToolsOptions ("LanguageSettings", "Languages")
113 if fLocaleString("LocaleScriptType") = "Western" then
114 gDocumentLanguage = Westlich.GetSelText
115 if gDocumentLanguage <> iSprache then Westlich.Select(fLocaleString("LocaleLocaleSettings"))
116 end if
117 if fLocaleString("LocaleScriptType") = "CJK" then
118 gDocumentLanguage = Asiatisch.GetSelText
119 if gDocumentLanguage <> iSprache then Asiatisch.Select(fLocaleString("LocaleLocaleSettings"))
120 end if
121 if fLocaleString("LocaleScriptType") = "CTL" then
122 gDocumentLanguage = LanguageComplexScript.GetSelText
123 if gDocumentLanguage <> iSprache then LanguageComplexScript.Select(fLocaleString("LocaleLocaleSettings"))
124 end if
125 Kontext "ExtrasOptionenDlg"
126 ExtrasOptionenDlg.OK
128 mUnit = fSetMeasurementToCM()
129 ToolsOptions
130 Call hToolsOptions ("Writer","GENERAL")
131 cDecSep = GetDecimalSeperator(Tabulatorenabstand.GetText)
132 Kontext "ExtrasOptionenDlg"
133 ExtrasOptionenDlg.Ok
135 ' Seperator to calculate with is not the same as used in UI
136 ' so we can't use GetDecimalSeparator here
137 Call wTypeKeys ("1/2")
138 Call wTypeKeys ("<Shift Home>")
139 ToolsCalculate
140 if Instr(GetClipBoardtext, ",") > 0 then cSep = ","
141 if Instr(GetClipBoardtext, ".") > 0 then cSep = "."
142 Call hCloseDocument
143 end sub
145 '---------------------------------------------------------------------------------------------------------------------
147 sub RestoreSettings
148 If iSprache <> iSystemSprache then
149 Call hNewDocument
150 ToolsOptions
151 Call hToolsOptions ("LanguageSettings", "Languages")
152 Gebietsschema.Select(gLocaleDefault)
153 Kontext "ExtrasOptionenDlg"
154 ExtrasOptionenDlg.OK
155 end if
156 ToolsOptions
157 Call hToolsOptions ("LanguageSettings", "Languages")
158 if fLocaleString("LocaleScriptType") = "Western" then Westlich.Select(gDocumentLanguage)
159 if fLocaleString("LocaleScriptType") = "CJK" then Asiatisch.Select(gDocumentLanguage)
160 if fLocaleString("LocaleScriptType") = "CTL" then LanguageComplexScript.Select(gDocumentLanguage)
161 Kontext "ExtrasOptionenDlg"
162 ExtrasOptionenDlg.OK
163 If iSprache <> iSystemSprache then
164 Call hCloseDocument
165 end if
166 end sub