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: gallery2.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:43:00 $
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 : Checking all gallery themes
38 '*****************************************************************
40 ' #1 tLoad100GalleryGraphicFiles 'Inserting 100 gallery graphics and checking the sizes
41 ' #1 tCheckAllGalleryGraphicFiles 'Checking the size ( > 0 Byte ) of all gallery-files.
42 ' #1 tInsertGalleryObjects 'Inserting random objects via contextmenu-insert-copy.
46 ' #1 tSettingsToCM 'Measurement unit for textdocuments to cm
47 ' #1 tResetSettings 'Resetting the measurement unit for textdocuments.
49 '\****************************************************************
51 testcase tSettingsToCM
53 printlog " Setting the measurement unit for textdocuments to cm."
54 printlog " +Tools / options / text documents / general"
59 hToolsOptions ( "WRITER", "General" )
60 iSaveSetting = Masseinheit.GetSelIndex
62 Kontext "ExtrasOptionenDlg"
67 '-------------------------------------------------------------------------
68 testcase tLoad100GalleryGraphicFiles
70 '/// Inserting all gallery graphics in a Writer document and checking the sizes.
71 Dim lsFiles (3000) as String
72 Dim lsGraphics (3000) as String
77 Dim corLoad as Boolean
80 '/// Geting all installed gallery objects out of the installation in a list.
81 if gNetzInst = TRUE then
82 GetAllFileList ( ConvertPath ( gOfficeBasisPath + "share\gallery\" ), "*.*", lsFiles () )
84 GetAllFileList ( ConvertPath ( gOfficePath + "share\gallery\" ), "*.*", lsFiles () )
86 call GetOnlyGraphics ( lsFiles (), lsGraphics() )
87 iCount = ListCount ( lsGraphics() )
88 printlog " We have " + iCount + " graphics in the gallery."
89 '/// + Open a new document
96 if (t<1) then 'just so we get it between 1 and the amount of items.
103 '/// <i>Loop begin</i>
104 '/// + Inserting all gallery files and checking the sizes
105 '/// +- Iinsert / graphic / from file
106 '/// +- Check the size in 'format / graphics' on the <i>Type</i> tabpage
107 '/// +-- The size should noz be smaler than 17*25cm / photos 21*25cm
108 '/// + Deleting the graphic with <delete> of the keyboard
109 '/// <i>Loop ends</i>
110 x = LoadGraphic ( lsGraphics(t), corLoad )
114 if corLoad = FALSE then
115 warnlog "Problems with " + lsGraphics(t)
121 printlog " Tested nr: " + t + " : " + lsGraphics(t)
125 '/// Close the gallery ///'
128 '/// Close the document ///'
130 endcase 'tLoadAllGalleryGraphicFiles
132 '-------------------------------------------------------------------------
134 testcase tCheckAllGalleryGraphicFiles
135 '/// Checking the filesize of all gallery graphics.
136 Dim lsFiles (3000) as String
137 Dim lsGraphics (3000) as String
141 Dim iCount as Integer
142 Dim corLoad as Boolean
145 '/// Geting all installed gallery objects out of the installation in a list.
146 if gNetzInst = TRUE then
147 GetAllFileList ( ConvertPath ( gOfficeBasisPath + "share\gallery\" ), "*.*", lsFiles () )
149 GetAllFileList ( ConvertPath ( gOfficePath + "share\gallery\" ), "*.*", lsFiles () )
151 call GetOnlyGraphics ( lsFiles (), lsGraphics() )
152 iCount = ListCount ( lsGraphics() )
153 printlog " We have " + iCount + " graphics in the gallery."
154 '/// Open a new document
160 '/// <i>Loop begin</i>
161 '///+ Inserting all gallery files and checking the sizes
162 '///+- Iinsert / graphic / from file
163 '///+- Check the size in 'format / graphics' on the <i>Type</i> tabpage
164 '///+-- The size should noz be smaler than 17*25cm / photos 21*25cm
165 '///+ Deleting the graphic with <delete> of the keyboard
166 '/// <i>Loop ends</i>
167 x = CheckGraphic ( lsGraphics(i), corLoad )
170 if corLoad = FALSE then
171 warnlog "Problems with " + lsGraphics(i)
177 printlog " Tested nr: " + i + " : " + lsGraphics(i)
180 '/// Close the gallery ///'
183 '/// Close the document ///'
185 endcase 'tLoadAllGalleryGraphicFiles
187 '-------------------------------------------------------------------------
189 testcase tInsertGalleryObjects
190 Dim lsFiles (3000) as String
191 Dim lsGraphics (3000) as String
193 Dim HowManyItems as Integer
194 Dim WhichOne as Integer
195 Dim CountOfItems as Integer
199 Dim iCount as Integer
200 Dim corLoad, x as Boolean
202 '/// 1. Select theme ///'
206 CountOfThemes = Gallerys.GetItemCount
207 for ct = 1 to CountOfThemes
209 printlog " Selected Gallery-Theme nr: " + ct + ": " + Gallerys.GetSelText
211 CountOfItems = View.GetItemCount()
212 '/// 2. Choose if we should test 3,4 or 5 objects. ///'
215 HowManyItems=Int((5*Rnd)+(3*Rnd))
216 if CountOfItems = 0 then
217 QaErrorLog " There were no objects in the the gallery-theme on position: " + ct
219 if (HowManyItems<3) then 'just so we get it between 3 and 5.
222 printlog " Will now select and copy " + HowManyItems + " items from this Theme."
224 for i = 1 to HowManyItems
225 '/// 3. Select the objects ///'
228 WhichOne=Int(CountOfItems*RND) '(5*Rnd)+(CountOfItems*Rnd))
229 if (WhichOne<1) then 'just so we get it between 1 and the amount of items. '>(CountOfItems + 1)) OR (WhichOne<1) then '
233 printlog " Will copy object nr: " + WhichOne
235 View.TypeKeys "<HOME>"
236 View.TypeKeys "<RIGHT>", (WhichOne)
237 kontext "GraphicObjectBar"
238 if GraphicObjectBar.Exists then
239 if GraphicObjectBar.IsDocked = False then GraphicObjectBar.Dock
243 View.TypeKeys("<shift f10>")
246 dim number as integer
247 number = MenuGetItemCount
248 if (number > 2) AND (number < 10) then
249 '/// 4. Copy the selected item into our document. ///'
250 hMenuSelectNr (1) 'Insert
251 hMenuSelectNr (1) 'As Copy
254 Warnlog " The contextmenu came up, but the number of entries were strange."
255 printlog " Number of entries:" + number
259 warnlog " A contextmenu didnt come up for the gallery-theme on position: " + ct
262 '/// 5. Repeat 3.-5. until 2. is fulfilled. ///'
264 end if 'if the theme didnt have any objects, we landed here.
266 '/// 6. Change Theme. ///'
267 '/// 7. Repeat 2. - 8. until all themes are done. ///'
271 if Gallery.Exists(2) then
276 '/// Remove the last copied object. ///'
280 endcase 'tInsertGalleryObjects
282 '-------------------------------------------------------------------------
283 testcase tResetSettings
285 printlog "Resetting the measurement unit for textdocuments."
286 printlog "+Tools / options / text documents / general"
289 hToolsOptions ( "WRITER", "General" )
290 Masseinheit.Select iSaveSetting
291 Kontext "ExtrasOptionenDlg"
295 endcase 'tResetSettings
296 '-------------------------------------------------------------------------