|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 // [INCLUDE FILES] - do not remove |
|
27 #include <e32svr.h> |
|
28 #include <StifParser.h> |
|
29 #include <StifTestInterface.h> |
|
30 #include <e32math.h> |
|
31 #include <libc/assert.h> |
|
32 #include <e32panic.h> |
|
33 #include "testxml.h" |
|
34 #include "senxmlTester.h" |
|
35 |
|
36 // EXTERNAL DATA STRUCTURES |
|
37 //extern ?external_data; |
|
38 |
|
39 // EXTERNAL FUNCTION PROTOTYPES |
|
40 //extern ?external_function( ?arg_type,?arg_type ); |
|
41 |
|
42 // CONSTANTS |
|
43 //const ?type ?constant_var = ?constant; |
|
44 |
|
45 // MACROS |
|
46 //#define ?macro ?macro_def |
|
47 |
|
48 // LOCAL CONSTANTS AND MACROS |
|
49 //const ?type ?constant_var = ?constant; |
|
50 //#define ?macro_name ?macro_def |
|
51 |
|
52 // MODULE DATA STRUCTURES |
|
53 //enum ?declaration |
|
54 //typedef ?declaration |
|
55 |
|
56 // LOCAL FUNCTION PROTOTYPES |
|
57 //?type ?function_name( ?arg_type, ?arg_type ); |
|
58 |
|
59 // FORWARD DECLARATIONS |
|
60 //class ?FORWARD_CLASSNAME; |
|
61 |
|
62 // ============================= LOCAL FUNCTIONS =============================== |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // ?function_name ?description. |
|
66 // ?description |
|
67 // Returns: ?value_1: ?description |
|
68 // ?value_n: ?description_line1 |
|
69 // ?description_line2 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 /* |
|
73 ?type ?function_name( |
|
74 ?arg_type arg, // ?description |
|
75 ?arg_type arg) // ?description |
|
76 { |
|
77 |
|
78 ?code // ?comment |
|
79 |
|
80 // ?comment |
|
81 ?code |
|
82 } |
|
83 */ |
|
84 |
|
85 // ============================ MEMBER FUNCTIONS =============================== |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CsenxmlTester::Delete |
|
89 // Delete here all resources allocated and opened from test methods. |
|
90 // Called from destructor. |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CsenxmlTester::Delete() |
|
94 { |
|
95 |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CsenxmlTester::RunMethodL |
|
100 // Run specified method. Contains also table of test mothods and their names. |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 TInt CsenxmlTester::RunMethodL( |
|
104 CStifItemParser& aItem ) |
|
105 { |
|
106 |
|
107 static TStifFunctionInfo const KFunctions[] = |
|
108 { |
|
109 ENTRY("NewL-CSenBaseAttribute", CsenxmlTester::CSenBaseAttribute_NewLL), |
|
110 ENTRY("NewL-CSenBaseAttribute", CsenxmlTester::CSenBaseAttribute_NewL_1L), |
|
111 ENTRY("NewL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NewLL), |
|
112 ENTRY("NewL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NewL_1L), |
|
113 ENTRY("NewL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NewL_2L), |
|
114 ENTRY("NewL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NewL_3L), |
|
115 ENTRY("NewL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NewL_4L), |
|
116 ENTRY("SetAttributesL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetAttributesLL), |
|
117 ENTRY("LocalName-CSenBaseElement",CsenxmlTester::CSenBaseElement_LocalNameL), |
|
118 ENTRY("NamespaceURI-CSenBaseElement", CsenxmlTester::CSenBaseElement_NamespaceURIL), |
|
119 ENTRY("NsPrefix-CSenBaseElement", CsenxmlTester::CSenBaseElement_NsPrefixL), |
|
120 ENTRY("SetPrefixL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetPrefixLL), |
|
121 ENTRY("HasContentTrue-CSenBaseElement", CsenxmlTester::CSenBaseElement_HasContentTL), |
|
122 ENTRY("HasContentFalse-CSenBaseElement", CsenxmlTester::CSenBaseElement_HasContentFL), |
|
123 |
|
124 ENTRY("Content-CSenBaseElement", CsenxmlTester::CSenBaseElement_ContentL), |
|
125 |
|
126 ENTRY("ContentNull-CSenBaseElement", CsenxmlTester::CSenBaseElement_Content_NullL), |
|
127 |
|
128 ENTRY("ContentUnicodeL-CSenBaseElement", CsenxmlTester::CSenBaseElement_ContentUnicodeLL), |
|
129 |
|
130 ENTRY("SetContentL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetContentLL), |
|
131 |
|
132 ENTRY("SetContentNullL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetContentL_NullL), |
|
133 |
|
134 ENTRY("SetContentoverrightL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetContentL_OverRightL), |
|
135 |
|
136 ENTRY("SetContentEscCharL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetContentL_WithEscCharsL), |
|
137 |
|
138 ENTRY("ConsistsOfL-CSenBaseElement", CsenxmlTester::CSenBaseElement_ConsistsOfLL), |
|
139 |
|
140 ENTRY("SetNamespaceL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceLL), |
|
141 |
|
142 ENTRY("SetNamespaceNullL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_NullL), |
|
143 |
|
144 ENTRY("SetNamespaceL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_1L), |
|
145 |
|
146 ENTRY("SetNamespace2SameL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_2same1L), |
|
147 |
|
148 ENTRY("SetNamespace2DiffL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_2Diff1L), |
|
149 |
|
150 ENTRY("SetNamespaceDPSUL-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_DPSU1L), |
|
151 |
|
152 ENTRY("SetNamespaceSameNsforPC1L-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetNamespaceL_SNsPC1L), |
|
153 |
|
154 ENTRY("AddNamespace_FalseL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_FL), |
|
155 |
|
156 ENTRY("AddNamespace_TrueL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_TL), |
|
157 |
|
158 ENTRY("AddNamespace_TrueSameParentNSL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_TSPL), |
|
159 |
|
160 ENTRY("AddNamespace_TrueDiffParentNSL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_TDPL), |
|
161 |
|
162 ENTRY("AddNamespaceL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_1L), |
|
163 |
|
164 ENTRY("AddNamespace2SameL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_2same1L), |
|
165 |
|
166 ENTRY("AddNamespace2DiffL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddNamespaceL_2Diff1L), |
|
167 |
|
168 ENTRY("Namespace-CSenBaseElement", CsenxmlTester::CSenBaseElement_NamespaceL), |
|
169 |
|
170 |
|
171 ENTRY("Namespace-CSenBaseElement", CsenxmlTester::CSenBaseElement_Namespace_1L), |
|
172 |
|
173 ENTRY("Namespace_with_parent1-CSenBaseElement", CsenxmlTester::CSenBaseElement_Namespace_WP1L), |
|
174 |
|
175 ENTRY("Namespace-test2-CSenBaseElement", CsenxmlTester::CSenBaseElement_Namespace_2L), |
|
176 |
|
177 ENTRY("Namespace-test3-CSenBaseElement", CsenxmlTester::CSenBaseElement_Namespace_3L), |
|
178 |
|
179 ENTRY("ElementsL-CSenBaseElement", CsenxmlTester::CSenBaseElement_ElementsLL), |
|
180 |
|
181 ENTRY("AttributesL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AttributesLL), |
|
182 |
|
183 ENTRY("NamespacesL-CSenBaseElement", CsenxmlTester::CSenBaseElement_NamespacesLL), |
|
184 |
|
185 ENTRY("AttrValue-CSenBaseElement", CsenxmlTester::CSenBaseElement_AttrValueL), |
|
186 |
|
187 ENTRY("AddAttrL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddAttrLL), |
|
188 |
|
189 ENTRY("AddAttributeL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddAttributeLL), |
|
190 ENTRY("Parent-CSenBaseElement", CsenxmlTester::CSenBaseElement_ParentL), |
|
191 |
|
192 ENTRY("SetParent-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetParentL), |
|
193 |
|
194 ENTRY("Root-CSenBaseElement", CsenxmlTester::CSenBaseElement_RootL), |
|
195 |
|
196 ENTRY("Element-CSenBaseElement", CsenxmlTester::CSenBaseElement_ElementL), |
|
197 ENTRY("Elements1-CSenBaseElement", CsenxmlTester::CSenBaseElement_ElementsL1), |
|
198 ENTRY("Elements2-CSenBaseElement", CsenxmlTester::CSenBaseElement_ElementsL2), |
|
199 |
|
200 ENTRY("CreateElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_CreateElementLL), |
|
201 |
|
202 ENTRY("InsertElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_InsertElementLL), |
|
203 |
|
204 ENTRY("InsertElement_No_BeforeElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_InsertElementL_NoBeforeL), |
|
205 |
|
206 ENTRY("AddElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddElementLL), |
|
207 |
|
208 ENTRY("AddElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddElementL_1L), |
|
209 |
|
210 ENTRY("AddElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddElementL_2L), |
|
211 |
|
212 ENTRY("AddElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddElementL_3L), |
|
213 |
|
214 ENTRY("RemoveElement-CSenBaseElement", CsenxmlTester::CSenBaseElement_RemoveElementL), |
|
215 |
|
216 ENTRY("RemoveElement-CSenBaseElement", CsenxmlTester::CSenBaseElement_RemoveElement_1L), |
|
217 |
|
218 ENTRY("RemoveElement-CSenBaseElement", CsenxmlTester::CSenBaseElement_RemoveElement_2L), |
|
219 |
|
220 ENTRY("ReplaceElementL-CSenBaseElement", CsenxmlTester::CSenBaseElement_ReplaceElementLL), |
|
221 |
|
222 ENTRY("AsXmlL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AsXmlLL), |
|
223 |
|
224 ENTRY("AsXmlUnicodeL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AsXmlUnicodeLL), |
|
225 |
|
226 ENTRY("CopyFromL-CSenBaseElement", CsenxmlTester::CSenBaseElement_CopyFromLL), |
|
227 |
|
228 ENTRY("DetachL-CSenBaseElement", CsenxmlTester::CSenBaseElement_DetachLL), |
|
229 |
|
230 ENTRY("Child-CSenBaseElement", CsenxmlTester::CSenBaseElement_ChildL), |
|
231 |
|
232 ENTRY("Set-CSenBaseElement", CsenxmlTester::CSenBaseElement_SetL), |
|
233 |
|
234 ENTRY("AddAttributesL-CSenBaseElement", CsenxmlTester::CSenBaseElement_AddAttributesLL), |
|
235 |
|
236 ENTRY("AsElement-CSenBaseElement", CsenxmlTester::CSenBaseElement_AsElementL), |
|
237 |
|
238 ENTRY("ContentWriteStreamL-CSenBaseElement", CsenxmlTester::CSenBaseElement_ContentWriteStreamLL), |
|
239 |
|
240 ENTRY("RemoveAttributeL-CSenBaseElement", CsenxmlTester::CSenBaseElement_RemoveAttributeLL), |
|
241 |
|
242 ENTRY("NewL-CSenXmlElement", CsenxmlTester::CSenXmlElement_NewLL), |
|
243 |
|
244 ENTRY("NewL-CSenXmlElement", CsenxmlTester::CSenXmlElement_NewL_1L), |
|
245 |
|
246 ENTRY("NewL-CSenXmlElement", CsenxmlTester::CSenXmlElement_NewL_2L), |
|
247 |
|
248 ENTRY("SetAttributesL-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetAttributesLL), |
|
249 |
|
250 ENTRY("LocalName-CSenXmlElement", CsenxmlTester::CSenXmlElement_LocalNameL), |
|
251 |
|
252 ENTRY("NamespaceURI-CSenXmlElement", CsenxmlTester::CSenXmlElement_NamespaceURIL), |
|
253 |
|
254 ENTRY("NsPrefix-CSenXmlElement", CsenxmlTester::CSenXmlElement_NsPrefixL), |
|
255 |
|
256 ENTRY("SetPrefixL-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetPrefixLL), |
|
257 |
|
258 ENTRY("HasContent-CSenXmlElement", CsenxmlTester::CSenXmlElement_HasContentL), |
|
259 |
|
260 ENTRY("Content-CSenXmlElement", CsenxmlTester::CSenXmlElement_ContentL), |
|
261 |
|
262 ENTRY("ContentWriteStreamL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ContentWriteStreamLL), |
|
263 |
|
264 |
|
265 ENTRY("ContentUnicodeL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ContentUnicodeLL), |
|
266 |
|
267 ENTRY("SetContentL-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetContentLL), |
|
268 |
|
269 ENTRY("ConsistsOfL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ConsistsOfLL), |
|
270 |
|
271 ENTRY("ConsistsOfL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ConsistsOfL1L), |
|
272 |
|
273 ENTRY("ConsistsOfL-Extratest_CSenXmlElement", CsenxmlTester::CSenXmlElement_ConsistsOfL1L), |
|
274 |
|
275 ENTRY("SetNamespaceL-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetNamespaceLL), |
|
276 |
|
277 ENTRY("SetNamespaceL-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetNamespaceL_1L), |
|
278 |
|
279 ENTRY("SetNamespaceL-Sametest_CSenXmlElement", CsenxmlTester::CSenXmlElement_SetNamespaceL_2same1L), |
|
280 |
|
281 ENTRY("SetNamespaceL-Difftest_CSenXmlElement", CsenxmlTester::CSenXmlElement_SetNamespaceL_2Diff1L), |
|
282 |
|
283 ENTRY("AddNamespaceL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddNamespaceLL), |
|
284 |
|
285 ENTRY("AddNamespaceL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddNamespaceL_1L), |
|
286 |
|
287 ENTRY("Namespace-CSenXmlElement", CsenxmlTester::CSenXmlElement_NamespaceL), |
|
288 |
|
289 ENTRY("Namespace-CSenXmlElement", CsenxmlTester::CSenXmlElement_Namespace_1L), |
|
290 |
|
291 ENTRY("Namespace-CSenXmlElement", CsenxmlTester::CSenXmlElement_Namespace_2L), |
|
292 |
|
293 ENTRY("Namespace-CSenXmlElement", CsenxmlTester::CSenXmlElement_Namespace_3L), |
|
294 |
|
295 ENTRY("ElementsL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ElementsLL), |
|
296 |
|
297 ENTRY("AttributesL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AttributesLL), |
|
298 ENTRY("AttributeLL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddAttributeLL), |
|
299 |
|
300 ENTRY("NamespacesL-CSenXmlElement", CsenxmlTester::CSenXmlElement_NamespacesLL), |
|
301 |
|
302 ENTRY("AttrValue-CSenXmlElement", CsenxmlTester::CSenXmlElement_AttrValueL), |
|
303 |
|
304 ENTRY("AddAttrL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddAttrLL), |
|
305 |
|
306 ENTRY("Parent-CSenXmlElement", CsenxmlTester::CSenXmlElement_ParentL), |
|
307 |
|
308 ENTRY("SetParent-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetParentL), |
|
309 |
|
310 ENTRY("Root-CSenXmlElement", CsenxmlTester::CSenXmlElement_RootL), |
|
311 |
|
312 ENTRY("Element-CSenXmlElement", CsenxmlTester::CSenXmlElement_ElementL), |
|
313 |
|
314 ENTRY("CreateElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_CreateElementLL), |
|
315 |
|
316 ENTRY("InsertElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_InsertElementLL), |
|
317 |
|
318 ENTRY("AddElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddElementLL), |
|
319 |
|
320 ENTRY("AddElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddElementL_1L), |
|
321 |
|
322 ENTRY("AddElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddElementL_2L), |
|
323 |
|
324 ENTRY("AddElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddElementL_3L), |
|
325 |
|
326 ENTRY("RemoveElement-CSenXmlElement", CsenxmlTester::CSenXmlElement_RemoveElementL), |
|
327 |
|
328 ENTRY("RemoveElement-CSenXmlElement", CsenxmlTester::CSenXmlElement_RemoveElement_1L), |
|
329 |
|
330 ENTRY("RemoveElement-CSenXmlElement", CsenxmlTester::CSenXmlElement_RemoveElement_2L), |
|
331 |
|
332 ENTRY("ReplaceElementL-CSenXmlElement", CsenxmlTester::CSenXmlElement_ReplaceElementLL), |
|
333 |
|
334 ENTRY("AsXmlL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AsXmlLL), |
|
335 |
|
336 ENTRY("AsXmlUnicodeL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AsXmlUnicodeLL), |
|
337 |
|
338 ENTRY("CopyFromL-CSenXmlElement", CsenxmlTester::CSenXmlElement_CopyFromLL), |
|
339 |
|
340 ENTRY("DetachL-CSenXmlElement", CsenxmlTester::CSenXmlElement_DetachLL), |
|
341 |
|
342 ENTRY("Child-CSenXmlElement", CsenxmlTester::CSenXmlElement_ChildL), |
|
343 |
|
344 ENTRY("Set-CSenXmlElement", CsenxmlTester::CSenXmlElement_SetL), |
|
345 |
|
346 ENTRY("AddAttributesL-CSenXmlElement", CsenxmlTester::CSenXmlElement_AddAttributesLL), |
|
347 |
|
348 //ENTRY("RemoveAttributeL-CSenXmlElement", CsenxmlTester::CSenXmlElement_RemoveAttributeLL), |
|
349 |
|
350 ENTRY("AsElement-CSenXmlElement", CsenxmlTester::CSenXmlElement_AsElementL), |
|
351 |
|
352 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_L), |
|
353 |
|
354 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_1L), |
|
355 |
|
356 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_2L), |
|
357 |
|
358 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_3L), |
|
359 |
|
360 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_4L), |
|
361 |
|
362 ENTRY("NewL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NewL_5L), |
|
363 |
|
364 ENTRY("AsXmlUnicodeL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_AsXmlUnicodeLL), |
|
365 |
|
366 ENTRY("WriteAsXMLToL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_WriteAsXMLToLL), |
|
367 |
|
368 ENTRY("Content-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ContentL), |
|
369 ENTRY("Namespace-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NamespaceL), |
|
370 ENTRY("EnsureNamespace-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_EnsureNamespaceL), |
|
371 ENTRY("DetachL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_DetachLL), |
|
372 ENTRY("SaveNamespacesLL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_SaveNamespacesLL), |
|
373 ENTRY("ResetContentLL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ResetContentLL), |
|
374 ENTRY("LocalNameL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_LocalNameL), |
|
375 ENTRY("NsUriL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NsUriL), |
|
376 ENTRY("NsPrefixL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_NsPrefixL), |
|
377 ENTRY("ExtractElementL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ExtractElementL), |
|
378 ENTRY("SetAttributesL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_SetAttributesLL), |
|
379 ENTRY("ConsistsOfL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ConsistsOfLL), |
|
380 ENTRY("ParseL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ParseLL), |
|
381 ENTRY("ErrorParseL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ParseL1L), |
|
382 ENTRY("SetContentOfL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_SetContentOfLL), |
|
383 ENTRY("ContentOf-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_ContentOfL), |
|
384 ENTRY("ParserFeature-CSenXMLReader", CsenxmlTester::CSenXMLReader_ParserFeatureL), |
|
385 ENTRY("ParseL-CSenXMLReader", CsenxmlTester::CSenXMLReader_ParseLL), |
|
386 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_1L), |
|
387 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_L), |
|
388 |
|
389 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_2L), |
|
390 |
|
391 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_3L), |
|
392 |
|
393 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_4L), |
|
394 |
|
395 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_5L), |
|
396 |
|
397 ENTRY("NewL-CSenDomFragment", CsenxmlTester::CSenDomFragment_NewL_6L), |
|
398 |
|
399 //ENTRY("ExpandL-CSenDomFragment", CsenxmlTester::CSenDomFragment_ExpandLL), |
|
400 |
|
401 //ENTRY("ResumeParsingFromL-CSenDomFragment", CsenxmlTester::CSenDomFragment_ResumeParsingFromLL), |
|
402 |
|
403 ENTRY("ParseWithL-CSenDomFragment", CsenxmlTester::CSenDomFragment_ParseWithLL), |
|
404 |
|
405 |
|
406 ENTRY("SetAttributesL-CSenDomFragment", CsenxmlTester::CSenDomFragment_SetAttributesLL), |
|
407 |
|
408 ENTRY("ParseL1-CSenDomFragment", CsenxmlTester::CSenDomFragment_ParseL1L), |
|
409 |
|
410 ENTRY("NewL-CSenNamespace", CsenxmlTester::CSenNamespace_NewL_L), |
|
411 |
|
412 ENTRY("NewLC-CSenNamespace", CsenxmlTester::CSenNamespace_NewLC_L), |
|
413 |
|
414 ENTRY("NewL-CSenNamespace", CsenxmlTester::CSenNamespace_NewL_1L), |
|
415 |
|
416 ENTRY("NewLC-CSenNamespace", CsenxmlTester::CSenNamespace_NewLC_1L), |
|
417 |
|
418 ENTRY("MatchesL-CSenNamespace", CsenxmlTester::CSenNamespace_MatchesL_L), |
|
419 |
|
420 ENTRY("InsertL-CSenNamespace", CsenxmlTester::CSenNamespace_InsertLL), |
|
421 |
|
422 |
|
423 ENTRY("NewL-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewL_L), |
|
424 |
|
425 ENTRY("NewLC-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewLC_L), |
|
426 |
|
427 ENTRY("NewL-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewL_1L), |
|
428 |
|
429 ENTRY("NewLC-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewLC_1L), |
|
430 |
|
431 ENTRY("NewL-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewL_2L), |
|
432 |
|
433 ENTRY("NewLC-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewLC_2L), |
|
434 |
|
435 ENTRY("NewL-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewL_3L), |
|
436 |
|
437 ENTRY("NewLC-CSenXmlReader", CsenxmlTester::CSenXmlReader_NewLC_3L), |
|
438 |
|
439 ENTRY("EnabledParserFeature-CSenXmlReader", CsenxmlTester::CSenXmlReader_EnabledParserFeature_L), |
|
440 |
|
441 ENTRY("ToUtf8LC-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_ToUtf8LCL), |
|
442 |
|
443 ENTRY("StartsWith-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_StartsWithL), |
|
444 |
|
445 ENTRY("EndsWith-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_EndsWithL), |
|
446 |
|
447 ENTRY("AttrValue-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_AttrValueL), |
|
448 |
|
449 ENTRY("AllocAttrValueL-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_AllocAttrValueLL), |
|
450 |
|
451 ENTRY("DecodeHttpCharactersL-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_DecodeHttpCharactersLL), |
|
452 |
|
453 ENTRY("DecodeHttpCharactersLC-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_DecodeHttpCharactersLCL), |
|
454 |
|
455 ENTRY("NsPrefix-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_NsPrefixL), |
|
456 |
|
457 ENTRY("LocalName-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_LocalNameL), |
|
458 |
|
459 ENTRY("RemoveAttributeL-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_RemoveAttributeLL), |
|
460 |
|
461 ENTRY("RemoveAttributeL1-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_RemoveAttributeL1L), |
|
462 |
|
463 ENTRY("AddAttributeL-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_AddAttributeLL), |
|
464 |
|
465 ENTRY("AddAttributeL1-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_AddAttributeL1L), |
|
466 |
|
467 ENTRY("AddAttributeL1-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_AddAttributeL2L), |
|
468 |
|
469 ENTRY("EncodeHttpCharactersLC-CSenXmlUtils", CsenxmlTester::CSenXmlUtils_EncodeHttpCharactersLCL), |
|
470 ENTRY("BaseConstructL-CSenDomFragment", CsenxmlTester::CSenDomFragment_BaseConstructL), |
|
471 ENTRY("BaseConstructL-CSenBaseFragment", CsenxmlTester::CSenBaseFragment_BaseConstructL), |
|
472 //ADD NEW ENTRY HERE |
|
473 // [test cases entries]-Do not remove |
|
474 |
|
475 }; |
|
476 |
|
477 const TInt count = sizeof( KFunctions ) / |
|
478 sizeof( TStifFunctionInfo ); |
|
479 |
|
480 return RunInternalL( KFunctions, count, aItem ); |
|
481 |
|
482 } |
|
483 |
|
484 void CsenxmlTester::SetupL( ){ |
|
485 if ( iXmlReader ){ |
|
486 delete iXmlReader; |
|
487 iXmlReader = NULL; |
|
488 } |
|
489 iXmlReader = CSenXmlReader::NewL( |
|
490 ); |
|
491 } |
|
492 |
|
493 void CsenxmlTester::Teardown( ){ |
|
494 if ( iXmlReader){ |
|
495 delete iXmlReader; |
|
496 iXmlReader = NULL; |
|
497 } |
|
498 } |
|
499 |
|
500 TInt CsenxmlTester::CSenBaseAttribute_NewLL (CStifItemParser& aItem) |
|
501 { |
|
502 SetupL(); |
|
503 TBool Flag; |
|
504 CSenBaseAttribute* pAttr=CSenBaseAttribute::NewL(_L8("Attr1"),_L8("value")); |
|
505 CleanupStack::PushL(pAttr); |
|
506 if(pAttr) |
|
507 Flag=1; |
|
508 else |
|
509 Flag=0; |
|
510 /*EUNIT_ASSERT( Flag );*/ |
|
511 if(!Flag) |
|
512 return KErrArgument; |
|
513 |
|
514 CleanupStack::PopAndDestroy(pAttr); |
|
515 Teardown(); |
|
516 return KErrNone; |
|
517 } |
|
518 |
|
519 TInt CsenxmlTester::CSenBaseAttribute_NewL_1L (CStifItemParser& aItem) |
|
520 { |
|
521 SetupL(); |
|
522 TBool Flag; |
|
523 CSenBaseAttribute* pAttr=CSenBaseAttribute::NewL(_L8("N:Attr1"),_L8("Attr1"),_L8("value")); |
|
524 CleanupStack::PushL(pAttr); |
|
525 if(pAttr) |
|
526 Flag=1; |
|
527 else |
|
528 Flag=0; |
|
529 /*EUNIT_ASSERT( Flag );*/ |
|
530 if(!Flag) |
|
531 return KErrArgument; |
|
532 |
|
533 CleanupStack::PopAndDestroy(pAttr); |
|
534 Teardown(); |
|
535 return KErrNone; |
|
536 } |
|
537 |
|
538 TInt CsenxmlTester::CSenBaseElement_NewLL (CStifItemParser& aItem) |
|
539 { |
|
540 SetupL(); |
|
541 TBool Flag; |
|
542 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
543 CleanupStack::PushL(pElement); |
|
544 if(pElement!=NULL) |
|
545 Flag=1; |
|
546 else |
|
547 Flag=0; |
|
548 /*EUNIT_ASSERT( Flag );*/ |
|
549 if(!Flag) |
|
550 return KErrArgument; |
|
551 |
|
552 CleanupStack::PopAndDestroy(pElement); |
|
553 Teardown(); |
|
554 return KErrNone; |
|
555 } |
|
556 |
|
557 TInt CsenxmlTester::CSenBaseElement_NewL_1L (CStifItemParser& aItem) |
|
558 { |
|
559 SetupL(); |
|
560 TBool Flag; |
|
561 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia")); |
|
562 CleanupStack::PushL(pElement); |
|
563 if(pElement!=NULL) |
|
564 Flag=1; |
|
565 else |
|
566 Flag=0; |
|
567 /*EUNIT_ASSERT( Flag );*/ |
|
568 if(!Flag) |
|
569 return KErrArgument; |
|
570 |
|
571 CleanupStack::PopAndDestroy(pElement); |
|
572 Teardown(); |
|
573 return KErrNone; |
|
574 } |
|
575 |
|
576 TInt CsenxmlTester::CSenBaseElement_NewL_2L (CStifItemParser& aItem) |
|
577 { |
|
578 SetupL(); |
|
579 TBool Flag; |
|
580 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia")); |
|
581 CleanupStack::PushL(pElement); |
|
582 if(pElement!=NULL) |
|
583 Flag=1; |
|
584 else |
|
585 Flag=0; |
|
586 /*EUNIT_ASSERT( Flag );*/ |
|
587 if(!Flag) |
|
588 return KErrArgument; |
|
589 |
|
590 CleanupStack::PopAndDestroy(pElement); |
|
591 Teardown(); |
|
592 return KErrNone; |
|
593 } |
|
594 |
|
595 TInt CsenxmlTester::CSenBaseElement_NewL_3L (CStifItemParser& aItem) |
|
596 { |
|
597 SetupL(); |
|
598 TBool Flag; |
|
599 RAttributeArray aAttrs; |
|
600 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs); |
|
601 CleanupStack::PushL(pElement); |
|
602 if(pElement!=NULL) |
|
603 Flag=1; |
|
604 else |
|
605 Flag=0; |
|
606 /*EUNIT_ASSERT( Flag );*/ |
|
607 if(!Flag) |
|
608 return KErrArgument; |
|
609 |
|
610 CleanupStack::PopAndDestroy(pElement); |
|
611 Teardown(); |
|
612 return KErrNone; |
|
613 } |
|
614 |
|
615 TInt CsenxmlTester::CSenBaseElement_NewL_4L (CStifItemParser& aItem) |
|
616 { |
|
617 SetupL(); |
|
618 TBool Flag; |
|
619 RAttributeArray aAttrs; |
|
620 CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia")); |
|
621 CleanupStack::PushL(ele); |
|
622 CSenElement* parent = ele->Parent(); |
|
623 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent); |
|
624 CleanupStack::PushL(pElement); |
|
625 if(pElement!=NULL) |
|
626 Flag=1; |
|
627 else |
|
628 Flag=0; |
|
629 /*EUNIT_ASSERT( Flag );*/ |
|
630 if(!Flag) |
|
631 return KErrArgument; |
|
632 |
|
633 CleanupStack::PopAndDestroy(pElement); |
|
634 CleanupStack::PopAndDestroy(ele); |
|
635 Teardown(); |
|
636 return KErrNone; |
|
637 } |
|
638 |
|
639 TInt CsenxmlTester::CSenBaseElement_SetAttributesLL (CStifItemParser& aItem) |
|
640 { |
|
641 SetupL(); |
|
642 RStringPool stringPool; |
|
643 stringPool.OpenL(); |
|
644 CleanupClosePushL(stringPool); |
|
645 |
|
646 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
647 CleanupClosePushL(nsUriRString); |
|
648 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
649 CleanupClosePushL(nsPrefixRString); |
|
650 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
651 CleanupClosePushL(localNameRString); |
|
652 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
653 CleanupClosePushL(valueRString); |
|
654 |
|
655 RAttribute attribute; |
|
656 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
657 valueRString); |
|
658 CleanupStack::Pop(4); |
|
659 CleanupClosePushL(attribute); |
|
660 |
|
661 RAttributeArray attrArray; |
|
662 attrArray.AppendL(attribute); |
|
663 CleanupClosePushL(attrArray); |
|
664 |
|
665 CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia")); |
|
666 CleanupStack::PushL(pElement); |
|
667 pElement->SetAttributesL(attrArray); |
|
668 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
669 /*EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/ |
|
670 if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ))) |
|
671 return KErrArgument; |
|
672 |
|
673 CleanupStack::PopAndDestroy(pElement); |
|
674 CleanupStack::PopAndDestroy(&attrArray); |
|
675 CleanupStack::PopAndDestroy(&attribute); |
|
676 CleanupStack::PopAndDestroy(&stringPool); |
|
677 delete pElementBuf; |
|
678 Teardown(); |
|
679 return KErrNone; |
|
680 } |
|
681 |
|
682 TInt CsenxmlTester::CSenBaseElement_LocalNameL (CStifItemParser& aItem) |
|
683 { |
|
684 SetupL(); |
|
685 TBool Flag; |
|
686 _LIT8(KLName,"Nokia"); |
|
687 |
|
688 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
689 CleanupStack::PushL(pElement); |
|
690 const TDesC8& pLName=pElement->LocalName(); |
|
691 if(pLName==_L8("Nokia")) |
|
692 Flag=1; |
|
693 else |
|
694 Flag=0; |
|
695 /* EUNIT_ASSERT(Flag);*/ |
|
696 if(!Flag) |
|
697 return KErrArgument; |
|
698 |
|
699 CleanupStack::PopAndDestroy(pElement); |
|
700 Teardown(); |
|
701 return KErrNone; |
|
702 } |
|
703 |
|
704 TInt CsenxmlTester::CSenBaseElement_NamespaceURIL (CStifItemParser& aItem) |
|
705 { |
|
706 SetupL(); |
|
707 _LIT8(KNSUri,"nsuria"); |
|
708 TBool Flag; |
|
709 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia")); |
|
710 CleanupStack::PushL(pElement); |
|
711 const TDesC8 &pNSUri=pElement->NamespaceURI(); |
|
712 if(pNSUri==KNSUri) |
|
713 Flag=1; |
|
714 else |
|
715 Flag=0; |
|
716 CleanupStack::PopAndDestroy(pElement); |
|
717 /*EUNIT_ASSERT( Flag );*/ |
|
718 if(!Flag) |
|
719 return KErrArgument; |
|
720 |
|
721 Teardown(); |
|
722 return KErrNone; |
|
723 } |
|
724 |
|
725 TInt CsenxmlTester::CSenBaseElement_NsPrefixL (CStifItemParser& aItem) |
|
726 { |
|
727 SetupL(); |
|
728 TBool Flag; |
|
729 _LIT8(KNSPrefix,"N"); |
|
730 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
731 const TDesC8& pNSPrefix=pElement->NsPrefix(); |
|
732 if(pNSPrefix==KNSPrefix) |
|
733 Flag=1; |
|
734 else |
|
735 Flag=0; |
|
736 delete pElement; |
|
737 /*EUNIT_ASSERT( Flag );*/ |
|
738 if(!Flag) |
|
739 return KErrArgument; |
|
740 |
|
741 Teardown(); |
|
742 return KErrNone; |
|
743 } |
|
744 |
|
745 TInt CsenxmlTester::CSenBaseElement_SetPrefixLL (CStifItemParser& aItem) |
|
746 { |
|
747 SetupL(); |
|
748 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia")); |
|
749 CleanupStack::PushL(pElement); |
|
750 pElement->SetPrefixL(_L8("N")); |
|
751 const TDesC8& pNSPrefix=pElement->NsPrefix(); |
|
752 /*EUNIT_ASSERT_EQUALS(pNSPrefix, _L8("N"));*/ |
|
753 TL(pNSPrefix == _L8("N")); |
|
754 CleanupStack::PopAndDestroy(pElement); |
|
755 Teardown(); |
|
756 return KErrNone; |
|
757 } |
|
758 |
|
759 TInt CsenxmlTester::CSenBaseElement_HasContentTL (CStifItemParser& aItem) |
|
760 { |
|
761 SetupL(); |
|
762 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
763 pElement->SetContentL(_L8("Nokia content")); |
|
764 TBool Flag=pElement->HasContent(); |
|
765 /*EUNIT_ASSERT( Flag );*/ |
|
766 if(!Flag) |
|
767 return KErrArgument; |
|
768 |
|
769 delete pElement; |
|
770 Teardown(); |
|
771 return KErrNone; |
|
772 } |
|
773 |
|
774 TInt CsenxmlTester::CSenBaseElement_HasContentFL (CStifItemParser& aItem) |
|
775 { |
|
776 SetupL(); |
|
777 TBool Flag; |
|
778 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
779 TBool pHasContnt=pElement->HasContent(); |
|
780 if(pHasContnt) |
|
781 Flag=0; |
|
782 else |
|
783 Flag=1; |
|
784 /*EUNIT_ASSERT( Flag );*/ |
|
785 if(!Flag) |
|
786 return KErrArgument; |
|
787 |
|
788 delete pElement; |
|
789 Teardown(); |
|
790 return KErrNone; |
|
791 } |
|
792 |
|
793 TInt CsenxmlTester::CSenBaseElement_ContentL (CStifItemParser& aItem) |
|
794 { |
|
795 SetupL(); |
|
796 TBool Flag; |
|
797 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
798 pElement->SetContentL(_L8("Nokia content")); |
|
799 TPtrC8 pContent=pElement->Content(); |
|
800 if(pContent==_L8("Nokia content")) |
|
801 Flag=1; |
|
802 else |
|
803 Flag=0; |
|
804 |
|
805 /*EUNIT_ASSERT( Flag );*/ |
|
806 if(!Flag) |
|
807 return KErrArgument; |
|
808 |
|
809 delete pElement; |
|
810 Teardown(); |
|
811 return KErrNone; |
|
812 } |
|
813 |
|
814 TInt CsenxmlTester::CSenBaseElement_Content_NullL (CStifItemParser& aItem) |
|
815 { |
|
816 SetupL(); |
|
817 TBool Flag; |
|
818 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
819 TPtrC8 pContent=pElement->Content(); |
|
820 if(pContent==KNullDesC8()) |
|
821 Flag=1; |
|
822 else |
|
823 Flag=0; |
|
824 |
|
825 /*EUNIT_ASSERT( Flag );*/ |
|
826 if(!Flag) |
|
827 return KErrArgument; |
|
828 |
|
829 delete pElement; |
|
830 Teardown(); |
|
831 return KErrNone; |
|
832 } |
|
833 |
|
834 TInt CsenxmlTester::CSenBaseElement_ContentUnicodeLL (CStifItemParser& aItem) |
|
835 { |
|
836 SetupL(); |
|
837 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
838 CleanupStack::PushL(pElement); |
|
839 pElement->SetContentL(_L8("Nokia content")); |
|
840 HBufC* ElementBuf=pElement->ContentUnicodeL(); |
|
841 /* EUNIT_ASSERT_EQUALS(*ElementBuf,_L("Nokia content"));*/ |
|
842 TL(*ElementBuf == _L("Nokia content")); |
|
843 CleanupStack::PopAndDestroy(pElement); |
|
844 delete ElementBuf; |
|
845 Teardown(); |
|
846 return KErrNone; |
|
847 } |
|
848 |
|
849 TInt CsenxmlTester::CSenBaseElement_SetContentLL (CStifItemParser& aItem) |
|
850 { |
|
851 SetupL(); |
|
852 TBool Flag; |
|
853 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
854 CleanupStack::PushL(pElement); |
|
855 TPtrC8 pContent=pElement->SetContentL(_L8("Nokia Content")); |
|
856 if(pContent==_L8("Nokia Content")) |
|
857 Flag=1; |
|
858 else |
|
859 Flag=0; |
|
860 /*EUNIT_ASSERT( Flag );*/ |
|
861 if(!Flag) |
|
862 return KErrArgument; |
|
863 |
|
864 CleanupStack::PopAndDestroy(pElement); |
|
865 Teardown(); |
|
866 return KErrNone; |
|
867 } |
|
868 |
|
869 TInt CsenxmlTester::CSenBaseElement_SetContentL_NullL (CStifItemParser& aItem) |
|
870 { |
|
871 SetupL(); |
|
872 TBool Flag; |
|
873 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
874 CleanupStack::PushL(pElement); |
|
875 pElement->SetContentL(_L8("element content")); |
|
876 TPtrC8 pContent=pElement->SetContentL(KNullDesC8); |
|
877 if(pContent==KNullDesC8()) |
|
878 Flag=1; |
|
879 else |
|
880 Flag=0; |
|
881 /*EUNIT_ASSERT( Flag );*/ |
|
882 if(!Flag) |
|
883 return KErrArgument; |
|
884 |
|
885 CleanupStack::PopAndDestroy(pElement); |
|
886 Teardown(); |
|
887 return KErrNone; |
|
888 } |
|
889 |
|
890 TInt CsenxmlTester::CSenBaseElement_SetContentL_OverRightL (CStifItemParser& aItem) |
|
891 { |
|
892 SetupL(); |
|
893 TBool Flag; |
|
894 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
895 CleanupStack::PushL(pElement); |
|
896 pElement->SetContentL(_L8("Nokia Content1")); |
|
897 pElement->SetContentL(_L8("Nokia Content2")); |
|
898 TPtrC8 pContent=pElement->Content(); |
|
899 if(pContent==_L8("Nokia Content2")) |
|
900 Flag=1; |
|
901 else |
|
902 Flag=0; |
|
903 /*EUNIT_ASSERT( Flag );*/ |
|
904 if(!Flag) |
|
905 return KErrArgument; |
|
906 |
|
907 CleanupStack::PopAndDestroy(pElement); |
|
908 Teardown(); |
|
909 return KErrNone; |
|
910 } |
|
911 |
|
912 TInt CsenxmlTester::CSenBaseElement_SetContentL_WithEscCharsL (CStifItemParser& aItem) |
|
913 { |
|
914 SetupL(); |
|
915 TBool Flag; |
|
916 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
917 CleanupStack::PushL(pElement); |
|
918 TPtrC8 pContent=pElement->SetContentL(_L8("N&o'k\"ia <Content>")); |
|
919 if(pContent==_L8("N&o'k\"ia <Content>")) |
|
920 Flag=1; |
|
921 else |
|
922 Flag=0; |
|
923 /*EUNIT_ASSERT( Flag );*/ |
|
924 if(!Flag) |
|
925 return KErrArgument; |
|
926 |
|
927 CleanupStack::PopAndDestroy(pElement); |
|
928 Teardown(); |
|
929 return KErrNone; |
|
930 } |
|
931 |
|
932 TInt CsenxmlTester::CSenBaseElement_ConsistsOfLL (CStifItemParser& aItem) |
|
933 { |
|
934 SetupL(); |
|
935 CSenBaseElement* pElementA=CSenBaseElement::NewL(_L8("Nokia")); |
|
936 CleanupStack::PushL(pElementA); |
|
937 CSenBaseElement* pChild1A=CSenBaseElement::NewL(_L8("Asp")); |
|
938 CleanupStack::PushL(pChild1A); |
|
939 CSenBaseElement* pChild2A=CSenBaseElement::NewL(_L8("WebServices")); |
|
940 CleanupStack::PushL(pChild2A); |
|
941 pElementA->SetContentL(_L8("Nokia organisation structure")); |
|
942 pElementA->AddElementL(*pChild1A); |
|
943 pElementA->AddElementL(*pChild2A); |
|
944 |
|
945 CSenBaseElement* pElementB=CSenBaseElement::NewL(_L8("Nokia")); |
|
946 CleanupStack::PushL(pElementB); |
|
947 CSenBaseElement* pChild1B=CSenBaseElement::NewL(_L8("Asp")); |
|
948 CleanupStack::PushL(pChild1A); |
|
949 CSenBaseElement* pChild2B=CSenBaseElement::NewL(_L8("WebServices")); |
|
950 CleanupStack::PushL(pChild2B); |
|
951 pElementB->SetContentL(_L8("Nokia organisation structure")); |
|
952 pElementB->AddElementL(*pChild1B); |
|
953 pElementB->AddElementL(*pChild2B); |
|
954 |
|
955 TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA); |
|
956 /*EUNIT_ASSERT( ConsistOfFlag );*/ |
|
957 if(!ConsistOfFlag) |
|
958 return KErrArgument; |
|
959 |
|
960 CleanupStack::Pop(2); |
|
961 CleanupStack::PopAndDestroy(pElementB); |
|
962 CleanupStack::Pop(2); |
|
963 CleanupStack::PopAndDestroy(pElementA); |
|
964 Teardown(); |
|
965 return KErrNone; |
|
966 } |
|
967 |
|
968 TInt CsenxmlTester::CSenBaseElement_SetNamespaceLL (CStifItemParser& aItem) |
|
969 { |
|
970 SetupL(); |
|
971 TBool Flag; |
|
972 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
973 CleanupStack::PushL(pElement); |
|
974 pElement->SetNamespaceL(_L8("namespaceuri")); |
|
975 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
976 if(pNsURI==_L8("namespaceuri")) |
|
977 Flag=1; |
|
978 else |
|
979 Flag=0; |
|
980 CleanupStack::PopAndDestroy(pElement); |
|
981 /*EUNIT_ASSERT( Flag );*/ |
|
982 if(!Flag) |
|
983 return KErrArgument; |
|
984 |
|
985 Teardown(); |
|
986 return KErrNone; |
|
987 } |
|
988 |
|
989 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_NullL (CStifItemParser& aItem) |
|
990 { |
|
991 SetupL(); |
|
992 TBool Flag; |
|
993 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
994 CleanupStack::PushL(pElement); |
|
995 pElement->SetNamespaceL(_L8("")); |
|
996 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
997 if(pNsURI==_L8("")) |
|
998 Flag=1; |
|
999 else |
|
1000 Flag=0; |
|
1001 CleanupStack::PopAndDestroy(pElement) ; |
|
1002 /*EUNIT_ASSERT( Flag );*/ |
|
1003 if(!Flag) |
|
1004 return KErrArgument; |
|
1005 |
|
1006 Teardown(); |
|
1007 return KErrNone; |
|
1008 } |
|
1009 |
|
1010 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_1L (CStifItemParser& aItem) |
|
1011 { |
|
1012 SetupL(); |
|
1013 TBool Flag; |
|
1014 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1015 CleanupStack::PushL(pElement); |
|
1016 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1017 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
1018 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
1019 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1020 Flag=1; |
|
1021 else |
|
1022 Flag=0; |
|
1023 CleanupStack::PopAndDestroy(pElement); |
|
1024 /*EUNIT_ASSERT( Flag );*/ |
|
1025 if(!Flag) |
|
1026 return KErrArgument; |
|
1027 |
|
1028 Teardown(); |
|
1029 return KErrNone; |
|
1030 } |
|
1031 |
|
1032 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_2same1L (CStifItemParser& aItem) |
|
1033 { |
|
1034 SetupL(); |
|
1035 TBool Flag; |
|
1036 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1037 CleanupStack::PushL(pElement); |
|
1038 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1039 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1040 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
1041 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
1042 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1043 Flag=1; |
|
1044 else |
|
1045 Flag=0; |
|
1046 /*EUNIT_ASSERT( Flag );*/ |
|
1047 if(!Flag) |
|
1048 return KErrArgument; |
|
1049 |
|
1050 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1051 /*EUNIT_ASSERT( pNsList.Count()==1 );*/ |
|
1052 if(!( pNsList.Count()==1 )) |
|
1053 return KErrArgument; |
|
1054 |
|
1055 CleanupStack::PopAndDestroy(pElement); |
|
1056 Teardown(); |
|
1057 return KErrNone; |
|
1058 } |
|
1059 |
|
1060 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_2Diff1L (CStifItemParser& aItem) |
|
1061 { |
|
1062 SetupL(); |
|
1063 TBool Flag; |
|
1064 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1065 CleanupStack::PushL(pElement); |
|
1066 pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1")); |
|
1067 pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri2")); |
|
1068 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
1069 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
1070 if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2")) |
|
1071 Flag=1; |
|
1072 else |
|
1073 Flag=0; |
|
1074 /*EUNIT_ASSERT( Flag );*/ |
|
1075 if(!Flag) |
|
1076 return KErrArgument; |
|
1077 |
|
1078 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1079 /*EUNIT_ASSERT( pNsList.Count()==2 );*/ |
|
1080 if(!( pNsList.Count()==2 )) |
|
1081 return KErrArgument; |
|
1082 |
|
1083 CleanupStack::PopAndDestroy(pElement); |
|
1084 Teardown(); |
|
1085 return KErrNone; |
|
1086 } |
|
1087 |
|
1088 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_DPSU1L (CStifItemParser& aItem) |
|
1089 { |
|
1090 SetupL(); |
|
1091 TBool Flag; |
|
1092 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1093 CleanupStack::PushL(pElement); |
|
1094 pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1")); |
|
1095 pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri1")); |
|
1096 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
1097 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
1098 if(pNsURI==_L8("namespaceuri1")&&pNsPrefix==_L8("N2")) |
|
1099 Flag=1; |
|
1100 else |
|
1101 Flag=0; |
|
1102 /*EUNIT_ASSERT( Flag );*/ |
|
1103 if(!Flag) |
|
1104 return KErrArgument; |
|
1105 |
|
1106 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1107 /*EUNIT_ASSERT( pNsList.Count()==2 );*/ |
|
1108 if(!( pNsList.Count()==2 )) |
|
1109 return KErrArgument; |
|
1110 |
|
1111 CleanupStack::PopAndDestroy(pElement); |
|
1112 Teardown(); |
|
1113 return KErrNone; |
|
1114 } |
|
1115 |
|
1116 TInt CsenxmlTester::CSenBaseElement_SetNamespaceL_SNsPC1L (CStifItemParser& aItem) |
|
1117 { |
|
1118 SetupL(); |
|
1119 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1120 CleanupStack::PushL(pElement); |
|
1121 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1122 CleanupStack::PushL(pParent); |
|
1123 pElement->SetParent(pParent); |
|
1124 pParent->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1125 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1126 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1127 /* EUNIT_ASSERT(pNsList.Count()==0);*/ |
|
1128 if(!(pNsList.Count()==0)) |
|
1129 return KErrArgument; |
|
1130 |
|
1131 CleanupStack::PopAndDestroy(pParent); |
|
1132 CleanupStack::PopAndDestroy(pElement); |
|
1133 Teardown(); |
|
1134 return KErrNone; |
|
1135 } |
|
1136 |
|
1137 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_FL (CStifItemParser& aItem) |
|
1138 { |
|
1139 SetupL(); |
|
1140 TBool Flag; |
|
1141 TBool CheckParent=FALSE; |
|
1142 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1143 CleanupStack::PushL(pElement); |
|
1144 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri")); |
|
1145 CleanupStack::PushL(pNs1); |
|
1146 const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent); |
|
1147 const TDesC8& pNsURI=pNs->URI(); |
|
1148 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1149 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1150 Flag=1; |
|
1151 else |
|
1152 Flag=0; |
|
1153 CleanupStack::PopAndDestroy(pNs1); |
|
1154 CleanupStack::PopAndDestroy(pElement); |
|
1155 /*EUNIT_ASSERT( Flag );*/ |
|
1156 if(!Flag) |
|
1157 return KErrArgument; |
|
1158 |
|
1159 Teardown(); |
|
1160 return KErrNone; |
|
1161 } |
|
1162 |
|
1163 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_TL (CStifItemParser& aItem) |
|
1164 { |
|
1165 SetupL(); |
|
1166 TBool Flag; |
|
1167 TBool CheckParent=TRUE; |
|
1168 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1169 CleanupStack::PushL(pElement); |
|
1170 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement")); |
|
1171 CleanupStack::PushL(pParent); |
|
1172 |
|
1173 pElement->SetParent(pParent); |
|
1174 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri")); |
|
1175 CleanupStack::PushL(pNs1); |
|
1176 const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent); |
|
1177 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1178 const TDesC8& pNsURI=pNs->URI(); |
|
1179 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1180 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1181 Flag=1; |
|
1182 else |
|
1183 Flag=0; |
|
1184 |
|
1185 /*EUNIT_ASSERT( Flag );*/ |
|
1186 if(!Flag) |
|
1187 return KErrArgument; |
|
1188 |
|
1189 /* EUNIT_ASSERT( pNsList.Count()==1);*/ |
|
1190 if(!(pNsList.Count()==1)) |
|
1191 return KErrArgument; |
|
1192 |
|
1193 CleanupStack::PopAndDestroy(pNs1); |
|
1194 CleanupStack::PopAndDestroy(pParent); |
|
1195 CleanupStack::PopAndDestroy(pElement); |
|
1196 |
|
1197 Teardown(); |
|
1198 return KErrNone; |
|
1199 } |
|
1200 |
|
1201 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_TSPL (CStifItemParser& aItem) |
|
1202 { |
|
1203 SetupL(); |
|
1204 TBool Flag; |
|
1205 TBool CheckParent=TRUE; |
|
1206 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement")); |
|
1207 CleanupStack::PushL(pParent); |
|
1208 pParent->AddNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1209 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1210 CleanupStack::PushL(pElement); |
|
1211 pElement->SetParent(pParent); |
|
1212 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri")); |
|
1213 CleanupStack::PushL(pNs1); |
|
1214 const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent); |
|
1215 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1216 const TDesC8& pNsURI=pNs->URI(); |
|
1217 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1218 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1219 Flag=1; |
|
1220 else |
|
1221 Flag=0; |
|
1222 |
|
1223 /*EUNIT_ASSERT( Flag );*/ |
|
1224 if(!Flag) |
|
1225 return KErrArgument; |
|
1226 |
|
1227 /* EUNIT_ASSERT( pNsList.Count()==0);*/ |
|
1228 if(!(pNsList.Count()==0)) |
|
1229 return KErrArgument; |
|
1230 |
|
1231 CleanupStack::PopAndDestroy(pNs1); |
|
1232 CleanupStack::PopAndDestroy(pElement); |
|
1233 CleanupStack::PopAndDestroy(pParent); |
|
1234 Teardown(); |
|
1235 return KErrNone; |
|
1236 } |
|
1237 |
|
1238 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_TDPL (CStifItemParser& aItem) |
|
1239 { |
|
1240 SetupL(); |
|
1241 TBool Flag; |
|
1242 TBool CheckParent=TRUE; |
|
1243 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement")); |
|
1244 CleanupStack::PushL(pParent); |
|
1245 pParent->AddNamespaceL(_L8("N1"),_L8("namespaceuri1")); |
|
1246 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1247 CleanupStack::PushL(pElement); |
|
1248 pElement->SetParent(pParent); |
|
1249 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri")); |
|
1250 CleanupStack::PushL(pNs1); |
|
1251 const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent); |
|
1252 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1253 const TDesC8& pNsURI=pNs->URI(); |
|
1254 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1255 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1256 Flag=1; |
|
1257 else |
|
1258 Flag=0; |
|
1259 |
|
1260 /*EUNIT_ASSERT( Flag );*/ |
|
1261 if(!Flag) |
|
1262 return KErrArgument; |
|
1263 |
|
1264 /* EUNIT_ASSERT( pNsList.Count()==1);*/ |
|
1265 if(!(pNsList.Count()==1)) |
|
1266 return KErrArgument; |
|
1267 |
|
1268 CleanupStack::PopAndDestroy(pNs1); |
|
1269 CleanupStack::PopAndDestroy(pElement); |
|
1270 CleanupStack::PopAndDestroy(pParent); |
|
1271 Teardown(); |
|
1272 return KErrNone; |
|
1273 } |
|
1274 |
|
1275 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_1L (CStifItemParser& aItem) |
|
1276 { |
|
1277 SetupL(); |
|
1278 TBool Flag; |
|
1279 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1280 CleanupStack::PushL(pElement); |
|
1281 const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1282 const TDesC8& pNsURI=pNs->URI(); |
|
1283 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1284 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1285 Flag=1; |
|
1286 else |
|
1287 Flag=0; |
|
1288 CleanupStack::PopAndDestroy(pElement); |
|
1289 /*EUNIT_ASSERT( Flag );*/ |
|
1290 if(!Flag) |
|
1291 return KErrArgument; |
|
1292 |
|
1293 Teardown(); |
|
1294 return KErrNone; |
|
1295 } |
|
1296 |
|
1297 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_2same1L (CStifItemParser& aItem) |
|
1298 { |
|
1299 SetupL(); |
|
1300 TBool Flag; |
|
1301 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1302 CleanupStack::PushL(pElement); |
|
1303 const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1304 pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
1305 const TDesC8& pNsURI=pNs->URI(); |
|
1306 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1307 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
1308 Flag=1; |
|
1309 else |
|
1310 Flag=0; |
|
1311 /*EUNIT_ASSERT( Flag );*/ |
|
1312 if(!Flag) |
|
1313 return KErrArgument; |
|
1314 |
|
1315 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1316 /*EUNIT_ASSERT( pNsList.Count()==1 );*/ |
|
1317 if(!(pNsList.Count()==1)) |
|
1318 return KErrArgument; |
|
1319 |
|
1320 CleanupStack::PopAndDestroy(pElement); |
|
1321 Teardown(); |
|
1322 return KErrNone; |
|
1323 } |
|
1324 |
|
1325 TInt CsenxmlTester::CSenBaseElement_AddNamespaceL_2Diff1L (CStifItemParser& aItem) |
|
1326 { |
|
1327 SetupL(); |
|
1328 TBool Flag; |
|
1329 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1330 CleanupStack::PushL(pElement); |
|
1331 const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N1"),_L8("namespaceuri1")); |
|
1332 pNs=pElement->AddNamespaceL(_L8("N2"),_L8("namespaceuri2")); |
|
1333 const TDesC8& pNsURI=pNs->URI(); |
|
1334 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
1335 if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2")) |
|
1336 Flag=1; |
|
1337 else |
|
1338 Flag=0; |
|
1339 /*EUNIT_ASSERT( Flag );*/ |
|
1340 if(!Flag) |
|
1341 return KErrArgument; |
|
1342 |
|
1343 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1344 /*EUNIT_ASSERT( pNsList.Count()==2 );*/ |
|
1345 if(!(pNsList.Count()==2)) |
|
1346 return KErrArgument; |
|
1347 |
|
1348 CleanupStack::PopAndDestroy(pElement); |
|
1349 Teardown(); |
|
1350 return KErrNone; |
|
1351 } |
|
1352 |
|
1353 |
|
1354 TInt CsenxmlTester::CSenBaseElement_NamespaceL (CStifItemParser& aItem) |
|
1355 { |
|
1356 SetupL(); |
|
1357 TBool Flag,Flag1,Flag2; |
|
1358 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1359 CleanupStack::PushL(pElement); |
|
1360 //NULL |
|
1361 pElement->SetNamespaceL(_L8("")); |
|
1362 const CSenNamespace* pNs2=pElement->Namespace(); |
|
1363 if(pNs2==NULL) |
|
1364 Flag2=1; |
|
1365 else |
|
1366 Flag2=0; |
|
1367 /*EUNIT_ASSERT(Flag2);*/ |
|
1368 if(!Flag2) |
|
1369 return KErrArgument; |
|
1370 |
|
1371 |
|
1372 //only URI |
|
1373 pElement->SetNamespaceL(_L8("nsuri")); |
|
1374 const CSenNamespace* pNs1=pElement->Namespace(); |
|
1375 if(pNs1->Prefix()==_L8("")&&pNs1->URI()==_L8("nsuri")) |
|
1376 Flag1=1; |
|
1377 else |
|
1378 Flag1=0; |
|
1379 /*EUNIT_ASSERT(Flag1);*/ |
|
1380 if(!Flag1) |
|
1381 return KErrArgument; |
|
1382 |
|
1383 //URI and Prefix |
|
1384 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1385 const CSenNamespace* pNs=pElement->Namespace(); |
|
1386 if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri")) |
|
1387 Flag=1; |
|
1388 else |
|
1389 Flag=0; |
|
1390 /*EUNIT_ASSERT( Flag );*/ |
|
1391 if(!Flag) |
|
1392 return KErrArgument; |
|
1393 |
|
1394 CleanupStack::PopAndDestroy(pElement); |
|
1395 Teardown(); |
|
1396 return KErrNone; |
|
1397 } |
|
1398 |
|
1399 TInt CsenxmlTester::CSenBaseElement_Namespace_1L (CStifItemParser& aItem) |
|
1400 { |
|
1401 SetupL(); |
|
1402 TBool Flag,Flag1; |
|
1403 //True case |
|
1404 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1405 CleanupStack::PushL(pElement); |
|
1406 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1407 const CSenNamespace* pNs=pElement->Namespace(_L8("n")); |
|
1408 if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri")) |
|
1409 Flag=1; |
|
1410 else |
|
1411 Flag=0; |
|
1412 /*EUNIT_ASSERT( Flag );*/ |
|
1413 if(!Flag) |
|
1414 return KErrArgument; |
|
1415 |
|
1416 CleanupStack::PopAndDestroy(pElement); |
|
1417 //False case |
|
1418 pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1419 CleanupStack::PushL(pElement); |
|
1420 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1421 pNs=pElement->Namespace(_L8("N")); |
|
1422 if(pNs==NULL) |
|
1423 Flag1=1; |
|
1424 else |
|
1425 Flag1=0; |
|
1426 /*EUNIT_ASSERT(Flag1);*/ |
|
1427 if(!Flag1) |
|
1428 return KErrArgument; |
|
1429 |
|
1430 CleanupStack::PopAndDestroy(pElement); |
|
1431 Teardown(); |
|
1432 return KErrNone; |
|
1433 } |
|
1434 |
|
1435 TInt CsenxmlTester::CSenBaseElement_Namespace_WP1L (CStifItemParser& aItem) |
|
1436 { |
|
1437 SetupL(); |
|
1438 TBool Flag,Flag1; |
|
1439 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")) ; |
|
1440 CleanupStack::PushL(pParent); |
|
1441 pParent->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1442 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1443 CleanupStack::PushL(pElement); |
|
1444 pElement->SetParent(pParent); |
|
1445 const CSenNamespace* pNs=pElement->Namespace(_L8("n")); |
|
1446 if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri")) |
|
1447 Flag=1; |
|
1448 else |
|
1449 Flag=0; |
|
1450 /*EUNIT_ASSERT( Flag );*/ |
|
1451 if(!Flag) |
|
1452 return KErrArgument; |
|
1453 |
|
1454 CleanupStack::PopAndDestroy(pElement); |
|
1455 CleanupStack::PopAndDestroy(pParent); |
|
1456 //False case |
|
1457 pParent=CSenBaseElement::NewL(_L8("Parent")) ; |
|
1458 CleanupStack::PushL(pParent); |
|
1459 pParent->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
1460 pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1461 CleanupStack::PushL(pElement); |
|
1462 pElement->SetParent(pParent); |
|
1463 pNs=pElement->Namespace(_L8("N")); |
|
1464 if(pNs==NULL) |
|
1465 Flag1=1; |
|
1466 else |
|
1467 Flag1=0; |
|
1468 /* EUNIT_ASSERT( Flag1 );*/ |
|
1469 if(!Flag1) |
|
1470 return KErrArgument; |
|
1471 |
|
1472 CleanupStack::PopAndDestroy(pElement); |
|
1473 CleanupStack::PopAndDestroy(pParent); |
|
1474 Teardown(); |
|
1475 return KErrNone; |
|
1476 } |
|
1477 |
|
1478 TInt CsenxmlTester::CSenBaseElement_Namespace_2L (CStifItemParser& aItem) |
|
1479 { |
|
1480 SetupL(); |
|
1481 TBool Flag,Flag1; |
|
1482 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1483 CleanupStack::PushL(pElement); |
|
1484 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1485 CleanupStack::PushL(pParent); |
|
1486 pParent->SetNamespaceL(_L8("p"),_L8("nsurip")); |
|
1487 pElement->SetNamespaceL(_L8("n"),_L8("nsurin")); |
|
1488 pElement->SetParent(pParent); |
|
1489 //aCheckInParent=FALSE and parent prefix |
|
1490 const CSenNamespace* pPNs=pElement->Namespace(_L8("p"),FALSE); |
|
1491 if(pPNs==NULL) |
|
1492 Flag=1; |
|
1493 else |
|
1494 Flag=0; |
|
1495 /*EUNIT_ASSERT( Flag );*/ |
|
1496 if(!Flag) |
|
1497 return KErrArgument; |
|
1498 |
|
1499 //aCheckInParent=TRUE and parent prefix |
|
1500 pPNs=pElement->Namespace(_L8("p"),TRUE); |
|
1501 if(pPNs->Prefix()==_L8("p") && pPNs->URI()==_L8("nsurip")) |
|
1502 Flag1=1; |
|
1503 else |
|
1504 Flag1=0; |
|
1505 /*EUNIT_ASSERT( Flag1 );*/ |
|
1506 if(!Flag1) |
|
1507 return KErrArgument; |
|
1508 |
|
1509 CleanupStack::PopAndDestroy(pParent); |
|
1510 CleanupStack::PopAndDestroy(pElement); |
|
1511 Teardown(); |
|
1512 return KErrNone; |
|
1513 } |
|
1514 |
|
1515 TInt CsenxmlTester::CSenBaseElement_Namespace_3L (CStifItemParser& aItem) |
|
1516 { |
|
1517 SetupL(); |
|
1518 TBool Flag; |
|
1519 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1520 CleanupStack::PushL(pElement); |
|
1521 pElement->AddNamespaceL(_L8("n"),_L8("nsurin")); |
|
1522 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
1523 pElement->AddNamespaceL(_L8("l"),_L8("nsuril")); |
|
1524 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
1525 /* EUNIT_ASSERT( pNsList.Count()==3 );*/ |
|
1526 if(!( pNsList.Count()==3 )) |
|
1527 return KErrArgument; |
|
1528 |
|
1529 const CSenNamespace* pNs=pElement->Namespace(_L8("m"),_L8("nsurim")); |
|
1530 if(pNs->Prefix()==_L8("m") && pNs->URI()==_L8("nsurim")) |
|
1531 Flag=1; |
|
1532 else |
|
1533 Flag=0; |
|
1534 /*EUNIT_ASSERT(Flag);*/ |
|
1535 if(!Flag) |
|
1536 return KErrArgument; |
|
1537 |
|
1538 CleanupStack::PopAndDestroy(pElement); |
|
1539 Teardown(); |
|
1540 return KErrNone; |
|
1541 } |
|
1542 |
|
1543 TInt CsenxmlTester::CSenBaseElement_ElementsLL (CStifItemParser& aItem) |
|
1544 { |
|
1545 SetupL(); |
|
1546 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ; |
|
1547 CleanupStack::PushL(pElement); |
|
1548 CSenBaseElement* pChild1=CSenBaseElement::NewL(_L8("element1")) ; |
|
1549 CleanupStack::PushL(pChild1); |
|
1550 CSenBaseElement* pChild2=CSenBaseElement::NewL(_L8("element2")) ; |
|
1551 CleanupStack::PushL(pChild2); |
|
1552 CSenBaseElement* pChild3=CSenBaseElement::NewL(_L8("element3")) ; |
|
1553 CleanupStack::PushL(pChild3); |
|
1554 pElement->AddElementL(*pChild1); |
|
1555 pElement->AddElementL(*pChild2); |
|
1556 pElement->AddElementL(*pChild3); |
|
1557 RPointerArray<CSenElement>& ElList=pElement->ElementsL(); |
|
1558 /* EUNIT_ASSERT( ElList.Count()==3);*/ |
|
1559 if(!(ElList.Count()==3)) |
|
1560 return KErrArgument; |
|
1561 |
|
1562 CleanupStack::Pop(3); |
|
1563 CleanupStack::PopAndDestroy(pElement); |
|
1564 Teardown(); |
|
1565 return KErrNone; |
|
1566 } |
|
1567 |
|
1568 TInt CsenxmlTester::CSenBaseElement_AttributesLL (CStifItemParser& aItem) |
|
1569 { |
|
1570 SetupL(); |
|
1571 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ; |
|
1572 CleanupStack::PushL(pElement); |
|
1573 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
1574 pElement->AddAttrL(_L8("Attr2"),_L8("value2")); |
|
1575 pElement->AddAttrL(_L8("Attr3"),_L8("value3")); |
|
1576 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
1577 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
1578 RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL(); |
|
1579 /* EUNIT_ASSERT( pAttrList.Count()==4 );*/ |
|
1580 if(!( pAttrList.Count()==4 )) |
|
1581 return KErrArgument; |
|
1582 |
|
1583 CleanupStack::PopAndDestroy(pElement); |
|
1584 Teardown(); |
|
1585 return KErrNone; |
|
1586 } |
|
1587 |
|
1588 TInt CsenxmlTester::CSenBaseElement_NamespacesLL (CStifItemParser& aItem) |
|
1589 { |
|
1590 SetupL(); |
|
1591 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1592 CleanupStack::PushL(pElement); |
|
1593 pElement->AddNamespaceL(_L8("l"),_L8("nsuril")); |
|
1594 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
1595 pElement->AddNamespaceL(_L8("n"),_L8("nsurin")); |
|
1596 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
1597 const RPointerArray<CSenNamespace>& pNs=pElement->NamespacesL(); |
|
1598 /* EUNIT_ASSERT( pNs.Count()==3);*/ |
|
1599 if(!(pNs.Count()==3)) |
|
1600 return KErrArgument; |
|
1601 |
|
1602 CleanupStack::PopAndDestroy(pElement); |
|
1603 Teardown(); |
|
1604 return KErrNone; |
|
1605 } |
|
1606 |
|
1607 TInt CsenxmlTester::CSenBaseElement_AttrValueL (CStifItemParser& aItem) |
|
1608 { |
|
1609 SetupL(); |
|
1610 TBool Flag,NegFlag; |
|
1611 _LIT8(KValue,"value4"); |
|
1612 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ; |
|
1613 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
1614 pElement->AddAttrL(_L8("Attr2"),_L8("value2")); |
|
1615 pElement->AddAttrL(_L8("Attr3"),_L8("value3")); |
|
1616 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
1617 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
1618 const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr4")); |
|
1619 if(pAttrVal!=NULL) |
|
1620 { |
|
1621 Flag=1; |
|
1622 } |
|
1623 else |
|
1624 Flag=0; |
|
1625 /* EUNIT_ASSERT(Flag);*/ |
|
1626 if(!Flag) |
|
1627 return KErrArgument; |
|
1628 |
|
1629 const TDesC8* pNegAttrVal=pElement->AttrValue(_L8("attr1")); |
|
1630 if(pNegAttrVal==NULL) |
|
1631 NegFlag=1; |
|
1632 else |
|
1633 NegFlag=0; |
|
1634 /* EUNIT_ASSERT(NegFlag);*/ |
|
1635 if(!NegFlag) |
|
1636 return KErrArgument; |
|
1637 |
|
1638 delete pElement; |
|
1639 Teardown(); |
|
1640 return KErrNone; |
|
1641 } |
|
1642 |
|
1643 TInt CsenxmlTester::CSenBaseElement_AddAttrLL (CStifItemParser& aItem) |
|
1644 { |
|
1645 SetupL(); |
|
1646 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1647 CleanupStack::PushL(pElement); |
|
1648 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
1649 RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL(); |
|
1650 /* EUNIT_ASSERT( pAttrList.Count()==1 );*/ |
|
1651 if(!( pAttrList.Count()==1 )) |
|
1652 return KErrArgument; |
|
1653 |
|
1654 pElement->AddAttrL(_L8("Attr1"),_L8("Duplicatevalue1")); |
|
1655 /* EUNIT_ASSERT( pAttrList.Count()==1 );*/ |
|
1656 if(!( pAttrList.Count()==1 )) |
|
1657 return KErrArgument; |
|
1658 |
|
1659 const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr1")); |
|
1660 pElement->AddAttrL(_L8("Attr2"),_L8(" value2"));//improve here by comparing TDesC8* AttrValue() |
|
1661 /*EUNIT_ASSERT( pAttrList.Count()==2 );*/ |
|
1662 if(!( pAttrList.Count()==2 )) |
|
1663 return KErrArgument; |
|
1664 |
|
1665 CleanupStack::PopAndDestroy(pElement); |
|
1666 Teardown(); |
|
1667 return KErrNone; |
|
1668 } |
|
1669 TInt CsenxmlTester::CSenBaseElement_AddAttributeLL (CStifItemParser& aItem) |
|
1670 { |
|
1671 SetupL(); |
|
1672 CTestBaseElement* pElement=CTestBaseElement::NewL(_L8("Nokia")); |
|
1673 CleanupStack::PushL(pElement); |
|
1674 pElement->AddAttributeL(_L8("Attr1"),_L8("value1")); |
|
1675 |
|
1676 CleanupStack::PopAndDestroy(pElement); |
|
1677 Teardown(); |
|
1678 return KErrNone; |
|
1679 } |
|
1680 |
|
1681 TInt CsenxmlTester::CSenBaseElement_ParentL (CStifItemParser& aItem) |
|
1682 { |
|
1683 SetupL(); |
|
1684 TBool Flag,PFlag,PPFlag; |
|
1685 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1686 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1687 CSenBaseElement* pPParent=CSenBaseElement::NewL(_L8("parent of parent")); |
|
1688 pElement->SetParent(pParent); |
|
1689 pParent->SetParent(pPParent); |
|
1690 CSenElement* pEl1= pElement->Parent(); |
|
1691 CSenElement* pEl2= pParent->Parent(); |
|
1692 CSenElement* pEl3= pPParent->Parent(); |
|
1693 const TDesC8& pLName1=pEl1->LocalName(); |
|
1694 if(pLName1==_L8("Parent")) |
|
1695 Flag=1; |
|
1696 else |
|
1697 Flag=0; |
|
1698 /*EUNIT_ASSERT( Flag );*/ |
|
1699 if(!Flag) |
|
1700 return KErrArgument; |
|
1701 |
|
1702 const TDesC8& pLName2=pEl2->LocalName(); |
|
1703 if(pLName2==_L8("parent of parent")) |
|
1704 PFlag=1; |
|
1705 else |
|
1706 PFlag=0; |
|
1707 /* EUNIT_ASSERT(PFlag);*/ |
|
1708 if(!PFlag) |
|
1709 return KErrArgument; |
|
1710 |
|
1711 if(pEl3==NULL) |
|
1712 PPFlag=1; |
|
1713 else |
|
1714 PPFlag=0; |
|
1715 /*EUNIT_ASSERT(PPFlag);*/ |
|
1716 if(!PFlag) |
|
1717 return KErrArgument; |
|
1718 |
|
1719 delete pElement; |
|
1720 delete pParent; |
|
1721 delete pPParent; |
|
1722 Teardown(); |
|
1723 return KErrNone; |
|
1724 } |
|
1725 |
|
1726 TInt CsenxmlTester::CSenBaseElement_SetParentL (CStifItemParser& aItem) |
|
1727 { |
|
1728 SetupL(); |
|
1729 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1730 CleanupStack::PushL(pElement); |
|
1731 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1732 CleanupStack::PushL(pParent); |
|
1733 pElement->SetNamespaceL(_L8("Nsuria")); |
|
1734 pParent->SetNamespaceL(_L8("nsurip")); |
|
1735 pElement->SetParent(pParent); |
|
1736 CSenElement* pPar=pElement->Parent(); |
|
1737 const TDesC8& ParName=pPar->LocalName(); |
|
1738 /*EUNIT_ASSERT_EQUALS( ParName,_L8("Parent") );*/ |
|
1739 TL(ParName == _L8("Parent")); |
|
1740 CleanupStack::PopAndDestroy(pParent); |
|
1741 CleanupStack::PopAndDestroy(pElement); |
|
1742 Teardown(); |
|
1743 return KErrNone; |
|
1744 } |
|
1745 |
|
1746 TInt CsenxmlTester::CSenBaseElement_RootL (CStifItemParser& aItem) |
|
1747 { |
|
1748 SetupL(); |
|
1749 TBool Flag; |
|
1750 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
1751 const MSenElement& pElRoot=pElement->Root(); |
|
1752 const TDesC8& pElLName=pElRoot.LocalName(); |
|
1753 if(pElLName==_L8("Nokia")) |
|
1754 Flag=1; |
|
1755 else |
|
1756 Flag=0; |
|
1757 |
|
1758 CSenBaseElement* pParent1=CSenBaseElement::NewL(_L8("Parent1")); |
|
1759 pElement->SetParent(pParent1); |
|
1760 const MSenElement& pElRoot1=pElement->Root(); |
|
1761 const TDesC8& pElLName1=pElRoot1.LocalName(); |
|
1762 if(pElLName1==_L8("Parent1")) |
|
1763 Flag=1; |
|
1764 else |
|
1765 Flag=0; |
|
1766 |
|
1767 CSenBaseElement* pParent2=CSenBaseElement::NewL(_L8("Parent2")); |
|
1768 pParent1->SetParent(pParent2); |
|
1769 const MSenElement& pElRoot2=pElement->Root(); |
|
1770 const TDesC8& pElLName2=pElRoot2.LocalName(); |
|
1771 const MSenElement& pParRoot=pParent1->Root(); |
|
1772 const TDesC8& pParLName=pParRoot.LocalName(); |
|
1773 if(pElLName2==_L8("Parent2") && pParLName==_L8("Parent2")) |
|
1774 Flag=1; |
|
1775 else |
|
1776 Flag=0; |
|
1777 |
|
1778 /*EUNIT_ASSERT( Flag );*/ |
|
1779 if(!Flag) |
|
1780 return KErrArgument; |
|
1781 |
|
1782 delete pElement; |
|
1783 delete pParent1; |
|
1784 delete pParent2; |
|
1785 Teardown(); |
|
1786 return KErrNone; |
|
1787 } |
|
1788 |
|
1789 TInt CsenxmlTester::CSenBaseElement_ElementL (CStifItemParser& aItem) |
|
1790 { |
|
1791 SetupL(); |
|
1792 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1793 CleanupStack::PushL(pParent); |
|
1794 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1")); |
|
1795 CleanupStack::PushL(pElement1); |
|
1796 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2")); |
|
1797 CleanupStack::PushL(pElement2); |
|
1798 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3")); |
|
1799 CleanupStack::PushL(pElement3); |
|
1800 pParent->AddElementL(*pElement1); |
|
1801 pParent->AddElementL(*pElement2); |
|
1802 pParent->AddElementL(*pElement3); |
|
1803 CSenElement* element=pParent->Element(_L8("Nokia1")); |
|
1804 /* EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/ |
|
1805 if(!(element->LocalName()==_L8("Nokia1"))) |
|
1806 return KErrArgument; |
|
1807 |
|
1808 CleanupStack::Pop(3); |
|
1809 CleanupStack::PopAndDestroy(pParent); |
|
1810 Teardown(); |
|
1811 return KErrNone; |
|
1812 } |
|
1813 TInt CsenxmlTester::CSenBaseElement_ElementsL1 (CStifItemParser& aItem) |
|
1814 { |
|
1815 SetupL(); |
|
1816 //RPointerArray<CSenElement> &array; |
|
1817 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1818 CleanupStack::PushL(pParent); |
|
1819 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1")); |
|
1820 CleanupStack::PushL(pElement1); |
|
1821 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2")); |
|
1822 CleanupStack::PushL(pElement2); |
|
1823 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3")); |
|
1824 CleanupStack::PushL(pElement3); |
|
1825 pParent->AddElementL(*pElement1); |
|
1826 pParent->AddElementL(*pElement2); |
|
1827 pParent->AddElementL(*pElement3); |
|
1828 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
1829 pParent->ElementsL(elementList, _L8("Nokia1"), _L8("Nokia1")); |
|
1830 /* EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/ |
|
1831 //if(!(element->LocalName()==_L8("Nokia1"))) |
|
1832 //return KErrArgument; |
|
1833 |
|
1834 CleanupStack::Pop(3); |
|
1835 CleanupStack::PopAndDestroy(pParent); |
|
1836 Teardown(); |
|
1837 return KErrNone; |
|
1838 } |
|
1839 |
|
1840 |
|
1841 TInt CsenxmlTester::CSenBaseElement_ElementsL2 (CStifItemParser& aItem) |
|
1842 { |
|
1843 SetupL(); |
|
1844 //RPointerArray<CSenElement> &array; |
|
1845 |
|
1846 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1847 CleanupStack::PushL(pParent); |
|
1848 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1")); |
|
1849 CleanupStack::PushL(pElement1); |
|
1850 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2")); |
|
1851 CleanupStack::PushL(pElement2); |
|
1852 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3")); |
|
1853 CleanupStack::PushL(pElement3); |
|
1854 pParent->AddElementL(*pElement1); |
|
1855 pParent->AddElementL(*pElement2); |
|
1856 pParent->AddElementL(*pElement3); |
|
1857 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
1858 |
|
1859 pParent->ElementsL(elementList, _L8("Nokia1")); |
|
1860 /* EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/ |
|
1861 //if(!(element->LocalName()==_L8("Nokia1"))) |
|
1862 //return KErrArgument; |
|
1863 |
|
1864 CleanupStack::Pop(3); |
|
1865 CleanupStack::Pop(pParent); |
|
1866 Teardown(); |
|
1867 return KErrNone; |
|
1868 } |
|
1869 |
|
1870 TInt CsenxmlTester::CSenBaseElement_CreateElementLL (CStifItemParser& aItem) |
|
1871 { |
|
1872 SetupL(); |
|
1873 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("element")); |
|
1874 CleanupStack::PushL(pElement); |
|
1875 pElement->SetNamespaceL(_L8("N"),_L8("nsuri")); |
|
1876 CSenElement* pNewElement=pElement->CreateElementL(_L8("N"),_L8("Nokia")); |
|
1877 CleanupStack::PushL(pNewElement); |
|
1878 HBufC8* ElementBuf=pNewElement->AsXmlL(); |
|
1879 /* EUNIT_ASSERT_EQUALS(*ElementBuf,_L8("<N:Nokia xmlns:N=\"nsuri\"/>"));*/ |
|
1880 TL(*ElementBuf == _L8("<N:Nokia xmlns:N=\"nsuri\"/>")); |
|
1881 CleanupStack::PopAndDestroy(pNewElement); |
|
1882 CleanupStack::PopAndDestroy(pElement); |
|
1883 delete ElementBuf; |
|
1884 Teardown(); |
|
1885 return KErrNone; |
|
1886 } |
|
1887 |
|
1888 TInt CsenxmlTester::CSenBaseElement_InsertElementLL (CStifItemParser& aItem) |
|
1889 { |
|
1890 SetupL(); |
|
1891 TBool Flag; |
|
1892 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")); |
|
1893 CleanupStack::PushL(pParent); |
|
1894 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1")); |
|
1895 CleanupStack::PushL(pElement1); |
|
1896 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2")); |
|
1897 CleanupStack::PushL(pElement2); |
|
1898 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3")); |
|
1899 CleanupStack::PushL(pElement3); |
|
1900 CSenBaseElement* pElement5=CSenBaseElement::NewL(_L8("Nokia5")); |
|
1901 CleanupStack::PushL(pElement5); |
|
1902 pParent->AddElementL(*pElement1); |
|
1903 pParent->AddElementL(*pElement2); |
|
1904 pParent->AddElementL(*pElement3); |
|
1905 pParent->AddElementL(*pElement5); |
|
1906 CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Nokia4")); |
|
1907 CleanupStack::PushL(pElement4); |
|
1908 pParent->InsertElementL(*pElement4,*pElement5); |
|
1909 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
1910 const TDesC8& localName=elementList[3]->LocalName(); |
|
1911 if(localName==_L8("Nokia4")) |
|
1912 Flag=1; |
|
1913 else |
|
1914 Flag=0; |
|
1915 /*EUNIT_ASSERT( Flag );*/ |
|
1916 if(!Flag) |
|
1917 return KErrArgument; |
|
1918 |
|
1919 if(!Flag) |
|
1920 return KErrArgument; |
|
1921 |
|
1922 CleanupStack::Pop(pElement4); |
|
1923 CleanupStack::Pop(pElement5); |
|
1924 CleanupStack::Pop(pElement3); |
|
1925 CleanupStack::Pop(pElement2); |
|
1926 CleanupStack::Pop(pElement1); |
|
1927 CleanupStack::PopAndDestroy(pParent); |
|
1928 Teardown(); |
|
1929 return KErrNone; |
|
1930 } |
|
1931 |
|
1932 TInt CsenxmlTester::CSenBaseElement_InsertElementL_NoBeforeL (CStifItemParser& aItem) |
|
1933 { |
|
1934 SetupL(); |
|
1935 TBool Flag; |
|
1936 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
1937 CleanupStack::PushL(pParent); |
|
1938 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("nokia")); |
|
1939 CleanupStack::PushL(pElement1); |
|
1940 |
|
1941 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("nokia2")); |
|
1942 CleanupStack::PushL(pElement2); |
|
1943 |
|
1944 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("nokia3")); |
|
1945 CleanupStack::PushL(pElement3); |
|
1946 pParent->AddElementL(*pElement1); |
|
1947 pParent->AddElementL(*pElement2); |
|
1948 pParent->AddElementL(*pElement3); |
|
1949 |
|
1950 |
|
1951 CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("nokia4")); |
|
1952 CleanupStack::PushL(pElement4); |
|
1953 |
|
1954 |
|
1955 CSenBaseElement* pElement5=CSenBaseElement::NewL(_L8("nokia5")); |
|
1956 CleanupStack::PushL(pElement5); |
|
1957 |
|
1958 pParent->InsertElementL(*pElement4,*pElement5); |
|
1959 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
1960 const TDesC8& localName=elementList[(elementList.Count()-1)]->LocalName(); |
|
1961 if(localName==_L8("nokia4")) |
|
1962 Flag=1; |
|
1963 else |
|
1964 Flag=0; |
|
1965 |
|
1966 /* EUNIT_ASSERT(Flag);*/ |
|
1967 if(!Flag) |
|
1968 return KErrArgument; |
|
1969 |
|
1970 CleanupStack::PopAndDestroy(pElement5); |
|
1971 CleanupStack::Pop(pElement4); |
|
1972 CleanupStack::Pop(pElement3); |
|
1973 CleanupStack::Pop(pElement2); |
|
1974 CleanupStack::Pop(pElement1); |
|
1975 CleanupStack::PopAndDestroy(pParent); |
|
1976 Teardown(); |
|
1977 return KErrNone; |
|
1978 } |
|
1979 |
|
1980 TInt CsenxmlTester::CSenBaseElement_AddElementLL (CStifItemParser& aItem) |
|
1981 { |
|
1982 SetupL(); |
|
1983 TBool Flag; |
|
1984 CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent")); |
|
1985 CleanupStack::PushL(pParent); |
|
1986 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nokia")); |
|
1987 CleanupStack::PushL(pElement); |
|
1988 CSenElement& newElement=pParent->AddElementL(*pElement); |
|
1989 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
1990 const TDesC8& localName=elementList[0]->LocalName(); |
|
1991 if(localName==_L8("nokia") && elementList.Count()==1 ) |
|
1992 Flag=1; |
|
1993 else |
|
1994 Flag=0; |
|
1995 /*EUNIT_ASSERT( Flag );*/ |
|
1996 if(!Flag) |
|
1997 return KErrArgument; |
|
1998 |
|
1999 if(!Flag) |
|
2000 return KErrArgument; |
|
2001 |
|
2002 CleanupStack::Pop(pElement); |
|
2003 CleanupStack::PopAndDestroy(pParent); |
|
2004 Teardown(); |
|
2005 return KErrNone; |
|
2006 } |
|
2007 |
|
2008 TInt CsenxmlTester::CSenBaseElement_AddElementL_1L (CStifItemParser& aItem) |
|
2009 { |
|
2010 SetupL(); |
|
2011 TBool Flag; |
|
2012 CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2013 CleanupStack::PushL(pParent); |
|
2014 CSenElement& newElement=pParent->AddElementL(_L8("element")); |
|
2015 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
2016 const TDesC8& localName=elementList[0]->LocalName(); |
|
2017 if(localName==_L8("element") && elementList.Count()==1 ) |
|
2018 Flag=1; |
|
2019 else |
|
2020 Flag=0; |
|
2021 /*EUNIT_ASSERT( Flag );*/ |
|
2022 if(!Flag) |
|
2023 return KErrArgument; |
|
2024 |
|
2025 if(!Flag) |
|
2026 return KErrArgument; |
|
2027 |
|
2028 CleanupStack::PopAndDestroy(pParent); |
|
2029 Teardown(); |
|
2030 return KErrNone; |
|
2031 } |
|
2032 |
|
2033 TInt CsenxmlTester::CSenBaseElement_AddElementL_2L (CStifItemParser& aItem) |
|
2034 { |
|
2035 SetupL(); |
|
2036 TBool Flag; |
|
2037 CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2038 CleanupStack::PushL(pParent); |
|
2039 CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element")); |
|
2040 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
2041 const TDesC8& localName=elementList[0]->LocalName(); |
|
2042 const TDesC8& nsUri=elementList[0]->NamespaceURI(); |
|
2043 if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria")) |
|
2044 Flag=1; |
|
2045 else |
|
2046 Flag=0; |
|
2047 /*EUNIT_ASSERT( Flag );*/ |
|
2048 if(!Flag) |
|
2049 return KErrArgument; |
|
2050 |
|
2051 CleanupStack::PopAndDestroy(pParent); |
|
2052 Teardown(); |
|
2053 return KErrNone; |
|
2054 } |
|
2055 |
|
2056 TInt CsenxmlTester::CSenBaseElement_AddElementL_3L (CStifItemParser& aItem) |
|
2057 { |
|
2058 SetupL(); |
|
2059 TBool Flag; |
|
2060 CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2061 CleanupStack::PushL(pParent); |
|
2062 CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"),_L8("e:element")); |
|
2063 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
2064 const TDesC8& localName=elementList[0]->LocalName(); |
|
2065 const TDesC8& nsUri=elementList[0]->NamespaceURI(); |
|
2066 if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria")) |
|
2067 Flag=1; |
|
2068 else |
|
2069 Flag=0; |
|
2070 /*EUNIT_ASSERT( Flag );*/ |
|
2071 if(!Flag) |
|
2072 return KErrArgument; |
|
2073 |
|
2074 CleanupStack::PopAndDestroy(pParent); |
|
2075 Teardown(); |
|
2076 return KErrNone; |
|
2077 } |
|
2078 |
|
2079 TInt CsenxmlTester::CSenBaseElement_RemoveElementL (CStifItemParser& aItem) |
|
2080 { |
|
2081 SetupL(); |
|
2082 TBool TFlag; |
|
2083 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2084 CleanupStack::PushL(pParent); |
|
2085 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1")); |
|
2086 CleanupStack::PushL(pElement1); |
|
2087 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2")); |
|
2088 CleanupStack::PushL(pElement2); |
|
2089 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3")); |
|
2090 CleanupStack::PushL(pElement3); |
|
2091 CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4")); |
|
2092 CleanupStack::PushL(pElement4); |
|
2093 pParent->AddElementL(*pElement1); |
|
2094 pParent->AddElementL(*pElement2); |
|
2095 pParent->AddElementL(*pElement3); |
|
2096 pParent->AddElementL(*pElement4); |
|
2097 //true case |
|
2098 CSenElement* pRmdElement=pParent->RemoveElement(*pElement3); |
|
2099 const TDesC8& localName=pRmdElement->LocalName(); |
|
2100 /*CSenElement* pParElement=pElement3->Parent();//intentional |
|
2101 const TDesC8& localnmae1=pParElement->LocalName();*/ |
|
2102 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
2103 if(localName==_L8("Element3") && elList.Count()==3 ) |
|
2104 TFlag=1; |
|
2105 else |
|
2106 TFlag=0; |
|
2107 /* EUNIT_ASSERT( TFlag );*/ |
|
2108 if(!TFlag) |
|
2109 return KErrArgument; |
|
2110 |
|
2111 CleanupStack::Pop(4); |
|
2112 CleanupStack::PopAndDestroy(pParent); |
|
2113 delete pRmdElement; |
|
2114 //delete pRmdElement1; |
|
2115 Teardown(); |
|
2116 return KErrNone; |
|
2117 } |
|
2118 |
|
2119 TInt CsenxmlTester::CSenBaseElement_RemoveElement_1L (CStifItemParser& aItem) |
|
2120 { |
|
2121 SetupL(); |
|
2122 TBool TFlag,FFlag; |
|
2123 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2124 CleanupStack::PushL(pParent); |
|
2125 pParent->AddElementL(_L8("element1")); |
|
2126 pParent->AddElementL(_L8("element2")); |
|
2127 pParent->AddElementL(_L8("element3")); |
|
2128 pParent->AddElementL(_L8("element4")); |
|
2129 //True case |
|
2130 CSenElement* pRmdElement=pParent->RemoveElement(_L8("element1")); |
|
2131 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
2132 if(pRmdElement->LocalName()==_L8("element1") && elList.Count()==3) |
|
2133 TFlag=1; |
|
2134 else |
|
2135 TFlag=0; |
|
2136 /* EUNIT_ASSERT( TFlag );*/ |
|
2137 if(!TFlag) |
|
2138 return KErrArgument; |
|
2139 |
|
2140 //False case |
|
2141 CSenElement* pRmdElement1=pParent->RemoveElement(_L8("none")); |
|
2142 elList=pParent->ElementsL(); |
|
2143 if(pRmdElement1==NULL && elList.Count()==3) |
|
2144 FFlag=1; |
|
2145 else |
|
2146 FFlag=0; |
|
2147 /* EUNIT_ASSERT(FFlag);*/ |
|
2148 if(!FFlag) |
|
2149 return KErrArgument; |
|
2150 |
|
2151 CleanupStack::PopAndDestroy(pParent); |
|
2152 delete pRmdElement; |
|
2153 //delete pRmdElement1; |
|
2154 Teardown(); |
|
2155 return KErrNone; |
|
2156 } |
|
2157 |
|
2158 TInt CsenxmlTester::CSenBaseElement_RemoveElement_2L (CStifItemParser& aItem) |
|
2159 { |
|
2160 SetupL(); |
|
2161 TBool TFlag,FFlag; |
|
2162 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2163 CleanupStack::PushL(pParent); |
|
2164 pParent->AddElementL(_L8("nsuri1"),_L8("element1")); |
|
2165 pParent->AddElementL(_L8("nsuri2"),_L8("element2")); |
|
2166 pParent->AddElementL(_L8("nsuri2a"),_L8("element2")); |
|
2167 pParent->AddElementL(_L8("nsuri4"),_L8("element4")); |
|
2168 //True case |
|
2169 CSenElement* pRmdElement=pParent->RemoveElement(_L8("nsuri2a"),_L8("element2")); |
|
2170 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
2171 const TDesC8& localName=pRmdElement->LocalName(); |
|
2172 const TDesC8& nsURI=pRmdElement->NamespaceURI(); |
|
2173 if(localName==_L8("element2") && nsURI==_L8("nsuri2a") && elList.Count()==3) |
|
2174 TFlag=1; |
|
2175 else |
|
2176 TFlag=0; |
|
2177 /*EUNIT_ASSERT( TFlag );*/ |
|
2178 if(!TFlag) |
|
2179 return KErrArgument; |
|
2180 |
|
2181 //False case |
|
2182 CSenElement* pRmdElement1=pParent->RemoveElement(_L8("element1"),_L8("nothing")); |
|
2183 elList=pParent->ElementsL(); |
|
2184 if(pRmdElement1==NULL && elList.Count()==3) |
|
2185 FFlag=1; |
|
2186 else |
|
2187 FFlag=0; |
|
2188 /* EUNIT_ASSERT(FFlag);*/ |
|
2189 if(!FFlag) |
|
2190 return KErrArgument; |
|
2191 |
|
2192 CleanupStack::PopAndDestroy(pParent); |
|
2193 delete pRmdElement; |
|
2194 delete pRmdElement1; |
|
2195 |
|
2196 Teardown(); |
|
2197 return KErrNone; |
|
2198 } |
|
2199 |
|
2200 TInt CsenxmlTester::CSenBaseElement_ReplaceElementLL (CStifItemParser& aItem) |
|
2201 { |
|
2202 SetupL(); |
|
2203 TBool FFlag,TFlag; |
|
2204 _LIT8(KNewElement,"<a:Element1 xmlns:a=\"nsuria\"><subelement1/>New content</a:Element1>"); |
|
2205 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2206 CleanupStack::PushL(pParent); |
|
2207 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1")); |
|
2208 CleanupStack::PushL(pElement1); |
|
2209 pElement1->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
2210 pElement1->SetContentL(_L8("old content")); |
|
2211 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2")); |
|
2212 CleanupStack::PushL(pElement2); |
|
2213 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3")); |
|
2214 CleanupStack::PushL(pElement3); |
|
2215 CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4")); |
|
2216 CleanupStack::PushL(pElement4); |
|
2217 pParent->AddElementL(*pElement1); |
|
2218 pParent->AddElementL(*pElement2); |
|
2219 pParent->AddElementL(*pElement3); |
|
2220 pParent->AddElementL(*pElement4); |
|
2221 //true case |
|
2222 CSenBaseElement* pNewElement=CSenBaseElement::NewL(_L8("Element1")); |
|
2223 pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
2224 CleanupStack::PushL(pNewElement); |
|
2225 pNewElement->AddElementL(_L8("subelement1")); |
|
2226 pNewElement->SetContentL(_L8("New content")); |
|
2227 CSenElement* pReplacedElement=pParent->ReplaceElementL(*pNewElement); |
|
2228 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
2229 HBufC8* pRepBuf=elList[(elList.Count()-1)]->AsXmlL(); |
|
2230 if(pReplacedElement!=NULL && elList.Count()==4 && |
|
2231 elList[(elList.Count()-1)]->LocalName()==_L8("Element1") && |
|
2232 *pRepBuf==KNewElement && elList[(elList.Count()-1)]->Content()==_L8("New content") ) |
|
2233 TFlag=1; |
|
2234 else |
|
2235 TFlag=0; |
|
2236 /* EUNIT_ASSERT( TFlag );*/ |
|
2237 if(!TFlag) |
|
2238 return KErrArgument; |
|
2239 |
|
2240 //False case |
|
2241 CSenBaseElement* pNewElement1=CSenBaseElement::NewL(_L8("New Element1")); |
|
2242 pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
2243 CleanupStack::PushL(pNewElement1); |
|
2244 CSenElement* pReplacedElement1=pParent->ReplaceElementL(*pNewElement1); |
|
2245 RPointerArray<CSenElement>& elList1=pParent->ElementsL(); |
|
2246 if(pReplacedElement1==NULL && elList1.Count()==5) |
|
2247 FFlag=1; |
|
2248 else |
|
2249 FFlag=0; |
|
2250 /* EUNIT_ASSERT(FFlag);*/ |
|
2251 if(!FFlag) |
|
2252 return KErrArgument; |
|
2253 |
|
2254 CleanupStack::Pop(pNewElement1); |
|
2255 CleanupStack::Pop(pNewElement); |
|
2256 CleanupStack::Pop(4); |
|
2257 CleanupStack::PopAndDestroy(pParent); |
|
2258 delete pReplacedElement; |
|
2259 delete pRepBuf; |
|
2260 delete pReplacedElement1; |
|
2261 Teardown(); |
|
2262 return KErrNone; |
|
2263 } |
|
2264 |
|
2265 TInt CsenxmlTester::CSenBaseElement_AsXmlLL (CStifItemParser& aItem) |
|
2266 { |
|
2267 SetupL(); |
|
2268 TBool Flag; |
|
2269 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
2270 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2271 CleanupStack::PushL(pParent) ; |
|
2272 pParent->AddElementL(_L8("element1")); |
|
2273 pParent->AddElementL(_L8("element2")); |
|
2274 pParent->SetContentL(_L8("parent content")); |
|
2275 pParent->AddElementL(_L8("element3")); |
|
2276 HBufC8* parBuf=pParent->AsXmlL(); |
|
2277 if(*parBuf==KString) |
|
2278 Flag=1; |
|
2279 else |
|
2280 Flag=0; |
|
2281 /*EUNIT_ASSERT( Flag );*/ |
|
2282 if(!Flag) |
|
2283 return KErrArgument; |
|
2284 |
|
2285 delete parBuf; |
|
2286 CleanupStack::PopAndDestroy(pParent); |
|
2287 Teardown(); |
|
2288 return KErrNone; |
|
2289 } |
|
2290 |
|
2291 TInt CsenxmlTester::CSenBaseElement_AsXmlUnicodeLL (CStifItemParser& aItem) |
|
2292 { |
|
2293 SetupL(); |
|
2294 TBool Flag; |
|
2295 _LIT(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
2296 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2297 CleanupStack::PushL(pParent) ; |
|
2298 pParent->AddElementL(_L8("element1")); |
|
2299 pParent->AddElementL(_L8("element2")); |
|
2300 pParent->SetContentL(_L8("parent content")); |
|
2301 pParent->AddElementL(_L8("element3")); |
|
2302 HBufC* parBuf=pParent->AsXmlUnicodeL(); |
|
2303 if(*parBuf==KString) |
|
2304 Flag=1; |
|
2305 else |
|
2306 Flag=0; |
|
2307 /*EUNIT_ASSERT( Flag );*/ |
|
2308 if(!Flag) |
|
2309 return KErrArgument; |
|
2310 |
|
2311 delete parBuf; |
|
2312 CleanupStack::PopAndDestroy(pParent); |
|
2313 Teardown(); |
|
2314 return KErrNone; |
|
2315 } |
|
2316 |
|
2317 TInt CsenxmlTester::CSenBaseElement_CopyFromLL (CStifItemParser& aItem) |
|
2318 { |
|
2319 SetupL(); |
|
2320 TBool Flag; |
|
2321 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("xml element")); |
|
2322 CleanupStack::PushL(pElement); |
|
2323 pElement->AddElementL(_L8("child1")); |
|
2324 pElement->AddElementL(_L8("child2")); |
|
2325 pElement->SetContentL(_L8("element content")); |
|
2326 pElement->AddNamespaceL(_L8("a"),_L8("nsuri")); |
|
2327 CSenBaseElement* pCopied=CSenBaseElement::NewL(_L8("copied element")); |
|
2328 CleanupStack::PushL(pCopied); |
|
2329 pCopied->SetContentL(_L8("copy content")); |
|
2330 pCopied->AddElementL(_L8("child1")); |
|
2331 pCopied->AddNamespaceL(_L8("a"),_L8("nsuri")); |
|
2332 pCopied->CopyFromL(*pElement); |
|
2333 const TDesC8& content=pCopied->Content(); |
|
2334 const RPointerArray<CSenElement>& copElList=pCopied->ElementsL(); |
|
2335 const RPointerArray<CSenNamespace>& copNSList=pCopied->NamespacesL(); |
|
2336 if(copElList.Count()==3 && copNSList.Count()==2) |
|
2337 Flag=1; |
|
2338 else |
|
2339 Flag=0; |
|
2340 /*EUNIT_ASSERT( Flag );*/ |
|
2341 if(!Flag) |
|
2342 return KErrArgument; |
|
2343 |
|
2344 CleanupStack::PopAndDestroy(pCopied); |
|
2345 CleanupStack::PopAndDestroy(pElement); |
|
2346 Teardown(); |
|
2347 return KErrNone; |
|
2348 } |
|
2349 |
|
2350 TInt CsenxmlTester::CSenBaseElement_DetachLL (CStifItemParser& aItem) |
|
2351 { |
|
2352 SetupL(); |
|
2353 CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2354 CleanupStack::PushL(pParent); |
|
2355 CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1")); |
|
2356 CleanupStack::PushL(pElement1); |
|
2357 pElement1->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
2358 pElement1->SetContentL(_L8("old content")); |
|
2359 CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2")); |
|
2360 CleanupStack::PushL(pElement2); |
|
2361 CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3")); |
|
2362 CleanupStack::PushL(pElement3); |
|
2363 CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4")); |
|
2364 CleanupStack::PushL(pElement4); |
|
2365 pParent->AddElementL(*pElement1); |
|
2366 pParent->AddElementL(*pElement2); |
|
2367 pParent->AddElementL(*pElement3); |
|
2368 pParent->AddElementL(*pElement4); |
|
2369 CSenElement* dElement=pElement1->DetachL(); |
|
2370 const RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
2371 /*EUNIT_ASSERT( elList.Count()==3 );*/ |
|
2372 if(!(elList.Count()==3)) |
|
2373 return KErrArgument; |
|
2374 |
|
2375 CleanupStack::Pop(4); |
|
2376 CleanupStack::PopAndDestroy(pParent); |
|
2377 delete dElement; |
|
2378 Teardown(); |
|
2379 return KErrNone; |
|
2380 } |
|
2381 |
|
2382 TInt CsenxmlTester::CSenBaseElement_ChildL (CStifItemParser& aItem) |
|
2383 { |
|
2384 SetupL(); |
|
2385 TBool FFlag,TFlag; |
|
2386 CSenBaseElement*pParent=CSenBaseElement::NewL(_L8("parent")); |
|
2387 CleanupStack::PushL(pParent); |
|
2388 pParent->AddElementL(_L8("element1")); |
|
2389 pParent->AddElementL(_L8("element2")); |
|
2390 pParent->AddElementL(_L8("element3")); |
|
2391 CSenElement* pElement=pParent->Child(0); |
|
2392 if(pElement->LocalName()==_L8("element1")) |
|
2393 TFlag=1; |
|
2394 else |
|
2395 TFlag=0; |
|
2396 /*EUNIT_ASSERT( TFlag );*/ |
|
2397 if(!TFlag) |
|
2398 return KErrArgument; |
|
2399 |
|
2400 CSenElement* pElement1=pParent->Child(4); |
|
2401 if(pElement1==NULL) |
|
2402 FFlag=1; |
|
2403 else |
|
2404 FFlag=0; |
|
2405 /*EUNIT_ASSERT( FFlag );*/ |
|
2406 if(!FFlag) |
|
2407 return KErrArgument; |
|
2408 |
|
2409 CleanupStack::PopAndDestroy(pParent); |
|
2410 Teardown(); |
|
2411 return KErrNone; |
|
2412 } |
|
2413 |
|
2414 TInt CsenxmlTester::CSenBaseElement_SetL (CStifItemParser& aItem) |
|
2415 { |
|
2416 SetupL(); |
|
2417 TBool Flag; |
|
2418 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nokia")); |
|
2419 CleanupStack::PushL(pElement); |
|
2420 pElement->Set(_L8("nsuri"),_L8("element"),_L8("e:e:lement")); |
|
2421 if(pElement->LocalName()==_L8("element") && pElement->NamespaceURI()==_L8("nsuri") |
|
2422 && pElement->NsPrefix()==_L8("e")) |
|
2423 Flag=1; |
|
2424 else |
|
2425 Flag=0; |
|
2426 |
|
2427 /*EUNIT_ASSERT( Flag );*/ |
|
2428 if(!Flag) |
|
2429 return KErrArgument; |
|
2430 |
|
2431 if(!Flag) |
|
2432 return KErrArgument; |
|
2433 |
|
2434 CleanupStack::PopAndDestroy(pElement); |
|
2435 Teardown(); |
|
2436 return KErrNone; |
|
2437 } |
|
2438 |
|
2439 TInt CsenxmlTester::CSenBaseElement_AddAttributesLL (CStifItemParser& aItem) |
|
2440 { |
|
2441 SetupL(); |
|
2442 RStringPool stringPool; |
|
2443 stringPool.OpenL(); |
|
2444 CleanupClosePushL(stringPool); |
|
2445 |
|
2446 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
2447 CleanupClosePushL(nsUriRString); |
|
2448 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
2449 CleanupClosePushL(nsPrefixRString); |
|
2450 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
2451 CleanupClosePushL(localNameRString); |
|
2452 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
2453 CleanupClosePushL(valueRString); |
|
2454 |
|
2455 RAttribute attribute; |
|
2456 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
2457 valueRString); |
|
2458 CleanupStack::Pop(4); |
|
2459 CleanupClosePushL(attribute); |
|
2460 |
|
2461 RAttributeArray attrArray; |
|
2462 attrArray.AppendL(attribute); |
|
2463 CleanupClosePushL(attrArray); |
|
2464 |
|
2465 CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia")); |
|
2466 CleanupStack::PushL(pElement); |
|
2467 pElement->AddAttributesL(attrArray); |
|
2468 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
2469 /*EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/ |
|
2470 if(!(*pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ))) |
|
2471 return KErrArgument; |
|
2472 |
|
2473 CleanupStack::PopAndDestroy(pElement); |
|
2474 CleanupStack::PopAndDestroy(&attrArray); |
|
2475 CleanupStack::PopAndDestroy(&attribute); |
|
2476 CleanupStack::PopAndDestroy(&stringPool); |
|
2477 delete pElementBuf; |
|
2478 Teardown(); |
|
2479 return KErrNone; |
|
2480 } |
|
2481 |
|
2482 TInt CsenxmlTester::CSenBaseElement_AsElementL(CStifItemParser& aItem) |
|
2483 { |
|
2484 SetupL(); |
|
2485 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
2486 CleanupStack::PushL(pElement); |
|
2487 pElement->AddElementL(_L8("webservices")); |
|
2488 MSenElement* pAsElement=pElement->AsElement(); |
|
2489 HBufC8* pElementBuf=pElement->AsXmlL(); |
|
2490 /* EUNIT_ASSERT_EQUALS(*pElementBuf,_L8("<Nokia><webservices/></Nokia>"));*/ |
|
2491 TL(*pElementBuf == _L8("<Nokia><webservices/></Nokia>")); |
|
2492 CleanupStack::PopAndDestroy(pElement); |
|
2493 delete pElementBuf; |
|
2494 Teardown(); |
|
2495 return KErrNone; |
|
2496 } |
|
2497 |
|
2498 TInt CsenxmlTester::CSenBaseElement_ContentWriteStreamLL(CStifItemParser& aItem) |
|
2499 { |
|
2500 SetupL(); |
|
2501 TBuf8<50> StreamBuf; |
|
2502 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
2503 CleanupStack::PushL(pElement); |
|
2504 pElement->AddElementL(_L8("webservices")); |
|
2505 RWriteStream& ElemntStream=pElement->ContentWriteStreamL(); |
|
2506 TRAPD(res,ElemntStream.WriteL(StreamBuf)); |
|
2507 CleanupStack::PopAndDestroy(pElement); |
|
2508 //EUNIT_ASSERT(FALSE); |
|
2509 Teardown(); |
|
2510 return KErrNone; |
|
2511 } |
|
2512 |
|
2513 TInt CsenxmlTester::CSenBaseElement_RemoveAttributeLL(CStifItemParser& aItem) |
|
2514 { |
|
2515 SetupL();/* |
|
2516 RStringPool stringPool; |
|
2517 stringPool.OpenL(); |
|
2518 CleanupClosePushL(stringPool); |
|
2519 |
|
2520 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
2521 CleanupClosePushL(nsUriRString); |
|
2522 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
2523 CleanupClosePushL(nsPrefixRString); |
|
2524 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
2525 CleanupClosePushL(localNameRString); |
|
2526 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
2527 CleanupClosePushL(valueRString); |
|
2528 |
|
2529 RAttribute attribute; |
|
2530 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
2531 valueRString); |
|
2532 CleanupStack::Pop(4); |
|
2533 CleanupClosePushL(attribute); |
|
2534 |
|
2535 RAttributeArray attrArray; |
|
2536 attrArray.AppendL(attribute); |
|
2537 CleanupClosePushL(attrArray); |
|
2538 |
|
2539 CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia")); |
|
2540 CleanupStack::PushL(pElement); |
|
2541 pElement->AddAttributesL(attrArray); |
|
2542 CSenBaseAttribute* RmdElement=pElement->RemoveAttributeL(_L8("pr:LocalName")); |
|
2543 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
2544 RPointerArray<CSenBaseAttribute>& AttrList=pElement->AttributesL(); |
|
2545 //EUNIT_ASSERT( *pElementBuf == _L8("<Nokia/>" )); |
|
2546 if(!(*pElementBuf == _L8("<Nokia/>"))) |
|
2547 return KErrArgument; |
|
2548 |
|
2549 //EUNIT_ASSERT_EQUALS(AttrList.Count(),0); |
|
2550 TL(AttrList.Count() == 0); |
|
2551 CleanupStack::PopAndDestroy(pElement); |
|
2552 CleanupStack::PopAndDestroy(&attrArray); |
|
2553 CleanupStack::PopAndDestroy(&attribute); |
|
2554 CleanupStack::PopAndDestroy(&stringPool); |
|
2555 delete pElementBuf; |
|
2556 delete RmdElement; |
|
2557 //EUNIT_ASSERT(FALSE); |
|
2558 Teardown(); |
|
2559 return KErrNone; |
|
2560 */ |
|
2561 Teardown(); |
|
2562 return KErrNone; |
|
2563 |
|
2564 } |
|
2565 |
|
2566 TInt CsenxmlTester::CSenXmlElement_NewLL (CStifItemParser& aItem) |
|
2567 { |
|
2568 SetupL(); |
|
2569 TBool Flag; |
|
2570 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("elment")); |
|
2571 CleanupStack::PushL(pElement); |
|
2572 if(pElement!=NULL) |
|
2573 Flag=1; |
|
2574 else |
|
2575 Flag=0; |
|
2576 /*EUNIT_ASSERT( Flag );*/ |
|
2577 if(!Flag) |
|
2578 return KErrArgument; |
|
2579 |
|
2580 CleanupStack::PopAndDestroy(pElement); |
|
2581 Teardown(); |
|
2582 return KErrNone; |
|
2583 } |
|
2584 |
|
2585 TInt CsenxmlTester::CSenXmlElement_NewL_1L (CStifItemParser& aItem) |
|
2586 { |
|
2587 SetupL(); |
|
2588 TBool Flag; |
|
2589 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element")); |
|
2590 CleanupStack::PushL(pElement); |
|
2591 if(pElement!=NULL) |
|
2592 Flag=1; |
|
2593 else |
|
2594 Flag=0; |
|
2595 /*EUNIT_ASSERT( Flag );*/ |
|
2596 if(!Flag) |
|
2597 return KErrArgument; |
|
2598 |
|
2599 CleanupStack::PopAndDestroy(pElement); |
|
2600 Teardown(); |
|
2601 return KErrNone; |
|
2602 } |
|
2603 |
|
2604 TInt CsenxmlTester::CSenXmlElement_NewL_2L (CStifItemParser& aItem) |
|
2605 { |
|
2606 SetupL(); |
|
2607 TBool Flag; |
|
2608 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element")); |
|
2609 CleanupStack::PushL(pElement); |
|
2610 if(pElement!=NULL) |
|
2611 Flag=1; |
|
2612 else |
|
2613 Flag=0; |
|
2614 /*EUNIT_ASSERT( Flag );*/ |
|
2615 if(!Flag) |
|
2616 return KErrArgument; |
|
2617 |
|
2618 CleanupStack::PopAndDestroy(pElement); |
|
2619 Teardown(); |
|
2620 return KErrNone; |
|
2621 } |
|
2622 |
|
2623 TInt CsenxmlTester::CSenXmlElement_SetAttributesLL (CStifItemParser& aItem) |
|
2624 { |
|
2625 SetupL(); |
|
2626 RStringPool stringPool; |
|
2627 stringPool.OpenL(); |
|
2628 CleanupClosePushL(stringPool); |
|
2629 |
|
2630 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
2631 CleanupClosePushL(nsUriRString); |
|
2632 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
2633 CleanupClosePushL(nsPrefixRString); |
|
2634 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
2635 CleanupClosePushL(localNameRString); |
|
2636 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
2637 CleanupClosePushL(valueRString); |
|
2638 |
|
2639 RAttribute attribute; |
|
2640 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
2641 valueRString); |
|
2642 CleanupStack::Pop(4); |
|
2643 CleanupClosePushL(attribute); |
|
2644 |
|
2645 RAttributeArray attrArray; |
|
2646 attrArray.AppendL(attribute); |
|
2647 CleanupClosePushL(attrArray); |
|
2648 |
|
2649 CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia")); |
|
2650 CleanupStack::PushL(pElement); |
|
2651 pElement->SetAttributesL(attrArray); |
|
2652 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
2653 /* EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/ |
|
2654 if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ))) |
|
2655 return KErrArgument; |
|
2656 |
|
2657 CleanupStack::PopAndDestroy(pElement); |
|
2658 CleanupStack::PopAndDestroy(&attrArray); |
|
2659 CleanupStack::PopAndDestroy(&attribute); |
|
2660 CleanupStack::PopAndDestroy(&stringPool); |
|
2661 delete pElementBuf; |
|
2662 Teardown(); |
|
2663 return KErrNone; |
|
2664 } |
|
2665 |
|
2666 TInt CsenxmlTester::CSenXmlElement_LocalNameL (CStifItemParser& aItem) |
|
2667 { |
|
2668 SetupL(); |
|
2669 TBool Flag; |
|
2670 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element")); |
|
2671 CleanupStack::PushL(pElement); |
|
2672 const TDesC8& lName=pElement->LocalName(); |
|
2673 if(lName==_L8("element")) |
|
2674 Flag=1; |
|
2675 else |
|
2676 Flag=0; |
|
2677 /*EUNIT_ASSERT( Flag );*/ |
|
2678 if(!Flag) |
|
2679 return KErrArgument; |
|
2680 |
|
2681 CleanupStack::PopAndDestroy(pElement); |
|
2682 Teardown(); |
|
2683 return KErrNone; |
|
2684 } |
|
2685 |
|
2686 TInt CsenxmlTester::CSenXmlElement_NamespaceURIL (CStifItemParser& aItem) |
|
2687 { |
|
2688 SetupL(); |
|
2689 TBool Flag; |
|
2690 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element")); |
|
2691 CleanupStack::PushL(pElement); |
|
2692 const TDesC8& nsURI=pElement->NamespaceURI(); |
|
2693 if(nsURI==_L8("nsuria")) |
|
2694 Flag=1; |
|
2695 else |
|
2696 Flag=0; |
|
2697 /*EUNIT_ASSERT( Flag );*/ |
|
2698 if(!Flag) |
|
2699 return KErrArgument; |
|
2700 |
|
2701 CleanupStack::PopAndDestroy(pElement); |
|
2702 Teardown(); |
|
2703 return KErrNone; |
|
2704 } |
|
2705 |
|
2706 TInt CsenxmlTester::CSenXmlElement_NsPrefixL (CStifItemParser& aItem) |
|
2707 { |
|
2708 SetupL(); |
|
2709 TBool Flag; |
|
2710 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element")); |
|
2711 CleanupStack::PushL(pElement); |
|
2712 const TDesC8& nsPrefix=pElement->NsPrefix(); |
|
2713 if(nsPrefix==_L8("a")) |
|
2714 Flag=1; |
|
2715 else |
|
2716 Flag=0; |
|
2717 /*EUNIT_ASSERT( Flag );*/ |
|
2718 if(!Flag) |
|
2719 return KErrArgument; |
|
2720 |
|
2721 CleanupStack::PopAndDestroy(pElement); |
|
2722 Teardown(); |
|
2723 return KErrNone; |
|
2724 } |
|
2725 |
|
2726 TInt CsenxmlTester::CSenXmlElement_SetPrefixLL (CStifItemParser& aItem) |
|
2727 { |
|
2728 SetupL();//some thing |
|
2729 TBool Flag; |
|
2730 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element")); |
|
2731 CleanupStack::PushL(pElement); |
|
2732 pElement->SetPrefixL(_L8("pre")); |
|
2733 const TDesC8& lName=pElement->LocalName(); |
|
2734 const TDesC8& nsPrefix=pElement->NsPrefix(); |
|
2735 if(nsPrefix==_L8("pre") && lName==_L8("element")) |
|
2736 Flag=1; |
|
2737 else |
|
2738 Flag=0; |
|
2739 /*EUNIT_ASSERT( Flag );*/ |
|
2740 if(!Flag) |
|
2741 return KErrArgument; |
|
2742 |
|
2743 CleanupStack::PopAndDestroy(pElement); |
|
2744 |
|
2745 Teardown(); |
|
2746 return KErrNone; |
|
2747 } |
|
2748 |
|
2749 TInt CsenxmlTester::CSenXmlElement_HasContentL (CStifItemParser& aItem) |
|
2750 { |
|
2751 SetupL(); |
|
2752 TBool Flag; |
|
2753 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element")); |
|
2754 CleanupStack::PushL(pElement); |
|
2755 //False case |
|
2756 Flag=pElement->HasContent(); |
|
2757 /* EUNIT_ASSERT( !Flag );*/ |
|
2758 if(Flag) |
|
2759 return KErrArgument; |
|
2760 |
|
2761 //True case |
|
2762 pElement->SetContentL(_L8("CONTENT")); |
|
2763 Flag=pElement->HasContent(); |
|
2764 /*EUNIT_ASSERT( Flag );*/ |
|
2765 if(!Flag) |
|
2766 return KErrArgument; |
|
2767 |
|
2768 CleanupStack::PopAndDestroy(pElement); |
|
2769 Teardown(); |
|
2770 return KErrNone; |
|
2771 } |
|
2772 |
|
2773 TInt CsenxmlTester::CSenXmlElement_ContentL (CStifItemParser& aItem) |
|
2774 { |
|
2775 SetupL(); |
|
2776 TBool Flag; |
|
2777 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element")); |
|
2778 CleanupStack::PushL(pElement); |
|
2779 pElement->SetContentL(_L8("CONTENT")); |
|
2780 const TDesC8& content=pElement->Content(); |
|
2781 if(content==_L8("CONTENT")) |
|
2782 Flag=1; |
|
2783 else |
|
2784 Flag=0; |
|
2785 /*EUNIT_ASSERT( Flag );*/ |
|
2786 if(!Flag) |
|
2787 return KErrArgument; |
|
2788 |
|
2789 CleanupStack::PopAndDestroy(pElement); |
|
2790 Teardown(); |
|
2791 return KErrNone; |
|
2792 } |
|
2793 |
|
2794 TInt CsenxmlTester::CSenXmlElement_ContentWriteStreamLL (CStifItemParser& aItem) |
|
2795 { |
|
2796 SetupL(); |
|
2797 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element")); |
|
2798 CleanupStack::PushL(pElement); |
|
2799 RWriteStream stream = pElement->ContentWriteStreamL(); |
|
2800 CleanupStack::PopAndDestroy(pElement); |
|
2801 Teardown(); |
|
2802 return KErrNone; |
|
2803 } |
|
2804 |
|
2805 |
|
2806 TInt CsenxmlTester::CSenXmlElement_ContentUnicodeLL (CStifItemParser& aItem) |
|
2807 { |
|
2808 SetupL(); |
|
2809 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia")); |
|
2810 CleanupStack::PushL(pElement); |
|
2811 pElement->SetContentL(_L8("Nokia content")); |
|
2812 HBufC* ElementBuf=pElement->ContentUnicodeL(); |
|
2813 /* EUNIT_ASSERT_EQUALS(*ElementBuf,_L("Nokia content"));*/ |
|
2814 TL(*ElementBuf == _L("Nokia content")); |
|
2815 CleanupStack::PopAndDestroy(pElement); |
|
2816 delete ElementBuf; |
|
2817 Teardown(); |
|
2818 return KErrNone; |
|
2819 } |
|
2820 |
|
2821 TInt CsenxmlTester::CSenXmlElement_SetContentLL (CStifItemParser& aItem) |
|
2822 { |
|
2823 SetupL(); |
|
2824 TBool Flag; |
|
2825 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element")); |
|
2826 CleanupStack::PushL(pElement); |
|
2827 pElement->SetContentL(_L8("CONTENT")); |
|
2828 TBool ContentFlag=pElement->HasContent(); |
|
2829 const TDesC8& content=pElement->Content(); |
|
2830 if(content==_L8("CONTENT") && ContentFlag) |
|
2831 Flag=1; |
|
2832 else |
|
2833 Flag=0; |
|
2834 /*EUNIT_ASSERT( Flag );*/ |
|
2835 if(!Flag) |
|
2836 return KErrArgument; |
|
2837 |
|
2838 pElement->SetContentL(_L8("NEW CONTENT")); |
|
2839 const TDesC8& newContent=pElement->Content(); |
|
2840 if(newContent==_L8("NEW CONTENT") ) |
|
2841 Flag=1; |
|
2842 else |
|
2843 Flag=0; |
|
2844 /*EUNIT_ASSERT( Flag );*/ |
|
2845 if(!Flag) |
|
2846 return KErrArgument; |
|
2847 |
|
2848 CleanupStack::PopAndDestroy(pElement); |
|
2849 Teardown(); |
|
2850 return KErrNone; |
|
2851 } |
|
2852 |
|
2853 TInt CsenxmlTester::CSenXmlElement_ConsistsOfLL (CStifItemParser& aItem) |
|
2854 { |
|
2855 SetupL(); |
|
2856 CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia")); |
|
2857 CleanupStack::PushL(pElementA); |
|
2858 CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp")); |
|
2859 CleanupStack::PushL(pChild1A); |
|
2860 CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices")); |
|
2861 CleanupStack::PushL(pChild2A); |
|
2862 pElementA->SetContentL(_L8("Nokia organisation structure")); |
|
2863 pElementA->AddElementL(*pChild1A); |
|
2864 pElementA->AddElementL(*pChild2A); |
|
2865 |
|
2866 CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia")); |
|
2867 CleanupStack::PushL(pElementB); |
|
2868 CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp")); |
|
2869 CleanupStack::PushL(pChild1A); |
|
2870 CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("WebServices")); |
|
2871 CleanupStack::PushL(pChild2B); |
|
2872 pElementB->SetContentL(_L8("Nokia organisation structure")); |
|
2873 pElementB->AddElementL(*pChild1B); |
|
2874 pElementB->AddElementL(*pChild2B); |
|
2875 |
|
2876 TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA); |
|
2877 /* EUNIT_ASSERT( ConsistOfFlag );*/ |
|
2878 if(!ConsistOfFlag) |
|
2879 return KErrArgument; |
|
2880 |
|
2881 CleanupStack::Pop(2); |
|
2882 CleanupStack::PopAndDestroy(pElementB); |
|
2883 CleanupStack::Pop(2); |
|
2884 CleanupStack::PopAndDestroy(pElementA); |
|
2885 Teardown(); |
|
2886 return KErrNone; |
|
2887 } |
|
2888 |
|
2889 TInt CsenxmlTester::CSenXmlElement_ConsistsOfL1L (CStifItemParser& aItem) |
|
2890 { |
|
2891 SetupL(); |
|
2892 CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia")); |
|
2893 CleanupStack::PushL(pElementA); |
|
2894 CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp")); |
|
2895 CleanupStack::PushL(pChild1A); |
|
2896 CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices")); |
|
2897 CleanupStack::PushL(pChild2A); |
|
2898 pElementA->SetContentL(_L8("Nokia organisation structure")); |
|
2899 pElementA->AddElementL(*pChild1A); |
|
2900 pElementA->AddElementL(*pChild2A); |
|
2901 |
|
2902 CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia")); |
|
2903 CleanupStack::PushL(pElementB); |
|
2904 CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp")); |
|
2905 CleanupStack::PushL(pChild1A); |
|
2906 CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("Xml")); |
|
2907 CleanupStack::PushL(pChild2B); |
|
2908 pElementB->SetContentL(_L8("Nokia organisation structure")); |
|
2909 pElementB->AddElementL(*pChild1B); |
|
2910 pElementB->AddElementL(*pChild2B); |
|
2911 |
|
2912 TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA); |
|
2913 /* EUNIT_ASSERT( !ConsistOfFlag );*/ |
|
2914 if(ConsistOfFlag) |
|
2915 return KErrArgument; |
|
2916 |
|
2917 CleanupStack::Pop(2); |
|
2918 CleanupStack::PopAndDestroy(pElementB); |
|
2919 CleanupStack::Pop(2); |
|
2920 CleanupStack::PopAndDestroy(pElementA); |
|
2921 Teardown(); |
|
2922 return KErrNone; |
|
2923 } |
|
2924 |
|
2925 TInt CsenxmlTester::CSenXmlElement_ConsistsOfL2L (CStifItemParser& aItem) |
|
2926 { |
|
2927 SetupL(); |
|
2928 CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia")); |
|
2929 CleanupStack::PushL(pElementA); |
|
2930 CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp")); |
|
2931 CleanupStack::PushL(pChild1A); |
|
2932 CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices")); |
|
2933 CleanupStack::PushL(pChild2A); |
|
2934 CSenXmlElement* pChild3A=CSenXmlElement::NewL(_L8("Xml")); |
|
2935 CleanupStack::PushL(pChild3A); |
|
2936 pElementA->SetContentL(_L8("Nokia organisation structure")); |
|
2937 pElementA->AddElementL(*pChild1A); |
|
2938 pElementA->AddElementL(*pChild2A); |
|
2939 pElementA->AddElementL(*pChild3A); |
|
2940 |
|
2941 CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia")); |
|
2942 CleanupStack::PushL(pElementB); |
|
2943 CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp")); |
|
2944 CleanupStack::PushL(pChild1A); |
|
2945 CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("Xml")); |
|
2946 CleanupStack::PushL(pChild2B); |
|
2947 pElementB->SetContentL(_L8("Nokia organisation structure")); |
|
2948 pElementB->AddElementL(*pChild1B); |
|
2949 pElementB->AddElementL(*pChild2B); |
|
2950 |
|
2951 TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA); |
|
2952 /* EUNIT_ASSERT( ConsistOfFlag );*/ |
|
2953 if(!ConsistOfFlag) |
|
2954 return KErrArgument; |
|
2955 |
|
2956 CleanupStack::Pop(3); |
|
2957 CleanupStack::PopAndDestroy(pElementB); |
|
2958 CleanupStack::Pop(2); |
|
2959 CleanupStack::PopAndDestroy(pElementA); |
|
2960 Teardown(); |
|
2961 return KErrNone; |
|
2962 } |
|
2963 |
|
2964 TInt CsenxmlTester::CSenXmlElement_SetNamespaceLL (CStifItemParser& aItem) |
|
2965 { |
|
2966 SetupL(); |
|
2967 TBool Flag; |
|
2968 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
2969 CleanupStack::PushL(pElement); |
|
2970 pElement->SetNamespaceL(_L8("namespaceuri")); |
|
2971 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
2972 if(pNsURI==_L8("namespaceuri")) |
|
2973 Flag=1; |
|
2974 else |
|
2975 Flag=0; |
|
2976 CleanupStack::PopAndDestroy(pElement); |
|
2977 /*EUNIT_ASSERT( Flag );*/ |
|
2978 if(!Flag) |
|
2979 return KErrArgument; |
|
2980 |
|
2981 Teardown(); |
|
2982 return KErrNone; |
|
2983 } |
|
2984 |
|
2985 TInt CsenxmlTester::CSenXmlElement_SetNamespaceL_1L (CStifItemParser& aItem) |
|
2986 { |
|
2987 SetupL(); |
|
2988 TBool Flag; |
|
2989 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
2990 CleanupStack::PushL(pElement); |
|
2991 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
2992 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
2993 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
2994 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
2995 Flag=1; |
|
2996 else |
|
2997 Flag=0; |
|
2998 CleanupStack::PopAndDestroy(pElement); |
|
2999 /*EUNIT_ASSERT( Flag );*/ |
|
3000 if(!Flag) |
|
3001 return KErrArgument; |
|
3002 |
|
3003 Teardown(); |
|
3004 return KErrNone; |
|
3005 } |
|
3006 TInt CsenxmlTester::CSenXmlElement_SetNamespaceL_2same1L (CStifItemParser& aItem) |
|
3007 { |
|
3008 SetupL(); |
|
3009 TBool Flag; |
|
3010 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3011 CleanupStack::PushL(pElement); |
|
3012 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
3013 pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
3014 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
3015 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
3016 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
3017 Flag=1; |
|
3018 else |
|
3019 Flag=0; |
|
3020 /*EUNIT_ASSERT( Flag );*/ |
|
3021 if(!Flag) |
|
3022 return KErrArgument; |
|
3023 |
|
3024 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
3025 /* EUNIT_ASSERT( pNsList.Count()==1 );*/ |
|
3026 if(!( pNsList.Count()==1 )) |
|
3027 return KErrArgument; |
|
3028 |
|
3029 CleanupStack::PopAndDestroy(pElement); |
|
3030 Teardown(); |
|
3031 return KErrNone; |
|
3032 } |
|
3033 |
|
3034 TInt CsenxmlTester::CSenXmlElement_SetNamespaceL_2Diff1L (CStifItemParser& aItem) |
|
3035 { |
|
3036 SetupL(); |
|
3037 TBool Flag; |
|
3038 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3039 CleanupStack::PushL(pElement); |
|
3040 pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1")); |
|
3041 pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri2")); |
|
3042 const TDesC8& pNsURI=pElement->NamespaceURI(); |
|
3043 const TDesC8& pNsPrefix=pElement->NsPrefix(); |
|
3044 if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2")) |
|
3045 Flag=1; |
|
3046 else |
|
3047 Flag=0; |
|
3048 /*EUNIT_ASSERT( Flag );*/ |
|
3049 if(!Flag) |
|
3050 return KErrArgument; |
|
3051 |
|
3052 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
3053 /* EUNIT_ASSERT( pNsList.Count()==2 );*/ |
|
3054 if(!( pNsList.Count()==2 )) |
|
3055 return KErrArgument; |
|
3056 |
|
3057 CleanupStack::PopAndDestroy(pElement); |
|
3058 Teardown(); |
|
3059 return KErrNone; |
|
3060 } |
|
3061 |
|
3062 TInt CsenxmlTester::CSenXmlElement_AddNamespaceLL (CStifItemParser& aItem) |
|
3063 { |
|
3064 SetupL(); |
|
3065 TBool Flag; |
|
3066 TBool CheckParent=TRUE; |
|
3067 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3068 CleanupStack::PushL(pElement); |
|
3069 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("ParentElement")); |
|
3070 CleanupStack::PushL(pParent); |
|
3071 |
|
3072 pElement->SetParent(pParent); |
|
3073 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri")); |
|
3074 CleanupStack::PushL(pNs1); |
|
3075 const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent); |
|
3076 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
3077 const TDesC8& pNsURI=pNs->URI(); |
|
3078 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
3079 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
3080 Flag=1; |
|
3081 else |
|
3082 Flag=0; |
|
3083 |
|
3084 /*EUNIT_ASSERT( Flag );*/ |
|
3085 if(!Flag) |
|
3086 return KErrArgument; |
|
3087 |
|
3088 /* EUNIT_ASSERT( pNsList.Count()==1);*/ |
|
3089 if(!( pNsList.Count()==1 )) |
|
3090 return KErrArgument; |
|
3091 |
|
3092 CleanupStack::PopAndDestroy(pNs1); |
|
3093 CleanupStack::PopAndDestroy(pParent); |
|
3094 CleanupStack::PopAndDestroy(pElement); |
|
3095 Teardown(); |
|
3096 return KErrNone; |
|
3097 } |
|
3098 |
|
3099 TInt CsenxmlTester::CSenXmlElement_AddNamespaceL_1L (CStifItemParser& aItem) |
|
3100 { |
|
3101 SetupL(); |
|
3102 TBool Flag; |
|
3103 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3104 CleanupStack::PushL(pElement); |
|
3105 const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri")); |
|
3106 const TDesC8& pNsURI=pNs->URI(); |
|
3107 const TDesC8& pNsPrefix=pNs->Prefix(); |
|
3108 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N")) |
|
3109 Flag=1; |
|
3110 else |
|
3111 Flag=0; |
|
3112 CleanupStack::PopAndDestroy(pElement); |
|
3113 /*EUNIT_ASSERT( Flag );*/ |
|
3114 if(!Flag) |
|
3115 return KErrArgument; |
|
3116 |
|
3117 Teardown(); |
|
3118 return KErrNone; |
|
3119 } |
|
3120 |
|
3121 TInt CsenxmlTester::CSenXmlElement_NamespaceL (CStifItemParser& aItem) |
|
3122 { |
|
3123 SetupL(); |
|
3124 TBool Flag,Flag1,Flag2; |
|
3125 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3126 CleanupStack::PushL(pElement); |
|
3127 //NULL |
|
3128 pElement->SetNamespaceL(_L8("")); |
|
3129 const CSenNamespace* pNs2=pElement->Namespace(); |
|
3130 if(pNs2==NULL) |
|
3131 Flag2=1; |
|
3132 else |
|
3133 Flag2=0; |
|
3134 /* EUNIT_ASSERT(Flag2);*/ |
|
3135 if(!Flag2) |
|
3136 return KErrArgument; |
|
3137 |
|
3138 |
|
3139 //only URI |
|
3140 pElement->SetNamespaceL(_L8("nsuri")); |
|
3141 const CSenNamespace* pNs1=pElement->Namespace(); |
|
3142 if(pNs1->Prefix()==_L8("")&&pNs1->URI()==_L8("nsuri")) |
|
3143 Flag1=1; |
|
3144 else |
|
3145 Flag1=0; |
|
3146 /* EUNIT_ASSERT(Flag1);*/ |
|
3147 if(!Flag1) |
|
3148 return KErrArgument; |
|
3149 |
|
3150 //URI and Prefix |
|
3151 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
3152 const CSenNamespace* pNs=pElement->Namespace(); |
|
3153 if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri")) |
|
3154 Flag=1; |
|
3155 else |
|
3156 Flag=0; |
|
3157 /*EUNIT_ASSERT( Flag );*/ |
|
3158 if(!Flag) |
|
3159 return KErrArgument; |
|
3160 |
|
3161 CleanupStack::PopAndDestroy(pElement); |
|
3162 |
|
3163 Teardown(); |
|
3164 return KErrNone; |
|
3165 } |
|
3166 |
|
3167 TInt CsenxmlTester::CSenXmlElement_Namespace_1L (CStifItemParser& aItem) |
|
3168 { |
|
3169 SetupL(); |
|
3170 TBool Flag,Flag1; |
|
3171 //True case |
|
3172 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3173 CleanupStack::PushL(pElement); |
|
3174 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
3175 const CSenNamespace* pNs=pElement->Namespace(_L8("n")); |
|
3176 if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri")) |
|
3177 Flag=1; |
|
3178 else |
|
3179 Flag=0; |
|
3180 /*EUNIT_ASSERT( Flag );*/ |
|
3181 if(!Flag) |
|
3182 return KErrArgument; |
|
3183 |
|
3184 CleanupStack::PopAndDestroy(pElement); |
|
3185 //False case |
|
3186 pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3187 CleanupStack::PushL(pElement); |
|
3188 pElement->SetNamespaceL(_L8("n"),_L8("nsuri")); |
|
3189 pNs=pElement->Namespace(_L8("N")); |
|
3190 if(pNs==NULL) |
|
3191 Flag1=1; |
|
3192 else |
|
3193 Flag1=0; |
|
3194 /* EUNIT_ASSERT(Flag1);*/ |
|
3195 if(!Flag1) |
|
3196 return KErrArgument; |
|
3197 |
|
3198 CleanupStack::PopAndDestroy(pElement); |
|
3199 Teardown(); |
|
3200 return KErrNone; |
|
3201 } |
|
3202 |
|
3203 TInt CsenxmlTester::CSenXmlElement_Namespace_2L (CStifItemParser& aItem) |
|
3204 { |
|
3205 SetupL(); |
|
3206 TBool Flag,Flag1; |
|
3207 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3208 CleanupStack::PushL(pElement); |
|
3209 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent")); |
|
3210 CleanupStack::PushL(pParent); |
|
3211 pParent->SetNamespaceL(_L8("p"),_L8("nsurip")); |
|
3212 pElement->SetNamespaceL(_L8("n"),_L8("nsurin")); |
|
3213 pElement->SetParent(pParent); |
|
3214 //aCheckInParent=FALSE and parent prefix |
|
3215 const CSenNamespace* pPNs=pElement->Namespace(_L8("p"),FALSE); |
|
3216 if(pPNs==NULL) |
|
3217 Flag=1; |
|
3218 else |
|
3219 Flag=0; |
|
3220 /*EUNIT_ASSERT( Flag );*/ |
|
3221 if(!Flag) |
|
3222 return KErrArgument; |
|
3223 |
|
3224 //aCheckInParent=TRUE and parent prefix |
|
3225 pPNs=pElement->Namespace(_L8("p"),TRUE); |
|
3226 if(pPNs->Prefix()==_L8("p") && pPNs->URI()==_L8("nsurip")) |
|
3227 Flag1=1; |
|
3228 else |
|
3229 Flag1=0; |
|
3230 /* EUNIT_ASSERT( Flag1 );*/ |
|
3231 if(!Flag1) |
|
3232 return KErrArgument; |
|
3233 |
|
3234 CleanupStack::PopAndDestroy(pParent); |
|
3235 CleanupStack::PopAndDestroy(pElement); |
|
3236 Teardown(); |
|
3237 return KErrNone; |
|
3238 } |
|
3239 |
|
3240 TInt CsenxmlTester::CSenXmlElement_Namespace_3L (CStifItemParser& aItem) |
|
3241 { |
|
3242 SetupL(); |
|
3243 TBool Flag; |
|
3244 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3245 CleanupStack::PushL(pElement); |
|
3246 pElement->AddNamespaceL(_L8("n"),_L8("nsurin")); |
|
3247 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
3248 pElement->AddNamespaceL(_L8("l"),_L8("nsuril")); |
|
3249 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL(); |
|
3250 /* EUNIT_ASSERT( pNsList.Count()==3 );*/ |
|
3251 if(!( pNsList.Count()==3 )) |
|
3252 return KErrArgument; |
|
3253 |
|
3254 const CSenNamespace* pNs=pElement->Namespace(_L8("m"),_L8("nsurim")); |
|
3255 if(pNs->Prefix()==_L8("m") && pNs->URI()==_L8("nsurim")) |
|
3256 Flag=1; |
|
3257 else |
|
3258 Flag=0; |
|
3259 /*EUNIT_ASSERT(Flag);*/ |
|
3260 if(!Flag) |
|
3261 return KErrArgument; |
|
3262 |
|
3263 CleanupStack::PopAndDestroy(pElement); |
|
3264 Teardown(); |
|
3265 return KErrNone; |
|
3266 } |
|
3267 |
|
3268 TInt CsenxmlTester::CSenXmlElement_ElementsLL (CStifItemParser& aItem) |
|
3269 { |
|
3270 SetupL(); |
|
3271 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ; |
|
3272 CleanupStack::PushL(pElement); |
|
3273 CSenXmlElement* pChild1=CSenXmlElement::NewL(_L8("element1")) ; |
|
3274 CleanupStack::PushL(pChild1); |
|
3275 CSenXmlElement* pChild2=CSenXmlElement::NewL(_L8("element2")) ; |
|
3276 CleanupStack::PushL(pChild2); |
|
3277 CSenXmlElement* pChild3=CSenXmlElement::NewL(_L8("element3")) ; |
|
3278 CleanupStack::PushL(pChild3); |
|
3279 pElement->AddElementL(*pChild1); |
|
3280 pElement->AddElementL(*pChild2); |
|
3281 pElement->AddElementL(*pChild3); |
|
3282 RPointerArray<CSenElement>& ElList=pElement->ElementsL(); |
|
3283 /*EUNIT_ASSERT( ElList.Count()==3);*/ |
|
3284 if(!( ElList.Count()==3 )) |
|
3285 return KErrArgument; |
|
3286 |
|
3287 CleanupStack::Pop(3); |
|
3288 CleanupStack::PopAndDestroy(pElement); |
|
3289 Teardown(); |
|
3290 return KErrNone; |
|
3291 } |
|
3292 |
|
3293 TInt CsenxmlTester::CSenXmlElement_AttributesLL (CStifItemParser& aItem) |
|
3294 { |
|
3295 SetupL(); |
|
3296 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ; |
|
3297 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
3298 pElement->AddAttrL(_L8("Attr2"),_L8("value2")); |
|
3299 pElement->AddAttrL(_L8("Attr3"),_L8("value3")); |
|
3300 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
3301 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
3302 RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL(); |
|
3303 /* EUNIT_ASSERT( pAttrList.Count()==4 );*/ |
|
3304 if(!( pAttrList.Count()==4 )) |
|
3305 return KErrArgument; |
|
3306 |
|
3307 delete pElement; |
|
3308 Teardown(); |
|
3309 return KErrNone; |
|
3310 } |
|
3311 TInt CsenxmlTester::CSenXmlElement_AddAttributeLL (CStifItemParser& aItem) |
|
3312 { |
|
3313 SetupL(); |
|
3314 CTestXmlElement* pElement=CTestXmlElement::NewL(_L8("Nokia")); |
|
3315 CleanupStack::PushL(pElement); |
|
3316 pElement->AddAttributeL(_L8("Attr1"),_L8("value1")); |
|
3317 |
|
3318 CleanupStack::PopAndDestroy(pElement); |
|
3319 Teardown(); |
|
3320 return KErrNone; |
|
3321 } |
|
3322 |
|
3323 TInt CsenxmlTester::CSenXmlElement_NamespacesLL (CStifItemParser& aItem) |
|
3324 { |
|
3325 SetupL(); |
|
3326 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3327 CleanupStack::PushL(pElement); |
|
3328 pElement->AddNamespaceL(_L8("l"),_L8("nsuril")); |
|
3329 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
3330 pElement->AddNamespaceL(_L8("n"),_L8("nsurin")); |
|
3331 pElement->AddNamespaceL(_L8("m"),_L8("nsurim")); |
|
3332 const RPointerArray<CSenNamespace>& pNs=pElement->NamespacesL(); |
|
3333 /* EUNIT_ASSERT( pNs.Count()==3);*/ |
|
3334 if(!( pNs.Count()==3 )) |
|
3335 return KErrArgument; |
|
3336 |
|
3337 CleanupStack::PopAndDestroy(pElement); |
|
3338 Teardown(); |
|
3339 return KErrNone; |
|
3340 } |
|
3341 |
|
3342 TInt CsenxmlTester::CSenXmlElement_AttrValueL (CStifItemParser& aItem) |
|
3343 { |
|
3344 SetupL(); |
|
3345 TBool Flag,NegFlag; |
|
3346 _LIT8(KValue,"value4"); |
|
3347 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ; |
|
3348 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
3349 pElement->AddAttrL(_L8("Attr2"),_L8("value2")); |
|
3350 pElement->AddAttrL(_L8("Attr3"),_L8("value3")); |
|
3351 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
3352 pElement->AddAttrL(_L8("Attr4"),_L8("value4")); |
|
3353 const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr4")); |
|
3354 if(pAttrVal!=NULL) |
|
3355 Flag=1; |
|
3356 else |
|
3357 Flag=0; |
|
3358 /* EUNIT_ASSERT(Flag);*/ |
|
3359 if(!(Flag)) |
|
3360 return KErrArgument; |
|
3361 |
|
3362 const TDesC8* pNegAttrVal=pElement->AttrValue(_L8("attr1")); |
|
3363 if(pNegAttrVal==NULL) |
|
3364 NegFlag=1; |
|
3365 else |
|
3366 NegFlag=0; |
|
3367 /*EUNIT_ASSERT(NegFlag);*/ |
|
3368 if(!(NegFlag)) |
|
3369 return KErrArgument; |
|
3370 |
|
3371 delete pElement; |
|
3372 Teardown(); |
|
3373 return KErrNone; |
|
3374 } |
|
3375 |
|
3376 TInt CsenxmlTester::CSenXmlElement_AddAttrLL (CStifItemParser& aItem) |
|
3377 { |
|
3378 SetupL(); |
|
3379 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3380 CleanupStack::PushL(pElement); |
|
3381 pElement->AddAttrL(_L8("Attr1"),_L8("value1")); |
|
3382 RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL(); |
|
3383 /* EUNIT_ASSERT( pAttrList.Count()==1 );*/ |
|
3384 if(!(pAttrList.Count()==1)) |
|
3385 return KErrArgument; |
|
3386 |
|
3387 pElement->AddAttrL(_L8("Attr1"),_L8("Duplicatevalue1")); |
|
3388 /*EUNIT_ASSERT( pAttrList.Count()==1 );*/ |
|
3389 if(!(pAttrList.Count()==1)) |
|
3390 return KErrArgument; |
|
3391 |
|
3392 const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr1")); |
|
3393 pElement->AddAttrL(_L8("Attr2"),_L8(" value2"));//improve here by comparing TDesC8* AttrValue() |
|
3394 /*EUNIT_ASSERT( pAttrList.Count()==2 );*/ |
|
3395 if(!(pAttrList.Count()==2)) |
|
3396 return KErrArgument; |
|
3397 |
|
3398 CleanupStack::PopAndDestroy(pElement); |
|
3399 Teardown(); |
|
3400 return KErrNone; |
|
3401 } |
|
3402 |
|
3403 TInt CsenxmlTester::CSenXmlElement_ParentL (CStifItemParser& aItem) |
|
3404 { |
|
3405 SetupL(); |
|
3406 TBool Flag,PFlag,PPFlag; |
|
3407 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3408 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent")); |
|
3409 CSenXmlElement* pPParent=CSenXmlElement::NewL(_L8("parent of parent")); |
|
3410 pElement->SetParent(pParent); |
|
3411 pParent->SetParent(pPParent); |
|
3412 CSenElement* pEl1= pElement->Parent(); |
|
3413 CSenElement* pEl2= pParent->Parent(); |
|
3414 CSenElement* pEl3= pPParent->Parent(); |
|
3415 const TDesC8& pLName1=pEl1->LocalName(); |
|
3416 if(pLName1==_L8("Parent")) |
|
3417 Flag=1; |
|
3418 else |
|
3419 Flag=0; |
|
3420 /*EUNIT_ASSERT( Flag );*/ |
|
3421 if(!Flag) |
|
3422 return KErrArgument; |
|
3423 |
|
3424 const TDesC8& pLName2=pEl2->LocalName(); |
|
3425 if(pLName2==_L8("parent of parent")) |
|
3426 PFlag=1; |
|
3427 else |
|
3428 PFlag=0; |
|
3429 /* EUNIT_ASSERT(PFlag);*/ |
|
3430 if(!PFlag) |
|
3431 return KErrArgument; |
|
3432 |
|
3433 if(pEl3==NULL) |
|
3434 PPFlag=1; |
|
3435 else |
|
3436 PPFlag=0; |
|
3437 /*EUNIT_ASSERT(PPFlag);*/ |
|
3438 if(!PPFlag) |
|
3439 return KErrArgument; |
|
3440 |
|
3441 delete pElement; |
|
3442 delete pParent; |
|
3443 delete pPParent; |
|
3444 Teardown(); |
|
3445 return KErrNone; |
|
3446 } |
|
3447 |
|
3448 TInt CsenxmlTester::CSenXmlElement_SetParentL (CStifItemParser& aItem) |
|
3449 { |
|
3450 SetupL(); |
|
3451 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3452 CleanupStack::PushL(pElement); |
|
3453 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent")); |
|
3454 CleanupStack::PushL(pParent); |
|
3455 pElement->SetNamespaceL(_L8("Nsuria")); |
|
3456 pParent->SetNamespaceL(_L8("nsurip")); |
|
3457 pElement->SetParent(pParent); |
|
3458 CSenElement* pPar=pElement->Parent(); |
|
3459 const TDesC8& ParName=pPar->LocalName(); |
|
3460 /* EUNIT_ASSERT_EQUALS( ParName,_L8("Parent") ); */ |
|
3461 TL(ParName == _L8("Parent")); |
|
3462 CleanupStack::PopAndDestroy(pParent); |
|
3463 CleanupStack::PopAndDestroy(pElement); |
|
3464 Teardown(); |
|
3465 return KErrNone; |
|
3466 } |
|
3467 |
|
3468 TInt CsenxmlTester::CSenXmlElement_RootL (CStifItemParser& aItem) |
|
3469 { |
|
3470 SetupL(); |
|
3471 TBool Flag; |
|
3472 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
3473 const MSenElement& pElRoot=pElement->Root(); |
|
3474 const TDesC8& pElLName=pElRoot.LocalName(); |
|
3475 if(pElLName==_L8("Nokia")) |
|
3476 Flag=1; |
|
3477 else |
|
3478 Flag=0; |
|
3479 |
|
3480 CSenXmlElement* pParent1=CSenXmlElement::NewL(_L8("Parent1")); |
|
3481 pElement->SetParent(pParent1); |
|
3482 const MSenElement& pElRoot1=pElement->Root(); |
|
3483 const TDesC8& pElLName1=pElRoot1.LocalName(); |
|
3484 if(pElLName1==_L8("Parent1")) |
|
3485 Flag=1; |
|
3486 else |
|
3487 Flag=0; |
|
3488 |
|
3489 CSenXmlElement* pParent2=CSenXmlElement::NewL(_L8("Parent2")); |
|
3490 pParent1->SetParent(pParent2); |
|
3491 const MSenElement& pElRoot2=pElement->Root(); |
|
3492 const TDesC8& pElLName2=pElRoot2.LocalName(); |
|
3493 const MSenElement& pParRoot=pParent1->Root(); |
|
3494 const TDesC8& pParLName=pParRoot.LocalName(); |
|
3495 if(pElLName2==_L8("Parent2") && pParLName==_L8("Parent2")) |
|
3496 Flag=1; |
|
3497 else |
|
3498 Flag=0; |
|
3499 |
|
3500 /*EUNIT_ASSERT( Flag );*/ |
|
3501 if(!Flag) |
|
3502 return KErrArgument; |
|
3503 |
|
3504 delete pElement; |
|
3505 delete pParent1; |
|
3506 delete pParent2; |
|
3507 Teardown(); |
|
3508 return KErrNone; |
|
3509 } |
|
3510 |
|
3511 TInt CsenxmlTester::CSenXmlElement_ElementL (CStifItemParser& aItem) |
|
3512 { |
|
3513 SetupL(); |
|
3514 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent")); |
|
3515 CleanupStack::PushL(pParent); |
|
3516 CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Nokia1")); |
|
3517 CleanupStack::PushL(pElement1); |
|
3518 CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Nokia2")); |
|
3519 CleanupStack::PushL(pElement2); |
|
3520 CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Nokia3")); |
|
3521 CleanupStack::PushL(pElement3); |
|
3522 pParent->AddElementL(*pElement1); |
|
3523 pParent->AddElementL(*pElement2); |
|
3524 pParent->AddElementL(*pElement3); |
|
3525 CSenElement* element=pParent->Element(_L8("Nokia1")); |
|
3526 /* EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/ |
|
3527 if(!(element->LocalName()==_L8("Nokia1"))) |
|
3528 return KErrArgument; |
|
3529 |
|
3530 CleanupStack::Pop(3); |
|
3531 CleanupStack::PopAndDestroy(pParent); |
|
3532 Teardown(); |
|
3533 return KErrNone; |
|
3534 } |
|
3535 |
|
3536 TInt CsenxmlTester::CSenXmlElement_CreateElementLL (CStifItemParser& aItem) |
|
3537 { |
|
3538 SetupL(); |
|
3539 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element")); |
|
3540 CleanupStack::PushL(pElement); |
|
3541 pElement->SetNamespaceL(_L8("N"),_L8("nsuri")); |
|
3542 CSenElement* pNewElement=pElement->CreateElementL(_L8("N"),_L8("Nokia")); |
|
3543 CleanupStack::PushL(pNewElement); |
|
3544 HBufC8* ElementBuf=pNewElement->AsXmlL(); |
|
3545 /* EUNIT_ASSERT_EQUALS(*ElementBuf,_L8("<N:Nokia xmlns:N=\"nsuri\"/>"));*/ |
|
3546 TL(*ElementBuf == _L8("<N:Nokia xmlns:N=\"nsuri\"/>")); |
|
3547 CleanupStack::PopAndDestroy(pNewElement); |
|
3548 CleanupStack::PopAndDestroy(pElement); |
|
3549 delete ElementBuf; |
|
3550 Teardown(); |
|
3551 return KErrNone; |
|
3552 } |
|
3553 |
|
3554 TInt CsenxmlTester::CSenXmlElement_InsertElementLL (CStifItemParser& aItem) |
|
3555 { |
|
3556 SetupL(); |
|
3557 |
|
3558 TBool Flag; |
|
3559 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent")); |
|
3560 CleanupStack::PushL(pParent); |
|
3561 CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Nokia1")); |
|
3562 CleanupStack::PushL(pElement1); |
|
3563 CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Nokia2")); |
|
3564 CleanupStack::PushL(pElement2); |
|
3565 CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Nokia3")); |
|
3566 CleanupStack::PushL(pElement3); |
|
3567 CSenXmlElement* pElement5=CSenXmlElement::NewL(_L8("Nokia5")); |
|
3568 CleanupStack::PushL(pElement5); |
|
3569 pParent->AddElementL(*pElement1); |
|
3570 pParent->AddElementL(*pElement2); |
|
3571 pParent->AddElementL(*pElement3); |
|
3572 pParent->AddElementL(*pElement5); |
|
3573 CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Nokia4")); |
|
3574 CleanupStack::PushL(pElement4); |
|
3575 pParent->InsertElementL(*pElement4,*pElement5); |
|
3576 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
3577 const TDesC8& localName=elementList[3]->LocalName(); |
|
3578 if(localName==_L8("Nokia4")) |
|
3579 Flag=1; |
|
3580 else |
|
3581 Flag=0; |
|
3582 /*EUNIT_ASSERT( Flag );*/ |
|
3583 if(!Flag) |
|
3584 return KErrArgument; |
|
3585 |
|
3586 CleanupStack::Pop(pElement4); |
|
3587 CleanupStack::Pop(pElement5); |
|
3588 CleanupStack::Pop(pElement3); |
|
3589 CleanupStack::Pop(pElement2); |
|
3590 CleanupStack::Pop(pElement1); |
|
3591 CleanupStack::PopAndDestroy(pParent); |
|
3592 Teardown(); |
|
3593 return KErrNone; |
|
3594 } |
|
3595 |
|
3596 TInt CsenxmlTester::CSenXmlElement_AddElementLL (CStifItemParser& aItem) |
|
3597 { |
|
3598 SetupL(); |
|
3599 TBool Flag; |
|
3600 CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3601 CleanupStack::PushL(pParent); |
|
3602 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nokia")); |
|
3603 CleanupStack::PushL(pElement); |
|
3604 CSenElement& newElement=pParent->AddElementL(*pElement); |
|
3605 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
3606 const TDesC8& localName=elementList[0]->LocalName(); |
|
3607 const TDesC8& localName1=newElement.LocalName(); |
|
3608 if(localName==_L8("nokia") && elementList.Count()==1 )//&& newElement!=NULL) |
|
3609 Flag=1; |
|
3610 else |
|
3611 Flag=0; |
|
3612 /*EUNIT_ASSERT( Flag );*/ |
|
3613 if(!Flag) |
|
3614 return KErrArgument; |
|
3615 |
|
3616 CleanupStack::Pop(pElement); |
|
3617 CleanupStack::PopAndDestroy(pParent); |
|
3618 Teardown(); |
|
3619 return KErrNone; |
|
3620 } |
|
3621 |
|
3622 TInt CsenxmlTester::CSenXmlElement_AddElementL_1L (CStifItemParser& aItem) |
|
3623 { |
|
3624 SetupL(); |
|
3625 TBool Flag; |
|
3626 CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3627 CleanupStack::PushL(pParent); |
|
3628 CSenElement& newElement=pParent->AddElementL(_L8("element")); |
|
3629 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
3630 const TDesC8& localName=elementList[0]->LocalName(); |
|
3631 if(localName==_L8("element") && elementList.Count()==1 ) |
|
3632 Flag=1; |
|
3633 else |
|
3634 Flag=0; |
|
3635 /*EUNIT_ASSERT( Flag );*/ |
|
3636 if(!Flag) |
|
3637 return KErrArgument; |
|
3638 |
|
3639 CleanupStack::PopAndDestroy(pParent); |
|
3640 Teardown(); |
|
3641 return KErrNone; |
|
3642 } |
|
3643 |
|
3644 TInt CsenxmlTester::CSenXmlElement_AddElementL_2L (CStifItemParser& aItem) |
|
3645 { |
|
3646 SetupL(); |
|
3647 TBool Flag; |
|
3648 CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3649 CleanupStack::PushL(pParent); |
|
3650 CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element")); |
|
3651 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
3652 const TDesC8& localName=elementList[0]->LocalName(); |
|
3653 const TDesC8& nsUri=elementList[0]->NamespaceURI(); |
|
3654 if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria")) |
|
3655 Flag=1; |
|
3656 else |
|
3657 Flag=0; |
|
3658 /*EUNIT_ASSERT( Flag );*/ |
|
3659 if(!Flag) |
|
3660 return KErrArgument; |
|
3661 |
|
3662 CleanupStack::PopAndDestroy(pParent); |
|
3663 Teardown(); |
|
3664 return KErrNone; |
|
3665 } |
|
3666 |
|
3667 TInt CsenxmlTester::CSenXmlElement_AddElementL_3L (CStifItemParser& aItem) |
|
3668 { |
|
3669 SetupL(); |
|
3670 TBool Flag; |
|
3671 CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3672 CleanupStack::PushL(pParent); |
|
3673 CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"),_L8("e:element")); |
|
3674 RPointerArray<CSenElement>& elementList=pParent->ElementsL(); |
|
3675 const TDesC8& localName=elementList[0]->LocalName(); |
|
3676 const TDesC8& nsUri=elementList[0]->NamespaceURI(); |
|
3677 if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria")) |
|
3678 Flag=1; |
|
3679 else |
|
3680 Flag=0; |
|
3681 /*EUNIT_ASSERT( Flag );*/ |
|
3682 if(!Flag) |
|
3683 return KErrArgument; |
|
3684 |
|
3685 CleanupStack::PopAndDestroy(pParent); |
|
3686 Teardown(); |
|
3687 return KErrNone; |
|
3688 } |
|
3689 |
|
3690 TInt CsenxmlTester::CSenXmlElement_RemoveElementL (CStifItemParser& aItem) |
|
3691 { |
|
3692 SetupL(); |
|
3693 TBool TFlag; |
|
3694 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3695 CleanupStack::PushL(pParent); |
|
3696 CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1")); |
|
3697 CleanupStack::PushL(pElement1); |
|
3698 CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2")); |
|
3699 CleanupStack::PushL(pElement2); |
|
3700 CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3")); |
|
3701 CleanupStack::PushL(pElement3); |
|
3702 CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4")); |
|
3703 CleanupStack::PushL(pElement4); |
|
3704 pParent->AddElementL(*pElement1); |
|
3705 pParent->AddElementL(*pElement2); |
|
3706 pParent->AddElementL(*pElement3); |
|
3707 pParent->AddElementL(*pElement4); |
|
3708 //true case |
|
3709 CSenElement* pRmdElement=pParent->RemoveElement(*pElement3); |
|
3710 const TDesC8& localName=pRmdElement->LocalName(); |
|
3711 /*CSenElement* pParElement=pElement3->Parent();//intentional |
|
3712 const TDesC8& localnmae1=pParElement->LocalName();*/ |
|
3713 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
3714 if(localName==_L8("Element3") && elList.Count()==3 ) |
|
3715 TFlag=1; |
|
3716 else |
|
3717 TFlag=0; |
|
3718 /* EUNIT_ASSERT( TFlag );*/ |
|
3719 if(!TFlag) |
|
3720 return KErrArgument; |
|
3721 |
|
3722 CleanupStack::Pop(4); |
|
3723 CleanupStack::PopAndDestroy(pParent); |
|
3724 delete pRmdElement; |
|
3725 //delete pRmdElement1; |
|
3726 Teardown(); |
|
3727 return KErrNone; |
|
3728 } |
|
3729 |
|
3730 TInt CsenxmlTester::CSenXmlElement_RemoveElement_1L (CStifItemParser& aItem) |
|
3731 { |
|
3732 SetupL(); |
|
3733 TBool TFlag,FFlag; |
|
3734 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3735 CleanupStack::PushL(pParent); |
|
3736 pParent->AddElementL(_L8("element1")); |
|
3737 pParent->AddElementL(_L8("element2")); |
|
3738 pParent->AddElementL(_L8("element3")); |
|
3739 pParent->AddElementL(_L8("element4")); |
|
3740 //True case |
|
3741 CSenElement* pRmdElement=pParent->RemoveElement(_L8("element1")); |
|
3742 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
3743 if(pRmdElement->LocalName()==_L8("element1") && elList.Count()==3) |
|
3744 TFlag=1; |
|
3745 else |
|
3746 TFlag=0; |
|
3747 /* EUNIT_ASSERT( TFlag );*/ |
|
3748 if(!TFlag) |
|
3749 return KErrArgument; |
|
3750 |
|
3751 //False case |
|
3752 CSenElement* pRmdElement1=pParent->RemoveElement(_L8("none")); |
|
3753 elList=pParent->ElementsL(); |
|
3754 if(pRmdElement1==NULL && elList.Count()==3) |
|
3755 FFlag=1; |
|
3756 else |
|
3757 FFlag=0; |
|
3758 /* EUNIT_ASSERT(FFlag);*/ |
|
3759 if(!FFlag) |
|
3760 return KErrArgument; |
|
3761 |
|
3762 CleanupStack::PopAndDestroy(pParent); |
|
3763 delete pRmdElement; |
|
3764 //delete pRmdElement1; |
|
3765 Teardown(); |
|
3766 return KErrNone; |
|
3767 } |
|
3768 |
|
3769 TInt CsenxmlTester::CSenXmlElement_RemoveElement_2L (CStifItemParser& aItem) |
|
3770 { |
|
3771 SetupL(); |
|
3772 TBool TFlag,FFlag; |
|
3773 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3774 CleanupStack::PushL(pParent); |
|
3775 pParent->AddElementL(_L8("nsuri1"),_L8("element1")); |
|
3776 pParent->AddElementL(_L8("nsuri2"),_L8("element2")); |
|
3777 pParent->AddElementL(_L8("nsuri2a"),_L8("element2")); |
|
3778 pParent->AddElementL(_L8("nsuri4"),_L8("element4")); |
|
3779 //True case |
|
3780 CSenElement* pRmdElement=pParent->RemoveElement(_L8("nsuri2a"),_L8("element2")); |
|
3781 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
3782 const TDesC8& localName=pRmdElement->LocalName(); |
|
3783 const TDesC8& nsURI=pRmdElement->NamespaceURI(); |
|
3784 if(localName==_L8("element2") && nsURI==_L8("nsuri2a") && elList.Count()==3) |
|
3785 TFlag=1; |
|
3786 else |
|
3787 TFlag=0; |
|
3788 /* EUNIT_ASSERT( TFlag );*/ |
|
3789 if(!TFlag) |
|
3790 return KErrArgument; |
|
3791 |
|
3792 //False case |
|
3793 CSenElement* pRmdElement1=pParent->RemoveElement(_L8("element1"),_L8("nothing")); |
|
3794 elList=pParent->ElementsL(); |
|
3795 if(pRmdElement1==NULL && elList.Count()==3) |
|
3796 FFlag=1; |
|
3797 else |
|
3798 FFlag=0; |
|
3799 /* EUNIT_ASSERT(FFlag);*/ |
|
3800 if(!FFlag) |
|
3801 return KErrArgument; |
|
3802 |
|
3803 CleanupStack::PopAndDestroy(pParent); |
|
3804 delete pRmdElement; |
|
3805 delete pRmdElement1; |
|
3806 |
|
3807 Teardown(); |
|
3808 return KErrNone; |
|
3809 } |
|
3810 |
|
3811 TInt CsenxmlTester::CSenXmlElement_ReplaceElementLL (CStifItemParser& aItem) |
|
3812 { |
|
3813 SetupL(); |
|
3814 TBool FFlag,TFlag; |
|
3815 _LIT8(KNewElement,"<a:Element1 xmlns:a=\"nsuria\"><subelement1/>New content</a:Element1>"); |
|
3816 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3817 CleanupStack::PushL(pParent); |
|
3818 CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1")); |
|
3819 CleanupStack::PushL(pElement1); |
|
3820 pElement1->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
3821 pElement1->SetContentL(_L8("old content")); |
|
3822 CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2")); |
|
3823 CleanupStack::PushL(pElement2); |
|
3824 CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3")); |
|
3825 CleanupStack::PushL(pElement3); |
|
3826 CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4")); |
|
3827 CleanupStack::PushL(pElement4); |
|
3828 pParent->AddElementL(*pElement1); |
|
3829 pParent->AddElementL(*pElement2); |
|
3830 pParent->AddElementL(*pElement3); |
|
3831 pParent->AddElementL(*pElement4); |
|
3832 //true case |
|
3833 CSenXmlElement* pNewElement=CSenXmlElement::NewL(_L8("Element1")); |
|
3834 pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
3835 CleanupStack::PushL(pNewElement); |
|
3836 pNewElement->AddElementL(_L8("subelement1")); |
|
3837 pNewElement->SetContentL(_L8("New content")); |
|
3838 CSenElement* pReplacedElement=pParent->ReplaceElementL(*pNewElement); |
|
3839 RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
3840 HBufC8* pRepBuf=elList[(elList.Count()-1)]->AsXmlL(); |
|
3841 if(pReplacedElement!=NULL && elList.Count()==4 && |
|
3842 elList[(elList.Count()-1)]->LocalName()==_L8("Element1") && |
|
3843 *pRepBuf==KNewElement && elList[(elList.Count()-1)]->Content()==_L8("New content") ) |
|
3844 TFlag=1; |
|
3845 else |
|
3846 TFlag=0; |
|
3847 /* EUNIT_ASSERT( TFlag );*/ |
|
3848 if(!TFlag) |
|
3849 return KErrArgument; |
|
3850 |
|
3851 //False case |
|
3852 CSenXmlElement* pNewElement1=CSenXmlElement::NewL(_L8("New Element1")); |
|
3853 pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
3854 CleanupStack::PushL(pNewElement1); |
|
3855 CSenElement* pReplacedElement1=pParent->ReplaceElementL(*pNewElement1); |
|
3856 RPointerArray<CSenElement>& elList1=pParent->ElementsL(); |
|
3857 if(pReplacedElement1==NULL && elList1.Count()==5) |
|
3858 FFlag=1; |
|
3859 else |
|
3860 FFlag=0; |
|
3861 /* EUNIT_ASSERT(FFlag);*/ |
|
3862 if(!FFlag) |
|
3863 return KErrArgument; |
|
3864 |
|
3865 CleanupStack::Pop(pNewElement1); |
|
3866 CleanupStack::Pop(pNewElement); |
|
3867 CleanupStack::Pop(4); |
|
3868 CleanupStack::PopAndDestroy(pParent); |
|
3869 delete pReplacedElement; |
|
3870 delete pRepBuf; |
|
3871 delete pReplacedElement1; |
|
3872 Teardown(); |
|
3873 return KErrNone; |
|
3874 } |
|
3875 |
|
3876 TInt CsenxmlTester::CSenXmlElement_AsXmlLL (CStifItemParser& aItem) |
|
3877 { |
|
3878 SetupL(); |
|
3879 TBool Flag; |
|
3880 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
3881 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3882 CleanupStack::PushL(pParent) ; |
|
3883 pParent->AddElementL(_L8("element1")); |
|
3884 pParent->AddElementL(_L8("element2")); |
|
3885 pParent->SetContentL(_L8("parent content")); |
|
3886 pParent->AddElementL(_L8("element3")); |
|
3887 HBufC8* parBuf=pParent->AsXmlL(); |
|
3888 if(*parBuf==KString) |
|
3889 Flag=1; |
|
3890 else |
|
3891 Flag=0; |
|
3892 /*EUNIT_ASSERT( Flag );*/ |
|
3893 if(!Flag) |
|
3894 return KErrArgument; |
|
3895 |
|
3896 delete parBuf; |
|
3897 CleanupStack::PopAndDestroy(pParent); |
|
3898 Teardown(); |
|
3899 return KErrNone; |
|
3900 } |
|
3901 |
|
3902 TInt CsenxmlTester::CSenXmlElement_AsXmlUnicodeLL (CStifItemParser& aItem) |
|
3903 { |
|
3904 SetupL(); |
|
3905 TBool Flag; |
|
3906 _LIT(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
3907 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3908 CleanupStack::PushL(pParent) ; |
|
3909 pParent->AddElementL(_L8("element1")); |
|
3910 pParent->AddElementL(_L8("element2")); |
|
3911 pParent->SetContentL(_L8("parent content")); |
|
3912 pParent->AddElementL(_L8("element3")); |
|
3913 HBufC* parBuf=pParent->AsXmlUnicodeL(); |
|
3914 if(*parBuf==KString) |
|
3915 Flag=1; |
|
3916 else |
|
3917 Flag=0; |
|
3918 /*EUNIT_ASSERT( Flag );*/ |
|
3919 if(!Flag) |
|
3920 return KErrArgument; |
|
3921 |
|
3922 delete parBuf; |
|
3923 CleanupStack::PopAndDestroy(pParent); |
|
3924 Teardown(); |
|
3925 return KErrNone; |
|
3926 } |
|
3927 |
|
3928 TInt CsenxmlTester::CSenXmlElement_CopyFromLL (CStifItemParser& aItem) |
|
3929 { |
|
3930 SetupL(); |
|
3931 TBool Flag; |
|
3932 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("xml element")); |
|
3933 CleanupStack::PushL(pElement); |
|
3934 pElement->AddElementL(_L8("child1")); |
|
3935 pElement->AddElementL(_L8("child2")); |
|
3936 pElement->SetContentL(_L8("element content")); |
|
3937 pElement->AddNamespaceL(_L8("a"),_L8("nsuri")); |
|
3938 CSenXmlElement* pCopied=CSenXmlElement::NewL(_L8("copied element")); |
|
3939 CleanupStack::PushL(pCopied); |
|
3940 pCopied->SetContentL(_L8("copy content")); |
|
3941 pCopied->AddElementL(_L8("child1")); |
|
3942 pCopied->AddNamespaceL(_L8("a"),_L8("nsuri")); |
|
3943 pCopied->CopyFromL(*pElement); |
|
3944 const TDesC8& content=pCopied->Content(); |
|
3945 const RPointerArray<CSenElement>& copElList=pCopied->ElementsL(); |
|
3946 const RPointerArray<CSenNamespace>& copNSList=pCopied->NamespacesL(); |
|
3947 if(copElList.Count()==3 && copNSList.Count()==2) |
|
3948 Flag=1; |
|
3949 else |
|
3950 Flag=0; |
|
3951 /*EUNIT_ASSERT( Flag );*/ |
|
3952 if(!Flag) |
|
3953 return KErrArgument; |
|
3954 |
|
3955 CleanupStack::PopAndDestroy(pCopied); |
|
3956 CleanupStack::PopAndDestroy(pElement); |
|
3957 Teardown(); |
|
3958 return KErrNone; |
|
3959 } |
|
3960 |
|
3961 TInt CsenxmlTester::CSenXmlElement_DetachLL (CStifItemParser& aItem) |
|
3962 { |
|
3963 SetupL(); |
|
3964 CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3965 CleanupStack::PushL(pParent); |
|
3966 CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1")); |
|
3967 CleanupStack::PushL(pElement1); |
|
3968 pElement1->SetNamespaceL(_L8("a"),_L8("nsuria")); |
|
3969 pElement1->SetContentL(_L8("old content")); |
|
3970 CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2")); |
|
3971 CleanupStack::PushL(pElement2); |
|
3972 CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3")); |
|
3973 CleanupStack::PushL(pElement3); |
|
3974 CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4")); |
|
3975 CleanupStack::PushL(pElement4); |
|
3976 pParent->AddElementL(*pElement1); |
|
3977 pParent->AddElementL(*pElement2); |
|
3978 pParent->AddElementL(*pElement3); |
|
3979 pParent->AddElementL(*pElement4); |
|
3980 CSenElement* dElement=pElement1->DetachL(); |
|
3981 const RPointerArray<CSenElement>& elList=pParent->ElementsL(); |
|
3982 /* EUNIT_ASSERT( elList.Count()==3 );*/ |
|
3983 if(!( elList.Count()==3 )) |
|
3984 return KErrArgument; |
|
3985 |
|
3986 CleanupStack::Pop(4); |
|
3987 CleanupStack::PopAndDestroy(pParent); |
|
3988 delete dElement; |
|
3989 Teardown(); |
|
3990 return KErrNone; |
|
3991 } |
|
3992 |
|
3993 TInt CsenxmlTester::CSenXmlElement_ChildL (CStifItemParser& aItem) |
|
3994 { |
|
3995 SetupL(); |
|
3996 TBool FFlag,TFlag; |
|
3997 CSenXmlElement*pParent=CSenXmlElement::NewL(_L8("parent")); |
|
3998 CleanupStack::PushL(pParent); |
|
3999 pParent->AddElementL(_L8("element1")); |
|
4000 pParent->AddElementL(_L8("element2")); |
|
4001 pParent->AddElementL(_L8("element3")); |
|
4002 CSenElement* pElement=pParent->Child(0); |
|
4003 if(pElement->LocalName()==_L8("element1")) |
|
4004 TFlag=1; |
|
4005 else |
|
4006 TFlag=0; |
|
4007 /* EUNIT_ASSERT( TFlag );*/ |
|
4008 if(!TFlag) |
|
4009 return KErrArgument; |
|
4010 |
|
4011 CSenElement* pElement1=pParent->Child(4); |
|
4012 if(pElement1==NULL) |
|
4013 FFlag=1; |
|
4014 else |
|
4015 FFlag=0; |
|
4016 /* EUNIT_ASSERT( FFlag );*/ |
|
4017 if(!FFlag) |
|
4018 return KErrArgument; |
|
4019 |
|
4020 |
|
4021 CleanupStack::PopAndDestroy(pParent); |
|
4022 Teardown(); |
|
4023 return KErrNone; |
|
4024 } |
|
4025 |
|
4026 TInt CsenxmlTester::CSenXmlElement_SetL (CStifItemParser& aItem) |
|
4027 { |
|
4028 SetupL(); |
|
4029 TBool Flag; |
|
4030 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nokia")); |
|
4031 CleanupStack::PushL(pElement); |
|
4032 pElement->Set(_L8("nsuri"),_L8("element"),_L8("e:e:lement")); |
|
4033 if(pElement->LocalName()==_L8("element") && pElement->NamespaceURI()==_L8("nsuri") |
|
4034 && pElement->NsPrefix()==_L8("e")) |
|
4035 Flag=1; |
|
4036 else |
|
4037 Flag=0; |
|
4038 |
|
4039 /*EUNIT_ASSERT( Flag );*/ |
|
4040 if(!Flag) |
|
4041 return KErrArgument; |
|
4042 |
|
4043 CleanupStack::PopAndDestroy(pElement); |
|
4044 Teardown(); |
|
4045 return KErrNone; |
|
4046 } |
|
4047 |
|
4048 TInt CsenxmlTester::CSenXmlElement_AddAttributesLL (CStifItemParser& aItem) |
|
4049 { |
|
4050 SetupL(); |
|
4051 RStringPool stringPool; |
|
4052 stringPool.OpenL(); |
|
4053 CleanupClosePushL(stringPool); |
|
4054 |
|
4055 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
4056 CleanupClosePushL(nsUriRString); |
|
4057 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
4058 CleanupClosePushL(nsPrefixRString); |
|
4059 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
4060 CleanupClosePushL(localNameRString); |
|
4061 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
4062 CleanupClosePushL(valueRString); |
|
4063 |
|
4064 RAttribute attribute; |
|
4065 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
4066 valueRString); |
|
4067 CleanupStack::Pop(4); |
|
4068 CleanupClosePushL(attribute); |
|
4069 |
|
4070 RAttributeArray attrArray; |
|
4071 attrArray.AppendL(attribute); |
|
4072 CleanupClosePushL(attrArray); |
|
4073 |
|
4074 CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia")); |
|
4075 CleanupStack::PushL(pElement); |
|
4076 pElement->AddAttributesL(attrArray); |
|
4077 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
4078 /* EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/ |
|
4079 if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ))) |
|
4080 return KErrArgument; |
|
4081 |
|
4082 CleanupStack::PopAndDestroy(pElement); |
|
4083 CleanupStack::PopAndDestroy(&attrArray); |
|
4084 CleanupStack::PopAndDestroy(&attribute); |
|
4085 CleanupStack::PopAndDestroy(&stringPool); |
|
4086 delete pElementBuf; |
|
4087 Teardown(); |
|
4088 return KErrNone; |
|
4089 } |
|
4090 /* |
|
4091 TInt CsenxmlTester::CSenXmlElement_RemoveAttributeLL (CStifItemParser& aItem) |
|
4092 { |
|
4093 SetupL(); |
|
4094 RStringPool stringPool; |
|
4095 stringPool.OpenL(); |
|
4096 CleanupClosePushL(stringPool); |
|
4097 |
|
4098 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
4099 CleanupClosePushL(nsUriRString); |
|
4100 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
4101 CleanupClosePushL(nsPrefixRString); |
|
4102 RString localNameRString = stringPool.OpenStringL(_L8("LocalName")); |
|
4103 CleanupClosePushL(localNameRString); |
|
4104 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
4105 CleanupClosePushL(valueRString); |
|
4106 |
|
4107 RAttribute attribute; |
|
4108 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
4109 valueRString); |
|
4110 CleanupStack::Pop(4); |
|
4111 CleanupClosePushL(attribute); |
|
4112 |
|
4113 RAttributeArray attrArray; |
|
4114 attrArray.AppendL(attribute); |
|
4115 CleanupClosePushL(attrArray); |
|
4116 |
|
4117 CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia")); |
|
4118 CleanupStack::PushL(pElement); |
|
4119 pElement->AddAttributesL(attrArray); |
|
4120 CSenBaseAttribute* RmdElement=pElement->RemoveAttributeL(_L8("pr:LocalName")); |
|
4121 HBufC8* pElementBuf = pElement->AsXmlL(); |
|
4122 RPointerArray<CSenBaseAttribute>& AttrList=pElement->AttributesL(); |
|
4123 EUNIT_ASSERT( *pElementBuf == _L8("<Nokia/>" )); |
|
4124 EUNIT_ASSERT_EQUALS(AttrList.Count(),0); |
|
4125 TL(AttrList.Count() == 0); |
|
4126 CleanupStack::PopAndDestroy(pElement); |
|
4127 CleanupStack::PopAndDestroy(&attrArray); |
|
4128 CleanupStack::PopAndDestroy(&attribute); |
|
4129 CleanupStack::PopAndDestroy(&stringPool); |
|
4130 delete pElementBuf; |
|
4131 delete RmdElement; |
|
4132 Teardown(); |
|
4133 return KErrNone; |
|
4134 } |
|
4135 */ |
|
4136 TInt CsenxmlTester::CSenXmlElement_AsElementL(CStifItemParser& aItem) |
|
4137 { |
|
4138 SetupL(); |
|
4139 CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")); |
|
4140 CleanupStack::PushL(pElement); |
|
4141 pElement->AddElementL(_L8("webservices")); |
|
4142 MSenElement* pAsElement=pElement->AsElement(); |
|
4143 HBufC8* pElementBuf=pElement->AsXmlL(); |
|
4144 /* EUNIT_ASSERT_EQUALS(*pElementBuf,_L8("<Nokia><webservices/></Nokia>"));*/ |
|
4145 TL(*pElementBuf == _L8("<Nokia><webservices/></Nokia>")); |
|
4146 CleanupStack::PopAndDestroy(pElement); |
|
4147 delete pElementBuf; |
|
4148 Teardown(); |
|
4149 return KErrNone; |
|
4150 } |
|
4151 |
|
4152 TInt CsenxmlTester::CSenBaseFragment_NewL_L (CStifItemParser& aItem) |
|
4153 { |
|
4154 SetupL(); |
|
4155 TBool Flag; |
|
4156 CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia")); |
|
4157 CleanupStack::PushL(ele); |
|
4158 CSenElement* parent = ele->Parent(); |
|
4159 CSenBaseFragment* pElement=CSenBaseFragment::NewL(*ele); |
|
4160 CleanupStack::PushL(pElement); |
|
4161 if(pElement!=NULL) |
|
4162 Flag=1; |
|
4163 else |
|
4164 Flag=0; |
|
4165 /*EUNIT_ASSERT( Flag );*/ |
|
4166 if(!Flag) |
|
4167 return KErrArgument; |
|
4168 |
|
4169 CleanupStack::PopAndDestroy(pElement); |
|
4170 CleanupStack::PopAndDestroy(ele); |
|
4171 Teardown(); |
|
4172 return KErrNone; |
|
4173 } |
|
4174 |
|
4175 TInt CsenxmlTester::CSenBaseFragment_NewL_1L (CStifItemParser& aItem) |
|
4176 { |
|
4177 SetupL(); |
|
4178 TBool Flag; |
|
4179 CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("Nokia")); |
|
4180 CleanupStack::PushL(pElement); |
|
4181 if(pElement!=NULL) |
|
4182 Flag=1; |
|
4183 else |
|
4184 Flag=0; |
|
4185 /*EUNIT_ASSERT( Flag );*/ |
|
4186 if(!Flag) |
|
4187 return KErrArgument; |
|
4188 |
|
4189 CleanupStack::PopAndDestroy(pElement); |
|
4190 Teardown(); |
|
4191 return KErrNone; |
|
4192 } |
|
4193 |
|
4194 TInt CsenxmlTester::CSenBaseFragment_NewL_2L (CStifItemParser& aItem) |
|
4195 { |
|
4196 SetupL(); |
|
4197 TBool Flag; |
|
4198 CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia")); |
|
4199 CleanupStack::PushL(pElement); |
|
4200 if(pElement!=NULL) |
|
4201 Flag=1; |
|
4202 else |
|
4203 Flag=0; |
|
4204 /*EUNIT_ASSERT( Flag );*/ |
|
4205 if(!Flag) |
|
4206 return KErrArgument; |
|
4207 |
|
4208 CleanupStack::PopAndDestroy(pElement); |
|
4209 Teardown(); |
|
4210 return KErrNone; |
|
4211 } |
|
4212 |
|
4213 TInt CsenxmlTester::CSenBaseFragment_NewL_3L (CStifItemParser& aItem) |
|
4214 { |
|
4215 SetupL(); |
|
4216 TBool Flag; |
|
4217 CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia")); |
|
4218 CleanupStack::PushL(pElement); |
|
4219 if(pElement!=NULL) |
|
4220 Flag=1; |
|
4221 else |
|
4222 Flag=0; |
|
4223 /*EUNIT_ASSERT( Flag );*/ |
|
4224 if(!Flag) |
|
4225 return KErrArgument; |
|
4226 |
|
4227 CleanupStack::PopAndDestroy(pElement); |
|
4228 Teardown(); |
|
4229 return KErrNone; |
|
4230 } |
|
4231 |
|
4232 TInt CsenxmlTester::CSenBaseFragment_NewL_4L (CStifItemParser& aItem) |
|
4233 { |
|
4234 SetupL(); |
|
4235 TBool Flag; |
|
4236 RAttributeArray aAttrs; |
|
4237 CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs); |
|
4238 CleanupStack::PushL(pElement); |
|
4239 if(pElement!=NULL) |
|
4240 Flag=1; |
|
4241 else |
|
4242 Flag=0; |
|
4243 /*EUNIT_ASSERT( Flag );*/ |
|
4244 if(!Flag) |
|
4245 return KErrArgument; |
|
4246 |
|
4247 CleanupStack::PopAndDestroy(pElement); |
|
4248 Teardown(); |
|
4249 return KErrNone; |
|
4250 } |
|
4251 |
|
4252 TInt CsenxmlTester::CSenBaseFragment_NewL_5L (CStifItemParser& aItem) |
|
4253 { |
|
4254 SetupL(); |
|
4255 TBool Flag; |
|
4256 RAttributeArray aAttrs; |
|
4257 CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia")); |
|
4258 CleanupStack::PushL(ele); |
|
4259 CSenElement* parent = ele->Parent(); |
|
4260 CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent); |
|
4261 CleanupStack::PushL(pElement); |
|
4262 if(pElement!=NULL) |
|
4263 Flag=1; |
|
4264 else |
|
4265 Flag=0; |
|
4266 /*EUNIT_ASSERT( Flag );*/ |
|
4267 if(!Flag) |
|
4268 return KErrArgument; |
|
4269 |
|
4270 CleanupStack::PopAndDestroy(pElement); |
|
4271 CleanupStack::PopAndDestroy(ele); |
|
4272 Teardown(); |
|
4273 return KErrNone; |
|
4274 } |
|
4275 |
|
4276 TInt CsenxmlTester::CSenBaseFragment_AsXmlUnicodeLL(CStifItemParser& aItem) |
|
4277 { |
|
4278 SetupL(); |
|
4279 CSenBaseFragment* pFragment=CSenBaseFragment::NewL(_L8("Fragment")); |
|
4280 CleanupStack::PushL(pFragment); |
|
4281 HBufC* pFragBuf=pFragment->AsXmlUnicodeL(); |
|
4282 /* EUNIT_ASSERT_EQUALS(*pFragBuf,_L("<Fragment/>"));*/ |
|
4283 TL(*pFragBuf == _L("<Fragment/>")); |
|
4284 CleanupStack::PopAndDestroy(pFragment); |
|
4285 delete pFragBuf; |
|
4286 Teardown(); |
|
4287 return KErrNone; |
|
4288 } |
|
4289 |
|
4290 TInt CsenxmlTester::CSenBaseFragment_WriteAsXMLToLL(CStifItemParser& aItem) |
|
4291 { |
|
4292 SetupL(); |
|
4293 // Test serialization of Dom tree which has two child elements |
|
4294 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4295 CleanupStack::PushL(pFragment); |
|
4296 CSenElement& element = pFragment->AsElement(); |
|
4297 CSenElement& element2 = element.AddElementL(_L8("Child")); |
|
4298 CBufFlat* pBuf = CBufFlat::NewL(200); |
|
4299 CleanupStack::PushL(pBuf); |
|
4300 RBufWriteStream bufWs(*pBuf); |
|
4301 CleanupClosePushL(bufWs); |
|
4302 pFragment->WriteAsXMLToL(bufWs); |
|
4303 /* EUNIT_ASSERT( pBuf->Ptr(0) == _L8("<Test><Child/></Test>"));*/ |
|
4304 if(!( pBuf->Ptr(0) == _L8("<Test><Child/></Test>"))) |
|
4305 return KErrArgument; |
|
4306 |
|
4307 CleanupStack::PopAndDestroy(&bufWs); |
|
4308 CleanupStack::PopAndDestroy(pBuf); |
|
4309 CleanupStack::PopAndDestroy(pFragment); |
|
4310 Teardown(); |
|
4311 return KErrNone; |
|
4312 } |
|
4313 |
|
4314 TInt CsenxmlTester::CSenBaseFragment_ContentL( CStifItemParser& aItem ) |
|
4315 { |
|
4316 TBool Flag; |
|
4317 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4318 CleanupStack::PushL(pFragment); |
|
4319 CSenElement& element = pFragment->AsElement(); |
|
4320 element.AddElementL(_L8("Child")); |
|
4321 element.SetContentL(_L8("Test Content")); |
|
4322 TPtrC8 frag_Content = pFragment->Content(); |
|
4323 if(frag_Content == _L8("Test Content")) |
|
4324 Flag =1; |
|
4325 else |
|
4326 Flag =0; |
|
4327 CleanupStack::PopAndDestroy(pFragment); |
|
4328 if (Flag) return KErrNone; |
|
4329 else return KErrArgument; |
|
4330 } |
|
4331 TInt CsenxmlTester::CSenBaseFragment_NamespaceL( CStifItemParser& aItem ) |
|
4332 { |
|
4333 TBool Flag; |
|
4334 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuria"),_L8("Test"),_L8("a:Test")); |
|
4335 CleanupStack::PushL(pFragment); |
|
4336 CSenElement& element = pFragment->AsElement(); |
|
4337 element.AddElementL(_L8("Child")); |
|
4338 element.SetContentL(_L8("Test Content")); |
|
4339 TPtrC8 frag_NameSpace = pFragment->NsUri(); |
|
4340 TPtrC8 frag_prefix = pFragment->NsPrefix(); |
|
4341 if(frag_NameSpace == _L8("nsuria") && frag_prefix == _L8("a")) |
|
4342 Flag = 1; |
|
4343 else |
|
4344 Flag = 0; |
|
4345 CleanupStack::PopAndDestroy(pFragment); |
|
4346 if (Flag) return KErrNone; |
|
4347 else return KErrArgument; |
|
4348 } |
|
4349 TInt CsenxmlTester::CSenBaseFragment_EnsureNamespaceL( CStifItemParser& aItem ) |
|
4350 { |
|
4351 TBool Flag; |
|
4352 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuria"),_L8("Test"),_L8("a:Test")); |
|
4353 CleanupStack::PushL(pFragment); |
|
4354 CSenElement& element = pFragment->AsElement(); |
|
4355 element.AddElementL(_L8("Child")); |
|
4356 element.SetContentL(_L8("Test Content")); |
|
4357 pFragment->EnsureNamespace(_L8("a")); |
|
4358 CSenNamespace* frag_NameSpace; |
|
4359 frag_NameSpace = pFragment->Namespace(_L8("a")); |
|
4360 if(frag_NameSpace) |
|
4361 Flag = 1; |
|
4362 else |
|
4363 Flag = 0; |
|
4364 CleanupStack::PopAndDestroy(pFragment); |
|
4365 if (Flag) return KErrNone; |
|
4366 else return KErrArgument; |
|
4367 } |
|
4368 TInt CsenxmlTester::CSenBaseFragment_DetachLL( CStifItemParser& aItem ) |
|
4369 { |
|
4370 TBool Flag; |
|
4371 _LIT8(KFragment,"<Test xmlns=\"nsuri\"><Child/>Test Content</Test>"); |
|
4372 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre")); |
|
4373 CleanupStack::PushL(pFragment); |
|
4374 CSenElement& element = pFragment->AsElement(); |
|
4375 element.AddElementL(_L8("Child")); |
|
4376 element.SetContentL(_L8("Test Content")); |
|
4377 CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent")); |
|
4378 element.SetParent(pParent); |
|
4379 TRAPD(retval,pFragment->DetachL()); |
|
4380 CleanupStack::PopAndDestroy(pFragment); |
|
4381 return retval; |
|
4382 } |
|
4383 TInt CsenxmlTester::CSenBaseFragment_SaveNamespacesLL( CStifItemParser& aItem ) |
|
4384 { |
|
4385 TBool Flag; |
|
4386 RStringPool stringPool; |
|
4387 stringPool.OpenL(); |
|
4388 CleanupClosePushL(stringPool); |
|
4389 |
|
4390 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
4391 CleanupClosePushL(nsUriRString); |
|
4392 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
4393 CleanupClosePushL(nsPrefixRString); |
|
4394 RString localNameRString = stringPool.OpenStringL(_L8("xmlns")); |
|
4395 CleanupClosePushL(localNameRString); |
|
4396 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
4397 CleanupClosePushL(valueRString); |
|
4398 |
|
4399 RAttribute attribute; |
|
4400 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
4401 valueRString); |
|
4402 CleanupStack::Pop(4); |
|
4403 CleanupClosePushL(attribute); |
|
4404 |
|
4405 RAttributeArray attrArray; |
|
4406 attrArray.AppendL(attribute); |
|
4407 CleanupClosePushL(attrArray); |
|
4408 |
|
4409 CSenBaseFragment *pFragment = CSenBaseFragment::NewL(_L8("Nokia")); |
|
4410 CleanupStack::PushL(pFragment); |
|
4411 pFragment->SaveNamespacesL(attrArray,TRUE); |
|
4412 TPtrC8 frag_NameSpace = pFragment->NsUri(); |
|
4413 if(frag_NameSpace == _L8("Value")) |
|
4414 Flag = 1; |
|
4415 else |
|
4416 Flag = 0; |
|
4417 |
|
4418 CleanupStack::PopAndDestroy(pFragment); |
|
4419 CleanupStack::PopAndDestroy(&attrArray); |
|
4420 CleanupStack::PopAndDestroy(&attribute); |
|
4421 CleanupStack::PopAndDestroy(&stringPool); |
|
4422 if (Flag) return KErrNone; |
|
4423 else return KErrArgument; |
|
4424 } |
|
4425 TInt CsenxmlTester::CSenBaseFragment_ResetContentLL( CStifItemParser& aItem ) |
|
4426 { |
|
4427 TBool Flag; |
|
4428 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4429 CleanupStack::PushL(pFragment); |
|
4430 CSenElement& element = pFragment->AsElement(); |
|
4431 element.AddElementL(_L8("Child")); |
|
4432 element.SetContentL(_L8("Test Content")); |
|
4433 TPtrC8 frag_Content = pFragment->Content(); |
|
4434 if(frag_Content == _L8("Test Content")) |
|
4435 Flag =1; |
|
4436 else |
|
4437 Flag =0; |
|
4438 pFragment->ResetContentL(); |
|
4439 //frag_Content = pFragment->Content(); |
|
4440 if(pFragment->Content() == KNullDesC8) |
|
4441 Flag =1; |
|
4442 else |
|
4443 Flag =0; |
|
4444 CleanupStack::PopAndDestroy(pFragment); |
|
4445 if (Flag) return KErrNone; |
|
4446 else return KErrArgument; |
|
4447 } |
|
4448 TInt CsenxmlTester::CSenBaseFragment_LocalNameL( CStifItemParser& aItem ) |
|
4449 { |
|
4450 TBool Flag; |
|
4451 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4452 CleanupStack::PushL(pFragment); |
|
4453 CSenElement& element = pFragment->AsElement(); |
|
4454 element.AddElementL(_L8("Child")); |
|
4455 element.SetContentL(_L8("Test Content")); |
|
4456 TPtrC8 frag_LocalName = pFragment->LocalName(); |
|
4457 if(frag_LocalName == _L8("Test")) |
|
4458 Flag =1; |
|
4459 else |
|
4460 Flag =0; |
|
4461 CleanupStack::PopAndDestroy(pFragment); |
|
4462 if (Flag) return KErrNone; |
|
4463 else return KErrArgument; |
|
4464 } |
|
4465 TInt CsenxmlTester::CSenBaseFragment_NsUriL( CStifItemParser& aItem ) |
|
4466 { |
|
4467 TBool Flag; |
|
4468 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre")); |
|
4469 CleanupStack::PushL(pFragment); |
|
4470 CSenElement& element = pFragment->AsElement(); |
|
4471 element.AddElementL(_L8("Child")); |
|
4472 element.SetContentL(_L8("Test Content")); |
|
4473 TPtrC8 frag_NsUri= pFragment->NsUri(); |
|
4474 if(frag_NsUri == _L8("nsuri")) |
|
4475 Flag =1; |
|
4476 else |
|
4477 Flag =0; |
|
4478 CleanupStack::PopAndDestroy(pFragment); |
|
4479 if (Flag) return KErrNone; |
|
4480 else return KErrArgument; |
|
4481 } |
|
4482 TInt CsenxmlTester::CSenBaseFragment_NsPrefixL( CStifItemParser& aItem ) |
|
4483 { |
|
4484 TBool Flag; |
|
4485 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre")); |
|
4486 CleanupStack::PushL(pFragment); |
|
4487 CSenElement& element = pFragment->AsElement(); |
|
4488 element.AddElementL(_L8("Child")); |
|
4489 element.SetContentL(_L8("Test Content")); |
|
4490 TPtrC8 frag_NsUri= pFragment->NsUri(); |
|
4491 if(frag_NsUri == _L8("nsuri")) |
|
4492 Flag =1; |
|
4493 else |
|
4494 Flag =0; |
|
4495 CleanupStack::PopAndDestroy(pFragment); |
|
4496 if (Flag) return KErrNone; |
|
4497 else return KErrArgument; |
|
4498 } |
|
4499 TInt CsenxmlTester::CSenBaseFragment_ExtractElementL( CStifItemParser& aItem ) |
|
4500 { |
|
4501 TBool Flag; |
|
4502 _LIT8(KFragment,"<Test xmlns=\"nsuri\"><Child/>Test Content</Test>"); |
|
4503 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre")); |
|
4504 CleanupStack::PushL(pFragment); |
|
4505 CSenElement& element = pFragment->AsElement(); |
|
4506 element.AddElementL(_L8("Child")); |
|
4507 element.SetContentL(_L8("Test Content")); |
|
4508 CSenElement* Extr_Element = pFragment->ExtractElement(); |
|
4509 CleanupStack::PushL(Extr_Element); |
|
4510 HBufC8* Ext_ElementBuf = Extr_Element->AsXmlL(); |
|
4511 if(!(KFragment().Compare(*Ext_ElementBuf ))) |
|
4512 Flag =1; |
|
4513 else |
|
4514 Flag =0; |
|
4515 |
|
4516 CleanupStack::PopAndDestroy(Extr_Element); |
|
4517 CleanupStack::PopAndDestroy(pFragment); |
|
4518 delete Ext_ElementBuf ; |
|
4519 |
|
4520 if (Flag) return KErrNone; |
|
4521 else return KErrArgument; |
|
4522 } |
|
4523 TInt CsenxmlTester::CSenBaseFragment_SetAttributesLL( CStifItemParser& aItem ) |
|
4524 { |
|
4525 TBool Flag; |
|
4526 RStringPool stringPool; |
|
4527 stringPool.OpenL(); |
|
4528 CleanupClosePushL(stringPool); |
|
4529 |
|
4530 RString nsUriRString = stringPool.OpenStringL(_L8("nsuri")); |
|
4531 CleanupClosePushL(nsUriRString); |
|
4532 RString nsPrefixRString = stringPool.OpenStringL(_L8("pr")); |
|
4533 CleanupClosePushL(nsPrefixRString); |
|
4534 RString localNameRString = stringPool.OpenStringL(_L8("xmlns")); |
|
4535 CleanupClosePushL(localNameRString); |
|
4536 RString valueRString = stringPool.OpenStringL(_L8("Value")); |
|
4537 CleanupClosePushL(valueRString); |
|
4538 |
|
4539 RAttribute attribute; |
|
4540 attribute.Open(nsUriRString, nsPrefixRString, localNameRString, |
|
4541 valueRString); |
|
4542 CleanupStack::Pop(4); |
|
4543 CleanupClosePushL(attribute); |
|
4544 |
|
4545 RAttributeArray attrArray; |
|
4546 attrArray.AppendL(attribute); |
|
4547 CleanupClosePushL(attrArray); |
|
4548 |
|
4549 CSenBaseFragment *pFragment = CSenBaseFragment::NewL(_L8("Nokia")); |
|
4550 CleanupStack::PushL(pFragment); |
|
4551 pFragment->SetAttributesL(attrArray); |
|
4552 TPtrC8 frag_NameSpace = pFragment->NsUri(); |
|
4553 if(frag_NameSpace == _L8("Value")) |
|
4554 Flag = 1; |
|
4555 else |
|
4556 Flag = 0; |
|
4557 |
|
4558 CleanupStack::PopAndDestroy(pFragment); |
|
4559 CleanupStack::PopAndDestroy(&attrArray); |
|
4560 CleanupStack::PopAndDestroy(&attribute); |
|
4561 CleanupStack::PopAndDestroy(&stringPool); |
|
4562 if (Flag) return KErrNone; |
|
4563 else return KErrArgument; |
|
4564 } |
|
4565 TInt CsenxmlTester::CSenBaseFragment_ConsistsOfLL( CStifItemParser& aItem ) |
|
4566 { |
|
4567 TBool Flag; |
|
4568 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4569 CleanupStack::PushL(pFragment); |
|
4570 CSenElement& element = pFragment->AsElement(); |
|
4571 element.AddElementL(_L8("Child")); |
|
4572 element.SetContentL(_L8("Test Content")); |
|
4573 |
|
4574 CSenBaseFragment* pFragment2 = CSenBaseFragment::NewL(_L8("Test")); |
|
4575 CleanupStack::PushL(pFragment2); |
|
4576 CSenElement& element2 = pFragment2->AsElement(); |
|
4577 element2.AddElementL(_L8("Child")); |
|
4578 element2.SetContentL(_L8("Test Content")); |
|
4579 |
|
4580 Flag = pFragment->ConsistsOfL(*pFragment2); |
|
4581 |
|
4582 CleanupStack::PopAndDestroy(pFragment2); |
|
4583 CleanupStack::PopAndDestroy(pFragment); |
|
4584 if (Flag) return KErrNone; |
|
4585 else return KErrArgument; |
|
4586 } |
|
4587 TInt CsenxmlTester::CSenBaseFragment_ParseLL( CStifItemParser& aItem ) |
|
4588 { |
|
4589 SetupL(); |
|
4590 _LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\""\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \ |
|
4591 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\ |
|
4592 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\ |
|
4593 <Element2 z=\"value4\">Content2</Element2>\ |
|
4594 <Element3>Content3</Element3>\ |
|
4595 <Element4/></a:Test>"); |
|
4596 |
|
4597 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4598 CleanupStack::PushL(pFragment); |
|
4599 |
|
4600 pFragment->SetReader(*iXmlReader); |
|
4601 TRAPD(retVal,pFragment->ParseL(KInputString)); |
|
4602 CleanupStack::PopAndDestroy(pFragment); |
|
4603 Teardown(); |
|
4604 return retVal; |
|
4605 } |
|
4606 |
|
4607 TInt CsenxmlTester::CSenBaseFragment_ParseL1L( CStifItemParser& aItem ) |
|
4608 { |
|
4609 SetupL(); |
|
4610 _LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"""assa\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \ |
|
4611 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\ |
|
4612 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\ |
|
4613 <Element2 z=\"value4\">Content2<Element2>\ |
|
4614 <Element3>Content3</Element3>\ |
|
4615 <Element4/></a:Test>"); |
|
4616 |
|
4617 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4618 CleanupStack::PushL(pFragment); |
|
4619 |
|
4620 pFragment->SetReader(*iXmlReader); |
|
4621 TRAPD(retVal,pFragment->ParseL(KInputString)); |
|
4622 CleanupStack::PopAndDestroy(pFragment); |
|
4623 Teardown(); |
|
4624 if (retVal == -993) return KErrNone; |
|
4625 else return retVal; |
|
4626 } |
|
4627 |
|
4628 TInt CsenxmlTester::CSenBaseFragment_SetContentOfLL( CStifItemParser& aItem ) |
|
4629 { |
|
4630 CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment")); |
|
4631 CleanupStack::PushL(pTestFragment); |
|
4632 CSenElement& element = pTestFragment->AsElement(); |
|
4633 element.AddElementL(_L8("Test Child")); |
|
4634 MSenElement& element1 = pTestFragment->SetContentOfL(_L8("Test Child"),_L8("Child Content")); |
|
4635 TInt retVal = element1.Content().Compare(_L8("Child Content")); |
|
4636 CleanupStack::PopAndDestroy(pTestFragment); |
|
4637 return retVal; |
|
4638 } |
|
4639 TInt CsenxmlTester::CSenBaseFragment_ContentOfL( CStifItemParser& aItem ) |
|
4640 { |
|
4641 CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment")); |
|
4642 CleanupStack::PushL(pTestFragment); |
|
4643 pTestFragment->SetContentOfL(_L8("Test Child"),_L8("Child Content")); |
|
4644 TInt retVal = pTestFragment->ContentOf(_L8("Test Child")).Compare(_L8("Child Content")); |
|
4645 CleanupStack::PopAndDestroy(pTestFragment); |
|
4646 return retVal; |
|
4647 } |
|
4648 |
|
4649 TInt CsenxmlTester::CSenXMLReader_ParserFeatureL( CStifItemParser& aItem ) |
|
4650 { |
|
4651 TBool Flag; |
|
4652 SetupL(); |
|
4653 _LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\""\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \ |
|
4654 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\ |
|
4655 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\ |
|
4656 <Element2 z=\"value4\"><Content2"></Element2>\ |
|
4657 <Element3>Content3</Element3>\ |
|
4658 <Element4/></a:Test>"); |
|
4659 |
|
4660 CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test")); |
|
4661 CleanupStack::PushL(pFragment); |
|
4662 pFragment->SetReader(*iXmlReader); |
|
4663 TInt feature = iXmlReader->ParserFeature(); |
|
4664 TRAPD(retVal,pFragment->ParseL(KInputString)); |
|
4665 CleanupStack::PopAndDestroy(pFragment); |
|
4666 Teardown(); |
|
4667 if (retVal == KErrNone && feature == 64) return KErrNone; |
|
4668 else return KErrArgument; |
|
4669 } |
|
4670 |
|
4671 // EXPORT_C void CSenXmlReader::ParseL(RFs &aRFs, const TDesC& aFileToParse) |
|
4672 |
|
4673 TInt CsenxmlTester::CSenXMLReader_ParseLL( CStifItemParser& aItem ) |
|
4674 { |
|
4675 SetupL(); |
|
4676 CSenDomFragment* pFragment = CSenDomFragment::NewL(); |
|
4677 CleanupStack::PushL(pFragment); |
|
4678 pFragment->SetReader(*iXmlReader); |
|
4679 iXmlReader->SetContentHandler(*pFragment); |
|
4680 _LIT(KFile,"c:\\wf_constraint_elem.xml"); |
|
4681 RFs fs; |
|
4682 CleanupClosePushL(fs); |
|
4683 TRAPD(rFile, fs.Connect()); |
|
4684 TRAPD(retVal,iXmlReader->ParseL(fs,KFile)); |
|
4685 CleanupStack::PopAndDestroy(); |
|
4686 CleanupStack::PopAndDestroy(pFragment); |
|
4687 Teardown(); |
|
4688 return retVal; |
|
4689 } |
|
4690 TInt CsenxmlTester::CSenDomFragment_NewL_L (CStifItemParser& aItem) |
|
4691 { |
|
4692 SetupL(); |
|
4693 TBool Flag; |
|
4694 CSenDomFragment* pElement=CSenDomFragment::NewL(); |
|
4695 CleanupStack::PushL(pElement); |
|
4696 if(pElement!=NULL) |
|
4697 Flag=1; |
|
4698 else |
|
4699 Flag=0; |
|
4700 /*EUNIT_ASSERT( Flag );*/ |
|
4701 if(!Flag) |
|
4702 return KErrArgument; |
|
4703 |
|
4704 CleanupStack::PopAndDestroy(pElement); |
|
4705 Teardown(); |
|
4706 return KErrNone; |
|
4707 } |
|
4708 |
|
4709 TInt CsenxmlTester::CSenDomFragment_NewL_1L (CStifItemParser& aItem) |
|
4710 { |
|
4711 SetupL(); |
|
4712 TBool Flag; |
|
4713 CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia")); |
|
4714 CleanupStack::PushL(ele); |
|
4715 CSenElement* parent = ele->Parent(); |
|
4716 CSenDomFragment* pElement=CSenDomFragment::NewL(*ele); |
|
4717 CleanupStack::PushL(pElement); |
|
4718 if(pElement!=NULL) |
|
4719 Flag=1; |
|
4720 else |
|
4721 Flag=0; |
|
4722 /*EUNIT_ASSERT( Flag );*/ |
|
4723 if(!Flag) |
|
4724 return KErrArgument; |
|
4725 |
|
4726 CleanupStack::PopAndDestroy(pElement); |
|
4727 CleanupStack::PopAndDestroy(ele); |
|
4728 Teardown(); |
|
4729 return KErrNone; |
|
4730 } |
|
4731 |
|
4732 TInt CsenxmlTester::CSenDomFragment_NewL_2L (CStifItemParser& aItem) |
|
4733 { |
|
4734 SetupL(); |
|
4735 TBool Flag; |
|
4736 CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("Nokia")); |
|
4737 CleanupStack::PushL(pElement); |
|
4738 if(pElement!=NULL) |
|
4739 Flag=1; |
|
4740 else |
|
4741 Flag=0; |
|
4742 /*EUNIT_ASSERT( Flag );*/ |
|
4743 if(!Flag) |
|
4744 return KErrArgument; |
|
4745 |
|
4746 CleanupStack::PopAndDestroy(pElement); |
|
4747 Teardown(); |
|
4748 return KErrNone; |
|
4749 } |
|
4750 |
|
4751 TInt CsenxmlTester::CSenDomFragment_NewL_3L (CStifItemParser& aItem) |
|
4752 { |
|
4753 SetupL(); |
|
4754 TBool Flag; |
|
4755 CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia")); |
|
4756 CleanupStack::PushL(pElement); |
|
4757 if(pElement!=NULL) |
|
4758 Flag=1; |
|
4759 else |
|
4760 Flag=0; |
|
4761 /*EUNIT_ASSERT( Flag );*/ |
|
4762 if(!Flag) |
|
4763 return KErrArgument; |
|
4764 |
|
4765 CleanupStack::PopAndDestroy(pElement); |
|
4766 Teardown(); |
|
4767 return KErrNone; |
|
4768 } |
|
4769 |
|
4770 TInt CsenxmlTester::CSenDomFragment_NewL_4L (CStifItemParser& aItem) |
|
4771 { |
|
4772 SetupL(); |
|
4773 TBool Flag; |
|
4774 CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia")); |
|
4775 CleanupStack::PushL(pElement); |
|
4776 if(pElement!=NULL) |
|
4777 Flag=1; |
|
4778 else |
|
4779 Flag=0; |
|
4780 /*EUNIT_ASSERT( Flag );*/ |
|
4781 if(!Flag) |
|
4782 return KErrArgument; |
|
4783 |
|
4784 CleanupStack::PopAndDestroy(pElement); |
|
4785 Teardown(); |
|
4786 return KErrNone; |
|
4787 } |
|
4788 |
|
4789 TInt CsenxmlTester::CSenDomFragment_NewL_5L (CStifItemParser& aItem) |
|
4790 { |
|
4791 SetupL(); |
|
4792 TBool Flag; |
|
4793 RAttributeArray aAttrs; |
|
4794 CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs); |
|
4795 CleanupStack::PushL(pElement); |
|
4796 if(pElement!=NULL) |
|
4797 Flag=1; |
|
4798 else |
|
4799 Flag=0; |
|
4800 /*EUNIT_ASSERT( Flag );*/ |
|
4801 if(!Flag) |
|
4802 return KErrArgument; |
|
4803 |
|
4804 CleanupStack::PopAndDestroy(pElement); |
|
4805 Teardown(); |
|
4806 return KErrNone; |
|
4807 } |
|
4808 |
|
4809 TInt CsenxmlTester::CSenDomFragment_NewL_6L (CStifItemParser& aItem) |
|
4810 { |
|
4811 SetupL(); |
|
4812 TBool Flag; |
|
4813 RAttributeArray aAttrs; |
|
4814 CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia")); |
|
4815 CleanupStack::PushL(ele); |
|
4816 CSenElement* parent = ele->Parent(); |
|
4817 CSenDomFragment* pElement = CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent); |
|
4818 CleanupStack::PushL(pElement); |
|
4819 if(pElement!=NULL) |
|
4820 Flag=1; |
|
4821 else |
|
4822 Flag=0; |
|
4823 /*EUNIT_ASSERT( Flag );*/ |
|
4824 if(!Flag) |
|
4825 return KErrArgument; |
|
4826 |
|
4827 CleanupStack::PopAndDestroy(pElement); |
|
4828 CleanupStack::PopAndDestroy(ele); |
|
4829 Teardown(); |
|
4830 return KErrNone; |
|
4831 } |
|
4832 /* |
|
4833 TInt CsenxmlTester::CSenDomFragment_ExpandLL (CStifItemParser& aItem) |
|
4834 { |
|
4835 SetupL(); |
|
4836 TBool Flag; |
|
4837 RAttributeArray aAttrs; |
|
4838 CSenDomFragment* pElement=CSenDomFragment::NewL(); |
|
4839 |
|
4840 CleanupStack::PushL(pElement); |
|
4841 pElement->ExpandL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs); |
|
4842 CleanupStack::PopAndDestroy(pElement); |
|
4843 Teardown(); |
|
4844 return KErrNone; |
|
4845 } |
|
4846 |
|
4847 TInt CsenxmlTester::CSenDomFragment_ResumeParsingFromLL (CStifItemParser& aItem) |
|
4848 { |
|
4849 SetupL(); |
|
4850 TBool Flag; |
|
4851 RAttributeArray aAttrs; |
|
4852 CSenDomFragment* pElement=CSenDomFragment::NewL(); |
|
4853 |
|
4854 CleanupStack::PushL(pElement); |
|
4855 pElement->ResumeParsingFromL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia")); |
|
4856 CleanupStack::PopAndDestroy(pElement); |
|
4857 Teardown(); |
|
4858 return KErrNone; |
|
4859 } |
|
4860 */ |
|
4861 TInt CsenxmlTester::CSenDomFragment_ParseWithLL (CStifItemParser& aItem) |
|
4862 { |
|
4863 SetupL(); |
|
4864 CSenXmlReader* aReader = CSenXmlReader::NewL(); |
|
4865 CleanupStack::PushL(aReader); |
|
4866 |
|
4867 CSenDomFragment* pElement=CSenDomFragment::NewL(); |
|
4868 CleanupStack::PushL(pElement); |
|
4869 pElement->ParseWithL(*aReader); |
|
4870 CleanupStack::PopAndDestroy(pElement); |
|
4871 CleanupStack::PopAndDestroy(aReader); |
|
4872 |
|
4873 Teardown(); |
|
4874 return KErrNone; |
|
4875 } |
|
4876 |
|
4877 TInt CsenxmlTester::CSenDomFragment_SetAttributesLL (CStifItemParser& aItem) |
|
4878 { |
|
4879 SetupL(); |
|
4880 TBool Flag; |
|
4881 RAttributeArray aAttrs; |
|
4882 CSenDomFragment* pElement=CSenDomFragment::NewL(); |
|
4883 pElement->SetAttributesL(aAttrs); |
|
4884 CleanupStack::PushL(pElement); |
|
4885 |
|
4886 CleanupStack::PopAndDestroy(pElement); |
|
4887 Teardown(); |
|
4888 return KErrNone; |
|
4889 } |
|
4890 TInt CsenxmlTester::CSenDomFragment_ParseL1L( CStifItemParser& aItem ) |
|
4891 { |
|
4892 SetupL(); |
|
4893 _LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"""assa\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \ |
|
4894 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\ |
|
4895 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\ |
|
4896 <Element2 z=\"value4\">Content2<Element2>\ |
|
4897 <Element3>Content3</Element3>\ |
|
4898 <Element4/></a:Test>"); |
|
4899 |
|
4900 CSenDomFragment* pFragment = CSenDomFragment::NewL(_L8("Test")); |
|
4901 CleanupStack::PushL(pFragment); |
|
4902 |
|
4903 pFragment->SetReader(*iXmlReader); |
|
4904 TRAPD(retVal,pFragment->ParseL(KInputString)); |
|
4905 CleanupStack::PopAndDestroy(pFragment); |
|
4906 Teardown(); |
|
4907 if (retVal == -993) return KErrNone; |
|
4908 else return retVal; |
|
4909 } |
|
4910 /* |
|
4911 TInt CsenxmlTester::CSenDomFragment_ConsistsOfLL() |
|
4912 { |
|
4913 SetupL(); |
|
4914 CSenDomFragment* pFragmentA=CSenDomFragment::NewL(_L8("Nokia")); |
|
4915 CleanupStack::PushL(pFragmentA); |
|
4916 CSenElement pElement=pFragmentA->AsElement(); |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 |
|
4929 |
|
4930 |
|
4931 |
|
4932 CSenDomFragment* pChildFragment1A=CSenDomFragment::NewL(_L8("Asp")); |
|
4933 CleanupStack::PushL(pChild1A); |
|
4934 CSenDomFragment* pChild2A=CSenDomFragment::NewL(_L8("WebServices")); |
|
4935 CleanupStack::PushL(pChild2A); |
|
4936 pElementA->SetContentL(_L8("Nokia organisation structure")); |
|
4937 pElementA->AsElement() |
|
4938 pElementA->AddElementL(*pChild1A); |
|
4939 pElementA->AddElementL(*pChild2A); |
|
4940 |
|
4941 CSenDomFragment* pElementB=CSenDomFragment::NewL(_L8("Nokia")); |
|
4942 CleanupStack::PushL(pElementB); |
|
4943 CSenDomFragment* pChild1B=CSenDomFragment::NewL(_L8("Asp")); |
|
4944 CleanupStack::PushL(pChild1A); |
|
4945 CSenDomFragment* pChild2B=CSenDomFragment::NewL(_L8("WebServices")); |
|
4946 CleanupStack::PushL(pChild2B); |
|
4947 pElementB->SetContentL(_L8("Nokia organisation structure")); |
|
4948 pElementB->AddElementL(*pChild1B); |
|
4949 pElementB->AddElementL(*pChild2B); |
|
4950 |
|
4951 TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA); |
|
4952 EUNIT_ASSERT( ConsistOfFlag ); |
|
4953 CleanupStack::Pop(2); |
|
4954 CleanupStack::PopAndDestroy(pElementB); |
|
4955 CleanupStack::Pop(2); |
|
4956 CleanupStack::PopAndDestroy(pElementA); |
|
4957 Teardown(); |
|
4958 return KErrNone; |
|
4959 } |
|
4960 */ |
|
4961 |
|
4962 TInt CsenxmlTester::CSenNamespace_NewL_L (CStifItemParser& aItem) |
|
4963 { |
|
4964 SetupL(); |
|
4965 TBool Flag; |
|
4966 CSenNamespace* pElement=CSenNamespace::NewL(_L8("n:"),_L8("nsuri")); |
|
4967 CleanupStack::PushL(pElement); |
|
4968 if(pElement!=NULL) |
|
4969 Flag=1; |
|
4970 else |
|
4971 Flag=0; |
|
4972 /*EUNIT_ASSERT( Flag );*/ |
|
4973 if(!Flag) |
|
4974 return KErrArgument; |
|
4975 |
|
4976 CleanupStack::PopAndDestroy(pElement); |
|
4977 Teardown(); |
|
4978 return KErrNone; |
|
4979 } |
|
4980 |
|
4981 TInt CsenxmlTester::CSenNamespace_NewLC_L (CStifItemParser& aItem) |
|
4982 { |
|
4983 SetupL(); |
|
4984 TBool Flag; |
|
4985 CSenNamespace* pElement=CSenNamespace::NewLC(_L8("n:"),_L8("nsuri")); |
|
4986 if(pElement!=NULL) |
|
4987 Flag=1; |
|
4988 else |
|
4989 Flag=0; |
|
4990 /*EUNIT_ASSERT( Flag );*/ |
|
4991 if(!Flag) |
|
4992 return KErrArgument; |
|
4993 |
|
4994 CleanupStack::PopAndDestroy(pElement); |
|
4995 Teardown(); |
|
4996 return KErrNone; |
|
4997 } |
|
4998 |
|
4999 TInt CsenxmlTester::CSenNamespace_NewL_1L (CStifItemParser& aItem) |
|
5000 { |
|
5001 SetupL(); |
|
5002 TBool Flag; |
|
5003 CSenNamespace* pElement=CSenNamespace::NewL(_L8("nsuri")); |
|
5004 CleanupStack::PushL(pElement); |
|
5005 if(pElement!=NULL) |
|
5006 Flag=1; |
|
5007 else |
|
5008 Flag=0; |
|
5009 /*EUNIT_ASSERT( Flag );*/ |
|
5010 if(!Flag) |
|
5011 return KErrArgument; |
|
5012 |
|
5013 CleanupStack::PopAndDestroy(pElement); |
|
5014 Teardown(); |
|
5015 return KErrNone; |
|
5016 } |
|
5017 |
|
5018 TInt CsenxmlTester::CSenNamespace_NewLC_1L (CStifItemParser& aItem) |
|
5019 { |
|
5020 SetupL(); |
|
5021 TBool Flag; |
|
5022 CSenNamespace* pElement=CSenNamespace::NewLC(_L8("nsuri")); |
|
5023 if(pElement!=NULL) |
|
5024 Flag=1; |
|
5025 else |
|
5026 Flag=0; |
|
5027 /*EUNIT_ASSERT( Flag );*/ |
|
5028 if(!Flag) |
|
5029 return KErrArgument; |
|
5030 |
|
5031 CleanupStack::PopAndDestroy(pElement); |
|
5032 Teardown(); |
|
5033 return KErrNone; |
|
5034 } |
|
5035 |
|
5036 TInt CsenxmlTester::CSenNamespace_MatchesL_L (CStifItemParser& aItem) |
|
5037 { |
|
5038 SetupL(); |
|
5039 TBool Flag; |
|
5040 CSenNamespace* pElement = CSenNamespace::NewL(_L8("nsuri")); |
|
5041 CSenNamespace* pEle = CSenNamespace::NewL(_L8("nsuri")); |
|
5042 |
|
5043 CleanupStack::PushL(pElement); |
|
5044 CleanupStack::PushL(pEle); |
|
5045 |
|
5046 |
|
5047 if(pElement!=NULL && pEle!=NULL) |
|
5048 Flag = pEle->MatchesL(*pElement); |
|
5049 else |
|
5050 Flag=0; |
|
5051 /*EUNIT_ASSERT( Flag );*/ |
|
5052 if(!Flag) |
|
5053 return KErrArgument; |
|
5054 |
|
5055 CleanupStack::PopAndDestroy(pEle); |
|
5056 CleanupStack::PopAndDestroy(pElement); |
|
5057 |
|
5058 Teardown(); |
|
5059 return KErrNone; |
|
5060 } |
|
5061 |
|
5062 TInt CsenxmlTester::CSenNamespace_InsertLL (CStifItemParser& aItem) |
|
5063 { |
|
5064 SetupL(); |
|
5065 TBool Flag; |
|
5066 const TInt KFlatBufSize = 64; |
|
5067 CBufFlat *pBuf = CBufFlat::NewL(KFlatBufSize); |
|
5068 CleanupStack::PushL(pBuf); |
|
5069 RBufWriteStream bufWs(*pBuf); |
|
5070 CleanupClosePushL(bufWs); |
|
5071 |
|
5072 CSenNamespace* pElement = CSenNamespace::NewL(_L8("nsuri")); |
|
5073 CleanupStack::PushL(pElement); |
|
5074 |
|
5075 pElement->InsertL(bufWs); |
|
5076 CleanupStack::PopAndDestroy(pElement); |
|
5077 CleanupStack::PopAndDestroy(); // bufWs.Close(); |
|
5078 CleanupStack::PopAndDestroy(); // pBuf; |
|
5079 Teardown(); |
|
5080 return KErrNone; |
|
5081 } |
|
5082 |
|
5083 |
|
5084 |
|
5085 |
|
5086 TInt CsenxmlTester::CSenXmlReader_NewL_L (CStifItemParser& aItem) |
|
5087 { |
|
5088 SetupL(); |
|
5089 TBool Flag; |
|
5090 CSenXmlReader* pElement=CSenXmlReader::NewL(); |
|
5091 if(pElement!=NULL) |
|
5092 Flag=1; |
|
5093 else |
|
5094 Flag=0; |
|
5095 /*EUNIT_ASSERT( Flag );*/ |
|
5096 if(!Flag) |
|
5097 return KErrArgument; |
|
5098 |
|
5099 delete pElement; |
|
5100 pElement = NULL; |
|
5101 Teardown(); |
|
5102 return KErrNone; |
|
5103 } |
|
5104 |
|
5105 TInt CsenxmlTester::CSenXmlReader_NewLC_L (CStifItemParser& aItem) |
|
5106 { |
|
5107 SetupL(); |
|
5108 TBool Flag; |
|
5109 CSenXmlReader* pElement=CSenXmlReader::NewLC(); |
|
5110 if(pElement!=NULL) |
|
5111 Flag=1; |
|
5112 else |
|
5113 Flag=0; |
|
5114 /*EUNIT_ASSERT( Flag );*/ |
|
5115 if(!Flag) |
|
5116 return KErrArgument; |
|
5117 |
|
5118 CleanupStack::PopAndDestroy(pElement); |
|
5119 Teardown(); |
|
5120 return KErrNone; |
|
5121 } |
|
5122 |
|
5123 TInt CsenxmlTester::CSenXmlReader_NewL_1L (CStifItemParser& aItem) |
|
5124 { |
|
5125 SetupL(); |
|
5126 TBool Flag; |
|
5127 TInt param = 1; |
|
5128 CSenXmlReader* pElement=CSenXmlReader::NewL(param); |
|
5129 CleanupStack::PushL(pElement); |
|
5130 if(pElement!=NULL) |
|
5131 Flag=1; |
|
5132 else |
|
5133 Flag=0; |
|
5134 /*EUNIT_ASSERT( Flag );*/ |
|
5135 if(!Flag) |
|
5136 return KErrArgument; |
|
5137 |
|
5138 CleanupStack::PopAndDestroy(pElement); |
|
5139 Teardown(); |
|
5140 return KErrNone; |
|
5141 } |
|
5142 |
|
5143 TInt CsenxmlTester::CSenXmlReader_NewLC_1L (CStifItemParser& aItem) |
|
5144 { |
|
5145 SetupL(); |
|
5146 TBool Flag; |
|
5147 TInt param = 1; |
|
5148 CSenXmlReader* pElement=CSenXmlReader::NewLC(param); |
|
5149 if(pElement!=NULL) |
|
5150 Flag=1; |
|
5151 else |
|
5152 Flag=0; |
|
5153 /*EUNIT_ASSERT( Flag );*/ |
|
5154 if(!Flag) |
|
5155 return KErrArgument; |
|
5156 |
|
5157 CleanupStack::PopAndDestroy(pElement); |
|
5158 Teardown(); |
|
5159 return KErrNone; |
|
5160 } |
|
5161 |
|
5162 TInt CsenxmlTester::CSenXmlReader_NewL_2L (CStifItemParser& aItem) |
|
5163 { |
|
5164 SetupL(); |
|
5165 TBool Flag; |
|
5166 CSenXmlReader* pElement=CSenXmlReader::NewL(_L8("")); |
|
5167 CleanupStack::PushL(pElement); |
|
5168 if(pElement!=NULL) |
|
5169 Flag=1; |
|
5170 else |
|
5171 Flag=0; |
|
5172 /*EUNIT_ASSERT( Flag );*/ |
|
5173 if(!Flag) |
|
5174 return KErrArgument; |
|
5175 |
|
5176 CleanupStack::PopAndDestroy(pElement); |
|
5177 Teardown(); |
|
5178 return KErrNone; |
|
5179 } |
|
5180 |
|
5181 TInt CsenxmlTester::CSenXmlReader_NewLC_2L (CStifItemParser& aItem) |
|
5182 { |
|
5183 SetupL(); |
|
5184 TBool Flag; |
|
5185 CSenXmlReader* pElement=CSenXmlReader::NewLC(_L8("")); |
|
5186 if(pElement!=NULL) |
|
5187 Flag=1; |
|
5188 else |
|
5189 Flag=0; |
|
5190 /*EUNIT_ASSERT( Flag );*/ |
|
5191 if(!Flag) |
|
5192 return KErrArgument; |
|
5193 |
|
5194 CleanupStack::PopAndDestroy(pElement); |
|
5195 Teardown(); |
|
5196 return KErrNone; |
|
5197 } |
|
5198 |
|
5199 TInt CsenxmlTester::CSenXmlReader_NewL_3L (CStifItemParser& aItem) |
|
5200 { |
|
5201 SetupL(); |
|
5202 TBool Flag; |
|
5203 TInt param = 1; |
|
5204 CSenXmlReader* pElement=CSenXmlReader::NewL(_L8(""), param); |
|
5205 CleanupStack::PushL(pElement); |
|
5206 if(pElement!=NULL) |
|
5207 Flag=1; |
|
5208 else |
|
5209 Flag=0; |
|
5210 /*EUNIT_ASSERT( Flag );*/ |
|
5211 if(!Flag) |
|
5212 return KErrArgument; |
|
5213 |
|
5214 CleanupStack::PopAndDestroy(pElement); |
|
5215 Teardown(); |
|
5216 return KErrNone; |
|
5217 } |
|
5218 |
|
5219 TInt CsenxmlTester::CSenXmlReader_NewLC_3L (CStifItemParser& aItem) |
|
5220 { |
|
5221 SetupL(); |
|
5222 TBool Flag; |
|
5223 TInt param = 1; |
|
5224 CSenXmlReader* pElement=CSenXmlReader::NewLC(_L8(""), param); |
|
5225 if(pElement!=NULL) |
|
5226 Flag=1; |
|
5227 else |
|
5228 Flag=0; |
|
5229 /*EUNIT_ASSERT( Flag );*/ |
|
5230 if(!Flag) |
|
5231 return KErrArgument; |
|
5232 |
|
5233 CleanupStack::PopAndDestroy(pElement); |
|
5234 Teardown(); |
|
5235 return KErrNone; |
|
5236 } |
|
5237 |
|
5238 TInt CsenxmlTester::CSenXmlReader_EnabledParserFeature_L (CStifItemParser& aItem) |
|
5239 { |
|
5240 SetupL(); |
|
5241 TInt param = 1; |
|
5242 CSenXmlReader* pElement=CSenXmlReader::NewL(param); |
|
5243 CleanupStack::PushL(pElement); |
|
5244 /* EUNIT_ASSERT_EQUALS(param,pElement->EnabledParserFeature());*/ |
|
5245 TL(param == pElement->EnabledParserFeature()); |
|
5246 CleanupStack::PopAndDestroy(pElement); |
|
5247 Teardown(); |
|
5248 return KErrNone; |
|
5249 } |
|
5250 |
|
5251 TInt CsenxmlTester::CSenXmlUtils_ToUtf8LCL (CStifItemParser& aItem) |
|
5252 { |
|
5253 SetupL(); |
|
5254 HBufC8* buf; |
|
5255 |
|
5256 _LIT16(KText, "text"); |
|
5257 _LIT8(KText1, "text"); |
|
5258 buf = SenXmlUtils::ToUtf8LC(KText); |
|
5259 TPtr8 ptr = buf->Des(); |
|
5260 TL(ptr == KText1); |
|
5261 CleanupStack::PopAndDestroy(); |
|
5262 Teardown(); |
|
5263 return KErrNone; |
|
5264 } |
|
5265 |
|
5266 TInt CsenxmlTester::CSenXmlUtils_StartsWithL (CStifItemParser& aItem) |
|
5267 { |
|
5268 SetupL(); |
|
5269 HBufC8* buf; |
|
5270 TBool retVal; |
|
5271 _LIT8(KText, "text"); |
|
5272 _LIT8(KText1, "text1"); |
|
5273 retVal = SenXmlUtils::StartsWith(KText, KText1); |
|
5274 TL(retVal == KErrNone); |
|
5275 Teardown(); |
|
5276 return KErrNone; |
|
5277 } |
|
5278 |
|
5279 TInt CsenxmlTester::CSenXmlUtils_EndsWithL (CStifItemParser& aItem) |
|
5280 { |
|
5281 SetupL(); |
|
5282 TBool retVal; |
|
5283 _LIT8(KText, "text"); |
|
5284 _LIT8(KText1, "text1"); |
|
5285 retVal = SenXmlUtils::EndsWith(KText, KText1); |
|
5286 TL(retVal == KErrNone); |
|
5287 |
|
5288 Teardown(); |
|
5289 return KErrNone; |
|
5290 } |
|
5291 |
|
5292 TInt CsenxmlTester::CSenXmlUtils_AttrValueL (CStifItemParser& aItem) |
|
5293 { |
|
5294 SetupL(); |
|
5295 RAttributeArray array; |
|
5296 _LIT8(KText, "text"); |
|
5297 TPtrC8 ptr = SenXmlUtils::AttrValue(array, KText); |
|
5298 Teardown(); |
|
5299 return KErrNone; |
|
5300 } |
|
5301 |
|
5302 TInt CsenxmlTester::CSenXmlUtils_AllocAttrValueLL(CStifItemParser& aItem) |
|
5303 { |
|
5304 SetupL(); |
|
5305 RAttributeArray array; |
|
5306 _LIT8(KText, "text"); |
|
5307 HBufC8* ptr = SenXmlUtils::AllocAttrValueL(array, KText); |
|
5308 Teardown(); |
|
5309 return KErrNone; |
|
5310 } |
|
5311 |
|
5312 TInt CsenxmlTester::CSenXmlUtils_DecodeHttpCharactersLL(CStifItemParser& aItem) |
|
5313 { |
|
5314 SetupL(); |
|
5315 TBool retVal; |
|
5316 HBufC8* ptr = NULL; |
|
5317 _LIT8(KText, "text"); |
|
5318 retVal = SenXmlUtils::DecodeHttpCharactersL(KText, ptr); |
|
5319 TL(retVal == KErrNone); |
|
5320 |
|
5321 Teardown(); |
|
5322 return KErrNone; |
|
5323 } |
|
5324 |
|
5325 |
|
5326 TInt CsenxmlTester::CSenXmlUtils_DecodeHttpCharactersLCL(CStifItemParser& aItem) |
|
5327 { |
|
5328 SetupL(); |
|
5329 TBool retVal; |
|
5330 _LIT8(KText, "text"); |
|
5331 HBufC8* buf = SenXmlUtils::DecodeHttpCharactersLC(KText); |
|
5332 TPtr8 ptr = buf->Des(); |
|
5333 CleanupStack::PopAndDestroy(); |
|
5334 |
|
5335 Teardown(); |
|
5336 return KErrNone; |
|
5337 } |
|
5338 |
|
5339 |
|
5340 TInt CsenxmlTester::CSenXmlUtils_NsPrefixL(CStifItemParser& aItem) |
|
5341 { |
|
5342 SetupL(); |
|
5343 _LIT8(KText, "m:"); |
|
5344 _LIT8(KText1, "m"); |
|
5345 |
|
5346 TPtrC8 ptr = SenXmlUtils::NsPrefix(KText); |
|
5347 //TL(ptr == KText1); |
|
5348 Teardown(); |
|
5349 return KErrNone; |
|
5350 } |
|
5351 |
|
5352 TInt CsenxmlTester::CSenXmlUtils_LocalNameL(CStifItemParser& aItem) |
|
5353 { |
|
5354 SetupL(); |
|
5355 _LIT8(KText, "http:\\"); |
|
5356 _LIT8(KText1, "\\"); |
|
5357 TPtrC8 ptr = SenXmlUtils::LocalName(KText); |
|
5358 //TL(ptr == KText1); |
|
5359 Teardown(); |
|
5360 return KErrNone; |
|
5361 } |
|
5362 |
|
5363 TInt CsenxmlTester::CSenXmlUtils_RemoveAttributeLL(CStifItemParser& aItem) |
|
5364 { |
|
5365 SetupL(); |
|
5366 _LIT8(KText, "text"); |
|
5367 _LIT8(KText1, "text1"); |
|
5368 CSenBaseElement* element = CSenBaseElement::NewL(KText); |
|
5369 CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1); |
|
5370 attr = SenXmlUtils::RemoveAttributeL(*element, KText); |
|
5371 |
|
5372 Teardown(); |
|
5373 return KErrNone; |
|
5374 } |
|
5375 |
|
5376 TInt CsenxmlTester::CSenXmlUtils_RemoveAttributeL1L(CStifItemParser& aItem) |
|
5377 { |
|
5378 SetupL(); |
|
5379 _LIT8(KText, "text"); |
|
5380 _LIT8(KText1, "text1"); |
|
5381 CSenBaseElement* element = CSenBaseElement::NewL(KText); |
|
5382 CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1); |
|
5383 CSenBaseAttribute* attr1 = CSenBaseAttribute::NewL(KText, KText1); |
|
5384 |
|
5385 |
|
5386 attr = SenXmlUtils::RemoveAttributeL(*element, attr1); |
|
5387 |
|
5388 Teardown(); |
|
5389 return KErrNone; |
|
5390 } |
|
5391 |
|
5392 TInt CsenxmlTester::CSenXmlUtils_AddAttributeLL(CStifItemParser& aItem) |
|
5393 { |
|
5394 SetupL(); |
|
5395 _LIT8(KText, "text"); |
|
5396 CSenBaseElement* element = CSenBaseElement::NewL(KText); |
|
5397 |
|
5398 TDesC8 desc = SenXmlUtils::AddAttributeL(*element, KText, KText , KText ); |
|
5399 |
|
5400 Teardown(); |
|
5401 return KErrNone; |
|
5402 } |
|
5403 |
|
5404 TInt CsenxmlTester::CSenXmlUtils_AddAttributeL1L(CStifItemParser& aItem) |
|
5405 { |
|
5406 SetupL(); |
|
5407 _LIT8(KText, "text"); |
|
5408 _LIT8(KText1, "text1"); |
|
5409 CSenBaseElement* element = CSenBaseElement::NewL(KText); |
|
5410 TDesC8 desc = SenXmlUtils::AddAttributeL(*element, KText, KText ); |
|
5411 |
|
5412 Teardown(); |
|
5413 return KErrNone; |
|
5414 } |
|
5415 |
|
5416 TInt CsenxmlTester::CSenXmlUtils_AddAttributeL2L(CStifItemParser& aItem) |
|
5417 { |
|
5418 SetupL(); |
|
5419 _LIT8(KText, "text"); |
|
5420 _LIT8(KText1, "text1"); |
|
5421 CSenBaseElement* element = CSenBaseElement::NewL(KText); |
|
5422 CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1); |
|
5423 |
|
5424 TDesC8 desc = SenXmlUtils::AddAttributeL(*element, attr); |
|
5425 |
|
5426 Teardown(); |
|
5427 return KErrNone; |
|
5428 } |
|
5429 TInt CsenxmlTester::CSenXmlUtils_EncodeHttpCharactersLCL(CStifItemParser& aItem) |
|
5430 { |
|
5431 SetupL(); |
|
5432 TBool retVal; |
|
5433 _LIT8(KText, "text"); |
|
5434 HBufC8* buf = SenXmlUtils::EncodeHttpCharactersLC(KText); |
|
5435 //TPtr8 ptr = buf->Des(); |
|
5436 CleanupStack::PopAndDestroy(); |
|
5437 |
|
5438 Teardown(); |
|
5439 return KErrNone; |
|
5440 } |
|
5441 |
|
5442 TInt CsenxmlTester::CSenDomFragment_BaseConstructL( CStifItemParser& aItem ) |
|
5443 { |
|
5444 SetupL(); |
|
5445 |
|
5446 CTestDomFragment *pTestFragment = CTestDomFragment::NewL(_L8("Test Fragment")); |
|
5447 TInt retVal = 0; |
|
5448 CSenXmlReader* aReader = CSenXmlReader::NewL(); |
|
5449 CleanupStack::PushL(aReader); |
|
5450 |
|
5451 CleanupStack::PushL(pTestFragment); |
|
5452 pTestFragment->BaseConstructL(*aReader); |
|
5453 CleanupStack::PopAndDestroy(pTestFragment); |
|
5454 CleanupStack::PopAndDestroy(aReader); |
|
5455 |
|
5456 Teardown(); |
|
5457 |
|
5458 return retVal; |
|
5459 } |
|
5460 |
|
5461 TInt CsenxmlTester::CSenBaseFragment_BaseConstructL( CStifItemParser& aItem ) |
|
5462 { |
|
5463 SetupL(); |
|
5464 |
|
5465 CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment")); |
|
5466 TInt retVal = 0; |
|
5467 CSenXmlReader* aReader = CSenXmlReader::NewL(); |
|
5468 CleanupStack::PushL(aReader); |
|
5469 |
|
5470 CleanupStack::PushL(pTestFragment); |
|
5471 pTestFragment->BaseConstructL(*aReader); |
|
5472 CleanupStack::PopAndDestroy(pTestFragment); |
|
5473 CleanupStack::PopAndDestroy(aReader); |
|
5474 |
|
5475 Teardown(); |
|
5476 |
|
5477 return retVal; |
|
5478 } |
|
5479 |
|
5480 // ----------------------------------------------------------------------------- |
|
5481 // CsenxmlTester::?member_function |
|
5482 // ?implementation_description |
|
5483 // (other items were commented in a header). |
|
5484 // ----------------------------------------------------------------------------- |
|
5485 // |
|
5486 /* |
|
5487 TInt CsenxmlTester::?member_function( |
|
5488 CItemParser& aItem ) |
|
5489 { |
|
5490 |
|
5491 ?code |
|
5492 |
|
5493 } |
|
5494 */ |
|
5495 |
|
5496 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
5497 // None |
|
5498 |
|
5499 // [End of File]-Do not remove |