1589 // ----------------------------------------------------------------------------- |
1593 // ----------------------------------------------------------------------------- |
1590 // Ctsysinfoprovidertests::SetDisplayLang |
1594 // Ctsysinfoprovidertests::SetDisplayLang |
1591 // |
1595 // |
1592 // ----------------------------------------------------------------------------- |
1596 // ----------------------------------------------------------------------------- |
1593 // |
1597 // |
1594 TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) |
1598 TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) |
1595 { |
1599 { |
1596 |
1600 CCoeEnv* coeSupported = NULL; |
1597 TInt result =KErrNone; |
1601 coeSupported = CCoeEnv::Static(); |
1598 |
1602 if (coeSupported) |
1599 _LIT( KExample, "SetDisplayLang:" ); |
1603 { |
1600 iLog->Log( KExample ); |
1604 |
1601 |
1605 TInt result =KErrNone; |
1602 TInt32 oldDisplayLang = 0 ,newDisplayLang = 0,changedDisplayLang = 0; |
1606 |
1603 |
1607 _LIT(KExample, "SetDisplayLang:"); |
1604 __UHEAP_MARK; |
1608 iLog->Log(KExample); |
1605 |
1609 |
1606 |
1610 TInt32 oldDisplayLang = 0, newDisplayLang = 0, changedDisplayLang = 0; |
1607 _LIT(KDisplayLanguage,"DisplayLanguage"); |
1611 |
1608 |
1612 __UHEAP_MARK; |
1609 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
1613 |
1610 CleanupStack::PushL(iServiceHandler); |
1614 _LIT(KDisplayLanguage, "DisplayLanguage"); |
1611 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
1615 |
1612 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
1616 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
1613 |
1617 CleanupStack::PushL(iServiceHandler); |
1614 TInt err = KErrNone; |
1618 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
1615 |
1619 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
1616 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
1620 |
1617 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1621 TInt err = KErrNone; |
1618 |
1622 |
1619 RCriteriaArray a; |
1623 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, |
1620 a.AppendL(crit); |
1624 KService); |
1621 |
1625 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1622 iServiceHandler->AttachL(a); |
1626 |
1623 |
1627 RCriteriaArray a; |
1624 iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
1628 a.AppendL(crit); |
1625 |
1629 |
1626 delete crit; |
1630 iServiceHandler->AttachL(a); |
1627 a.Reset(); |
1631 |
1628 |
1632 iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
1629 TInt pos = 0; |
1633 |
1630 MLiwInterface* interface = NULL; |
1634 delete crit; |
1631 outparam->FindFirst( pos, KIDataSource ); |
1635 a.Reset(); |
1632 if(pos != KErrNotFound) |
1636 |
1633 { |
1637 TInt pos = 0; |
1634 //getting the interface handle |
1638 MLiwInterface* interface = NULL; |
1635 interface = (*outparam)[pos].Value().AsInterface(); |
1639 outparam->FindFirst(pos, KIDataSource); |
1636 } |
1640 if (pos != KErrNotFound) |
1637 |
1641 { |
1638 outparam->Reset(); |
1642 //getting the interface handle |
1639 inparam->Reset(); |
1643 interface = (*outparam)[pos].Value().AsInterface(); |
1640 |
1644 } |
1641 if(interface) |
1645 |
1642 { |
1646 outparam->Reset(); |
1643 TLiwGenericParam entity; |
1647 inparam->Reset(); |
1644 TLiwVariant entityname; |
1648 |
1645 TLiwGenericParam key; |
1649 if (interface) |
1646 TLiwVariant keyname; |
1650 { |
1647 |
1651 TLiwGenericParam entity; |
1648 entityname.Set(KGeneral); |
1652 TLiwVariant entityname; |
1649 entity.SetNameAndValueL(KEntity,entityname); |
1653 TLiwGenericParam key; |
1650 |
1654 TLiwVariant keyname; |
1651 keyname.Set(KDisplayLanguage); |
1655 |
1652 key.SetNameAndValueL(KKey,keyname); |
1656 entityname.Set(KGeneral); |
1653 |
1657 entity.SetNameAndValueL(KEntity, entityname); |
1654 inparam->AppendL(entity); |
1658 |
1655 |
1659 keyname.Set(KDisplayLanguage); |
1656 inparam->AppendL(key); |
1660 key.SetNameAndValueL(KKey, keyname); |
1657 |
1661 |
1658 entity.Reset(); |
1662 inparam->AppendL(entity); |
1659 entityname.Reset(); |
1663 |
1660 key.Reset(); |
1664 inparam->AppendL(key); |
1661 keyname.Reset(); |
1665 |
1662 |
1666 entity.Reset(); |
1663 //get current display language |
1667 entityname.Reset(); |
1664 TRAPD(err, interface->ExecuteCmdL(KGetInfo,*inparam,*outparam)); |
1668 key.Reset(); |
1665 pos = 0 ; |
1669 keyname.Reset(); |
1666 outparam->FindFirst( pos, KErrorCode ); |
1670 |
1667 if(pos != KErrNotFound) |
1671 //get current display language |
1668 { |
1672 TRAPD(err, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); |
1669 err = (TInt)((*outparam)[pos].Value().AsTInt32()); |
1673 pos = 0; |
1670 } |
1674 outparam->FindFirst(pos, KErrorCode); |
1671 |
1675 if (pos != KErrNotFound) |
1672 |
1676 { |
1673 if( err != SErrNotFound ) |
1677 err = (TInt)((*outparam)[pos].Value().AsTInt32()); |
1674 { |
1678 } |
1675 iLog->Log( _L("Failed,Get Display language found ret err: %d"),err ); |
1679 |
1676 result = KErrGeneral; |
1680 if (err != SErrNotFound) |
1677 } |
1681 { |
1678 else |
1682 iLog->Log(_L("Failed,Get Display language found ret err: %d"),err); |
1679 { |
1683 result = KErrGeneral; |
1680 result = KErrNone; |
1684 } |
1681 iLog->Log( _L("Passed Get Display language not found") ); |
1685 else |
1682 } |
1686 { |
1683 |
1687 result = KErrNone; |
1684 |
1688 iLog->Log(_L("Passed Get Display language not found") ); |
1685 outparam->Reset(); |
1689 } |
1686 CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); |
1690 |
1687 CleanupClosePushL(*sysdatamap); |
1691 outparam->Reset(); |
1688 sysdatamap->InsertL(KStatus,(TInt32)10); |
1692 CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); |
1689 inparam->AppendL(TLiwGenericParam(KSysData,TLiwVariant(sysdatamap))); |
1693 CleanupClosePushL(*sysdatamap); |
1690 CleanupStack::PopAndDestroy(sysdatamap); |
1694 sysdatamap->InsertL(KStatus, (TInt32)10); |
1691 |
1695 inparam->AppendL(TLiwGenericParam(KSysData, |
1692 TRAPD(err1, interface->ExecuteCmdL(KSetInfo,*inparam,*outparam)); |
1696 TLiwVariant(sysdatamap))); |
1693 |
1697 CleanupStack::PopAndDestroy(sysdatamap); |
1694 pos = 0 ; |
1698 |
1695 outparam->FindFirst( pos, KErrorCode ); |
1699 TRAPD(err1, interface->ExecuteCmdL(KSetInfo, *inparam, *outparam)); |
1696 if(pos != KErrNotFound) |
1700 |
1697 { |
1701 pos = 0; |
1698 err = (TInt)((*outparam)[pos].Value().AsTInt32()); |
1702 outparam->FindFirst(pos, KErrorCode); |
1699 } |
1703 if (pos != KErrNotFound) |
1700 |
1704 { |
1701 if( err != SErrNotFound ) |
1705 err = (TInt)((*outparam)[pos].Value().AsTInt32()); |
1702 { |
1706 } |
1703 iLog->Log( _L("Failed, Set Display language found ret err: %d"),err ); |
1707 |
1704 result = KErrGeneral; |
1708 if (err != SErrNotFound) |
1705 } |
1709 { |
1706 else |
1710 iLog->Log(_L("Failed, Set Display language found ret err: %d"),err); |
1707 { |
1711 result = KErrGeneral; |
1708 result = KErrNone; |
1712 } |
1709 iLog->Log( _L("Passed, Set Display language not found") ); |
1713 else |
1710 } |
1714 { |
1711 } |
1715 result = KErrNone; |
1712 |
1716 iLog->Log(_L("Passed, Set Display language not found") ); |
1713 inparam->Reset(); |
1717 } |
1714 outparam->Reset(); |
1718 } |
1715 |
1719 |
1716 interface->Close(); |
1720 inparam->Reset(); |
1717 |
1721 outparam->Reset(); |
1718 CleanupStack::PopAndDestroy( iServiceHandler ); |
1722 |
1719 |
1723 interface->Close(); |
1720 return result; |
1724 |
1721 __UHEAP_MARKEND; |
1725 CleanupStack::PopAndDestroy(iServiceHandler); |
1722 |
1726 |
1723 } |
1727 return result; |
1724 |
1728 __UHEAP_MARKEND; |
1725 |
1729 } |
|
1730 else |
|
1731 { |
|
1732 iLog->Log(_L("CCoeEnv not supported . Hence passing the test case") ); |
|
1733 return 0; |
|
1734 } |
|
1735 |
|
1736 } |
|
1737 |
1726 // ----------------------------------------------------------------------------- |
1738 // ----------------------------------------------------------------------------- |
1727 // Ctsysinfoprovidertests::SetInputLang |
1739 // Ctsysinfoprovidertests::SetInputLang |
1728 // |
1740 // |
1729 // ----------------------------------------------------------------------------- |
1741 // ----------------------------------------------------------------------------- |
1730 // |
1742 // |
3782 return KErrNone; |
3794 return KErrNone; |
3783 else |
3795 else |
3784 return KErrGeneral; |
3796 return KErrGeneral; |
3785 } |
3797 } |
3786 |
3798 |
|
3799 // ----------------------------------------------------------------------------- |
|
3800 // Ctsysinfoprovidertests::GetCameraInfoTestNegative |
|
3801 // negative test case general |
|
3802 // ----------------------------------------------------------------------------- |
|
3803 // |
|
3804 TInt Ctsysinfoprovidertests::GetCameraInfoTestNegative(CStifItemParser& aItem) |
|
3805 { |
|
3806 TInt retcode; |
|
3807 iLog->Log(_L("GetCameraInfoTest - Negative Test") ); |
|
3808 |
|
3809 __UHEAP_MARK; |
|
3810 TInt error = KErrNone; |
|
3811 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3812 CleanupStack::PushL(iServiceHandler); |
|
3813 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
3814 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
3815 |
|
3816 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); |
|
3817 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3818 |
|
3819 RCriteriaArray a; |
|
3820 a.AppendL(crit); |
|
3821 iServiceHandler->AttachL(a); |
|
3822 iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
|
3823 delete crit; |
|
3824 a.Reset(); |
|
3825 |
|
3826 TInt pos = 0; |
|
3827 MLiwInterface* interface = NULL; |
|
3828 outparam->FindFirst(pos, KIDataSource); |
|
3829 if (pos != KErrNotFound) |
|
3830 { |
|
3831 interface = (*outparam)[pos].Value().AsInterface(); |
|
3832 } |
|
3833 outparam->Reset(); |
|
3834 inparam->Reset(); |
|
3835 |
|
3836 if (interface) |
|
3837 { |
|
3838 TLiwGenericParam entity; |
|
3839 TLiwVariant entityValue; |
|
3840 TLiwGenericParam key; |
|
3841 TLiwVariant keyValue; |
|
3842 TPtrC16 Entity(KNullDesC); |
|
3843 TPtrC16 Key(KNullDesC); |
|
3844 TInt expectedError = 0; |
|
3845 |
|
3846 aItem.GetNextString(Entity); |
|
3847 aItem.GetNextString(Key); |
|
3848 aItem.GetNextInt(expectedError); |
|
3849 |
|
3850 if (Entity.Compare(_L("NULL")) == 0) |
|
3851 { |
|
3852 keyValue.Set(Key); |
|
3853 key.SetNameAndValueL(KKey, keyValue); |
|
3854 inparam->AppendL(key); |
|
3855 } |
|
3856 else |
|
3857 if (Key.Compare(_L("NULL")) == 0) |
|
3858 { |
|
3859 entityValue.Set(Entity); |
|
3860 entity.SetNameAndValueL(KEntity, entityValue); |
|
3861 inparam->AppendL(entity); |
|
3862 } |
|
3863 else |
|
3864 { |
|
3865 entityValue.Set(Entity); |
|
3866 entity.SetNameAndValueL(KEntity, entityValue); |
|
3867 keyValue.Set(Key); |
|
3868 key.SetNameAndValueL(KKey, keyValue); |
|
3869 inparam->AppendL(entity); |
|
3870 inparam->AppendL(key); |
|
3871 } |
|
3872 entity.Reset(); |
|
3873 entityValue.Reset(); |
|
3874 key.Reset(); |
|
3875 keyValue.Reset(); |
|
3876 |
|
3877 //Get Image Data |
|
3878 TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); |
|
3879 |
|
3880 pos = 0; |
|
3881 const TLiwGenericParam* errorCode = outparam->FindFirst(pos, |
|
3882 KErrorCode); |
|
3883 if (errorCode) |
|
3884 { |
|
3885 retcode = errorCode->Value().AsTInt32(); |
|
3886 if (retcode == expectedError) |
|
3887 { |
|
3888 iLog->Log(_L("Got expected error code %d"), retcode); |
|
3889 pos = 0; |
|
3890 const TLiwGenericParam* output = outparam->FindFirst(pos, |
|
3891 KReturnValue); |
|
3892 if (output) |
|
3893 { |
|
3894 const CLiwMap* Map = output->Value().AsMap(); |
|
3895 if (Map) |
|
3896 { |
|
3897 TLiwVariant data1; |
|
3898 TLiwVariant data2; |
|
3899 if (EFalse != Map->FindL(KCamResList, data1)) |
|
3900 { |
|
3901 const CLiwList* resolutionList = data1.AsList(); |
|
3902 TInt width; |
|
3903 TInt height; |
|
3904 if (resolutionList) |
|
3905 { |
|
3906 TInt count = resolutionList->Count(); |
|
3907 for (TInt i=0; i < count; i++) |
|
3908 { |
|
3909 TLiwVariant resolutionData; |
|
3910 resolutionList->AtL(i, resolutionData); |
|
3911 const CLiwMap* resolutionDataMap = resolutionData.AsMap(); |
|
3912 TLiwVariant xPix; |
|
3913 resolutionDataMap->FindL(KXPixels, xPix); |
|
3914 width = xPix.AsTInt32(); |
|
3915 xPix.Reset(); |
|
3916 iLog->Log(_L("Supported XPixel %d is %d -"),i, width); |
|
3917 |
|
3918 TLiwVariant yPix; |
|
3919 resolutionDataMap->FindL(KYPixels, yPix); |
|
3920 height = yPix.AsTInt32(); |
|
3921 yPix.Reset(); |
|
3922 iLog->Log(_L("Supported YPixel %d is %d -"),i, height); |
|
3923 |
|
3924 resolutionData.Reset(); |
|
3925 }//for |
|
3926 } //resolutionList |
|
3927 }//FindL |
|
3928 if (EFalse != Map->FindL(KCamMimeTypesList, data2)) |
|
3929 { |
|
3930 const CLiwList* mimeList = data2.AsList(); |
|
3931 if (mimeList) |
|
3932 { |
|
3933 for (TInt i=0; i != mimeList->Count(); i++) |
|
3934 { |
|
3935 TLiwVariant mimeData; |
|
3936 TPtrC16 mimeType; |
|
3937 mimeList->AtL(i, mimeData); |
|
3938 mimeType.Set(mimeData.AsDes()); |
|
3939 |
|
3940 iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); |
|
3941 mimeData.Reset(); |
|
3942 }//for |
|
3943 } //mimeList |
|
3944 }//FindL |
|
3945 data1.Reset(); |
|
3946 data2.Reset(); |
|
3947 }//Map |
|
3948 }//output |
|
3949 retcode = KErrNone; |
|
3950 iLog->Log(_L("Test Completed")); |
|
3951 iLog->Log(_L("PASS")); |
|
3952 }//retcode == expected error |
|
3953 else |
|
3954 { |
|
3955 iLog->Log(_L("Error Code Returned = %d"), retcode); |
|
3956 iLog->Log(_L("Error Code Expected = %d"), expectedError); |
|
3957 iLog->Log(_L("Test Completed")); |
|
3958 iLog->Log(_L("FAIL")); |
|
3959 } |
|
3960 }//errorCode |
|
3961 }//interface |
|
3962 inparam->Reset(); |
|
3963 outparam->Reset(); |
|
3964 interface->Close(); |
|
3965 CleanupStack::PopAndDestroy(iServiceHandler); |
|
3966 __UHEAP_MARKEND; |
|
3967 iLog->Log(_L("END")); |
|
3968 return retcode; |
|
3969 } |
|
3970 |
|
3971 // ----------------------------------------------------------------------------- |
|
3972 // Ctsysinfoprovidertests::GetCameraInfoNegEntity |
|
3973 // negative test case - Wrong Entity |
|
3974 // ----------------------------------------------------------------------------- |
|
3975 // |
|
3976 TInt Ctsysinfoprovidertests::GetCameraInfoNegEntity(CStifItemParser& aItem) |
|
3977 { |
|
3978 _LIT8(KEntity1, "Entity1"); |
|
3979 TInt retcode; |
|
3980 iLog->Log(_L("GetCameraInfoNegEntity - Negative Test") ); |
|
3981 |
|
3982 __UHEAP_MARK; |
|
3983 TInt error = KErrNone; |
|
3984 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3985 CleanupStack::PushL(iServiceHandler); |
|
3986 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
3987 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
3988 |
|
3989 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); |
|
3990 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3991 |
|
3992 RCriteriaArray a; |
|
3993 a.AppendL(crit); |
|
3994 iServiceHandler->AttachL(a); |
|
3995 iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
|
3996 delete crit; |
|
3997 a.Reset(); |
|
3998 |
|
3999 TInt pos = 0; |
|
4000 MLiwInterface* interface = NULL; |
|
4001 outparam->FindFirst(pos, KIDataSource); |
|
4002 if (pos != KErrNotFound) |
|
4003 { |
|
4004 interface = (*outparam)[pos].Value().AsInterface(); |
|
4005 } |
|
4006 outparam->Reset(); |
|
4007 inparam->Reset(); |
|
4008 |
|
4009 if (interface) |
|
4010 { |
|
4011 TLiwGenericParam entity; |
|
4012 TLiwVariant entityName; |
|
4013 TLiwVariant entityValue; |
|
4014 TLiwGenericParam key; |
|
4015 TLiwGenericParam keyName; |
|
4016 TLiwVariant keyValue; |
|
4017 TPtrC16 Entity(KNullDesC); |
|
4018 TPtrC16 Key(KNullDesC); |
|
4019 TInt expectedError = 0; |
|
4020 |
|
4021 aItem.GetNextString(Entity); |
|
4022 aItem.GetNextString(Key); |
|
4023 aItem.GetNextInt(expectedError); |
|
4024 |
|
4025 entityValue.Set(Entity); |
|
4026 entity.SetNameAndValueL(KEntity1, entityValue); |
|
4027 keyValue.Set(Key); |
|
4028 key.SetNameAndValueL(KKey, keyValue); |
|
4029 inparam->AppendL(entity); |
|
4030 inparam->AppendL(key); |
|
4031 |
|
4032 entity.Reset(); |
|
4033 entityValue.Reset(); |
|
4034 key.Reset(); |
|
4035 keyValue.Reset(); |
|
4036 |
|
4037 //Get Image Data |
|
4038 TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); |
|
4039 |
|
4040 pos = 0; |
|
4041 const TLiwGenericParam* errorCode = outparam->FindFirst(pos, |
|
4042 KErrorCode); |
|
4043 if (errorCode) |
|
4044 { |
|
4045 retcode = errorCode->Value().AsTInt32(); |
|
4046 if (retcode == expectedError) |
|
4047 { |
|
4048 iLog->Log(_L("Got expected error code %d"), retcode); |
|
4049 pos = 0; |
|
4050 const TLiwGenericParam* output = outparam->FindFirst(pos, |
|
4051 KReturnValue); |
|
4052 if (output) |
|
4053 { |
|
4054 const CLiwMap* Map = output->Value().AsMap(); |
|
4055 if (Map) |
|
4056 { |
|
4057 TLiwVariant data1; |
|
4058 TLiwVariant data2; |
|
4059 if (EFalse != Map->FindL(KCamResList, data1)) |
|
4060 { |
|
4061 const CLiwList* resolutionList = data1.AsList(); |
|
4062 TInt width; |
|
4063 TInt height; |
|
4064 if (resolutionList) |
|
4065 { |
|
4066 TInt count = resolutionList->Count(); |
|
4067 for (TInt i=0; i < count; i++) |
|
4068 { |
|
4069 TLiwVariant resolutionData; |
|
4070 resolutionList->AtL(i, resolutionData); |
|
4071 const CLiwMap* resolutionDataMap = resolutionData.AsMap(); |
|
4072 TLiwVariant xPix; |
|
4073 resolutionDataMap->FindL(KXPixels, xPix); |
|
4074 width = xPix.AsTInt32(); |
|
4075 xPix.Reset(); |
|
4076 iLog->Log(_L("Supported XPixel %d is %d -"),i, width); |
|
4077 |
|
4078 TLiwVariant yPix; |
|
4079 resolutionDataMap->FindL(KYPixels, yPix); |
|
4080 height = yPix.AsTInt32(); |
|
4081 yPix.Reset(); |
|
4082 iLog->Log(_L("Supported YPixel %d is %d -"),i, height); |
|
4083 |
|
4084 resolutionData.Reset(); |
|
4085 }//for |
|
4086 } //resolutionList |
|
4087 }//FindL |
|
4088 if (EFalse != Map->FindL(KCamMimeTypesList, data2)) |
|
4089 { |
|
4090 const CLiwList* mimeList = data2.AsList(); |
|
4091 if (mimeList) |
|
4092 { |
|
4093 for (TInt i=0; i != mimeList->Count(); i++) |
|
4094 { |
|
4095 TLiwVariant mimeData; |
|
4096 TPtrC16 mimeType; |
|
4097 mimeList->AtL(i, mimeData); |
|
4098 mimeType.Set(mimeData.AsDes()); |
|
4099 |
|
4100 iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); |
|
4101 mimeData.Reset(); |
|
4102 }//for |
|
4103 } //mimeList |
|
4104 }//FindL |
|
4105 data1.Reset(); |
|
4106 data2.Reset(); |
|
4107 }//Map |
|
4108 }//output |
|
4109 retcode = KErrNone; |
|
4110 iLog->Log(_L("Test Completed")); |
|
4111 iLog->Log(_L("PASS")); |
|
4112 }//retcode == expected error |
|
4113 else |
|
4114 { |
|
4115 iLog->Log(_L("Error Code Returned = %d"), retcode); |
|
4116 iLog->Log(_L("Error Code Expected = %d"), expectedError); |
|
4117 iLog->Log(_L("Test Completed")); |
|
4118 iLog->Log(_L("FAIL")); |
|
4119 } |
|
4120 }//errorCode |
|
4121 }//interface |
|
4122 inparam->Reset(); |
|
4123 outparam->Reset(); |
|
4124 interface->Close(); |
|
4125 CleanupStack::PopAndDestroy(iServiceHandler); |
|
4126 __UHEAP_MARKEND; |
|
4127 iLog->Log(_L("END")); |
|
4128 return retcode; |
|
4129 } |
|
4130 |
|
4131 // ----------------------------------------------------------------------------- |
|
4132 // Ctsysinfoprovidertests::GetCameraInfoNegKey |
|
4133 // negative test case - Wrong Key |
|
4134 // ----------------------------------------------------------------------------- |
|
4135 // |
|
4136 TInt Ctsysinfoprovidertests::GetCameraInfoNegKey(CStifItemParser& aItem) |
|
4137 { |
|
4138 _LIT8(KKey1, "Key1"); |
|
4139 TInt retcode; |
|
4140 iLog->Log(_L("GetCameraInfoNegKey - Negative Test") ); |
|
4141 |
|
4142 __UHEAP_MARK; |
|
4143 TInt error = KErrNone; |
|
4144 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4145 CleanupStack::PushL(iServiceHandler); |
|
4146 CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
4147 CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
4148 |
|
4149 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); |
|
4150 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4151 |
|
4152 RCriteriaArray a; |
|
4153 a.AppendL(crit); |
|
4154 iServiceHandler->AttachL(a); |
|
4155 iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
|
4156 delete crit; |
|
4157 a.Reset(); |
|
4158 |
|
4159 TInt pos = 0; |
|
4160 MLiwInterface* interface = NULL; |
|
4161 outparam->FindFirst(pos, KIDataSource); |
|
4162 if (pos != KErrNotFound) |
|
4163 { |
|
4164 interface = (*outparam)[pos].Value().AsInterface(); |
|
4165 } |
|
4166 outparam->Reset(); |
|
4167 inparam->Reset(); |
|
4168 |
|
4169 if (interface) |
|
4170 { |
|
4171 TLiwGenericParam entity; |
|
4172 TLiwVariant entityValue; |
|
4173 TLiwGenericParam key; |
|
4174 TLiwVariant keyValue; |
|
4175 TPtrC16 Entity(KNullDesC); |
|
4176 TPtrC16 Key(KNullDesC); |
|
4177 TInt expectedError = 0; |
|
4178 |
|
4179 aItem.GetNextString(Entity); |
|
4180 aItem.GetNextString(Key); |
|
4181 aItem.GetNextInt(expectedError); |
|
4182 |
|
4183 entityValue.Set(Entity); |
|
4184 entity.SetNameAndValueL(KEntity, entityValue); |
|
4185 keyValue.Set(Key); |
|
4186 key.SetNameAndValueL(KKey1, keyValue); |
|
4187 inparam->AppendL(entity); |
|
4188 inparam->AppendL(key); |
|
4189 |
|
4190 entity.Reset(); |
|
4191 entityValue.Reset(); |
|
4192 key.Reset(); |
|
4193 keyValue.Reset(); |
|
4194 |
|
4195 //Get Image Data |
|
4196 TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); |
|
4197 |
|
4198 pos = 0; |
|
4199 const TLiwGenericParam* errorCode = outparam->FindFirst(pos, |
|
4200 KErrorCode); |
|
4201 if (errorCode) |
|
4202 { |
|
4203 retcode = errorCode->Value().AsTInt32(); |
|
4204 if (retcode == expectedError) |
|
4205 { |
|
4206 iLog->Log(_L("Got expected error code %d"), retcode); |
|
4207 pos = 0; |
|
4208 const TLiwGenericParam* output = outparam->FindFirst(pos, |
|
4209 KReturnValue); |
|
4210 if (output) |
|
4211 { |
|
4212 const CLiwMap* Map = output->Value().AsMap(); |
|
4213 if (Map) |
|
4214 { |
|
4215 TLiwVariant data1; |
|
4216 TLiwVariant data2; |
|
4217 if (EFalse != Map->FindL(KCamResList, data1)) |
|
4218 { |
|
4219 const CLiwList* resolutionList = data1.AsList(); |
|
4220 TInt width; |
|
4221 TInt height; |
|
4222 if (resolutionList) |
|
4223 { |
|
4224 TInt count = resolutionList->Count(); |
|
4225 for (TInt i=0; i < count; i++) |
|
4226 { |
|
4227 TLiwVariant resolutionData; |
|
4228 resolutionList->AtL(i, resolutionData); |
|
4229 const CLiwMap* resolutionDataMap = resolutionData.AsMap(); |
|
4230 TLiwVariant xPix; |
|
4231 resolutionDataMap->FindL(KXPixels, xPix); |
|
4232 width = xPix.AsTInt32(); |
|
4233 xPix.Reset(); |
|
4234 iLog->Log(_L("Supported XPixel %d is %d -"),i, width); |
|
4235 |
|
4236 TLiwVariant yPix; |
|
4237 resolutionDataMap->FindL(KYPixels, yPix); |
|
4238 height = yPix.AsTInt32(); |
|
4239 yPix.Reset(); |
|
4240 iLog->Log(_L("Supported YPixel %d is %d -"),i, height); |
|
4241 |
|
4242 resolutionData.Reset(); |
|
4243 }//for |
|
4244 } //resolutionList |
|
4245 }//FindL |
|
4246 if (EFalse != Map->FindL(KCamMimeTypesList, data2)) |
|
4247 { |
|
4248 const CLiwList* mimeList = data2.AsList(); |
|
4249 if (mimeList) |
|
4250 { |
|
4251 for (TInt i=0; i != mimeList->Count(); i++) |
|
4252 { |
|
4253 TLiwVariant mimeData; |
|
4254 TPtrC16 mimeType; |
|
4255 mimeList->AtL(i, mimeData); |
|
4256 mimeType.Set(mimeData.AsDes()); |
|
4257 |
|
4258 iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); |
|
4259 mimeData.Reset(); |
|
4260 }//for |
|
4261 } //mimeList |
|
4262 }//FindL |
|
4263 data1.Reset(); |
|
4264 data2.Reset(); |
|
4265 }//Map |
|
4266 }//output |
|
4267 retcode = KErrNone; |
|
4268 iLog->Log(_L("Test Completed")); |
|
4269 iLog->Log(_L("PASS")); |
|
4270 }//retcode == expected error |
|
4271 else |
|
4272 { |
|
4273 iLog->Log(_L("Error Code Returned = %d"), retcode); |
|
4274 iLog->Log(_L("Error Code Expected = %d"), expectedError); |
|
4275 iLog->Log(_L("Test Completed")); |
|
4276 iLog->Log(_L("FAIL")); |
|
4277 } |
|
4278 }//errorCode |
|
4279 }//interface |
|
4280 inparam->Reset(); |
|
4281 outparam->Reset(); |
|
4282 interface->Close(); |
|
4283 CleanupStack::PopAndDestroy(iServiceHandler); |
|
4284 __UHEAP_MARKEND; |
|
4285 iLog->Log(_L("END")); |
|
4286 return retcode; |
|
4287 } |
|
4288 |