88 _LIT(KTestTApaAppInfoShortCaptionDefault,"TC UK"); |
87 _LIT(KTestTApaAppInfoShortCaptionDefault,"TC UK"); |
89 |
88 |
90 // Cenrep configuration details for English language |
89 // Cenrep configuration details for English language |
91 _LIT(KCenRepCaption, "CRTstCap UK"); |
90 _LIT(KCenRepCaption, "CRTstCap UK"); |
92 _LIT(KCenRepShortCaption, "CRTC UK"); |
91 _LIT(KCenRepShortCaption, "CRTC UK"); |
93 _LIT(KCenRepIconFilename, "C:\\resource\\apps\\ticoncapoverride.mbm"); |
92 _LIT(KCenRepIconFilename, "Z:\\resource\\apps\\ticoncapoverride.mbm"); |
94 |
|
95 _LIT(KTstAppStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TSTAPP_standalone.sis"); |
|
96 _LIT(KTstAppStandAloneComponent, "TSTAPP_standalone"); |
|
97 |
|
98 _LIT(KTstAppTiconcaptionoverrideSisFile, "z:\\apparctest\\apparctestsisfiles\\ticoncaptionoverride.sis"); |
|
99 _LIT(KTstAppTiconcaptionoverrideComponent, "ticoncaptionoverride"); |
|
100 |
|
101 _LIT(KForceRegAppSisFile, "z:\\apparctest\\apparctestsisfiles\\ForceRegApp1.sis"); |
|
102 _LIT(KForceRegAppComponent, "ForceRegApp1"); |
|
103 |
93 |
104 const TUid KUidIconCaptionRepository = {0x1028583d}; // Central Repository UID. |
94 const TUid KUidIconCaptionRepository = {0x1028583d}; // Central Repository UID. |
105 const TInt KTextSize = 100; |
95 const TInt KTextSize = 100; |
106 |
96 |
107 const TInt KDelay = 4000000; |
|
108 // |
97 // |
109 // |
98 // |
110 // CT_CaptionStep |
99 // CT_CaptionStep |
111 // |
100 // |
112 // |
101 // |
113 |
102 |
114 |
103 |
115 void CT_CaptionStep::ChangeLocaleL(TLanguage aLanguage) |
104 void CT_CaptionStep::ChangeLocaleL(TLanguage aLanguage) |
116 { |
105 { |
117 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
106 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
118 _LIT(KLitLanguageLocaleDllNameBase, "elocl_lan"); |
107 _LIT(KLitLocaleDllNameBase, "elocl_lan"); |
119 //Region and collation code values are hard coded, as the check, after changing the locale is made for the language only. |
108 _LIT(KLitLocaleDllNameExtension, ".loc"); |
120 _LIT(KLitRegionLocaleDllNameBase, "elocl_reg.826"); |
|
121 _LIT(KLitCollationLocaleDllNameBase, "elocl_col.001"); |
|
122 _LIT(ThreeDigExt,".%03d"); |
|
123 TExtendedLocale localeDll; |
|
124 const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6)); |
|
125 TBuf<16> languageLocaleDllName(KLitLanguageLocaleDllNameBase); |
|
126 languageLocaleDllName.AppendFormat(ThreeDigExt, aLanguage); |
|
127 TBuf<16> regionLocaleDllName(KLitRegionLocaleDllNameBase); |
|
128 TBuf<16> collationLocaleDllName(KLitCollationLocaleDllNameBase); |
|
129 // Try to load the locale dll |
|
130 TInt error=localeDll.LoadLocale(languageLocaleDllName, regionLocaleDllName, collationLocaleDllName); |
|
131 |
|
132 if (error==KErrNotFound) |
|
133 { |
|
134 // Locale dll is not found for the asked language. |
|
135 ERR_PRINTF2(_L("Failed to find the locale dll for %d"), aLanguage); |
|
136 } |
|
137 |
|
138 User::LeaveIfError(error); |
|
139 localeDll.SaveSystemSettings(); |
|
140 #else |
109 #else |
141 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
110 _LIT(KLitLocaleDllNameBase, "ELOCL"); |
|
111 _LIT(KLitLocaleDllNameExtension, ".LOC"); |
|
112 #endif |
|
113 RLibrary localeDll; |
|
114 TBuf<16> localeDllName(KLitLocaleDllNameBase); |
|
115 CleanupClosePushL(localeDll); |
|
116 const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6)); |
|
117 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
|
118 _LIT(ThreeDigExt,".%03d"); |
|
119 localeDllName.AppendFormat(ThreeDigExt, aLanguage); |
|
120 #else |
142 _LIT(TwoDigExt,".%02d"); |
121 _LIT(TwoDigExt,".%02d"); |
143 |
122 localeDllName.AppendFormat(TwoDigExt, aLanguage); |
144 RLibrary localeDll; |
123 #endif |
145 CleanupClosePushL(localeDll); |
124 |
146 |
|
147 const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6)); |
|
148 TBuf<16> localeDllName(KLitLocaleDllNameBase); |
|
149 localeDllName.AppendFormat(TwoDigExt, language); |
|
150 |
|
151 // Try to load the locale dll |
|
152 TInt error=localeDll.Load(localeDllName, uidType); |
125 TInt error=localeDll.Load(localeDllName, uidType); |
153 if (error==KErrNotFound) |
126 if (error==KErrNotFound) |
154 { |
127 { |
155 // Locale dll is not found for the asked language. |
128 localeDllName=KLitLocaleDllNameBase; |
156 ERR_PRINTF2(_L("Failed to find the locale dll for %d"), language); |
129 localeDllName.Append(KLitLocaleDllNameExtension); |
|
130 error=localeDll.Load(localeDllName, uidType); |
157 } |
131 } |
158 |
|
159 User::LeaveIfError(error); |
132 User::LeaveIfError(error); |
|
133 |
|
134 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL |
|
135 TExtendedLocale myExtendedLocale; |
|
136 User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName)); |
|
137 User::LeaveIfError(myExtendedLocale.SaveSystemSettings()); |
|
138 #else |
160 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
139 User::LeaveIfError(UserSvr::ChangeLocale(localeDllName)); |
161 CleanupStack: opAndDestroy(); // localeDll |
|
162 #endif |
140 #endif |
163 |
141 CleanupStack::PopAndDestroy(&localeDll); |
164 // Check if the device locale has changed |
|
165 if (aLanguage == User::Language()) |
|
166 { |
|
167 SetTestStepResult(EPass); |
|
168 } |
|
169 else |
|
170 { |
|
171 ERR_PRINTF3(_L("Failed to change the locale to %d whereas the current locale is"), aLanguage, User::Language()); |
|
172 } |
|
173 } |
142 } |
174 |
143 |
175 |
144 |
176 void CT_CaptionStep::DoLanguageTestL() |
145 void CT_CaptionStep::DoLanguageTestL() |
177 { |
146 { |
538 iLs.GetAppInfo(appInfo, KUidTestApp); |
507 iLs.GetAppInfo(appInfo, KUidTestApp); |
539 TEST(appInfo.iShortCaption == KShortCaption1); |
508 TEST(appInfo.iShortCaption == KShortCaption1); |
540 |
509 |
541 // Check short caption remains updated after a refresh of the applist |
510 // Check short caption remains updated after a refresh of the applist |
542 INFO_PRINTF1(_L(".....checking short caption remains updated after a refresh of the applist")); |
511 INFO_PRINTF1(_L(".....checking short caption remains updated after a refresh of the applist")); |
543 ForceApplistUpdate(); |
512 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
544 iLs.GetAppInfo(appInfo, KUidTestApp); |
513 iLs.GetAppInfo(appInfo, KUidTestApp); |
545 TEST(appInfo.iShortCaption == KShortCaption1); |
514 TEST(appInfo.iShortCaption == KShortCaption1); |
546 |
515 |
547 // Check short caption remains updated after a locale change |
516 // Check short caption remains updated after a locale change |
548 INFO_PRINTF1(_L(".....checking short caption remains updated after a locale change")); |
517 INFO_PRINTF1(_L(".....checking short caption remains updated after a locale change")); |
549 ChangeLocaleWaitForApplistUpdate(ELangJapanese); |
518 ChangeLocaleL(ELangJapanese); |
550 TEST(User::Language() == ELangJapanese); // Japanese locale exists in epoc32 tree but not defined in test app |
519 TEST(User::Language() == ELangJapanese); // Japanese locale exists in epoc32 tree but not defined in test app |
551 ChangeLocaleWaitForApplistUpdate(ELangEnglish); // back to English to see what happened in between |
520 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
|
521 ChangeLocaleL(ELangEnglish); // back to English to see what happened in between |
552 TEST(User::Language() == ELangEnglish); |
522 TEST(User::Language() == ELangEnglish); |
|
523 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
553 iLs.GetAppInfo(appInfo, KUidTestApp); |
524 iLs.GetAppInfo(appInfo, KUidTestApp); |
554 TEST(appInfo.iShortCaption == KShortCaption1); |
525 TEST(appInfo.iShortCaption == KShortCaption1); |
555 |
526 |
556 // Set short caption of an app for a language which is not the current one (ELangFrench, for example) |
527 // Set short caption of an app for a language which is not the current one (ELangFrench, for example) |
557 INFO_PRINTF1(_L(".....setting short caption of an app for a language which is not the current one")); |
528 INFO_PRINTF1(_L(".....setting short caption of an app for a language which is not the current one")); |
558 err = iLs.SetAppShortCaption(KShortCaption2, ELangFrench, KUidTestApp); |
529 err = iLs.SetAppShortCaption(KShortCaption2, ELangFrench, KUidTestApp); |
559 TEST(err == KErrNone); |
530 TEST(err == KErrNone); |
560 iLs.GetAppInfo(appInfo, KUidTestApp); |
531 iLs.GetAppInfo(appInfo, KUidTestApp); |
561 TEST(appInfo.iShortCaption == KShortCaption1); // English, the current app language, doesn't change... |
532 TEST(appInfo.iShortCaption == KShortCaption1); // English, the current app language, doesn't change... |
562 ChangeLocaleWaitForApplistUpdate(ELangFrench); |
533 ChangeLocaleL(ELangFrench); |
563 TEST(User::Language() == ELangFrench); |
534 TEST(User::Language() == ELangFrench); |
|
535 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
564 iLs.GetAppInfo(appInfo, KUidTestApp); |
536 iLs.GetAppInfo(appInfo, KUidTestApp); |
565 TEST(appInfo.iShortCaption == KShortCaption2); |
537 TEST(appInfo.iShortCaption == KShortCaption2); |
566 |
538 |
567 // Set short caption of an app for a language which the app does not include (ELangAmerican) |
539 // Set short caption of an app for a language which the app does not include (ELangAmerican) |
568 INFO_PRINTF1(_L(".....setting short caption of an app for a language which the app does not include")); |
540 INFO_PRINTF1(_L(".....setting short caption of an app for a language which the app does not include")); |
569 ChangeLocaleWaitForApplistUpdate(ELangAmerican); |
541 ChangeLocaleL(ELangAmerican); |
570 TEST(User::Language() == ELangAmerican); |
542 TEST(User::Language() == ELangAmerican); |
|
543 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
571 err = iLs.SetAppShortCaption(KShortCaption2, ELangAmerican, KUidTestApp); |
544 err = iLs.SetAppShortCaption(KShortCaption2, ELangAmerican, KUidTestApp); |
572 iLs.GetAppInfo(appInfo, KUidTestApp); |
545 iLs.GetAppInfo(appInfo, KUidTestApp); |
573 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
546 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
574 |
547 |
575 // Set short caption of an app for all languages with ELangNone |
548 // Set short caption of an app for all languages with ELangNone |
576 INFO_PRINTF1(_L(".....setting short caption for all languages with ELangNone")); |
549 INFO_PRINTF1(_L(".....setting short caption for all languages with ELangNone")); |
577 err = iLs.SetAppShortCaption(KShortCaption3, ELangNone, KUidTestApp); |
550 err = iLs.SetAppShortCaption(KShortCaption3, ELangNone, KUidTestApp); |
578 TEST(err == KErrNone); |
551 TEST(err == KErrNone); |
579 iLs.GetAppInfo(appInfo, KUidTestApp); |
552 iLs.GetAppInfo(appInfo, KUidTestApp); |
580 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
553 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
581 ChangeLocaleWaitForApplistUpdate(ELangEnglish); |
554 ChangeLocaleL(ELangEnglish); |
582 TEST(User::Language() == ELangEnglish); |
555 TEST(User::Language() == ELangEnglish); |
|
556 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
583 iLs.GetAppInfo(appInfo, KUidTestApp); |
557 iLs.GetAppInfo(appInfo, KUidTestApp); |
584 TEST(appInfo.iShortCaption == KShortCaption1); // English set individually ===> not updated by ELangNone |
558 TEST(appInfo.iShortCaption == KShortCaption1); // English set individually ===> not updated by ELangNone |
585 ChangeLocaleWaitForApplistUpdate(ELangFrench); |
559 ChangeLocaleL(ELangFrench); |
586 TEST(User::Language() == ELangFrench); |
560 TEST(User::Language() == ELangFrench); |
|
561 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
587 iLs.GetAppInfo(appInfo, KUidTestApp); |
562 iLs.GetAppInfo(appInfo, KUidTestApp); |
588 TEST(appInfo.iShortCaption == KShortCaption2); // French set individually ===> not updated by ELangNone |
563 TEST(appInfo.iShortCaption == KShortCaption2); // French set individually ===> not updated by ELangNone |
589 ChangeLocaleWaitForApplistUpdate(ELangGerman); |
564 ChangeLocaleL(ELangGerman); |
590 TEST(User::Language() == ELangGerman); |
565 TEST(User::Language() == ELangGerman); |
|
566 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
591 iLs.GetAppInfo(appInfo, KUidTestApp); |
567 iLs.GetAppInfo(appInfo, KUidTestApp); |
592 TEST(appInfo.iShortCaption == KShortCaption3); // German takes the one set by ELangNone |
568 TEST(appInfo.iShortCaption == KShortCaption3); // German takes the one set by ELangNone |
593 ChangeLocaleWaitForApplistUpdate(ELangItalian); |
569 ChangeLocaleL(ELangItalian); |
594 TEST(User::Language() == ELangItalian); |
570 TEST(User::Language() == ELangItalian); |
|
571 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
595 iLs.GetAppInfo(appInfo, KUidTestApp); |
572 iLs.GetAppInfo(appInfo, KUidTestApp); |
596 TEST(appInfo.iShortCaption == KShortCaption3); // Italian takes the one set by ELangNone |
573 TEST(appInfo.iShortCaption == KShortCaption3); // Italian takes the one set by ELangNone |
597 ChangeLocaleWaitForApplistUpdate(ELangSpanish); |
574 ChangeLocaleL(ELangSpanish); |
598 TEST(User::Language() == ELangSpanish); |
575 TEST(User::Language() == ELangSpanish); |
|
576 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
599 iLs.GetAppInfo(appInfo, KUidTestApp); |
577 iLs.GetAppInfo(appInfo, KUidTestApp); |
600 TEST(appInfo.iShortCaption == KShortCaption3); // Spanish takes the one set by ELangNone |
578 TEST(appInfo.iShortCaption == KShortCaption3); // Spanish takes the one set by ELangNone |
601 |
579 |
602 // Set short caption of an app for a language which was set by the previous ELangNone |
580 // Set short caption of an app for a language which was set by the previous ELangNone |
603 INFO_PRINTF1(_L(".....setting short caption of an app which was set by the previous ELangNone")); |
581 INFO_PRINTF1(_L(".....setting short caption of an app which was set by the previous ELangNone")); |
604 ChangeLocaleWaitForApplistUpdate(ELangItalian); |
582 ChangeLocaleL(ELangItalian); |
605 TEST(User::Language() == ELangItalian); |
583 TEST(User::Language() == ELangItalian); |
|
584 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
606 err = iLs.SetAppShortCaption(KShortCaption4, ELangItalian, KUidTestApp); |
585 err = iLs.SetAppShortCaption(KShortCaption4, ELangItalian, KUidTestApp); |
607 iLs.GetAppInfo(appInfo, KUidTestApp); |
586 iLs.GetAppInfo(appInfo, KUidTestApp); |
608 TEST(appInfo.iShortCaption == KShortCaption4); |
587 TEST(appInfo.iShortCaption == KShortCaption4); |
609 |
588 |
610 // Repeat set short caption of an app for all languages with ELangNone |
589 // Repeat set short caption of an app for all languages with ELangNone |
611 INFO_PRINTF1(_L(".....repeat setting short caption for all languages with ELangNone")); |
590 INFO_PRINTF1(_L(".....repeat setting short caption for all languages with ELangNone")); |
612 err = iLs.SetAppShortCaption(KShortCaption5, ELangNone, KUidTestApp); |
591 err = iLs.SetAppShortCaption(KShortCaption5, ELangNone, KUidTestApp); |
613 TEST(err == KErrNone); |
592 TEST(err == KErrNone); |
614 iLs.GetAppInfo(appInfo, KUidTestApp); |
593 iLs.GetAppInfo(appInfo, KUidTestApp); |
615 TEST(appInfo.iShortCaption == KShortCaption4); // Italian set individually ===> not updated by ELangNone |
594 TEST(appInfo.iShortCaption == KShortCaption4); // Italian set individually ===> not updated by ELangNone |
616 ChangeLocaleWaitForApplistUpdate(ELangEnglish); |
595 ChangeLocaleL(ELangEnglish); |
617 TEST(User::Language() == ELangEnglish); |
596 TEST(User::Language() == ELangEnglish); |
|
597 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
618 iLs.GetAppInfo(appInfo, KUidTestApp); |
598 iLs.GetAppInfo(appInfo, KUidTestApp); |
619 TEST(appInfo.iShortCaption == KShortCaption1); // English set individually ===> not updated by ELangNone |
599 TEST(appInfo.iShortCaption == KShortCaption1); // English set individually ===> not updated by ELangNone |
620 ChangeLocaleWaitForApplistUpdate(ELangFrench); |
600 ChangeLocaleL(ELangFrench); |
621 TEST(User::Language() == ELangFrench); |
601 TEST(User::Language() == ELangFrench); |
|
602 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
622 iLs.GetAppInfo(appInfo, KUidTestApp); |
603 iLs.GetAppInfo(appInfo, KUidTestApp); |
623 TEST(appInfo.iShortCaption == KShortCaption2); // French set individually ===> not updated by ELangNone |
604 TEST(appInfo.iShortCaption == KShortCaption2); // French set individually ===> not updated by ELangNone |
624 ChangeLocaleWaitForApplistUpdate(ELangGerman); |
605 ChangeLocaleL(ELangGerman); |
625 TEST(User::Language() == ELangGerman); |
606 TEST(User::Language() == ELangGerman); |
|
607 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
626 iLs.GetAppInfo(appInfo, KUidTestApp); |
608 iLs.GetAppInfo(appInfo, KUidTestApp); |
627 TEST(appInfo.iShortCaption == KShortCaption5); // German takes the one set by ELangNone |
609 TEST(appInfo.iShortCaption == KShortCaption5); // German takes the one set by ELangNone |
628 ChangeLocaleWaitForApplistUpdate(ELangSpanish); |
610 ChangeLocaleL(ELangSpanish); |
629 TEST(User::Language() == ELangSpanish); |
611 TEST(User::Language() == ELangSpanish); |
|
612 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
630 iLs.GetAppInfo(appInfo, KUidTestApp); |
613 iLs.GetAppInfo(appInfo, KUidTestApp); |
631 TEST(appInfo.iShortCaption == KShortCaption5); // Spanish takes the one set by ELangNone |
614 TEST(appInfo.iShortCaption == KShortCaption5); // Spanish takes the one set by ELangNone |
632 ChangeLocaleWaitForApplistUpdate(ELangAmerican); |
615 ChangeLocaleL(ELangAmerican); |
633 TEST(User::Language() == ELangAmerican); |
616 TEST(User::Language() == ELangAmerican); |
|
617 User::LeaveIfError(iLs.ForceRegistration(dummy)); |
634 iLs.GetAppInfo(appInfo, KUidTestApp); |
618 iLs.GetAppInfo(appInfo, KUidTestApp); |
635 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
619 TEST(appInfo.iShortCaption == KShortCaption1); // American takes the default...so English...which has just been updated. |
636 |
620 |
637 // restore original settings.... |
621 // restore original settings.... |
638 INFO_PRINTF1(_L(".....restoring original settings")); |
622 INFO_PRINTF1(_L(".....restoring original settings")); |
639 ChangeLocaleWaitForApplistUpdate(language); |
623 ChangeLocaleL(language); |
640 TEST(User::Language() == language); |
624 TEST(User::Language() == language); |
641 // restore original short captions for all langs....(h4 doesn't perform reboots between tests) |
625 // restore original short captions for all langs....(h4 doesn't perform reboots between tests) |
642 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionEnglish, ELangEnglish, KUidTestApp) == KErrNone); |
626 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionEnglish, ELangEnglish, KUidTestApp) == KErrNone); |
643 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionFrench, ELangFrench, KUidTestApp) == KErrNone); |
627 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionFrench, ELangFrench, KUidTestApp) == KErrNone); |
644 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionGerman, ELangGerman, KUidTestApp) == KErrNone); |
628 TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionGerman, ELangGerman, KUidTestApp) == KErrNone); |