update dev300-m58
[ooovba.git] / qadevOOo / tests / basic / ifc / container / XHierarchicalName / container_XHierarchicalName.xba
blob119d7183acd9192eb7c0850f146c237ace1fe24a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="container_XHierarchicalName" script:language="StarBasic">
4 '*************************************************************************
6 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 '
8 ' Copyright 2008 by Sun Microsystems, Inc.
10 ' OpenOffice.org - a multi-platform office productivity suite
12 ' $RCSfile: container_XHierarchicalName.xba,v $
14 ' $Revision: 1.4 $
16 ' This file is part of OpenOffice.org.
18 ' OpenOffice.org is free software: you can redistribute it and/or modify
19 ' it under the terms of the GNU Lesser General Public License version 3
20 ' only, as published by the Free Software Foundation.
22 ' OpenOffice.org is distributed in the hope that it will be useful,
23 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ' GNU Lesser General Public License version 3 for more details
26 ' (a copy is included in the LICENSE file that accompanied this code).
28 ' You should have received a copy of the GNU Lesser General Public License
29 ' version 3 along with OpenOffice.org. If not, see
30 ' <http://www.openoffice.org/license.html>
31 ' for a copy of the LGPLv3 License.
33 '*************************************************************************
34 '*************************************************************************
36 ' This Interface/Service test depends on the followingobject relations
37 ' variables, which must be specified in the object creation:
39 ' ObjectRelation: oObjRelation(0).Name = "ElementName"
40 ' ObjectRelation: oObjRelation(0).Value = "MyAccessibleElementName"
41 ' ObjectRelation: oObjRelation(1).Name = "HierarchicalName"
42 ' ObjectRelation: oObjRelation(1).Value = "MyHierachicalName"
44 '*************************************************************************
46 ' Be sure that all variables are dimensioned:
47 option explicit
49 Sub RunTest()
51 '*************************************************************************
52 ' INTERFACE:
53 ' com.sun.star.container.XHierarchicalName
54 '*************************************************************************
55 On Error Goto ErrHndl
56 Dim bOK As Boolean
58 Dim cElemName as Variant
59 cElemName = utils.getObjectRelation("ElementName")
60 if isNull(cElemName) then
61 out.log("Could not get relation 'ElenemtName' -> FALSE")
62 end if
64 Dim cExpName as Variant
65 cExpName = utils.getObjectRelation("HierarchicalName")
66 if isNull(cExpName) then
67 out.log("Could not get relation 'HierarchicalName' -> FALSE")
68 end if
70 Test.StartMethod("getHierarchicalName()")
71 bOK = TRUE
72 Dim cHName as String
73 cHName = oObj.getHierarchicalName()
74 Dim result as String
75 result = instr(cHName, cExpName)
76 if len(result) = 0 then
77 olt.log("Getting: " + cHName + " but expected it to start with " + _
78 cExpName)
79 bOK = FALSE
80 end if
81 Test.MethodTested("getHierarchicalName()", bOK)
83 Test.StartMethod("composeHierarchicalName()")
84 bOK = TRUE
85 Dim gettedName as String
86 gettedName = oObj.composeHierarchicalName(cElemName)
87 result = instr(gettedName, cElemName)
88 if len(result) = 0 then
89 olt.log("Getting: " + gettedName + " but expected it to start with " + _
90 cElemetName)
91 bOK = FALSE
92 end if
93 Test.MethodTested("composeHierarchicalName()", bOK)
95 Exit Sub
96 ErrHndl:
97 Test.Exception()
98 bOK = false
99 resume next
100 End Sub
101 </script:module>