258 /* |
261 /* |
259 ------------------------------------------------------------------------------- |
262 ------------------------------------------------------------------------------- |
260 |
263 |
261 Class: CFavouritesEngineTest |
264 Class: CFavouritesEngineTest |
262 |
265 |
|
266 Method: ItemAssignCompleteTestL |
|
267 |
|
268 Description: Assigning one item to another with the Assign(=) method. |
|
269 |
|
270 Parameters: TTestResult& aErrorDescription: out: |
|
271 Test result and on error case a short description of error |
|
272 |
|
273 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
274 |
|
275 Errors/Exceptions: None |
|
276 |
|
277 Status: Approved |
|
278 |
|
279 ------------------------------------------------------------------------------- |
|
280 */ |
|
281 TInt CFavouritesEngineTest::ItemAssignCompleteTestL( TTestResult& aResult ) |
|
282 { |
|
283 /* Simple server connect */ |
|
284 _LIT( KDefinition ,"State"); |
|
285 _LIT( KData ,"Assigning item with Assign(=) operator"); |
|
286 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
287 |
|
288 TFavouritesWapAp accessPoint1; |
|
289 accessPoint1.SetApId( 22 ); |
|
290 |
|
291 CFavouritesItem* item1 = CFavouritesItem::NewLC(); |
|
292 item1->SetNameL( _L("Item1") ); |
|
293 item1->SetUrlL( _L("http://www.nokia.com") ); |
|
294 item1->SetUserNameL( _L("Name 1")); |
|
295 item1->SetPasswordL( _L("Password 1")); |
|
296 item1->SetParentFolder(3); |
|
297 item1->SetContextId(22); |
|
298 item1->SetHidden(1); |
|
299 item1->SetWapAp( accessPoint1 ); |
|
300 |
|
301 |
|
302 TFavouritesWapAp accessPoint2; |
|
303 accessPoint2.SetApId( 24 ); |
|
304 |
|
305 CFavouritesItem* item2 = CFavouritesItem::NewLC(); |
|
306 item2->SetNameL( _L("Item2") ); |
|
307 item2->SetUrlL( _L("http://www.google.com") ); |
|
308 item2->SetUserNameL( _L("Name 2")); |
|
309 item2->SetPasswordL( _L("Password 2")); |
|
310 item2->SetParentFolder(4); |
|
311 item2->SetContextId(24); |
|
312 // item2->SetHidden(0); |
|
313 item2->SetWapAp( accessPoint2 ); |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 *item1 = *item2; |
|
319 |
|
320 _LIT( KData2 ,"Finished"); |
|
321 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
322 |
|
323 if ( |
|
324 (item1->Name() == item2->Name()) && |
|
325 (item1->Url() == item2->Url()) && |
|
326 (item1->UserName() == item2->UserName()) && |
|
327 (item1->Password() == item2->Password()) && |
|
328 (item1->ContextId() == item2->ContextId()) && |
|
329 (item1->ParentFolder() == item2->ParentFolder()) && |
|
330 (item1->Type() == item2->Type()) && |
|
331 (item1->WapAp().ApId() == item2->WapAp().ApId()) && |
|
332 (item1->IsItem() == item2->IsItem()) && |
|
333 (item1->IsFolder() == item2->IsFolder()) && |
|
334 (item1->IsHidden() == item2->IsHidden()) && |
|
335 // (item1->Uid() == item2->Uid()) && |
|
336 (item1->Modified() == item2->Modified()) |
|
337 |
|
338 ) |
|
339 { |
|
340 _LIT( KDescription , "Test case passed"); |
|
341 aResult.SetResult( KErrNone, KDescription ); |
|
342 } |
|
343 else |
|
344 { |
|
345 _LIT( KDescription , "Test case failed"); |
|
346 aResult.SetResult( KErrGeneral, KDescription ); |
|
347 } |
|
348 |
|
349 CleanupStack::PopAndDestroy( 2 ); // item1, item2 |
|
350 |
|
351 // Case was executed |
|
352 return KErrNone; |
|
353 } |
|
354 |
|
355 |
|
356 /* |
|
357 ------------------------------------------------------------------------------- |
|
358 |
|
359 Class: CFavouritesEngineTest |
|
360 |
|
361 Method: ItemAssignSelfTestL |
|
362 |
|
363 Description: Assigning one item to self with the Assign(=) method. |
|
364 |
|
365 Parameters: TTestResult& aErrorDescription: out: |
|
366 Test result and on error case a short description of error |
|
367 |
|
368 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
369 |
|
370 Errors/Exceptions: None |
|
371 |
|
372 Status: Approved |
|
373 |
|
374 ------------------------------------------------------------------------------- |
|
375 */ |
|
376 TInt CFavouritesEngineTest::ItemAssignSelfTestL( TTestResult& aResult ) |
|
377 { |
|
378 /* Simple server connect */ |
|
379 _LIT( KDefinition ,"State"); |
|
380 _LIT( KData ,"Assigning item with Assign(=) operator"); |
|
381 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
382 |
|
383 CFavouritesItem* item1 = CFavouritesItem::NewLC(); |
|
384 item1->SetNameL( _L("Item1") ); |
|
385 |
|
386 *item1 = *item1; //copy to self, should not affect anything |
|
387 |
|
388 _LIT( KData2 ,"Finished"); |
|
389 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
390 |
|
391 if (item1->Name() == _L("Item1")) |
|
392 { |
|
393 _LIT( KDescription , "Test case passed"); |
|
394 aResult.SetResult( KErrNone, KDescription ); |
|
395 } |
|
396 else |
|
397 { |
|
398 _LIT( KDescription , "Test case failed"); |
|
399 aResult.SetResult( KErrGeneral, KDescription ); |
|
400 } |
|
401 |
|
402 CleanupStack::PopAndDestroy( item1 ); |
|
403 |
|
404 // Case was executed |
|
405 return KErrNone; |
|
406 } |
|
407 |
|
408 /* |
|
409 ------------------------------------------------------------------------------- |
|
410 |
|
411 Class: CFavouritesEngineTest |
|
412 |
263 Method: ItemUidTestL |
413 Method: ItemUidTestL |
264 |
414 |
265 Description: Test getting the item's Uid using the Uid method. |
415 Description: Test getting the item's Uid using the Uid method. |
266 |
416 |
267 Parameters: TTestResult& aErrorDescription: out: |
417 Parameters: TTestResult& aErrorDescription: out: |
811 else |
1014 else |
812 { |
1015 { |
813 _LIT( KDescription , "Test case failed"); |
1016 _LIT( KDescription , "Test case failed"); |
814 aResult.SetResult( KErrGeneral, KDescription ); |
1017 aResult.SetResult( KErrGeneral, KDescription ); |
815 } |
1018 } |
|
1019 |
|
1020 CleanupStack::PopAndDestroy( item ); |
|
1021 |
|
1022 // Case was executed |
|
1023 return KErrNone; |
|
1024 } |
|
1025 |
|
1026 /* |
|
1027 ------------------------------------------------------------------------------- |
|
1028 |
|
1029 Class: CFavouritesEngineTest |
|
1030 |
|
1031 Method: ItemIsFolderEFolderTestL |
|
1032 |
|
1033 Description: Test if the item of type EFolder is a folder using the IsFolder method. |
|
1034 |
|
1035 Parameters: TTestResult& aErrorDescription: out: |
|
1036 Test result and on error case a short description of error |
|
1037 |
|
1038 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1039 |
|
1040 Errors/Exceptions: None |
|
1041 |
|
1042 Status: Draft |
|
1043 |
|
1044 ------------------------------------------------------------------------------- |
|
1045 */ |
|
1046 TInt CFavouritesEngineTest::ItemIsFolderEFolderTestL( TTestResult& aResult ) |
|
1047 { |
|
1048 /* Simple server connect */ |
|
1049 _LIT( KDefinition ,"State"); |
|
1050 _LIT( KData ,"Checking if the folder is a folder with IsFolder method"); |
|
1051 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1052 |
|
1053 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1054 /* set item as folder type */ |
|
1055 item->SetType(CFavouritesItem::EFolder); |
|
1056 TBool itemIsFolder = item->IsFolder(); |
|
1057 |
|
1058 _LIT( KData2 ,"Finished"); |
|
1059 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1060 |
|
1061 if (itemIsFolder) |
|
1062 { |
|
1063 _LIT( KDescription , "Test case passed"); |
|
1064 aResult.SetResult( KErrNone, KDescription ); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 _LIT( KDescription , "Test case failed"); |
|
1069 aResult.SetResult( KErrGeneral, KDescription ); |
|
1070 } |
816 |
1071 |
817 CleanupStack::PopAndDestroy( item ); |
1072 CleanupStack::PopAndDestroy( item ); |
818 |
1073 |
819 // Case was executed |
1074 // Case was executed |
820 return KErrNone; |
1075 return KErrNone; |
1131 /* |
1386 /* |
1132 ------------------------------------------------------------------------------- |
1387 ------------------------------------------------------------------------------- |
1133 |
1388 |
1134 Class: CFavouritesEngineTest |
1389 Class: CFavouritesEngineTest |
1135 |
1390 |
|
1391 Method: ItemSetTypeNoneTestL |
|
1392 |
|
1393 Description: Test setting the item's type to ENone using the SetType method. Type should not be affected. |
|
1394 |
|
1395 Parameters: TTestResult& aErrorDescription: out: |
|
1396 Test result and on error case a short description of error |
|
1397 |
|
1398 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1399 |
|
1400 Errors/Exceptions: None |
|
1401 |
|
1402 Status: Draft |
|
1403 |
|
1404 ------------------------------------------------------------------------------- |
|
1405 */ |
|
1406 TInt CFavouritesEngineTest::ItemSetTypeNoneTestL( TTestResult& aResult ) |
|
1407 { |
|
1408 /* Simple server connect */ |
|
1409 _LIT( KDefinition ,"State"); |
|
1410 _LIT( KData ,"Setting the item's type to None with SetType method"); |
|
1411 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1412 |
|
1413 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1414 |
|
1415 item->SetType(CFavouritesItem::ENone); |
|
1416 |
|
1417 _LIT( KData2 ,"Finished"); |
|
1418 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1419 |
|
1420 if (item->Type() != CFavouritesItem::ENone) |
|
1421 { |
|
1422 _LIT( KDescription , "Test case passed"); |
|
1423 aResult.SetResult( KErrNone, KDescription ); |
|
1424 } |
|
1425 else |
|
1426 { |
|
1427 _LIT( KDescription , "Test case failed"); |
|
1428 aResult.SetResult( KErrGeneral, KDescription ); |
|
1429 } |
|
1430 |
|
1431 CleanupStack::PopAndDestroy( item ); |
|
1432 |
|
1433 // Case was executed |
|
1434 return KErrNone; |
|
1435 } |
|
1436 |
|
1437 /* |
|
1438 ------------------------------------------------------------------------------- |
|
1439 |
|
1440 Class: CFavouritesEngineTest |
|
1441 |
1136 Method: ItemSetNameLTestL |
1442 Method: ItemSetNameLTestL |
1137 |
1443 |
1138 Description: Test setting the item's name using the SetNameL method. |
1444 Description: Test setting the item's name using the SetNameL method. |
1139 |
1445 |
1140 Parameters: TTestResult& aErrorDescription: out: |
1446 Parameters: TTestResult& aErrorDescription: out: |
1177 |
1483 |
1178 // Case was executed |
1484 // Case was executed |
1179 return KErrNone; |
1485 return KErrNone; |
1180 } |
1486 } |
1181 |
1487 |
1182 /* |
1488 |
|
1489 /* |
|
1490 ------------------------------------------------------------------------------- |
|
1491 |
|
1492 Class: CFavouritesEngineTest |
|
1493 |
|
1494 Method: ItemSetNameFolderLTestL |
|
1495 |
|
1496 Description: Test setting the item (folder)'s name using the SetNameL method. |
|
1497 |
|
1498 Parameters: TTestResult& aErrorDescription: out: |
|
1499 Test result and on error case a short description of error |
|
1500 |
|
1501 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1502 |
|
1503 Errors/Exceptions: None |
|
1504 |
|
1505 Status: Approved |
|
1506 |
|
1507 ------------------------------------------------------------------------------- |
|
1508 */ |
|
1509 TInt CFavouritesEngineTest::ItemSetNameFolderLTestL( TTestResult& aResult ) |
|
1510 { |
|
1511 /* Simple server connect */ |
|
1512 _LIT( KDefinition ,"State"); |
|
1513 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1514 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1515 |
|
1516 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1517 item->SetType(CFavouritesItem::EFolder); |
|
1518 item->SetNameL( _L("Fav Folder") ); |
|
1519 |
|
1520 _LIT( KData2 ,"Finished"); |
|
1521 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1522 |
|
1523 if (item->Name() == _L("Fav Folder")) |
|
1524 { |
|
1525 _LIT( KDescription , "Test case passed"); |
|
1526 aResult.SetResult( KErrNone, KDescription ); |
|
1527 } |
|
1528 else |
|
1529 { |
|
1530 _LIT( KDescription , "Test case failed"); |
|
1531 aResult.SetResult( KErrGeneral, KDescription ); |
|
1532 } |
|
1533 |
|
1534 CleanupStack::PopAndDestroy( item ); |
|
1535 |
|
1536 // Case was executed |
|
1537 return KErrNone; |
|
1538 } |
|
1539 |
|
1540 |
|
1541 /* |
|
1542 ------------------------------------------------------------------------------- |
|
1543 |
|
1544 Class: CFavouritesEngineTest |
|
1545 |
|
1546 Method: ItemSetNameMaxLengthTruncateLTestL |
|
1547 |
|
1548 Description: Test setting the item's name and maxlength using the SetNameL method. |
|
1549 |
|
1550 Parameters: TTestResult& aErrorDescription: out: |
|
1551 Test result and on error case a short description of error |
|
1552 |
|
1553 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1554 |
|
1555 Errors/Exceptions: None |
|
1556 |
|
1557 Status: Draft |
|
1558 |
|
1559 ------------------------------------------------------------------------------- |
|
1560 */ |
|
1561 TInt CFavouritesEngineTest::ItemSetNameMaxLengthTruncateLTestL( TTestResult& aResult ) |
|
1562 { |
|
1563 /* Simple server connect */ |
|
1564 _LIT( KDefinition ,"State"); |
|
1565 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1566 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1567 |
|
1568 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1569 TRAPD(err, item->SetNameL( _L("Item Name longer than KFavouritesMaxName limit which is 50 chars"))); |
|
1570 |
|
1571 _LIT( KData2 ,"Finished"); |
|
1572 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1573 |
|
1574 if ((item->Name().Length() == KFavouritesMaxName)&& (err==KErrOverflow)) |
|
1575 { |
|
1576 _LIT( KDescription , "Test case passed"); |
|
1577 aResult.SetResult( KErrNone, KDescription ); |
|
1578 } |
|
1579 else |
|
1580 { |
|
1581 _LIT( KDescription , "Test case failed"); |
|
1582 aResult.SetResult( KErrGeneral, KDescription ); |
|
1583 } |
|
1584 |
|
1585 CleanupStack::PopAndDestroy( item ); |
|
1586 |
|
1587 // Case was executed |
|
1588 return KErrNone; |
|
1589 } |
|
1590 |
|
1591 |
|
1592 /* |
|
1593 ------------------------------------------------------------------------------- |
|
1594 |
|
1595 Class: CFavouritesEngineTest |
|
1596 |
|
1597 Method: ItemSetNameTrimStringLTestL |
|
1598 |
|
1599 Description: Test setting the item's name with trim using the SetNameL method. |
|
1600 |
|
1601 Parameters: TTestResult& aErrorDescription: out: |
|
1602 Test result and on error case a short description of error |
|
1603 |
|
1604 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1605 |
|
1606 Errors/Exceptions: None |
|
1607 |
|
1608 Status: Draft |
|
1609 |
|
1610 ------------------------------------------------------------------------------- |
|
1611 */ |
|
1612 TInt CFavouritesEngineTest::ItemSetNameTrimStringLTestL( TTestResult& aResult ) |
|
1613 { |
|
1614 /* Simple server connect */ |
|
1615 _LIT( KDefinition ,"State"); |
|
1616 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1617 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1618 |
|
1619 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1620 item->SetNameL( _L(" some name ")); |
|
1621 |
|
1622 _LIT( KData2 ,"Finished"); |
|
1623 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1624 |
|
1625 if (item->Name()== _L("some name")) |
|
1626 { |
|
1627 _LIT( KDescription , "Test case passed"); |
|
1628 aResult.SetResult( KErrNone, KDescription ); |
|
1629 } |
|
1630 else |
|
1631 { |
|
1632 _LIT( KDescription , "Test case failed"); |
|
1633 aResult.SetResult( KErrGeneral, KDescription ); |
|
1634 } |
|
1635 |
|
1636 CleanupStack::PopAndDestroy( item ); |
|
1637 |
|
1638 // Case was executed |
|
1639 return KErrNone; |
|
1640 } |
|
1641 |
|
1642 /* |
|
1643 ------------------------------------------------------------------------------- |
|
1644 |
|
1645 Class: CFavouritesEngineTest |
|
1646 |
|
1647 Method: ItemSetNameRTLMarkLTestL |
|
1648 |
|
1649 Description: Test setting the item's name with trim using the SetNameL method. |
|
1650 |
|
1651 Parameters: TTestResult& aErrorDescription: out: |
|
1652 Test result and on error case a short description of error |
|
1653 |
|
1654 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1655 |
|
1656 Errors/Exceptions: None |
|
1657 |
|
1658 Status: Draft |
|
1659 |
|
1660 ------------------------------------------------------------------------------- |
|
1661 */ |
|
1662 TInt CFavouritesEngineTest::ItemSetNameRTLMarkLTestL( TTestResult& aResult ) |
|
1663 { |
|
1664 /* Simple server connect */ |
|
1665 _LIT( KDefinition ,"State"); |
|
1666 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1667 |
|
1668 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1669 |
|
1670 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1671 item->SetNameL( _L("\x200F some name \x200F")); |
|
1672 |
|
1673 _LIT( KData2 ,"Finished"); |
|
1674 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1675 |
|
1676 if (item->Name()== _L("some name")) |
|
1677 { |
|
1678 _LIT( KDescription , "Test case passed"); |
|
1679 aResult.SetResult( KErrNone, KDescription ); |
|
1680 } |
|
1681 else |
|
1682 { |
|
1683 _LIT( KDescription , "Test case failed"); |
|
1684 aResult.SetResult( KErrGeneral, KDescription ); |
|
1685 } |
|
1686 |
|
1687 CleanupStack::PopAndDestroy( item ); |
|
1688 |
|
1689 // Case was executed |
|
1690 return KErrNone; |
|
1691 } |
|
1692 |
|
1693 |
|
1694 /* |
|
1695 ------------------------------------------------------------------------------- |
|
1696 |
|
1697 Class: CFavouritesEngineTest |
|
1698 |
|
1699 Method: ItemSetNameEmptyStringLTestL |
|
1700 |
|
1701 Description: Test setting the item's name with trim using the SetNameL method. |
|
1702 |
|
1703 Parameters: TTestResult& aErrorDescription: out: |
|
1704 Test result and on error case a short description of error |
|
1705 |
|
1706 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1707 |
|
1708 Errors/Exceptions: None |
|
1709 |
|
1710 Status: Draft |
|
1711 |
|
1712 ------------------------------------------------------------------------------- |
|
1713 */ |
|
1714 TInt CFavouritesEngineTest::ItemSetNameEmptyStringLTestL( TTestResult& aResult ) |
|
1715 { |
|
1716 /* Simple server connect */ |
|
1717 _LIT( KDefinition ,"State"); |
|
1718 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1719 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1720 |
|
1721 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1722 TRAPD(err, item->SetNameL( _L(""))); //returns error |
|
1723 |
|
1724 _LIT( KData2 ,"Finished"); |
|
1725 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1726 |
|
1727 if (err!=KErrNone) |
|
1728 { |
|
1729 _LIT( KDescription , "Test case passed"); |
|
1730 aResult.SetResult( KErrNone, KDescription ); |
|
1731 } |
|
1732 else |
|
1733 { |
|
1734 _LIT( KDescription , "Test case failed"); |
|
1735 aResult.SetResult( KErrGeneral, KDescription ); |
|
1736 } |
|
1737 |
|
1738 CleanupStack::PopAndDestroy( item ); |
|
1739 |
|
1740 // Case was executed |
|
1741 return KErrNone; |
|
1742 } |
|
1743 |
|
1744 /* |
|
1745 ------------------------------------------------------------------------------- |
|
1746 |
|
1747 Class: CFavouritesEngineTest |
|
1748 |
|
1749 Method: ItemSetNameWhiteSpaceLTestL |
|
1750 |
|
1751 Description: Test setting the item's name with trim using the SetNameL method. |
|
1752 |
|
1753 Parameters: TTestResult& aErrorDescription: out: |
|
1754 Test result and on error case a short description of error |
|
1755 |
|
1756 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1757 |
|
1758 Errors/Exceptions: None |
|
1759 |
|
1760 Status: Draft |
|
1761 |
|
1762 ------------------------------------------------------------------------------- |
|
1763 */ |
|
1764 TInt CFavouritesEngineTest::ItemSetNameWhiteSpaceLTestL( TTestResult& aResult ) |
|
1765 { |
|
1766 /* Simple server connect */ |
|
1767 _LIT( KDefinition ,"State"); |
|
1768 _LIT( KData ,"Setting the item's name with SetNameL method"); |
|
1769 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1770 |
|
1771 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1772 TRAPD(err, item->SetNameL( _L(" "))); //returns error |
|
1773 |
|
1774 _LIT( KData2 ,"Finished"); |
|
1775 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1776 |
|
1777 if (err!=KErrNone) |
|
1778 { |
|
1779 _LIT( KDescription , "Test case passed"); |
|
1780 aResult.SetResult( KErrNone, KDescription ); |
|
1781 } |
|
1782 else |
|
1783 { |
|
1784 _LIT( KDescription , "Test case failed"); |
|
1785 aResult.SetResult( KErrGeneral, KDescription ); |
|
1786 } |
|
1787 |
|
1788 CleanupStack::PopAndDestroy( item ); |
|
1789 |
|
1790 // Case was executed |
|
1791 return KErrNone; |
|
1792 } |
|
1793 |
|
1794 |
|
1795 /* |
|
1796 |
1183 ------------------------------------------------------------------------------- |
1797 ------------------------------------------------------------------------------- |
1184 |
1798 |
1185 Class: CFavouritesEngineTest |
1799 Class: CFavouritesEngineTest |
1186 |
1800 |
1187 Method: ItemSetUrlLTestL |
1801 Method: ItemSetUrlLTestL |
1332 |
1946 |
1333 // Case was executed |
1947 // Case was executed |
1334 return KErrNone; |
1948 return KErrNone; |
1335 } |
1949 } |
1336 |
1950 |
|
1951 |
|
1952 /* |
|
1953 ------------------------------------------------------------------------------- |
|
1954 |
|
1955 Class: CFavouritesEngineTest |
|
1956 |
|
1957 Method: ItemSetUserNameMaxLengthLTestL |
|
1958 |
|
1959 Description: Test setting the item's user name using the SetUserNameL method. |
|
1960 |
|
1961 Parameters: TTestResult& aErrorDescription: out: |
|
1962 Test result and on error case a short description of error |
|
1963 |
|
1964 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1965 |
|
1966 Errors/Exceptions: None |
|
1967 |
|
1968 Status: Approved |
|
1969 |
|
1970 ------------------------------------------------------------------------------- |
|
1971 */ |
|
1972 TInt CFavouritesEngineTest::ItemSetUserNameMaxLengthLTestL( TTestResult& aResult ) |
|
1973 { |
|
1974 /* Simple server connect */ |
|
1975 _LIT( KDefinition ,"State"); |
|
1976 _LIT( KData ,"Setting the item's user name with SetUserNameL method"); |
|
1977 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1978 |
|
1979 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1980 // TInt err; |
|
1981 |
|
1982 TRAPD(err, item->SetUserNameL( _L("New User name longer than allowed by the limit of KFavouritesMaxUserName which is 40 chars at this moment") )); |
|
1983 |
|
1984 _LIT( KData2 ,"Finished"); |
|
1985 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1986 |
|
1987 if (err==KErrOverflow) |
|
1988 { |
|
1989 _LIT( KDescription , "Test case passed"); |
|
1990 aResult.SetResult( KErrNone, KDescription ); |
|
1991 } |
|
1992 else |
|
1993 { |
|
1994 _LIT( KDescription , "Test case failed"); |
|
1995 aResult.SetResult( KErrGeneral, KDescription ); |
|
1996 } |
|
1997 |
|
1998 CleanupStack::PopAndDestroy( item ); |
|
1999 |
|
2000 // Case was executed |
|
2001 return KErrNone; |
|
2002 } |
|
2003 |
|
2004 |
|
2005 /* |
|
2006 ------------------------------------------------------------------------------- |
|
2007 |
|
2008 Class: CFavouritesEngineTest |
|
2009 |
|
2010 Method: ItemSetUserNameTruncateLengthLTestL |
|
2011 |
|
2012 Description: Test setting the item's user name using the SetUserNameL method. |
|
2013 |
|
2014 Parameters: TTestResult& aErrorDescription: out: |
|
2015 Test result and on error case a short description of error |
|
2016 |
|
2017 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
2018 |
|
2019 Errors/Exceptions: None |
|
2020 |
|
2021 Status: Approved |
|
2022 |
|
2023 ------------------------------------------------------------------------------- |
|
2024 */ |
|
2025 TInt CFavouritesEngineTest::ItemSetUserNameTruncateLengthLTestL( TTestResult& aResult ) |
|
2026 { |
|
2027 /* Simple server connect */ |
|
2028 _LIT( KDefinition ,"State"); |
|
2029 _LIT( KData ,"Setting the item's user name with SetUserNameL method"); |
|
2030 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
2031 |
|
2032 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
2033 TInt truncLength; |
|
2034 |
|
2035 TRAPD(err, item->SetUserNameL( _L("New User name longer than allowed by the limit of KFavouritesMaxUserName which is 40 chars at this moment") )); |
|
2036 |
|
2037 _LIT( KData2 ,"Finished"); |
|
2038 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
2039 truncLength = item->UserName().Length(); |
|
2040 |
|
2041 if ((truncLength==KFavouritesMaxUserName)&& (err==KErrOverflow)) |
|
2042 { |
|
2043 _LIT( KDescription , "Test case passed"); |
|
2044 aResult.SetResult( KErrNone, KDescription ); |
|
2045 } |
|
2046 else |
|
2047 { |
|
2048 _LIT( KDescription , "Test case failed"); |
|
2049 aResult.SetResult( KErrGeneral, KDescription ); |
|
2050 } |
|
2051 |
|
2052 CleanupStack::PopAndDestroy( item ); |
|
2053 |
|
2054 // Case was executed |
|
2055 return KErrNone; |
|
2056 } |
|
2057 |
|
2058 |
1337 /* |
2059 /* |
1338 ------------------------------------------------------------------------------- |
2060 ------------------------------------------------------------------------------- |
1339 |
2061 |
1340 Class: CFavouritesEngineTest |
2062 Class: CFavouritesEngineTest |
1341 |
2063 |
1434 |
2156 |
1435 // Case was executed |
2157 // Case was executed |
1436 return KErrNone; |
2158 return KErrNone; |
1437 } |
2159 } |
1438 |
2160 |
|
2161 /* |
|
2162 ------------------------------------------------------------------------------- |
|
2163 |
|
2164 Class: CFavouritesEngineTest |
|
2165 |
|
2166 Method: ItemIsHiddenTestL |
|
2167 |
|
2168 Description: Test if the item is hidden using the IsHidden method. |
|
2169 |
|
2170 Parameters: TTestResult& aErrorDescription: out: |
|
2171 Test result and on error case a short description of error |
|
2172 |
|
2173 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
2174 |
|
2175 Errors/Exceptions: None |
|
2176 |
|
2177 Status: Approved |
|
2178 |
|
2179 ------------------------------------------------------------------------------- |
|
2180 */ |
|
2181 |
|
2182 TInt CFavouritesEngineTest::ItemIsHiddenTestL( TTestResult& aResult ) |
|
2183 { |
|
2184 /* Simple server connect */ |
|
2185 _LIT( KDefinition ,"State"); |
|
2186 _LIT( KData ,"Checking if the item is hidden item with IsHidden method"); |
|
2187 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
2188 |
|
2189 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
2190 |
|
2191 TBool itemIsHidden = item->IsHidden(); |
|
2192 |
|
2193 _LIT( KData2 ,"Finished"); |
|
2194 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
2195 |
|
2196 if (!itemIsHidden) |
|
2197 { |
|
2198 _LIT( KDescription , "Test case passed"); |
|
2199 aResult.SetResult( KErrNone, KDescription ); |
|
2200 } |
|
2201 else |
|
2202 { |
|
2203 _LIT( KDescription , "Test case failed"); |
|
2204 aResult.SetResult( KErrGeneral, KDescription ); |
|
2205 } |
|
2206 |
|
2207 CleanupStack::PopAndDestroy( item ); |
|
2208 |
|
2209 // Case was executed |
|
2210 return KErrNone; |
|
2211 } |
|
2212 |
|
2213 /* |
|
2214 ------------------------------------------------------------------------------- |
|
2215 |
|
2216 Class: CFavouritesEngineTest |
|
2217 |
|
2218 Method: ItemSetHiddenTestL |
|
2219 |
|
2220 Description: Test setting the item's hidden value using the SetHidden method. |
|
2221 |
|
2222 Parameters: TTestResult& aErrorDescription: out: |
|
2223 Test result and on error case a short description of error |
|
2224 |
|
2225 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
2226 |
|
2227 Errors/Exceptions: None |
|
2228 |
|
2229 Status: Approved |
|
2230 |
|
2231 ------------------------------------------------------------------------------- |
|
2232 */ |
|
2233 TInt CFavouritesEngineTest::ItemSetHiddenTestL( TTestResult& aResult ) |
|
2234 { |
|
2235 /* Simple server connect */ |
|
2236 _LIT( KDefinition ,"State"); |
|
2237 _LIT( KData ,"Setting the item's hidden value with SetHidden method"); |
|
2238 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
2239 |
|
2240 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
2241 |
|
2242 item->SetHidden(1); |
|
2243 |
|
2244 _LIT( KData2 ,"Finished"); |
|
2245 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
2246 |
|
2247 if (item->IsHidden() == 1) |
|
2248 { |
|
2249 _LIT( KDescription , "Test case passed"); |
|
2250 aResult.SetResult( KErrNone, KDescription ); |
|
2251 } |
|
2252 else |
|
2253 { |
|
2254 _LIT( KDescription , "Test case failed"); |
|
2255 aResult.SetResult( KErrGeneral, KDescription ); |
|
2256 } |
|
2257 |
|
2258 CleanupStack::PopAndDestroy( item ); |
|
2259 |
|
2260 // Case was executed |
|
2261 return KErrNone; |
|
2262 } |
|
2263 |
1439 // ================= OTHER EXPORTED FUNCTIONS ================================= |
2264 // ================= OTHER EXPORTED FUNCTIONS ================================= |
1440 |
2265 |
1441 // End of File |
2266 // End of File |