1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2009 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" |
|
39 |
38 |
40 const TUid KUidTestApp = { 10 }; //uid of tstapp. |
39 const TUid KUidTestApp = { 10 }; //uid of tstapp. |
41 const TUid KUidCustomiseDefaultIconApp = {0x10208181}; // uid of CustomiseDefaultIconApp. |
40 const TUid KUidCustomiseDefaultIconApp = {0x10208181}; // uid of CustomiseDefaultIconApp. |
42 const TInt KDelayForOnDemand = 4000000; //a small delay |
41 const TInt KDelayForOnDemand = 20000; //a small delay |
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. |
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. |
44 const TInt KViewCount = 3; // Total no of views in tstapp |
43 const TInt KViewCount = 3; // Total no of views in tstapp |
45 |
44 |
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"); |
|
51 |
45 |
52 /** |
46 /** |
53 Auxiliary Fn for Test Case ID T-LocaleStep-TestAllLanguages |
47 Auxiliary Fn for Test Case ID T-LocaleStep-TestAllLanguages |
54 |
48 |
55 This method loads the required DLL for the language specified as argument |
49 This method loads the required DLL for the language specified as argument |
56 and changes the locale accordingly. |
50 and changes the locale accordingly. |
57 |
51 |
58 */ |
52 */ |
59 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage) |
53 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage) |
60 {/* |
54 { |
61 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
55 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
62 _LIT(KLitLocaleDllNameBase, "elocl_lan"); |
56 _LIT(KLitLocaleDllNameBase, "elocl_lan"); |
63 _LIT(KLitLocaleDllNameExtension, ".loc"); |
57 _LIT(KLitLocaleDllNameExtension, ".loc"); |
64 #else |
58 #else |
65 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
59 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
91 User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName)); |
85 User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName)); |
92 User::LeaveIfError(myExtendedLocale.SaveSystemSettings()); |
86 User::LeaveIfError(myExtendedLocale.SaveSystemSettings()); |
93 #else |
87 #else |
94 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
88 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
95 #endif |
89 #endif |
96 CleanupStack::PopAndDestroy(); // localeDll */ |
90 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 } |
|
154 } |
91 } |
155 |
92 |
156 // CheckIcons is a function used in testcase TestLocaleDefaultIconL to check the size of the default icons |
93 // CheckIcons is a function used in testcase TestLocaleDefaultIconL to check the size of the default icons |
157 void CT_LocaleStep::CheckIcons(CArrayFixFlat<TSize>* aNewIconSizes,TSize aSmall,TSize aMedium,TSize aLarge, TSize& afstIcon, TSize& asecIcon, TSize& atrdIcon) |
94 void CT_LocaleStep::CheckIcons(CArrayFixFlat<TSize>* aNewIconSizes,TSize aSmall,TSize aMedium,TSize aLarge, TSize& afstIcon, TSize& asecIcon, TSize& atrdIcon) |
158 { |
95 { |
819 /** |
756 /** |
820 @return - TVerdict code |
757 @return - TVerdict code |
821 Override of base class virtual |
758 Override of base class virtual |
822 */ |
759 */ |
823 { |
760 { |
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); |
|
829 SetTestStepResult(EPass); |
761 SetTestStepResult(EPass); |
830 return TestStepResult(); |
762 return TestStepResult(); |
831 } |
763 } |
832 |
764 |
833 TVerdict CT_LocaleStep::doTestStepPostambleL() |
765 TVerdict CT_LocaleStep::doTestStepPostambleL() |
834 /** |
766 /** |
835 @return - TVerdict code |
767 @return - TVerdict code |
836 Override of base class virtual |
768 Override of base class virtual |
837 */ |
769 */ |
838 { |
770 { |
839 CSisFileInstaller sisFileInstaller; |
|
840 sisFileInstaller.UninstallSisL(KTstAppStandAloneComponent); |
|
841 sisFileInstaller.UninstallSisL(KTstCustomiseDefaultIconAppComponent); |
|
842 return TestStepResult(); |
771 return TestStepResult(); |
843 } |
772 } |
844 |
773 |
845 |
774 |
846 TVerdict CT_LocaleStep::doTestStepL() |
775 TVerdict CT_LocaleStep::doTestStepL() |