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: menuentries.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:14 $
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 : Read menubar and first level drop down lists and compare to reference
38 '\*****************************************************************
42 dim sApplication() as string
44 sApplication = array("WRITER","MASTERDOCUMENT","HTML","CALC","IMPRESS","DRAW","MATH","BASIC","DATABASE")
46 ' for every application
47 c = uBound(sApplication())
49 gApplication = sApplication(k)
50 printlog "********** " + gApplication
53 gApplication = "WRITER"
56 testcase s_getMenuText
57 dim i,j,l,m,a,b,d,e as integer
58 dim sReference(400) as string
59 dim sCurrent(400) as string
60 dim sFileName as string
63 dim iTopLevelCount as integer
64 dim iOffset as integer
66 for i=0 to uBound(sReference())
73 ' for every item in main menu bar
79 stemp = MenuGetItemText(MenuGetItemID(i))
81 listAppend(sCurrent(),"********** "+sTemp)
82 MenuSelect(MenuGetItemID(i))
85 sTemp = MenuGetItemText(MenuGetItemID(j))
87 listAppend(sCurrent(),sTemp)
92 sFileName = convertPath(gTestToolPath+"framework\optional\input/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
93 printlog( "Using reference file: " & sFileName )
94 ' gProductName should not make a big difference.
95 if fileExists(sFileName) then
97 listRead(sReference(), sFileName, "utf8")
98 d = listCount(sCurrent())
100 e = listCount(sReference())
102 warnlog "The count of Menuentries differs from reference "+gApplication+". should: '" + e + "'; delta is: '" + (d - e) + "'"
104 ' always take the shorter list count
110 printlog "Count of Menuentries is ok"
113 ' compare all entries
117 ' count main menu bar items
118 if inStr(sReference(l), "********** ") > 0 then
121 printlog mid(sReference(l),12)
123 ' complain non existing accelerator
124 if (sReference(l) <> "") AND (inStr(sReference(l),"~") < 1) then
125 qaErrorLog "No accelerator (~) in item: '" + sReference(l) + "'"
127 ' compare the menu entries
128 if (sReference(l) <> sCurrent(l+iOffset))then
129 ' try to syncronize different count of entries
131 iOffset = iOffset + sgn(e)
132 'qaerrorlog "io: " + ioffset
134 'qaerrorlog "e: " + e
137 if (m = (iTopLevelCount-1)) then
138 ' tolerate the window menu
139 printlog "String differs: " + chr(13) + "current : '"+sCurrent(l) + "'" + chr(13) + "reference: '" + sReference(l) + "'"
142 warnlog "String differs: " + chr(13) + "current : '"+sCurrent(l) + "'" + chr(13) + "reference: '" + sReference(l) + "'"
148 ' printlog sreference(l)
149 ' printlog scurrent(l)
151 ' if there is still is a difference in count
154 warnlog "Not all reference entries are there, e.g.: '" + sReference(l+1) + "'"
156 warnlog "There are too much entries, e.g.: '" + sCurrent(l+1) + "'"
160 sFileName = convertPath(gOfficePath+"user/work/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
161 listWrite(sCurrent(), sFileName, "utf8")
162 printlog "Written strings from this build to: " + chr(13) + sFileName
168 warnlog "No reference found; please copy:"+lCase(gISOLang+"_"+gApplication+".txt")
169 sFileName = convertPath(gOfficePath+"user/work/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
170 listWrite(sCurrent(), sFileName, "utf8")
171 printlog sFileName + chr(13) + "to"
172 sFileName = convertPath(gTestToolPath+"framework/level1/input/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
174 'listWrite(sCurrent(), sFileName, "utf8")
176 'speichern: (vendor?) sprache gISOLang applikation