appfw/apparchitecture/tef/T_LocaleStep.cpp
branchRCL_3
changeset 62 924385140d98
parent 0 2e3d3ce01487
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    33 #include <apgicnflpartner.h>
    33 #include <apgicnflpartner.h>
    34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    35 #include <hal.h>
    35 #include <hal.h>
    36 #include <apgcli.h>
    36 #include <apgcli.h>
    37 #include "T_LocaleStep.h"
    37 #include "T_LocaleStep.h"
       
    38 #include "T_SisFileInstaller.h"
    38 
    39 
    39 const TUid KUidTestApp = { 10 }; //uid of tstapp.
    40 const TUid KUidTestApp = { 10 }; //uid of tstapp.
    40 const TUid KUidCustomiseDefaultIconApp = {0x10208181}; // uid of CustomiseDefaultIconApp.
    41 const TUid KUidCustomiseDefaultIconApp = {0x10208181}; // uid of CustomiseDefaultIconApp.
    41 const TInt KDelayForOnDemand = 20000; //a small delay
    42 const TInt KDelayForOnDemand = 4000000; //a small delay
    42 const TInt KDelay = 4000000; // Most apparc tests have 2.5 secs wait time to let apparc update the app-list, but on safer side let us give 4 secs.
    43 const TInt KDelay = 4000000; // Most apparc tests have 2.5 secs wait time to let apparc update the app-list, but on safer side let us give 4 secs.
    43 const TInt KViewCount = 3; // Total no of views in tstapp
    44 const TInt KViewCount = 3; // Total no of views in tstapp
    44 
    45 
       
    46 _LIT(KTstAppStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TSTAPP_standalone.sis");
       
    47 _LIT(KTstAppStandAloneComponent, "TSTAPP_standalone");
       
    48 
       
    49 _LIT(KTstCustomiseDefaultIconAppSisFile, "z:\\apparctest\\apparctestsisfiles\\CustomiseDefaultIconApp.sis");
       
    50 _LIT(KTstCustomiseDefaultIconAppComponent, "CustomiseDefaultIconApp");
    45 
    51 
    46 /**
    52 /**
    47   Auxiliary Fn for Test Case ID T-LocaleStep-TestAllLanguages
    53   Auxiliary Fn for Test Case ID T-LocaleStep-TestAllLanguages
    48  
    54  
    49   This method loads the required DLL for the language specified as argument
    55   This method loads the required DLL for the language specified as argument
    50   and changes the locale accordingly.
    56   and changes the locale accordingly.
    51  
    57  
    52 */
    58 */
    53 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage)
    59 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage)
    54 	{
    60 	{/*
    55 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
    61 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
    56 	_LIT(KLitLocaleDllNameBase, "elocl_lan");
    62 	_LIT(KLitLocaleDllNameBase, "elocl_lan");
    57 	_LIT(KLitLocaleDllNameExtension, ".loc");
    63 	_LIT(KLitLocaleDllNameExtension, ".loc");
    58 #else
    64 #else
    59 	_LIT(KLitLocaleDllNameBase, "ELOCL");
    65 	_LIT(KLitLocaleDllNameBase, "ELOCL");
    85     User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName));
    91     User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName));
    86     User::LeaveIfError(myExtendedLocale.SaveSystemSettings());
    92     User::LeaveIfError(myExtendedLocale.SaveSystemSettings());
    87 #else	
    93 #else	
    88 	User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
    94 	User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
    89 #endif
    95 #endif
    90 	CleanupStack::PopAndDestroy(); // localeDll
    96 	CleanupStack::PopAndDestroy(); // localeDll */
       
    97 	
       
    98 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
       
    99     _LIT(KLitLanguageLocaleDllNameBase, "elocl_lan");
       
   100     //Region and collation code values are hard coded, as the check, after changing the locale is made for the language only.
       
   101     _LIT(KLitRegionLocaleDllNameBase, "elocl_reg.826");        
       
   102     _LIT(KLitCollationLocaleDllNameBase, "elocl_col.001");
       
   103     _LIT(ThreeDigExt,".%03d");
       
   104     TExtendedLocale localeDll;    
       
   105     const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6));
       
   106     TBuf<16> languageLocaleDllName(KLitLanguageLocaleDllNameBase);  
       
   107     languageLocaleDllName.AppendFormat(ThreeDigExt, aLanguage);
       
   108     TBuf<16> regionLocaleDllName(KLitRegionLocaleDllNameBase);  
       
   109     TBuf<16> collationLocaleDllName(KLitCollationLocaleDllNameBase);  
       
   110     // Try to load the locale dll
       
   111     TInt error=localeDll.LoadLocale(languageLocaleDllName, regionLocaleDllName, collationLocaleDllName);
       
   112         
       
   113     if (error==KErrNotFound)
       
   114         {
       
   115         // Locale dll is not found for the asked language. 
       
   116         ERR_PRINTF2(_L("Failed to find the locale dll for %d"), aLanguage);
       
   117         }
       
   118            
       
   119     User::LeaveIfError(error);
       
   120     localeDll.SaveSystemSettings();
       
   121 #else
       
   122     _LIT(KLitLocaleDllNameBase, "ELOCL");
       
   123     _LIT(TwoDigExt,".%02d");
       
   124     
       
   125     RLibrary localeDll; 
       
   126     CleanupClosePushL(localeDll);
       
   127     
       
   128     const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6));
       
   129     TBuf<16> localeDllName(KLitLocaleDllNameBase);  
       
   130     localeDllName.AppendFormat(TwoDigExt, language);
       
   131     
       
   132     // Try to load the locale dll
       
   133     TInt error=localeDll.Load(localeDllName, uidType);
       
   134     if (error==KErrNotFound)
       
   135         {
       
   136         // Locale dll is not found for the asked language. 
       
   137         ERR_PRINTF2(_L("Failed to find the locale dll for %d"), language);
       
   138         }
       
   139     
       
   140     User::LeaveIfError(error);
       
   141     User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
       
   142     CleanupStack::PopAndDestroy(); // localeDll
       
   143 #endif
       
   144     
       
   145     // Check if the device locale has changed
       
   146     if (aLanguage == User::Language())
       
   147         {
       
   148         SetTestStepResult(EPass);
       
   149         }
       
   150     else
       
   151         {
       
   152         ERR_PRINTF3(_L("Failed to change the locale to %d whereas the current locale is"), aLanguage, User::Language());
       
   153         }
    91 	}
   154 	}
    92 
   155 
    93 // CheckIcons is a function used in testcase TestLocaleDefaultIconL to check the size of the default icons
   156 // CheckIcons is a function used in testcase TestLocaleDefaultIconL to check the size of the default icons
    94 void CT_LocaleStep::CheckIcons(CArrayFixFlat<TSize>* aNewIconSizes,TSize aSmall,TSize aMedium,TSize aLarge, TSize& afstIcon, TSize& asecIcon, TSize& atrdIcon)
   157 void CT_LocaleStep::CheckIcons(CArrayFixFlat<TSize>* aNewIconSizes,TSize aSmall,TSize aMedium,TSize aLarge, TSize& afstIcon, TSize& asecIcon, TSize& atrdIcon)
    95 	{
   158 	{
   756 /**
   819 /**
   757    @return - TVerdict code
   820    @return - TVerdict code
   758    Override of base class virtual
   821    Override of base class virtual
   759  */
   822  */
   760 	{
   823 	{
       
   824     CSisFileInstaller sisFileInstaller;
       
   825     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstAppStandAloneSisFile);
       
   826     sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KTstAppStandAloneSisFile);
       
   827     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstCustomiseDefaultIconAppSisFile);
       
   828     sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KTstCustomiseDefaultIconAppSisFile);    
   761 	SetTestStepResult(EPass);
   829 	SetTestStepResult(EPass);
   762 	return TestStepResult();
   830 	return TestStepResult();
   763 	}
   831 	}
   764 
   832 
   765 TVerdict CT_LocaleStep::doTestStepPostambleL()
   833 TVerdict CT_LocaleStep::doTestStepPostambleL()
   766 /**
   834 /**
   767    @return - TVerdict code
   835    @return - TVerdict code
   768    Override of base class virtual
   836    Override of base class virtual
   769  */
   837  */
   770 	{
   838 	{
       
   839 	CSisFileInstaller sisFileInstaller;
       
   840 	sisFileInstaller.UninstallSisL(KTstAppStandAloneComponent);
       
   841 	sisFileInstaller.UninstallSisL(KTstCustomiseDefaultIconAppComponent);	
   771 	return TestStepResult();
   842 	return TestStepResult();
   772 	}
   843 	}
   773 
   844 
   774 
   845 
   775 TVerdict CT_LocaleStep::doTestStepL()
   846 TVerdict CT_LocaleStep::doTestStepL()