|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32math.h> |
|
23 #include "FavouritesEngineTest.h" |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 // None |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 // None |
|
30 |
|
31 // CONSTANTS |
|
32 // None |
|
33 |
|
34 // MACROS |
|
35 // None |
|
36 |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 // None |
|
39 |
|
40 // MODULE DATA STRUCTURES |
|
41 // None |
|
42 |
|
43 // LOCAL FUNCTION PROTOTYPES |
|
44 // None |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 // None |
|
48 |
|
49 // ==================== LOCAL FUNCTIONS ======================================= |
|
50 |
|
51 /* |
|
52 ------------------------------------------------------------------------------- |
|
53 |
|
54 DESCRIPTION |
|
55 |
|
56 This module contains the implementation of CTestModuleDemo class |
|
57 member functions that does the actual tests. |
|
58 |
|
59 ------------------------------------------------------------------------------- |
|
60 */ |
|
61 |
|
62 // ============================ MEMBER FUNCTIONS =============================== |
|
63 |
|
64 /* |
|
65 ------------------------------------------------------------------------------- |
|
66 |
|
67 Class: CFavouritesEngineTest |
|
68 |
|
69 Method: ItemNewLCTestL |
|
70 |
|
71 Description: Test creating a new favourites item with the NewLC method. |
|
72 |
|
73 Parameters: TTestResult& aErrorDescription: out: |
|
74 Test result and on error case a short description of error |
|
75 |
|
76 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
77 |
|
78 Errors/Exceptions: None |
|
79 |
|
80 Status: Approved |
|
81 |
|
82 ------------------------------------------------------------------------------- |
|
83 */ |
|
84 TInt CFavouritesEngineTest::ItemNewLCTestL( TTestResult& aResult ) |
|
85 { |
|
86 /* Simple server connect */ |
|
87 _LIT( KDefinition ,"State"); |
|
88 _LIT( KData ,"Creating item with NewLC method"); |
|
89 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
90 |
|
91 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
92 |
|
93 _LIT( KData2 ,"Finished"); |
|
94 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
95 |
|
96 if (item) |
|
97 { |
|
98 _LIT( KDescription , "Test case passed"); |
|
99 aResult.SetResult( KErrNone, KDescription ); |
|
100 } |
|
101 else |
|
102 { |
|
103 _LIT( KDescription , "Test case failed"); |
|
104 aResult.SetResult( KErrGeneral, KDescription ); |
|
105 } |
|
106 |
|
107 CleanupStack::PopAndDestroy( item ); |
|
108 |
|
109 // Case was executed |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 /* |
|
114 ------------------------------------------------------------------------------- |
|
115 |
|
116 Class: CFavouritesEngineTest |
|
117 |
|
118 Method: ItemNewLTestL |
|
119 |
|
120 Description: Test creating a new favourites item with the NewL method. |
|
121 |
|
122 Parameters: TTestResult& aErrorDescription: out: |
|
123 Test result and on error case a short description of error |
|
124 |
|
125 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
126 |
|
127 Errors/Exceptions: None |
|
128 |
|
129 Status: Approved |
|
130 |
|
131 ------------------------------------------------------------------------------- |
|
132 */ |
|
133 TInt CFavouritesEngineTest::ItemNewLTestL( TTestResult& aResult ) |
|
134 { |
|
135 /* Simple server connect */ |
|
136 _LIT( KDefinition ,"State"); |
|
137 _LIT( KData ,"Creating item with NewL method"); |
|
138 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
139 |
|
140 CFavouritesItem* item = CFavouritesItem::NewL(); |
|
141 |
|
142 _LIT( KData2 ,"Finished"); |
|
143 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
144 |
|
145 if (item) |
|
146 { |
|
147 _LIT( KDescription , "Test case passed"); |
|
148 aResult.SetResult( KErrNone, KDescription ); |
|
149 |
|
150 delete item; |
|
151 } |
|
152 else |
|
153 { |
|
154 _LIT( KDescription , "Test case failed"); |
|
155 aResult.SetResult( KErrGeneral, KDescription ); |
|
156 } |
|
157 |
|
158 |
|
159 // Case was executed |
|
160 return KErrNone; |
|
161 } |
|
162 |
|
163 /* |
|
164 ------------------------------------------------------------------------------- |
|
165 |
|
166 Class: CFavouritesEngineTest |
|
167 |
|
168 Method: ItemDestructorTestL |
|
169 |
|
170 Description: Test destroying an item with the ~CFavouritesItem method. |
|
171 |
|
172 Parameters: TTestResult& aErrorDescription: out: |
|
173 Test result and on error case a short description of error |
|
174 |
|
175 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
176 |
|
177 Errors/Exceptions: None |
|
178 |
|
179 Status: Approved |
|
180 |
|
181 ------------------------------------------------------------------------------- |
|
182 */ |
|
183 TInt CFavouritesEngineTest::ItemDestructorTestL( TTestResult& aResult ) |
|
184 { |
|
185 /* Simple server connect */ |
|
186 _LIT( KDefinition ,"State"); |
|
187 _LIT( KData ,"Destroying item with ~CFavouritesItem method"); |
|
188 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
189 |
|
190 CFavouritesItem* item = CFavouritesItem::NewL(); |
|
191 |
|
192 delete item; |
|
193 |
|
194 _LIT( KData2 ,"Finished"); |
|
195 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
196 |
|
197 _LIT( KDescription , "Test case passed"); |
|
198 aResult.SetResult( KErrNone, KDescription ); |
|
199 |
|
200 // Case was executed |
|
201 return KErrNone; |
|
202 } |
|
203 |
|
204 /* |
|
205 ------------------------------------------------------------------------------- |
|
206 |
|
207 Class: CFavouritesEngineTest |
|
208 |
|
209 Method: ItemAssignTestL |
|
210 |
|
211 Description: Assigning one item to another with the Assign(=) method. |
|
212 |
|
213 Parameters: TTestResult& aErrorDescription: out: |
|
214 Test result and on error case a short description of error |
|
215 |
|
216 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
217 |
|
218 Errors/Exceptions: None |
|
219 |
|
220 Status: Approved |
|
221 |
|
222 ------------------------------------------------------------------------------- |
|
223 */ |
|
224 TInt CFavouritesEngineTest::ItemAssignTestL( TTestResult& aResult ) |
|
225 { |
|
226 /* Simple server connect */ |
|
227 _LIT( KDefinition ,"State"); |
|
228 _LIT( KData ,"Assigning item with Assign(=) operator"); |
|
229 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
230 |
|
231 CFavouritesItem* item1 = CFavouritesItem::NewLC(); |
|
232 item1->SetNameL( _L("Item1") ); |
|
233 CFavouritesItem* item2 = CFavouritesItem::NewLC(); |
|
234 item2->SetNameL( _L("Item2") ); |
|
235 |
|
236 *item1 = *item2; |
|
237 |
|
238 _LIT( KData2 ,"Finished"); |
|
239 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
240 |
|
241 if (item1->Name() == item2->Name()) |
|
242 { |
|
243 _LIT( KDescription , "Test case passed"); |
|
244 aResult.SetResult( KErrNone, KDescription ); |
|
245 } |
|
246 else |
|
247 { |
|
248 _LIT( KDescription , "Test case failed"); |
|
249 aResult.SetResult( KErrGeneral, KDescription ); |
|
250 } |
|
251 |
|
252 CleanupStack::PopAndDestroy( 2 ); // item1, item2 |
|
253 |
|
254 // Case was executed |
|
255 return KErrNone; |
|
256 } |
|
257 |
|
258 /* |
|
259 ------------------------------------------------------------------------------- |
|
260 |
|
261 Class: CFavouritesEngineTest |
|
262 |
|
263 Method: ItemUidTestL |
|
264 |
|
265 Description: Test getting the item's Uid using the Uid method. |
|
266 |
|
267 Parameters: TTestResult& aErrorDescription: out: |
|
268 Test result and on error case a short description of error |
|
269 |
|
270 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
271 |
|
272 Errors/Exceptions: None |
|
273 |
|
274 Status: Approved |
|
275 |
|
276 ------------------------------------------------------------------------------- |
|
277 */ |
|
278 TInt CFavouritesEngineTest::ItemUidTestL( TTestResult& aResult ) |
|
279 { |
|
280 /* Simple server connect */ |
|
281 _LIT( KDefinition ,"State"); |
|
282 _LIT( KData ,"Getting item's Uid with Uid method"); |
|
283 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
284 |
|
285 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
286 |
|
287 TInt itemUid = item->Uid(); |
|
288 |
|
289 _LIT( KData2 ,"Finished"); |
|
290 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
291 |
|
292 if (itemUid == 0) |
|
293 { |
|
294 _LIT( KDescription , "Test case passed"); |
|
295 aResult.SetResult( KErrNone, KDescription ); |
|
296 } |
|
297 else |
|
298 { |
|
299 _LIT( KDescription , "Test case failed"); |
|
300 aResult.SetResult( KErrGeneral, KDescription ); |
|
301 } |
|
302 |
|
303 CleanupStack::PopAndDestroy( item ); |
|
304 |
|
305 // Case was executed |
|
306 return KErrNone; |
|
307 } |
|
308 |
|
309 /* |
|
310 ------------------------------------------------------------------------------- |
|
311 |
|
312 Class: CFavouritesEngineTest |
|
313 |
|
314 Method: ItemParentFolderTestL |
|
315 |
|
316 Description: Test getting the item's parent folder using the ParentFolder method. |
|
317 |
|
318 Parameters: TTestResult& aErrorDescription: out: |
|
319 Test result and on error case a short description of error |
|
320 |
|
321 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
322 |
|
323 Errors/Exceptions: None |
|
324 |
|
325 Status: Approved |
|
326 |
|
327 ------------------------------------------------------------------------------- |
|
328 */ |
|
329 TInt CFavouritesEngineTest::ItemParentFolderTestL( TTestResult& aResult ) |
|
330 { |
|
331 /* Simple server connect */ |
|
332 _LIT( KDefinition ,"State"); |
|
333 _LIT( KData ,"Getting item's parent folder with ParentFolder method"); |
|
334 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
335 |
|
336 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
337 |
|
338 TInt itemParent = item->ParentFolder(); |
|
339 |
|
340 _LIT( KData2 ,"Finished"); |
|
341 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
342 |
|
343 if (itemParent == 0) |
|
344 { |
|
345 _LIT( KDescription , "Test case passed"); |
|
346 aResult.SetResult( KErrNone, KDescription ); |
|
347 } |
|
348 else |
|
349 { |
|
350 _LIT( KDescription , "Test case failed"); |
|
351 aResult.SetResult( KErrGeneral, KDescription ); |
|
352 } |
|
353 |
|
354 CleanupStack::PopAndDestroy( item ); |
|
355 |
|
356 // Case was executed |
|
357 return KErrNone; |
|
358 } |
|
359 |
|
360 /* |
|
361 ------------------------------------------------------------------------------- |
|
362 |
|
363 Class: CFavouritesEngineTest |
|
364 |
|
365 Method: ItemTypeTestL |
|
366 |
|
367 Description: Test getting the item's type using the Type method. |
|
368 |
|
369 Parameters: TTestResult& aErrorDescription: out: |
|
370 Test result and on error case a short description of error |
|
371 |
|
372 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
373 |
|
374 Errors/Exceptions: None |
|
375 |
|
376 Status: Approved |
|
377 |
|
378 ------------------------------------------------------------------------------- |
|
379 */ |
|
380 TInt CFavouritesEngineTest::ItemTypeTestL( TTestResult& aResult ) |
|
381 { |
|
382 /* Simple server connect */ |
|
383 _LIT( KDefinition ,"State"); |
|
384 _LIT( KData ,"Getting item's type with Type method"); |
|
385 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
386 |
|
387 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
388 |
|
389 TInt itemType = item->Type(); |
|
390 |
|
391 _LIT( KData2 ,"Finished"); |
|
392 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
393 |
|
394 if (itemType == 1) |
|
395 { |
|
396 _LIT( KDescription , "Test case passed"); |
|
397 aResult.SetResult( KErrNone, KDescription ); |
|
398 } |
|
399 else |
|
400 { |
|
401 _LIT( KDescription , "Test case failed"); |
|
402 aResult.SetResult( KErrGeneral, KDescription ); |
|
403 } |
|
404 |
|
405 CleanupStack::PopAndDestroy( item ); |
|
406 |
|
407 // Case was executed |
|
408 return KErrNone; |
|
409 } |
|
410 |
|
411 /* |
|
412 ------------------------------------------------------------------------------- |
|
413 |
|
414 Class: CFavouritesEngineTest |
|
415 |
|
416 Method: ItemNameTestL |
|
417 |
|
418 Description: Test getting the item's name using the Name method. |
|
419 |
|
420 Parameters: TTestResult& aErrorDescription: out: |
|
421 Test result and on error case a short description of error |
|
422 |
|
423 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
424 |
|
425 Errors/Exceptions: None |
|
426 |
|
427 Status: Approved |
|
428 |
|
429 ------------------------------------------------------------------------------- |
|
430 */ |
|
431 TInt CFavouritesEngineTest::ItemNameTestL( TTestResult& aResult ) |
|
432 { |
|
433 /* Simple server connect */ |
|
434 _LIT( KDefinition ,"State"); |
|
435 _LIT( KData ,"Getting item's name with Name method"); |
|
436 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
437 |
|
438 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
439 |
|
440 TPtrC itemName = item->Name(); |
|
441 |
|
442 _LIT( KData2 ,"Finished"); |
|
443 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
444 |
|
445 _LIT( KItemName ,""); |
|
446 if (itemName == KItemName) |
|
447 { |
|
448 _LIT( KDescription , "Test case passed"); |
|
449 aResult.SetResult( KErrNone, KDescription ); |
|
450 } |
|
451 else |
|
452 { |
|
453 _LIT( KDescription , "Test case failed"); |
|
454 aResult.SetResult( KErrGeneral, KDescription ); |
|
455 } |
|
456 |
|
457 CleanupStack::PopAndDestroy( item ); |
|
458 |
|
459 // Case was executed |
|
460 return KErrNone; |
|
461 } |
|
462 |
|
463 /* |
|
464 ------------------------------------------------------------------------------- |
|
465 |
|
466 Class: CFavouritesEngineTest |
|
467 |
|
468 Method: ItemUrlTestL |
|
469 |
|
470 Description: Test getting the item's url using the Url method. |
|
471 |
|
472 Parameters: TTestResult& aErrorDescription: out: |
|
473 Test result and on error case a short description of error |
|
474 |
|
475 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
476 |
|
477 Errors/Exceptions: None |
|
478 |
|
479 Status: Approved |
|
480 |
|
481 ------------------------------------------------------------------------------- |
|
482 */ |
|
483 TInt CFavouritesEngineTest::ItemUrlTestL( TTestResult& aResult ) |
|
484 { |
|
485 /* Simple server connect */ |
|
486 _LIT( KDefinition ,"State"); |
|
487 _LIT( KData ,"Getting item's url with Url method"); |
|
488 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
489 |
|
490 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
491 |
|
492 TPtrC itemUrl = item->Url(); |
|
493 |
|
494 _LIT( KData2 ,"Finished"); |
|
495 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
496 |
|
497 _LIT( KItemUrl ,""); |
|
498 if (itemUrl == KItemUrl) |
|
499 { |
|
500 _LIT( KDescription , "Test case passed"); |
|
501 aResult.SetResult( KErrNone, KDescription ); |
|
502 } |
|
503 else |
|
504 { |
|
505 _LIT( KDescription , "Test case failed"); |
|
506 aResult.SetResult( KErrGeneral, KDescription ); |
|
507 } |
|
508 |
|
509 CleanupStack::PopAndDestroy( item ); |
|
510 |
|
511 // Case was executed |
|
512 return KErrNone; |
|
513 } |
|
514 |
|
515 /* |
|
516 ------------------------------------------------------------------------------- |
|
517 |
|
518 Class: CFavouritesEngineTest |
|
519 |
|
520 Method: ItemWapApTestL |
|
521 |
|
522 Description: Test getting the item's access point using the WapAp method. |
|
523 |
|
524 Parameters: TTestResult& aErrorDescription: out: |
|
525 Test result and on error case a short description of error |
|
526 |
|
527 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
528 |
|
529 Errors/Exceptions: None |
|
530 |
|
531 Status: Approved |
|
532 |
|
533 ------------------------------------------------------------------------------- |
|
534 */ |
|
535 TInt CFavouritesEngineTest::ItemWapApTestL( TTestResult& aResult ) |
|
536 { |
|
537 /* Simple server connect */ |
|
538 _LIT( KDefinition ,"State"); |
|
539 _LIT( KData ,"Getting item's access point with WapAp method"); |
|
540 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
541 |
|
542 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
543 |
|
544 TFavouritesWapAp itemAP = item->WapAp(); |
|
545 |
|
546 _LIT( KData2 ,"Finished"); |
|
547 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
548 |
|
549 if (itemAP.IsDefault()) |
|
550 { |
|
551 _LIT( KDescription , "Test case passed"); |
|
552 aResult.SetResult( KErrNone, KDescription ); |
|
553 } |
|
554 else |
|
555 { |
|
556 _LIT( KDescription , "Test case failed"); |
|
557 aResult.SetResult( KErrGeneral, KDescription ); |
|
558 } |
|
559 |
|
560 CleanupStack::PopAndDestroy( item ); |
|
561 |
|
562 // Case was executed |
|
563 return KErrNone; |
|
564 } |
|
565 |
|
566 /* |
|
567 ------------------------------------------------------------------------------- |
|
568 |
|
569 Class: CFavouritesEngineTest |
|
570 |
|
571 Method: ItemUserNameTestL |
|
572 |
|
573 Description: Test getting the item's user name using the UserName method. |
|
574 |
|
575 Parameters: TTestResult& aErrorDescription: out: |
|
576 Test result and on error case a short description of error |
|
577 |
|
578 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
579 |
|
580 Errors/Exceptions: None |
|
581 |
|
582 Status: Approved |
|
583 |
|
584 ------------------------------------------------------------------------------- |
|
585 */ |
|
586 TInt CFavouritesEngineTest::ItemUserNameTestL( TTestResult& aResult ) |
|
587 { |
|
588 /* Simple server connect */ |
|
589 _LIT( KDefinition ,"State"); |
|
590 _LIT( KData ,"Getting item's user name with UserName method"); |
|
591 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
592 |
|
593 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
594 |
|
595 TPtrC itemUserName = item->UserName(); |
|
596 |
|
597 _LIT( KData2 ,"Finished"); |
|
598 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
599 |
|
600 _LIT( KItemUserName ,""); |
|
601 if (itemUserName == KItemUserName) |
|
602 { |
|
603 _LIT( KDescription , "Test case passed"); |
|
604 aResult.SetResult( KErrNone, KDescription ); |
|
605 } |
|
606 else |
|
607 { |
|
608 _LIT( KDescription , "Test case failed"); |
|
609 aResult.SetResult( KErrGeneral, KDescription ); |
|
610 } |
|
611 |
|
612 CleanupStack::PopAndDestroy( item ); |
|
613 |
|
614 // Case was executed |
|
615 return KErrNone; |
|
616 } |
|
617 |
|
618 /* |
|
619 ------------------------------------------------------------------------------- |
|
620 |
|
621 Class: CFavouritesEngineTest |
|
622 |
|
623 Method: ItemPasswordTestL |
|
624 |
|
625 Description: Test getting the item's password using the Password method. |
|
626 |
|
627 Parameters: TTestResult& aErrorDescription: out: |
|
628 Test result and on error case a short description of error |
|
629 |
|
630 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
631 |
|
632 Errors/Exceptions: None |
|
633 |
|
634 Status: Approved |
|
635 |
|
636 ------------------------------------------------------------------------------- |
|
637 */ |
|
638 TInt CFavouritesEngineTest::ItemPasswordTestL( TTestResult& aResult ) |
|
639 { |
|
640 /* Simple server connect */ |
|
641 _LIT( KDefinition ,"State"); |
|
642 _LIT( KData ,"Getting item's password with Password method"); |
|
643 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
644 |
|
645 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
646 |
|
647 TPtrC itemPassword = item->Password(); |
|
648 |
|
649 _LIT( KData2 ,"Finished"); |
|
650 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
651 |
|
652 _LIT( KItemPassword ,""); |
|
653 if (itemPassword == KItemPassword) |
|
654 { |
|
655 _LIT( KDescription , "Test case passed"); |
|
656 aResult.SetResult( KErrNone, KDescription ); |
|
657 } |
|
658 else |
|
659 { |
|
660 _LIT( KDescription , "Test case failed"); |
|
661 aResult.SetResult( KErrGeneral, KDescription ); |
|
662 } |
|
663 |
|
664 CleanupStack::PopAndDestroy( item ); |
|
665 |
|
666 // Case was executed |
|
667 return KErrNone; |
|
668 } |
|
669 |
|
670 /* |
|
671 ------------------------------------------------------------------------------- |
|
672 |
|
673 Class: CFavouritesEngineTest |
|
674 |
|
675 Method: ItemContextIdTestL |
|
676 |
|
677 Description: Test getting the item's context id using the ContextId method. |
|
678 |
|
679 Parameters: TTestResult& aErrorDescription: out: |
|
680 Test result and on error case a short description of error |
|
681 |
|
682 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
683 |
|
684 Errors/Exceptions: None |
|
685 |
|
686 Status: Approved |
|
687 |
|
688 ------------------------------------------------------------------------------- |
|
689 */ |
|
690 TInt CFavouritesEngineTest::ItemContextIdTestL( TTestResult& aResult ) |
|
691 { |
|
692 /* Simple server connect */ |
|
693 _LIT( KDefinition ,"State"); |
|
694 _LIT( KData ,"Getting item's context id with ContextId method"); |
|
695 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
696 |
|
697 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
698 |
|
699 TInt32 itemContextId = item->ContextId(); |
|
700 |
|
701 _LIT( KData2 ,"Finished"); |
|
702 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
703 |
|
704 if (itemContextId == 0) |
|
705 { |
|
706 _LIT( KDescription , "Test case passed"); |
|
707 aResult.SetResult( KErrNone, KDescription ); |
|
708 } |
|
709 else |
|
710 { |
|
711 _LIT( KDescription , "Test case failed"); |
|
712 aResult.SetResult( KErrGeneral, KDescription ); |
|
713 } |
|
714 |
|
715 CleanupStack::PopAndDestroy( item ); |
|
716 |
|
717 // Case was executed |
|
718 return KErrNone; |
|
719 } |
|
720 |
|
721 /* |
|
722 ------------------------------------------------------------------------------- |
|
723 |
|
724 Class: CFavouritesEngineTest |
|
725 |
|
726 Method: ItemIsItemTestL |
|
727 |
|
728 Description: Test if the item is an item using the IsItem method. |
|
729 |
|
730 Parameters: TTestResult& aErrorDescription: out: |
|
731 Test result and on error case a short description of error |
|
732 |
|
733 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
734 |
|
735 Errors/Exceptions: None |
|
736 |
|
737 Status: Approved |
|
738 |
|
739 ------------------------------------------------------------------------------- |
|
740 */ |
|
741 TInt CFavouritesEngineTest::ItemIsItemTestL( TTestResult& aResult ) |
|
742 { |
|
743 /* Simple server connect */ |
|
744 _LIT( KDefinition ,"State"); |
|
745 _LIT( KData ,"Checking if the item is an item with IsItem method"); |
|
746 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
747 |
|
748 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
749 |
|
750 TBool itemIsItem = item->IsItem(); |
|
751 |
|
752 _LIT( KData2 ,"Finished"); |
|
753 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
754 |
|
755 if (itemIsItem) |
|
756 { |
|
757 _LIT( KDescription , "Test case passed"); |
|
758 aResult.SetResult( KErrNone, KDescription ); |
|
759 } |
|
760 else |
|
761 { |
|
762 _LIT( KDescription , "Test case failed"); |
|
763 aResult.SetResult( KErrGeneral, KDescription ); |
|
764 } |
|
765 |
|
766 CleanupStack::PopAndDestroy( item ); |
|
767 |
|
768 // Case was executed |
|
769 return KErrNone; |
|
770 } |
|
771 |
|
772 /* |
|
773 ------------------------------------------------------------------------------- |
|
774 |
|
775 Class: CFavouritesEngineTest |
|
776 |
|
777 Method: ItemIsFolderTestL |
|
778 |
|
779 Description: Test if the item is a folder using the IsFolder method. |
|
780 |
|
781 Parameters: TTestResult& aErrorDescription: out: |
|
782 Test result and on error case a short description of error |
|
783 |
|
784 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
785 |
|
786 Errors/Exceptions: None |
|
787 |
|
788 Status: Approved |
|
789 |
|
790 ------------------------------------------------------------------------------- |
|
791 */ |
|
792 TInt CFavouritesEngineTest::ItemIsFolderTestL( TTestResult& aResult ) |
|
793 { |
|
794 /* Simple server connect */ |
|
795 _LIT( KDefinition ,"State"); |
|
796 _LIT( KData ,"Checking if the item is a folder with IsFolder method"); |
|
797 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
798 |
|
799 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
800 |
|
801 TBool itemIsFolder = item->IsFolder(); |
|
802 |
|
803 _LIT( KData2 ,"Finished"); |
|
804 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
805 |
|
806 if (!itemIsFolder) |
|
807 { |
|
808 _LIT( KDescription , "Test case passed"); |
|
809 aResult.SetResult( KErrNone, KDescription ); |
|
810 } |
|
811 else |
|
812 { |
|
813 _LIT( KDescription , "Test case failed"); |
|
814 aResult.SetResult( KErrGeneral, KDescription ); |
|
815 } |
|
816 |
|
817 CleanupStack::PopAndDestroy( item ); |
|
818 |
|
819 // Case was executed |
|
820 return KErrNone; |
|
821 } |
|
822 |
|
823 /* |
|
824 ------------------------------------------------------------------------------- |
|
825 |
|
826 Class: CFavouritesEngineTest |
|
827 |
|
828 Method: ItemIsFactoryItemTestL |
|
829 |
|
830 Description: Test if the item is a factory item using the IsFactoryItem method. |
|
831 |
|
832 Parameters: TTestResult& aErrorDescription: out: |
|
833 Test result and on error case a short description of error |
|
834 |
|
835 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
836 |
|
837 Errors/Exceptions: None |
|
838 |
|
839 Status: Approved |
|
840 |
|
841 ------------------------------------------------------------------------------- |
|
842 */ |
|
843 TInt CFavouritesEngineTest::ItemIsFactoryItemTestL( TTestResult& aResult ) |
|
844 { |
|
845 /* Simple server connect */ |
|
846 _LIT( KDefinition ,"State"); |
|
847 _LIT( KData ,"Checking if the item is a factory item with IsFactory method"); |
|
848 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
849 |
|
850 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
851 |
|
852 TBool itemIsFactoryItem = item->IsFactoryItem(); |
|
853 |
|
854 _LIT( KData2 ,"Finished"); |
|
855 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
856 |
|
857 if (!itemIsFactoryItem) |
|
858 { |
|
859 _LIT( KDescription , "Test case passed"); |
|
860 aResult.SetResult( KErrNone, KDescription ); |
|
861 } |
|
862 else |
|
863 { |
|
864 _LIT( KDescription , "Test case failed"); |
|
865 aResult.SetResult( KErrGeneral, KDescription ); |
|
866 } |
|
867 |
|
868 CleanupStack::PopAndDestroy( item ); |
|
869 |
|
870 // Case was executed |
|
871 return KErrNone; |
|
872 } |
|
873 |
|
874 /* |
|
875 ------------------------------------------------------------------------------- |
|
876 |
|
877 Class: CFavouritesEngineTest |
|
878 |
|
879 Method: ItemIsReadOnlyTestL |
|
880 |
|
881 Description: Test if the item is read-only using the IsReadOnly method. |
|
882 |
|
883 Parameters: TTestResult& aErrorDescription: out: |
|
884 Test result and on error case a short description of error |
|
885 |
|
886 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
887 |
|
888 Errors/Exceptions: None |
|
889 |
|
890 Status: Approved |
|
891 |
|
892 ------------------------------------------------------------------------------- |
|
893 */ |
|
894 TInt CFavouritesEngineTest::ItemIsReadOnlyTestL( TTestResult& aResult ) |
|
895 { |
|
896 /* Simple server connect */ |
|
897 _LIT( KDefinition ,"State"); |
|
898 _LIT( KData ,"Checking if the item is read-only item with IsReadOnly method"); |
|
899 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
900 |
|
901 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
902 |
|
903 TBool itemIsReadOnly = item->IsReadOnly(); |
|
904 |
|
905 _LIT( KData2 ,"Finished"); |
|
906 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
907 |
|
908 if (!itemIsReadOnly) |
|
909 { |
|
910 _LIT( KDescription , "Test case passed"); |
|
911 aResult.SetResult( KErrNone, KDescription ); |
|
912 } |
|
913 else |
|
914 { |
|
915 _LIT( KDescription , "Test case failed"); |
|
916 aResult.SetResult( KErrGeneral, KDescription ); |
|
917 } |
|
918 |
|
919 CleanupStack::PopAndDestroy( item ); |
|
920 |
|
921 // Case was executed |
|
922 return KErrNone; |
|
923 } |
|
924 |
|
925 /* |
|
926 ------------------------------------------------------------------------------- |
|
927 |
|
928 Class: CFavouritesEngineTest |
|
929 |
|
930 Method: ItemModifiedTestL |
|
931 |
|
932 Description: Test getting the last modified time using the Modified method. |
|
933 |
|
934 Parameters: TTestResult& aErrorDescription: out: |
|
935 Test result and on error case a short description of error |
|
936 |
|
937 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
938 |
|
939 Errors/Exceptions: None |
|
940 |
|
941 Status: Approved |
|
942 |
|
943 ------------------------------------------------------------------------------- |
|
944 */ |
|
945 TInt CFavouritesEngineTest::ItemModifiedTestL( TTestResult& aResult ) |
|
946 { |
|
947 /* Simple server connect */ |
|
948 _LIT( KDefinition ,"State"); |
|
949 _LIT( KData ,"Getting the item's last modified time with Modified method"); |
|
950 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
951 |
|
952 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
953 |
|
954 TTime itemModified = item->Modified(); |
|
955 |
|
956 _LIT( KData2 ,"Finished"); |
|
957 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
958 |
|
959 if (itemModified != NULL) |
|
960 { |
|
961 _LIT( KDescription , "Test case passed"); |
|
962 aResult.SetResult( KErrNone, KDescription ); |
|
963 } |
|
964 else |
|
965 { |
|
966 _LIT( KDescription , "Test case failed"); |
|
967 aResult.SetResult( KErrGeneral, KDescription ); |
|
968 } |
|
969 |
|
970 CleanupStack::PopAndDestroy( item ); |
|
971 |
|
972 // Case was executed |
|
973 return KErrNone; |
|
974 } |
|
975 |
|
976 /* |
|
977 ------------------------------------------------------------------------------- |
|
978 |
|
979 Class: CFavouritesEngineTest |
|
980 |
|
981 Method: ItemClearLTestL |
|
982 |
|
983 Description: Test clearing the item using the ClearL method. |
|
984 |
|
985 Parameters: TTestResult& aErrorDescription: out: |
|
986 Test result and on error case a short description of error |
|
987 |
|
988 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
989 |
|
990 Errors/Exceptions: None |
|
991 |
|
992 Status: Approved |
|
993 |
|
994 ------------------------------------------------------------------------------- |
|
995 */ |
|
996 TInt CFavouritesEngineTest::ItemClearLTestL( TTestResult& aResult ) |
|
997 { |
|
998 /* Simple server connect */ |
|
999 _LIT( KDefinition ,"State"); |
|
1000 _LIT( KData ,"Clearing the item with ClearL method"); |
|
1001 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1002 |
|
1003 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1004 |
|
1005 item->SetType(CFavouritesItem::EFolder); |
|
1006 item->SetNameL( _L("Item Name") ); |
|
1007 item->ClearL(); |
|
1008 |
|
1009 _LIT( KData2 ,"Finished"); |
|
1010 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1011 |
|
1012 if ((item->Type() == CFavouritesItem::EFolder) || (item->Name() == _L("Item Name"))) |
|
1013 { |
|
1014 _LIT( KDescription , "Test case failed"); |
|
1015 aResult.SetResult( KErrGeneral, KDescription ); |
|
1016 } |
|
1017 else |
|
1018 { |
|
1019 _LIT( KDescription , "Test case passed"); |
|
1020 aResult.SetResult( KErrNone, KDescription ); |
|
1021 } |
|
1022 |
|
1023 CleanupStack::PopAndDestroy( item ); |
|
1024 |
|
1025 // Case was executed |
|
1026 return KErrNone; |
|
1027 } |
|
1028 |
|
1029 /* |
|
1030 ------------------------------------------------------------------------------- |
|
1031 |
|
1032 Class: CFavouritesEngineTest |
|
1033 |
|
1034 Method: ItemSetParentFolderTestL |
|
1035 |
|
1036 Description: Test setting the item's parent folder using the SetParentFolder method. |
|
1037 |
|
1038 Parameters: TTestResult& aErrorDescription: out: |
|
1039 Test result and on error case a short description of error |
|
1040 |
|
1041 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1042 |
|
1043 Errors/Exceptions: None |
|
1044 |
|
1045 Status: Approved |
|
1046 |
|
1047 ------------------------------------------------------------------------------- |
|
1048 */ |
|
1049 TInt CFavouritesEngineTest::ItemSetParentFolderTestL( TTestResult& aResult ) |
|
1050 { |
|
1051 /* Simple server connect */ |
|
1052 _LIT( KDefinition ,"State"); |
|
1053 _LIT( KData ,"Setting the item's parent folder with SetParentFolder method"); |
|
1054 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1055 |
|
1056 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1057 |
|
1058 item->SetParentFolder(3); |
|
1059 |
|
1060 _LIT( KData2 ,"Finished"); |
|
1061 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1062 |
|
1063 if (item->ParentFolder() == 3) |
|
1064 { |
|
1065 _LIT( KDescription , "Test case passed"); |
|
1066 aResult.SetResult( KErrNone, KDescription ); |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 _LIT( KDescription , "Test case failed"); |
|
1071 aResult.SetResult( KErrGeneral, KDescription ); |
|
1072 } |
|
1073 |
|
1074 CleanupStack::PopAndDestroy( item ); |
|
1075 |
|
1076 // Case was executed |
|
1077 return KErrNone; |
|
1078 } |
|
1079 |
|
1080 /* |
|
1081 ------------------------------------------------------------------------------- |
|
1082 |
|
1083 Class: CFavouritesEngineTest |
|
1084 |
|
1085 Method: ItemSetTypeTestL |
|
1086 |
|
1087 Description: Test setting the item's type using the SetType method. |
|
1088 |
|
1089 Parameters: TTestResult& aErrorDescription: out: |
|
1090 Test result and on error case a short description of error |
|
1091 |
|
1092 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1093 |
|
1094 Errors/Exceptions: None |
|
1095 |
|
1096 Status: Approved |
|
1097 |
|
1098 ------------------------------------------------------------------------------- |
|
1099 */ |
|
1100 TInt CFavouritesEngineTest::ItemSetTypeTestL( TTestResult& aResult ) |
|
1101 { |
|
1102 /* Simple server connect */ |
|
1103 _LIT( KDefinition ,"State"); |
|
1104 _LIT( KData ,"Setting the item's type with SetType method"); |
|
1105 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1106 |
|
1107 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1108 |
|
1109 item->SetType(CFavouritesItem::EFolder); |
|
1110 |
|
1111 _LIT( KData2 ,"Finished"); |
|
1112 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1113 |
|
1114 if (item->Type() == CFavouritesItem::EFolder) |
|
1115 { |
|
1116 _LIT( KDescription , "Test case passed"); |
|
1117 aResult.SetResult( KErrNone, KDescription ); |
|
1118 } |
|
1119 else |
|
1120 { |
|
1121 _LIT( KDescription , "Test case failed"); |
|
1122 aResult.SetResult( KErrGeneral, KDescription ); |
|
1123 } |
|
1124 |
|
1125 CleanupStack::PopAndDestroy( item ); |
|
1126 |
|
1127 // Case was executed |
|
1128 return KErrNone; |
|
1129 } |
|
1130 |
|
1131 /* |
|
1132 ------------------------------------------------------------------------------- |
|
1133 |
|
1134 Class: CFavouritesEngineTest |
|
1135 |
|
1136 Method: ItemSetNameLTestL |
|
1137 |
|
1138 Description: Test setting the item's name using the SetNameL method. |
|
1139 |
|
1140 Parameters: TTestResult& aErrorDescription: out: |
|
1141 Test result and on error case a short description of error |
|
1142 |
|
1143 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1144 |
|
1145 Errors/Exceptions: None |
|
1146 |
|
1147 Status: Approved |
|
1148 |
|
1149 ------------------------------------------------------------------------------- |
|
1150 */ |
|
1151 TInt CFavouritesEngineTest::ItemSetNameLTestL( TTestResult& aResult ) |
|
1152 { |
|
1153 /* Simple server connect */ |
|
1154 _LIT( KDefinition ,"State"); |
|
1155 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1156 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1157 |
|
1158 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1159 |
|
1160 item->SetNameL( _L("Item Name") ); |
|
1161 |
|
1162 _LIT( KData2 ,"Finished"); |
|
1163 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1164 |
|
1165 if (item->Name() == _L("Item Name")) |
|
1166 { |
|
1167 _LIT( KDescription , "Test case passed"); |
|
1168 aResult.SetResult( KErrNone, KDescription ); |
|
1169 } |
|
1170 else |
|
1171 { |
|
1172 _LIT( KDescription , "Test case failed"); |
|
1173 aResult.SetResult( KErrGeneral, KDescription ); |
|
1174 } |
|
1175 |
|
1176 CleanupStack::PopAndDestroy( item ); |
|
1177 |
|
1178 // Case was executed |
|
1179 return KErrNone; |
|
1180 } |
|
1181 |
|
1182 /* |
|
1183 ------------------------------------------------------------------------------- |
|
1184 |
|
1185 Class: CFavouritesEngineTest |
|
1186 |
|
1187 Method: ItemSetUrlLTestL |
|
1188 |
|
1189 Description: Test setting the item's url using the SetUrlL method. |
|
1190 |
|
1191 Parameters: TTestResult& aErrorDescription: out: |
|
1192 Test result and on error case a short description of error |
|
1193 |
|
1194 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1195 |
|
1196 Errors/Exceptions: None |
|
1197 |
|
1198 Status: Approved |
|
1199 |
|
1200 ------------------------------------------------------------------------------- |
|
1201 */ |
|
1202 TInt CFavouritesEngineTest::ItemSetUrlLTestL( TTestResult& aResult ) |
|
1203 { |
|
1204 /* Simple server connect */ |
|
1205 _LIT( KDefinition ,"State"); |
|
1206 _LIT( KData ,"Setting the item's url with SetUrlL method"); |
|
1207 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1208 |
|
1209 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1210 |
|
1211 item->SetUrlL( _L("http://www.nokia.com") ); |
|
1212 |
|
1213 _LIT( KData2 ,"Finished"); |
|
1214 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1215 |
|
1216 if (item->Url() == _L("http://www.nokia.com")) |
|
1217 { |
|
1218 _LIT( KDescription , "Test case passed"); |
|
1219 aResult.SetResult( KErrNone, KDescription ); |
|
1220 } |
|
1221 else |
|
1222 { |
|
1223 _LIT( KDescription , "Test case failed"); |
|
1224 aResult.SetResult( KErrGeneral, KDescription ); |
|
1225 } |
|
1226 |
|
1227 CleanupStack::PopAndDestroy( item ); |
|
1228 |
|
1229 // Case was executed |
|
1230 return KErrNone; |
|
1231 } |
|
1232 |
|
1233 /* |
|
1234 ------------------------------------------------------------------------------- |
|
1235 |
|
1236 Class: CFavouritesEngineTest |
|
1237 |
|
1238 Method: ItemSetWapApTestL |
|
1239 |
|
1240 Description: Test setting the item's access point using the SetWapAp method. |
|
1241 |
|
1242 Parameters: TTestResult& aErrorDescription: out: |
|
1243 Test result and on error case a short description of error |
|
1244 |
|
1245 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1246 |
|
1247 Errors/Exceptions: None |
|
1248 |
|
1249 Status: Approved |
|
1250 |
|
1251 ------------------------------------------------------------------------------- |
|
1252 */ |
|
1253 TInt CFavouritesEngineTest::ItemSetWapApTestL( TTestResult& aResult ) |
|
1254 { |
|
1255 /* Simple server connect */ |
|
1256 _LIT( KDefinition ,"State"); |
|
1257 _LIT( KData ,"Setting the item's access point with SetWapAp method"); |
|
1258 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1259 |
|
1260 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1261 |
|
1262 TFavouritesWapAp accessPoint; |
|
1263 accessPoint.SetApId( 22 ); |
|
1264 item->SetWapAp( accessPoint ); |
|
1265 |
|
1266 _LIT( KData2 ,"Finished"); |
|
1267 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1268 |
|
1269 if (item->WapAp().ApId() == 22) |
|
1270 { |
|
1271 _LIT( KDescription , "Test case passed"); |
|
1272 aResult.SetResult( KErrNone, KDescription ); |
|
1273 } |
|
1274 else |
|
1275 { |
|
1276 _LIT( KDescription , "Test case failed"); |
|
1277 aResult.SetResult( KErrGeneral, KDescription ); |
|
1278 } |
|
1279 |
|
1280 CleanupStack::PopAndDestroy( item ); |
|
1281 |
|
1282 // Case was executed |
|
1283 return KErrNone; |
|
1284 } |
|
1285 |
|
1286 /* |
|
1287 ------------------------------------------------------------------------------- |
|
1288 |
|
1289 Class: CFavouritesEngineTest |
|
1290 |
|
1291 Method: ItemSetUserNameLTestL |
|
1292 |
|
1293 Description: Test setting the item's user name using the SetUserNameL method. |
|
1294 |
|
1295 Parameters: TTestResult& aErrorDescription: out: |
|
1296 Test result and on error case a short description of error |
|
1297 |
|
1298 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1299 |
|
1300 Errors/Exceptions: None |
|
1301 |
|
1302 Status: Approved |
|
1303 |
|
1304 ------------------------------------------------------------------------------- |
|
1305 */ |
|
1306 TInt CFavouritesEngineTest::ItemSetUserNameLTestL( TTestResult& aResult ) |
|
1307 { |
|
1308 /* Simple server connect */ |
|
1309 _LIT( KDefinition ,"State"); |
|
1310 _LIT( KData ,"Setting the item's user name with SetUserNameL method"); |
|
1311 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1312 |
|
1313 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1314 |
|
1315 item->SetUserNameL( _L("New User") ); |
|
1316 |
|
1317 _LIT( KData2 ,"Finished"); |
|
1318 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1319 |
|
1320 if (item->UserName() == _L("New User")) |
|
1321 { |
|
1322 _LIT( KDescription , "Test case passed"); |
|
1323 aResult.SetResult( KErrNone, KDescription ); |
|
1324 } |
|
1325 else |
|
1326 { |
|
1327 _LIT( KDescription , "Test case failed"); |
|
1328 aResult.SetResult( KErrGeneral, KDescription ); |
|
1329 } |
|
1330 |
|
1331 CleanupStack::PopAndDestroy( item ); |
|
1332 |
|
1333 // Case was executed |
|
1334 return KErrNone; |
|
1335 } |
|
1336 |
|
1337 /* |
|
1338 ------------------------------------------------------------------------------- |
|
1339 |
|
1340 Class: CFavouritesEngineTest |
|
1341 |
|
1342 Method: ItemSetPasswordLTestL |
|
1343 |
|
1344 Description: Test setting the item's password using the SetPasswordL method. |
|
1345 |
|
1346 Parameters: TTestResult& aErrorDescription: out: |
|
1347 Test result and on error case a short description of error |
|
1348 |
|
1349 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1350 |
|
1351 Errors/Exceptions: None |
|
1352 |
|
1353 Status: Approved |
|
1354 |
|
1355 ------------------------------------------------------------------------------- |
|
1356 */ |
|
1357 TInt CFavouritesEngineTest::ItemSetPasswordLTestL( TTestResult& aResult ) |
|
1358 { |
|
1359 /* Simple server connect */ |
|
1360 _LIT( KDefinition ,"State"); |
|
1361 _LIT( KData ,"Setting the item's password with SetPasswordL method"); |
|
1362 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1363 |
|
1364 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1365 |
|
1366 item->SetPasswordL( _L("12345") ); |
|
1367 |
|
1368 _LIT( KData2 ,"Finished"); |
|
1369 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1370 |
|
1371 if (item->Password() == _L("12345")) |
|
1372 { |
|
1373 _LIT( KDescription , "Test case passed"); |
|
1374 aResult.SetResult( KErrNone, KDescription ); |
|
1375 } |
|
1376 else |
|
1377 { |
|
1378 _LIT( KDescription , "Test case failed"); |
|
1379 aResult.SetResult( KErrGeneral, KDescription ); |
|
1380 } |
|
1381 |
|
1382 CleanupStack::PopAndDestroy( item ); |
|
1383 |
|
1384 // Case was executed |
|
1385 return KErrNone; |
|
1386 } |
|
1387 |
|
1388 /* |
|
1389 ------------------------------------------------------------------------------- |
|
1390 |
|
1391 Class: CFavouritesEngineTest |
|
1392 |
|
1393 Method: ItemSetContextIdTestL |
|
1394 |
|
1395 Description: Test setting the item's context id using the SetContextId method. |
|
1396 |
|
1397 Parameters: TTestResult& aErrorDescription: out: |
|
1398 Test result and on error case a short description of error |
|
1399 |
|
1400 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1401 |
|
1402 Errors/Exceptions: None |
|
1403 |
|
1404 Status: Approved |
|
1405 |
|
1406 ------------------------------------------------------------------------------- |
|
1407 */ |
|
1408 TInt CFavouritesEngineTest::ItemSetContextIdTestL( TTestResult& aResult ) |
|
1409 { |
|
1410 /* Simple server connect */ |
|
1411 _LIT( KDefinition ,"State"); |
|
1412 _LIT( KData ,"Setting the item's context id with SetContextId method"); |
|
1413 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1414 |
|
1415 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1416 |
|
1417 item->SetContextId(22); |
|
1418 |
|
1419 _LIT( KData2 ,"Finished"); |
|
1420 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1421 |
|
1422 if (item->ContextId() == 22) |
|
1423 { |
|
1424 _LIT( KDescription , "Test case passed"); |
|
1425 aResult.SetResult( KErrNone, KDescription ); |
|
1426 } |
|
1427 else |
|
1428 { |
|
1429 _LIT( KDescription , "Test case failed"); |
|
1430 aResult.SetResult( KErrGeneral, KDescription ); |
|
1431 } |
|
1432 |
|
1433 CleanupStack::PopAndDestroy( item ); |
|
1434 |
|
1435 // Case was executed |
|
1436 return KErrNone; |
|
1437 } |
|
1438 |
|
1439 // ================= OTHER EXPORTED FUNCTIONS ================================= |
|
1440 |
|
1441 // End of File |