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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* Owner : thorsten.bosbach@oracle.com
30 '* short description : Read menubar and first level drop down lists and compare to reference
32 '\*****************************************************************
36 dim sApplication() as string
38 sApplication = array("WRITER","MASTERDOCUMENT","HTML","CALC","IMPRESS","DRAW","MATH","BASIC","DATABASE")
40 ' for every application
41 c = uBound(sApplication())
43 gApplication = sApplication(k)
44 printlog "********** " + gApplication
47 gApplication = "WRITER"
50 testcase s_getMenuText
51 dim i,j,l,m,a,b,d,e as integer
52 dim sReference(400) as string
53 dim sCurrent(400) as string
54 dim sFileName as string
57 dim iTopLevelCount as integer
58 dim iOffset as integer
60 for i=0 to uBound(sReference())
67 ' for every item in main menu bar
73 stemp = MenuGetItemText(MenuGetItemID(i))
75 listAppend(sCurrent(),"********** "+sTemp)
76 MenuSelect(MenuGetItemID(i))
79 sTemp = MenuGetItemText(MenuGetItemID(j))
81 listAppend(sCurrent(),sTemp)
86 sFileName = convertPath(gTestToolPath+"framework\optional\input/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
87 printlog( "Using reference file: " & sFileName )
88 ' gProductName should not make a big difference.
89 if fileExists(sFileName) then
91 listRead(sReference(), sFileName, "utf8")
92 d = listCount(sCurrent())
94 e = listCount(sReference())
96 warnlog "The count of Menuentries differs from reference "+gApplication+". should: '" + e + "'; delta is: '" + (d - e) + "'"
98 ' always take the shorter list count
104 printlog "Count of Menuentries is ok"
107 ' compare all entries
111 ' count main menu bar items
112 if inStr(sReference(l), "********** ") > 0 then
115 printlog mid(sReference(l),12)
117 ' complain non existing accelerator
118 if (sReference(l) <> "") AND (inStr(sReference(l),"~") < 1) then
119 qaErrorLog "No accelerator (~) in item: '" + sReference(l) + "'"
121 ' compare the menu entries
122 if (sReference(l) <> sCurrent(l+iOffset))then
123 ' try to syncronize different count of entries
125 iOffset = iOffset + sgn(e)
126 'qaerrorlog "io: " + ioffset
128 'qaerrorlog "e: " + e
131 if (m = (iTopLevelCount-1)) then
132 ' tolerate the window menu
133 printlog "String differs: " + chr(13) + "current : '"+sCurrent(l) + "'" + chr(13) + "reference: '" + sReference(l) + "'"
136 warnlog "String differs: " + chr(13) + "current : '"+sCurrent(l) + "'" + chr(13) + "reference: '" + sReference(l) + "'"
142 ' printlog sreference(l)
143 ' printlog scurrent(l)
145 ' if there is still is a difference in count
148 warnlog "Not all reference entries are there, e.g.: '" + sReference(l+1) + "'"
150 warnlog "There are too much entries, e.g.: '" + sCurrent(l+1) + "'"
154 sFileName = convertPath(gOfficePath+"user/work/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
155 listWrite(sCurrent(), sFileName, "utf8")
156 printlog "Written strings from this build to: " + chr(13) + sFileName
162 warnlog "No reference found; please copy:"+lCase(gISOLang+"_"+gApplication+".txt")
163 sFileName = convertPath(gOfficePath+"user/work/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
164 listWrite(sCurrent(), sFileName, "utf8")
165 printlog sFileName + chr(13) + "to"
166 sFileName = convertPath(gTestToolPath+"framework/level1/input/menu/"+lCase(gISOLang+"_"+gApplication+".txt"))
168 'listWrite(sCurrent(), sFileName, "utf8")
170 'speichern: (vendor?) sprache gISOLang applikation