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: window_functions.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-09-04 09:16:41 $
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 : joerg.skottke@sun.com
36 '* short description : Window/Titlebar functionality
38 '\******************************************************************************
40 testcase tWindowFunctions
42 printlog( "Update test for window functions" )
44 if ( gtSysName = "Mac OS X" ) then
45 printlog( "No testing for Mac as some Window attributes do not exist" )
50 printlog( "Create initial document" )
51 gApplication = "WRITER"
53 hInitWriteDocIdentifier( "F_updt_windowfuncs.bas" )
55 printlog( "New document" )
57 if ( getDocumentCount <> 2 ) then
58 warnlog( "Two open documents were expected, found " & getDocumentCount )
61 kontext "DocumentWriter"
62 printlog( "Close document" )
63 DocumentWriter.close()
65 if ( getDocumentCount <> 1 ) then
66 warnlog( "One open document was expected, found " & getDocumentCount )
69 printlog( "New document" )
71 if ( getDocumentCount <> 2) then
72 warnlog( "Two open documents were expected, found " & getDocumentCount )
75 printlog( "Enter some text into the second writer document" )
76 kontext "DocumentWriter"
77 DocumentWriter.TypeKeys( "test" )
78 DocumentWriter.close()
81 if ( Active.exists() ) then
82 printlog( "Close messagebox with Cancel (leaves the document open)" )
85 warnlog( "No warning that data will be lost on close of this document" )
88 kontext "DocumentWriter"
89 if ( getDocumentCount = 2 ) then
90 printlog( "Two documents open. Good." )
92 warnlog( "Incorrect document count. Expected two, found " & getDocumentCount )
95 kontext "DocumentWriter"
96 printlog( "Close the document" )
100 if ( Active.exists() ) then
101 printlog( "Do not save the document" )
104 warnlog( "Warning: No data loss warning" )
107 kontext "DocumentWriter"
108 if ( getDocumentCount = 1 ) then
109 printlog( "One document open. Good." )
111 warnlog( "Incorrect document count. Expected one, found " & getDocumentCount )
114 Kontext "DocumentWriter"
115 printlog( "Minimize window" )
116 DocumentWriter.Minimize()
119 kontext "DocumentWriter"
120 if ( DocumentWriter.IsMin() ) then
121 printlog( "Window is minimized" )
123 qaerrorlog( "#i32672# Window not minimized" )
126 kontext "DocumentWriter"
127 printlog( "Restore window" )
128 DocumentWriter.Restore()
131 if ( DocumentWriter.IsRestore() ) then
132 printlog( "Window is Restored" )
134 warnlog( " * Window not Restored" )
137 kontext "DocumentWriter"
138 printlog( "Maximize window" )
139 DocumentWriter.Maximize()
142 kontext "DocumentWriter"
143 if ( DocumentWriter.IsMax() ) then
144 printlog( "Window is maximized" )
146 warnlog( " * Window not maximized" )
153 '*******************************************************************************
157 printlog( "Window titles for the applications" )
160 gApplication = "WRITER"
161 call tCheckWindowTitle("swriter","Writer")
163 printlog( "Master Document" )
164 gApplication = "MASTERDOCUMENT"
165 call tCheckWindowTitle("sglobal","Writer")
168 gApplication = "HTML"
169 call tCheckWindowTitle("sweb","Writer/Web")
171 printlog( "Spreadsheet" )
172 gApplication = "CALC"
173 call tCheckWindowTitle("scalc","Calc")
175 printlog( "Presentation" )
176 gApplication = "IMPRESS"
177 call tCheckWindowTitle("simpress","Impress")
179 printlog( "Drawing" )
180 gApplication = "DRAW"
181 call tCheckWindowTitle("sdraw","Draw")
183 printlog( "Formula" )
184 gApplication = "MATH"
185 call tCheckWindowTitle("smath","Math")
187 qaerrorlog( "Excluded BASE and BACKINGWINDOW" )
189 'gApplication = "DATABASE"
190 'call tCheckWindowTitle("DATABASE","Base")
193 'call tCheckWindowTitle("soffice","")
197 '*******************************************************************************
199 testcase tCheckWindowTitle(sApplication as string, sReference as string)
201 printlog( "Update test for the office window titles" )
204 '+<li>Name of application (string), case sensitive. Valid options are:</li>
206 '+<li>"swriter"</li>
207 '+<li>"sglobal"</li>
208 '+<li>"sweb"</li>
209 '+<li>"scalc"</li>
210 '+<li>"simpress"</li>
211 '+<li>"sdraw"</li>
212 '+<li>"smath"</li>
213 '+<li>"insight" * Currently disabled</li>
214 '+<li>"soffice" * Currently disabled</li>
216 '+<li>Reference name (string), matches name of application</li>
218 '+<li>"Writer"</li>
219 '+<li>"Writer/Web"</li>
220 '+<li>"Calc"</li>
221 '+<li>"Impress"</li>
222 '+<li>"Draw"</li>
223 '+<li>"Math"</li>
224 '+<li>"Base" * Currently disabled</li>
225 '+<li>"" * Currently disabled</li>
237 dim saTemp() as string
239 gApplication = UCase (gApplication)
240 printlog " - Application: " + sApplication + "; Title should be: " + sReference
242 printlog( "Ensure that exactly one document is open" )
245 printlog( "Open another document as specified by gApplication" )
248 printlog( "Verify that the correct window is open" )
249 select case sApplication
262 if Makro.exists(5) then
263 MakroAus.typeKeys "<end>"
265 if (Neu.isEnabled) then
270 if BasicIDE.exists(5) then
271 printlog( "Basic IDE open. Good." )
273 warnlog( "Basic IDE not open. This is unexpected" )
277 warnlog( "New-button is unexpectedly disabled." )
285 if NeuesModul.exists(5) then
288 warnlog( "New module naming dialog is not open" )
292 warnlog( "Accessing <New module> dialog failed" )
296 warnlog( "Couldn't open Tools->Macros->Organize Macros...->StarOffice Basic..." )
302 brc = hDestroyDocument()
305 printlog( "Retrieve the caption from the window" )
306 sTemp = hGetWindowCaption(sApplication)
307 printlog( "Caption is: " & sTemp )
309 printlog( "Split up the string to isolate the desired part" )
310 saTemp() = fSplitWindowTitle(sTemp)
311 printlog "Filename/Untitled: '" & saTemp(0) & "'"
313 printlog( "Compare the string to a reference" )
314 if (ubound(saTemp()) > 0) then
316 if (saTemp(1) <> sReference) then
317 warnlog "Applicationname not as expected. Sould be: '" & sReference & "', is: '" & saTemp(1) & "'"
320 printlog "Productname: '" & saTemp(2) & "'"
322 warnlog "#i36173# - Applicationname not as expected. Should be: '" & sReference & "', is: '" & "'"
325 printlog( "Cleanup after test" )
326 select case sApplication
335 brc = hDestroyDocument()
343 printlog( "Close all open documents" )