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