1 // Copyright (c) 2005-2009 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 the License "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". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
19 // Test for CR0902 - Enable Dynamic Language Switching in APPARC. |
19 // Test for CR0902 - Enable Dynamic Language Switching in APPARC. |
20 // Application's localisable information should be updated by apparc on language change event. |
20 // Application's localisable information should be updated by apparc on language change event. |
21 // |
21 // |
22 // |
22 // |
23 |
23 |
24 |
|
25 |
|
26 /** |
24 /** |
27 @file |
25 @file |
28 @internalComponent - Internal Symbian test code |
26 @internalComponent - Internal Symbian test code |
29 */ |
27 */ |
30 |
28 |
31 #include <e32test.h> |
29 #include <e32test.h> |
32 #include <f32file.h> |
30 #include <f32file.h> |
33 #include <apgicnfl.h> |
31 #include <apgicnfl.h> |
|
32 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
33 #include <apgicnflpartner.h> |
|
34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
34 #include <hal.h> |
35 #include <hal.h> |
35 #include <apgcli.h> |
36 #include <apgcli.h> |
36 #include "T_LocaleStep.h" |
37 #include "T_LocaleStep.h" |
37 |
38 |
38 const TUid KUidTestApp = { 10 }; //uid of tstapp. |
39 const TUid KUidTestApp = { 10 }; //uid of tstapp. |
49 and changes the locale accordingly. |
50 and changes the locale accordingly. |
50 |
51 |
51 */ |
52 */ |
52 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage) |
53 void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage) |
53 { |
54 { |
|
55 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
|
56 _LIT(KLitLocaleDllNameBase, "elocl_lan"); |
|
57 _LIT(KLitLocaleDllNameExtension, ".loc"); |
|
58 #else |
54 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
59 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
55 _LIT(KLitLocaleDllNameExtension, ".LOC"); |
60 _LIT(KLitLocaleDllNameExtension, ".LOC"); |
|
61 #endif |
56 RLibrary localeDll; |
62 RLibrary localeDll; |
57 TBuf<16> localeDllName(KLitLocaleDllNameBase); |
63 TBuf<16> localeDllName(KLitLocaleDllNameBase); |
58 CleanupClosePushL(localeDll); |
64 CleanupClosePushL(localeDll); |
59 const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6)); |
65 const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6)); |
|
66 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
|
67 _LIT(ThreeDigExt,".%03d"); |
|
68 localeDllName.AppendFormat(ThreeDigExt, aLanguage); |
|
69 #else |
60 _LIT(TwoDigExt,".%02d"); |
70 _LIT(TwoDigExt,".%02d"); |
61 localeDllName.AppendFormat(TwoDigExt, aLanguage); |
71 localeDllName.AppendFormat(TwoDigExt, aLanguage); |
|
72 #endif |
|
73 |
62 TInt error=localeDll.Load(localeDllName, uidType); |
74 TInt error=localeDll.Load(localeDllName, uidType); |
63 if (error==KErrNotFound) |
75 if (error==KErrNotFound) |
64 { |
76 { |
65 localeDllName=KLitLocaleDllNameBase; |
77 localeDllName=KLitLocaleDllNameBase; |
66 localeDllName.Append(KLitLocaleDllNameExtension); |
78 localeDllName.Append(KLitLocaleDllNameExtension); |
67 error=localeDll.Load(localeDllName, uidType); |
79 error=localeDll.Load(localeDllName, uidType); |
68 } |
80 } |
69 User::LeaveIfError(error); |
81 User::LeaveIfError(error); |
|
82 |
|
83 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
|
84 TExtendedLocale myExtendedLocale; |
|
85 User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName)); |
|
86 User::LeaveIfError(myExtendedLocale.SaveSystemSettings()); |
|
87 #else |
70 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
88 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
|
89 #endif |
71 CleanupStack::PopAndDestroy(); // localeDll |
90 CleanupStack::PopAndDestroy(); // localeDll |
72 } |
91 } |
73 |
92 |
74 // 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 |
75 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) |