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:42: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 : 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 Dim lsFiles (3000) as String
71 Dim lsGraphics (3000) as String
76 Dim corLoad as Boolean
79 if gNetzInst = TRUE then
80 GetAllFileList ( ConvertPath ( gOfficeBasisPath + "share\gallery\" ), "*.*", lsFiles () )
82 GetAllFileList ( ConvertPath ( gOfficePath + "share\gallery\" ), "*.*", lsFiles () )
84 call GetOnlyGraphics ( lsFiles (), lsGraphics() )
85 iCount = ListCount ( lsGraphics() )
86 printlog " We have " + iCount + " graphics in the gallery."
93 if (t<1) then 'just so we get it between 1 and the amount of items.
100 x = LoadGraphic ( lsGraphics(t), corLoad )
104 if corLoad = FALSE then
105 warnlog "Problems with " + lsGraphics(t)
111 printlog " Tested nr: " + t + " : " + lsGraphics(t)
118 endcase 'tLoadAllGalleryGraphicFiles
120 '-------------------------------------------------------------------------
122 testcase tCheckAllGalleryGraphicFiles
123 Dim lsFiles (3000) as String
124 Dim lsGraphics (3000) as String
128 Dim iCount as Integer
129 Dim corLoad as Boolean
132 if gNetzInst = TRUE then
133 GetAllFileList ( ConvertPath ( gOfficeBasisPath + "share\gallery\" ), "*.*", lsFiles () )
135 GetAllFileList ( ConvertPath ( gOfficePath + "share\gallery\" ), "*.*", lsFiles () )
137 call GetOnlyGraphics ( lsFiles (), lsGraphics() )
138 iCount = ListCount ( lsGraphics() )
139 printlog " We have " + iCount + " graphics in the gallery."
145 x = CheckGraphic ( lsGraphics(i), corLoad )
148 if corLoad = FALSE then
149 warnlog "Problems with " + lsGraphics(i)
155 printlog " Tested nr: " + i + " : " + lsGraphics(i)
161 endcase 'tLoadAllGalleryGraphicFiles
163 '-------------------------------------------------------------------------
165 testcase tInsertGalleryObjects
166 Dim lsFiles (3000) as String
167 Dim lsGraphics (3000) as String
169 Dim HowManyItems as Integer
170 Dim WhichOne as Integer
171 Dim CountOfItems as Integer
175 Dim iCount as Integer
176 Dim corLoad, x as Boolean
181 CountOfThemes = Gallerys.GetItemCount
182 for ct = 1 to CountOfThemes
184 printlog " Selected Gallery-Theme nr: " + ct + ": " + Gallerys.GetSelText
186 CountOfItems = View.GetItemCount()
189 HowManyItems=Int((5*Rnd)+(3*Rnd))
190 if CountOfItems = 0 then
191 QaErrorLog " There were no objects in the the gallery-theme on position: " + ct
193 if (HowManyItems<3) then 'just so we get it between 3 and 5.
196 printlog " Will now select and copy " + HowManyItems + " items from this Theme."
198 for i = 1 to HowManyItems
201 WhichOne=Int(CountOfItems*RND) '(5*Rnd)+(CountOfItems*Rnd))
202 if (WhichOne<1) then 'just so we get it between 1 and the amount of items. '>(CountOfItems + 1)) OR (WhichOne<1) then '
206 printlog " Will copy object nr: " + WhichOne
208 View.TypeKeys "<HOME>"
209 View.TypeKeys "<RIGHT>", (WhichOne)
210 kontext "GraphicObjectBar"
211 if GraphicObjectBar.Exists then
212 if GraphicObjectBar.IsDocked = False then GraphicObjectBar.Dock
216 View.TypeKeys("<shift f10>")
219 dim number as integer
220 number = MenuGetItemCount
221 if (number > 2) AND (number < 10) then
222 hMenuSelectNr (1) 'Insert
223 hMenuSelectNr (1) 'As Copy
226 Warnlog " The contextmenu came up, but the number of entries were strange."
227 printlog " Number of entries:" + number
231 warnlog " A contextmenu didnt come up for the gallery-theme on position: " + ct
235 end if 'if the theme didnt have any objects, we landed here.
240 if Gallery.Exists(2) then
248 endcase 'tInsertGalleryObjects
250 '-------------------------------------------------------------------------
251 testcase tResetSettings
253 printlog "Resetting the measurement unit for textdocuments."
254 printlog "+Tools / options / text documents / general"
257 hToolsOptions ( "WRITER", "General" )
258 Masseinheit.Select iSaveSetting
259 Kontext "ExtrasOptionenDlg"
263 endcase 'tResetSettings
264 '-------------------------------------------------------------------------