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 '///<h3>Update test: Check the window titles for all applications</h3>
162 gApplication = "WRITER"
163 call tCheckWindowTitle("swriter","Writer")
165 '///+<li>MasterDoc</li>
166 gApplication = "MASTERDOCUMENT"
167 call tCheckWindowTitle("sglobal","Writer")
169 '///+<li>HTML document</li>
170 gApplication = "HTML"
171 call tCheckWindowTitle("sweb","Writer/Web")
174 gApplication = "CALC"
175 call tCheckWindowTitle("scalc","Calc")
177 '///+<li>Impress</li>
178 gApplication = "IMPRESS"
179 call tCheckWindowTitle("simpress","Impress")
182 gApplication = "DRAW"
183 call tCheckWindowTitle("sdraw","Draw")
186 gApplication = "MATH"
187 call tCheckWindowTitle("smath","Math")
189 qaerrorlog( "Excluded BASE and BACKINGWINDOW" )
191 'gApplication = "DATABASE"
192 'call tCheckWindowTitle("DATABASE","Base")
195 'call tCheckWindowTitle("soffice","")
199 '*******************************************************************************
201 testcase tCheckWindowTitle(sApplication as string, sReference as string)
203 '///<h1>Update test for the office window titles</h1>
206 '///+<li>Name of application (string), case sensitive. Valid options are:</li>
208 '///+<li>"swriter"</li>
209 '///+<li>"sglobal"</li>
210 '///+<li>"sweb"</li>
211 '///+<li>"scalc"</li>
212 '///+<li>"simpress"</li>
213 '///+<li>"sdraw"</li>
214 '///+<li>"smath"</li>
215 '///+<li>"insight" * Currently disabled</li>
216 '///+<li>"soffice" * Currently disabled</li>
218 '///+<li>Reference name (string), matches name of application</li>
220 '///+<li>"Writer"</li>
221 '///+<li>"Writer"</li>
222 '///+<li>"Writer/Web"</li>
223 '///+<li>"Calc"</li>
224 '///+<li>"Impress"</li>
225 '///+<li>"Draw"</li>
226 '///+<li>"Math"</li>
227 '///+<li>"Base" * Currently disabled</li>
228 '///+<li>"" * Currently disabled</li>
233 '///+<li>Nothing</li>
235 '///<u>Description</u>:
240 dim saTemp() as string
242 gApplication = UCase (gApplication)
243 printlog " - Application: " + sApplication + "; Title should be: " + sReference
244 '///+<li>Make sure exactly one document is open</li>
247 '///+<li>Open a new document</li>
250 '///+<li>Ensure the correct window is open (e.g. goto Basic IDE)</li>
251 select case sApplication
264 if Makro.exists(5) then
265 MakroAus.typeKeys "<end>"
267 if (Neu.isEnabled) then
272 if BasicIDE.exists(5) then
273 ' OK :-) here we want to stay
276 ' qaErrorlog "Unexpected 2"
280 qaErrorlog "Unexpected 1"
288 if NeuesModul.exists(5) then
291 qaErrorlog "Unexpected 3"
298 qaErrorlog "Couldn't open Tools->Macros->Organize Macros...->StarOffice Basic..."
304 brc = hDestroyDocument()
307 ' sTemp = hWindowGetText("") ' was a wOrkAround until the next line worked
308 '///+<li>Retrieve the caption</li>
309 sTemp = hGetWindowCaption(sApplication)
311 ' seperate each part of the title
313 '///+<li>Split up the string, we just need a s mall part of the string</li>
314 saTemp() = fSplitWindowTitle(sTemp)
315 printlog "Filename/Untitled: '" + saTemp(0) + "'"
317 '///+<li>Compare the string to the reference, warn on error</li>
318 if (ubound(saTemp()) > 0) then
320 if (saTemp(1) <> sReference) then
321 warnlog "Applicationname not as expected. Sould be: '" + sReference + "', is: '" + saTemp(1) + "'"
324 printlog "Productname: '" + saTemp(2) + "'"
326 warnlog "#i36173# - Applicationname not as expected. Should be: '" + sReference + "', is: '"+"'"
329 '///+<li>Cleanup</li>
330 select case sApplication
339 brc = hDestroyDocument()
347 '///+<li>Close the document</li>
348 while( getDocumentCount > 0 )