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: options_ls_2.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:15 $
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 : thorsten.bosbach@sun.com
36 '* short description : (functionality test for load/save group)
38 '\******************************************************************************
40 testcase func_LoadSaveGeneral_1
42 warnlog( "#i95523# - cannot access custom tabpage on document info dialog" )
45 Dim bSave as boolean, bPromptSave as boolean
46 Dim sSaveTime as String
47 Dim sFilename, sFilebak as String
50 gApplication = "WRITER"
52 '///load&save/general : functionality test of all settings in 'Save'-group
54 sFilename = ConvertPath ( gOfficePath + "user\work\o_save.sxw" )
55 sFilebak = ConvertPath ( gOfficePath + "user\backup\o_save.bak" )
57 if app.Dir ( sFilename ) <> "" then app.kill ( sFilename )
58 if app.Dir ( sFilebak ) <> "" then app.kill ( sFilebak )
60 '///save : 'document properties before saving'
61 '///+open a new document
63 printlog " - document properties before saving"
64 printlog " open a new document"
67 '///+insert a short paragraph
68 Kontext "DocumentWriter"
69 DocumentWriter.TypeKeys "tools/options/load-save/general: save-> edit document properties before saving<Return>"
70 '///+tools / options / load&save / general
71 printlog " open tools / options / load & save / general"
73 hToolsOptions ( "LoadSave", "General" )
75 printlog " check 'document properties before saving'"
76 '///+save the default setting for 'document properties before saving' and check it
77 bSave = DokumenteigenschaftenBearbeiten.IsChecked
78 DokumenteigenschaftenBearbeiten.Check
80 '///+close options dialog with OK
81 Kontext "ExtrasOptionenDlg"
84 printlog " save the document"
88 '///+insert a file name and press 'save'
89 Kontext "SpeichernDlg"
90 Dateiname.SetText sFilename
95 'overwrite warning on rerun
96 if active.exists(3) then
100 printlog " activate all tabpages on properties dialog and cancel it"
101 '///+=> now the properties dialog must be actived
104 active.SetPage( TabDokument)
105 active.SetPage TabDokumentinfo
106 active.SetPage TabBenutzer
107 active.SetPage TabInternet
108 active.SetPage TabStatistik
109 Kontext "TabStatistik"
110 '///+cancel the properties dialog
113 Warnlog "Perhaps the document properties aren't active after saving => the dialog come not up after file save!"
116 '///save : 'always create backup copy'
117 printlog " - always create backup copy"
118 Kontext "DocumentWriter"
119 '///+insert a short paragraph in the writer doc
120 DocumentWriter.TypeKeys "tools/options/load-save/general: save-> always create backup copy<Return>"
121 '///+tools / options / load&save / general
122 printlog " open tools / options / load & save / general"
124 hToolsOptions ( "LoadSave", "General" )
126 '///+uncheck 'document properties before saving'
127 if bSave = TRUE then DokumenteigenschaftenBearbeiten.Check else DokumenteigenschaftenBearbeiten.UnCheck
128 bSave = Sicherungskopie.IsChecked
129 '///+check 'always create backup copy'
130 Sicherungskopie.Check
131 '///+close options dialog with OK
132 Kontext "ExtrasOptionenDlg"
136 '///+check if the backup file exists before saving => BUG
137 if app.Dir ( sFilebak ) <> "" then Warnlog "Before saving the document the backup-file exists!"
140 '///+check if the backup file exists after saving => ( ../user/backup/.. )
141 if app.Dir ( sFilebak ) = "" then Warnlog "After saving the document the backup-file doesn't exists => BUG!"
143 '///save : 'auto save' after 1 min
144 printlog " - autosave : after 1 min, with prompt"
145 '///+write another short paragraph into the writer document
146 Kontext "DocumentWriter"
147 DocumentWriter.TypeKeys "tools/options/load-save/general: save-> autosave after 1 min with prompt<Return>"
148 '///+tools / options / load&save / general
150 hToolsOptions ( "LoadSave", "General" )
152 '///+set 'always create backup copy' to default
153 if bSave = TRUE then Sicherungskopie.Check else Sicherungskopie.UnCheck
154 bSave = AutomatischSpeichern.IsChecked
155 '///+check 'auto save' and set the time to 1 minute
156 AutomatischSpeichern.Check
157 sSaveTime = 15 'debug
161 '///+close options dialog with OK
162 Kontext "ExtrasOptionenDlg"
166 '///+wait about 2 minutes
167 '///+two 'save file?" dialogs should pop up, one for each document.
168 '///+Select 'yes' for both dialogs and cancel both file-save dialogs
171 if Active.Exists (3) then
173 Kontext "SpeichernDlg"
174 if SpeichernDlg.Exists then SpeichernDlg.Cancel
176 printlog "Active came up :-) " + i
178 printlog "Active didn't come up :-( " + i
182 '///check the documents
183 '///+close the document, there should be a warning that the file has not been saved
184 '///+discard the file
185 printlog " - close the document and check the saved data"
186 hCloseDocument ' closes the document with 'discard'
187 '///+reopen the file and check if all paragraphs are inserted, t
188 hFileOpen ( sFilename )
190 if active.exists(5) then
191 warnlog active.gettext
194 ' This part compares the content of the file after reload with text entered
195 ' during the entire test. It should contain three lines of text.
196 printlog( " - Compare the content of the file with the text entered during the test." )
197 printlog( " First line..." )
198 Kontext "DocumentWriter"
199 DocumentWriter.TypeKeys "<Up>", 5
200 DocumentWriter.TypeKeys "<Home>"
201 DocumentWriter.TypeKeys "<Shift End>"
204 if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> edit document properties before saving" then Warnlog "The first sentence is wrong!"
206 printlog( " Second line..." )
207 DocumentWriter.TypeKeys "<Down>"
208 DocumentWriter.TypeKeys "<Home>"
209 DocumentWriter.TypeKeys "<Shift End>"
212 if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> always create backup copy" then Warnlog "The second sentence is wrong!"
214 printlog( " Third line..." )
215 DocumentWriter.TypeKeys "<Down>"
216 DocumentWriter.TypeKeys "<Home>"
217 DocumentWriter.TypeKeys "<Shift End>"
220 if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> autosave after 1 min with prompt" then Warnlog "The third sentence is wrong!"
222 '///+close the document
225 '///+open the backup file ( ../user/backup/.. ) and check if there are 2 paragraphs (last paragraph should not have been saved)
226 printlog " - load the backup-file"
227 hOpenFile ( sFilebak )
229 Kontext "Filterauswahl"
230 if Filterauswahl.Exists(2) then
231 warnlog "Is bugId 107399 present? => Detection of our own fileformar fails when the extension is not the standard extension!"
234 Kontext "DocumentWriter"
235 DocumentWriter.TypeKeys "<Up>", 5
236 DocumentWriter.TypeKeys "<Home>"
237 DocumentWriter.TypeKeys "<Shift End>"
240 '///+close the document
243 if GetClipboardText <> "" then
246 warnlog "Perhaps the bak-file was not loaded. => Verify BugID 86607!"
250 '///reset the options to default settings
251 printlog " - reset options"
253 hToolsOptions ( "LoadSave", "General" )
254 AutomatischSpeichern.Check
255 Minuten.SetText sSaveTime
256 if bSave = TRUE then AutomatischSpeichern.Check else AutomatischSpeichern.UnCheck
257 '///+close options dialog with OK
258 Kontext "ExtrasOptionenDlg"
263 ' > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * > *
264 ' > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * > *
265 testcase func_LoadSaveGeneral_2
267 Dim sFilename, sFilename2, sCharSet as String
269 const ICWAIT as integer = 1
271 '///load&save/general : functionality test of all settings in 'Save URLs relativ to'-group
273 sFilename = ConvertPath ( gOfficePath + "user\work\o_save_1.html" )
274 sFilename2 = ConvertPath ( gOfficePath + "user\work\o_save_2.html" )
276 if app.dir ( sFilename ) <> "" then app.kill ( sFilename )
277 if app.dir ( sFilename2 ) <> "" then app.kill ( sFilename2 )
280 printlog " - save URL relative to"
282 '///if you test a StarSuite ( asian language ) you have to change the encoding for HTML-export to 'UTF8' ( load&save/HTML compatibility )
283 if bAsianLan = TRUE then
284 sCharSet = GetHTMLCharSet
285 if SetHTMLCharSetToUTF8 = FALSE then
286 Warnlog "The test cannot find the UTF8 Character Set for HTML-Export. The test can have many errors at saving HTML-Files!"
288 printlog "The Character Set for HTML-Export is now Unicode UTF8!"
292 '///open a new HTML document
293 gApplication = "HTML"
296 '///+ insert a graphic out of the internal gallery ( [Officepath]/share/gallery/photos/desert.jpg )
297 if gNetzInst = TRUE then
298 hGrafikEinfuegen ( ConvertPath ( gNetzOfficePath + "share\gallery\photos\desert1.jpg" ) )
300 hGrafikEinfuegen ( ConvertPath ( gOfficePath + "share\gallery\photos\desert1.jpg" ) )
303 '///+open tools/options/load&save/general
304 printlog " - relative to filesystem"
306 hToolsOptions ( "LoadSave", "General" )
308 '///+check 'relativ to filesystem'
309 bSave = URLimDateisystem.IsChecked
310 URLimDateisystem.Check
311 Kontext "ExtrasOptionenDlg"
312 '///+close options dialog with OK
316 printlog " save the HTML file"
317 '///+save the HTML-doc at ../user/work/..
318 hFileSaveAs ( sFilename )
320 '///+check if the path for the graphic is 'relativ' in the source code
321 printlog " check the relativ path in source code of HTML file"
322 Call URLGraphicCheck ( TRUE, sFilename )
324 '///+open tools/options/load&save/general
325 printlog " - relative to filesystem ( unchecked )"
327 hToolsOptions ( "LoadSave", "General" )
329 '///+uncheck 'relativ to filesystem'
330 URLimDateisystem.UnCheck
331 '///+close options dialog with OK
332 Kontext "ExtrasOptionenDlg"
336 '///+save the HTML-doc at ../user/work/.. with another name
337 printlog " save the HTML file"
338 hFileSaveAs ( sFilename2 )
340 '///+check if the path for the graphic is 'not relativ' in the source code
341 printlog " check the hard coded path in source code of HTML file"
342 Call URLGraphicCheck ( FALSE, sFilename2 )
344 '///+close the document
347 '///+reset 'relativ to file system' to default and close the options dialog with OK
348 printlog " - reset the options"
350 hToolsOptions ( "LoadSave", "General" )
352 if bSave = TRUE then URLimDateisystem.Check else URLimDateisystem.UnCheck
353 Kontext "ExtrasOptionenDlg"
357 printlog "No test for 'relative to internet'"
359 '///<FONT COLOR="#ff0000">No test for 'relative to internet'</FONT>
360 if bAsianLan = TRUE then
361 printlog Chr(13 ) + "Reset the Character Set back to default : " + sCharSet
362 SetHTMLCharSet ( sCharSet )
365 gApplication = "WRITER"