sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "../EcomTestUtils/EcomTestUtils.h" sl@0: sl@0: #define UNUSED_VAR(a) a = a sl@0: sl@0: LOCAL_D RTest TEST(_L("ECom Language Plugin Test")); sl@0: sl@0: // Files to copy sl@0: _LIT(KEComLangPluginDllOnC, "C:\\sys\\bin\\LanguagePlugin.dll"); sl@0: _LIT(KEComLangPluginDllOnZ, "Z:\\RAMOnly\\LanguagePlugin.dll"); sl@0: sl@0: _LIT(KEComLangPluginRscOnC, "C:\\resource\\plugins\\LanguagePlugin.rsc"); sl@0: _LIT(KEComLangPluginRscOnZ, "Z:\\RAMOnly\\LanguagePlugin.rsc"); sl@0: sl@0: _LIT(KEComLangPluginRsc1OnC, "C:\\resource\\plugins\\LanguagePlugin.r01"); sl@0: _LIT(KEComLangPluginRsc1OnZ, "Z:\\RAMOnly\\LanguagePlugin.r01"); sl@0: sl@0: _LIT(KEComLangPluginRsc2OnC, "C:\\resource\\plugins\\LanguagePlugin.r02"); sl@0: _LIT(KEComLangPluginRsc2OnZ, "Z:\\RAMOnly\\LanguagePlugin.r02"); sl@0: sl@0: _LIT(KEComLangPluginRsc3OnC, "C:\\resource\\plugins\\LanguagePlugin.r03"); sl@0: _LIT(KEComLangPluginRsc3OnZ, "Z:\\RAMOnly\\LanguagePlugin.r03"); sl@0: sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: // Language files used for locale settings sl@0: _LIT(KEComEnglishLocale, "elocl.01"); sl@0: _LIT(KEComFrenchLocale, "elocl.02"); sl@0: _LIT(KEComGermanLocale, "elocl.03"); sl@0: _LIT(KEComSpanishLocale, "elocl.04"); sl@0: #else sl@0: // refer base/os/kernelhwsrv/kernel/eka/euser/locmapping.cpp sl@0: // Language sl@0: _LIT(KEComEnglishLang,"elocl_lan.001"); sl@0: _LIT(KEComFrenchLang,"elocl_lan.002"); sl@0: _LIT(KEComGermanLang,"elocl_lan.003"); sl@0: _LIT(KEComSpanishLang,"elocl_lan.004"); sl@0: // Region sl@0: _LIT(KEComEnglishReg,"elocl_reg.826"); sl@0: _LIT(KEComFrenchReg,"elocl_reg.250"); sl@0: _LIT(KEComGermanReg,"elocl_reg.276"); sl@0: _LIT(KEComSpanishReg,"elocl_reg.724"); sl@0: // Collation sl@0: _LIT(KEComEnglishColl,"elocl_col.001"); sl@0: _LIT(KEComFrenchColl,"elocl_col.002"); sl@0: _LIT(KEComGermanColl,"elocl_col.003"); sl@0: _LIT(KEComSpanishColl,"elocl_col.001"); sl@0: #endif sl@0: sl@0: // Result strings saved in opaque_data of each plugin sl@0: _LIT8(KEComDefaultResult, "LANGUAGE_RSC"); sl@0: _LIT8(KEComEnglishResult, "LANGUAGE_01"); sl@0: _LIT8(KEComFrenchResult, "LANGUAGE_02"); sl@0: _LIT8(KEComGermanResult, "LANGUAGE_03"); sl@0: sl@0: // Test data for data driven tests. sl@0: #define MAX_LANGUAGE_TEST_FILES 5 sl@0: struct TLangTestEntry sl@0: { sl@0: // Source and destination to copy necessary plugins sl@0: struct FilesInfo sl@0: { sl@0: const TDesC* source; sl@0: const TDesC* dest; sl@0: }; sl@0: FilesInfo files[MAX_LANGUAGE_TEST_FILES]; sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: // Locale file to load sl@0: const TDesC* localeFile; sl@0: #else sl@0: const TDesC* lang; sl@0: const TDesC* region; sl@0: const TDesC* collation; sl@0: #endif sl@0: // Language downgrade path to set up sl@0: TLanguage downgradePathSetup[3]; sl@0: sl@0: // Expected result - opaque_data of retrieved plugin sl@0: const TDesC8* result; sl@0: }; sl@0: sl@0: // Test Data sl@0: LOCAL_D const TLangTestEntry LangTestData[] = sl@0: { sl@0: // Data Set 0 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComEnglishResult sl@0: }, sl@0: // Data Set 1 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComFrenchLocale, sl@0: #else sl@0: &KEComFrenchLang, sl@0: &KEComFrenchReg, sl@0: &KEComFrenchColl, sl@0: #endif sl@0: {ELangFrench, ELangEnglish, ELangGerman}, sl@0: &KEComFrenchResult sl@0: }, sl@0: // Data Set 2 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangGerman, ELangEnglish, ELangFrench}, sl@0: &KEComGermanResult sl@0: }, sl@0: // Data Set 3 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComFrenchLocale, sl@0: #else sl@0: &KEComFrenchLang, sl@0: &KEComFrenchReg, sl@0: &KEComFrenchColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComFrenchResult sl@0: }, sl@0: // Data Set 4 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComGermanResult sl@0: }, sl@0: // Data Set 5 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangSpanish, ELangItalian, ELangGerman}, sl@0: &KEComGermanResult sl@0: }, sl@0: // Data Set 6 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC}, sl@0: {&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC} sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangSpanish, ELangItalian, ELangSwedish}, sl@0: &KEComDefaultResult sl@0: }, sl@0: // Data Set 7 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: {&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC}, sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangSpanish, ELangSwedish, ELangItalian}, sl@0: &KEComEnglishResult sl@0: }, sl@0: // Data Set 8 sl@0: { sl@0: { sl@0: {&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC}, sl@0: {&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC}, sl@0: }, sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangItalian, ELangSwedish, ELangSpanish}, sl@0: &KEComDefaultResult sl@0: }, sl@0: }; sl@0: sl@0: struct TLangTestEntry2 sl@0: { sl@0: // Locale file to load sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: // Locale file to load sl@0: const TDesC* localeFile; sl@0: #else sl@0: const TDesC* lang; sl@0: const TDesC* region; sl@0: const TDesC* collation; sl@0: #endif sl@0: sl@0: // Language downgrade path to set up sl@0: TLanguage downgradePathSetup[3]; sl@0: sl@0: // Expected result - opaque_data of retrieved plugin sl@0: const TDesC8* result; sl@0: }; sl@0: sl@0: LOCAL_D const TLangTestEntry2 LangTestData2[] = sl@0: { sl@0: //Data Set 0 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComEnglishResult sl@0: sl@0: }, sl@0: sl@0: //Data Set 1 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComFrenchLocale, sl@0: #else sl@0: &KEComFrenchLang, sl@0: &KEComFrenchReg, sl@0: &KEComFrenchColl, sl@0: #endif sl@0: {ELangFrench, ELangEnglish, ELangGerman}, sl@0: &KEComFrenchResult sl@0: }, sl@0: //Data Set 2 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangGerman, ELangEnglish, ELangFrench}, sl@0: &KEComGermanResult sl@0: }, sl@0: //Data Set 3 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComFrenchLocale, sl@0: #else sl@0: &KEComFrenchLang, sl@0: &KEComFrenchReg, sl@0: &KEComFrenchColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComFrenchResult sl@0: }, sl@0: //Data Set 4 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangEnglish, ELangFrench, ELangGerman}, sl@0: &KEComGermanResult sl@0: }, sl@0: //Data Set 5 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComGermanLocale, sl@0: #else sl@0: &KEComGermanLang, sl@0: &KEComGermanReg, sl@0: &KEComGermanColl, sl@0: #endif sl@0: {ELangSpanish, ELangItalian, ELangGerman}, sl@0: &KEComGermanResult sl@0: }, sl@0: //Data Set 6 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComEnglishLocale, sl@0: #else sl@0: &KEComEnglishLang, sl@0: &KEComEnglishReg, sl@0: &KEComEnglishColl, sl@0: #endif sl@0: {ELangSpanish, ELangItalian, ELangSwedish}, sl@0: &KEComEnglishResult sl@0: sl@0: }, sl@0: //Data Set 7 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComSpanishLocale, sl@0: #else sl@0: &KEComSpanishLang, sl@0: &KEComSpanishReg, sl@0: &KEComSpanishColl, sl@0: #endif sl@0: {ELangSpanish, ELangFrench, ELangEnglish}, sl@0: &KEComFrenchResult sl@0: sl@0: }, sl@0: //Data Set 8 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComSpanishLocale, sl@0: #else sl@0: &KEComSpanishLang, sl@0: &KEComSpanishReg, sl@0: &KEComSpanishColl, sl@0: #endif sl@0: {ELangSpanish,ELangItalian, ELangSwedish}, sl@0: &KEComDefaultResult sl@0: }, sl@0: sl@0: //Data Set 9 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComSpanishLocale, sl@0: #else sl@0: &KEComSpanishLang, sl@0: &KEComSpanishReg, sl@0: &KEComSpanishColl, sl@0: #endif sl@0: {ELangSpanish, ELangGerman, ELangItalian}, sl@0: &KEComGermanResult sl@0: }, sl@0: sl@0: //Data Set 10 sl@0: { sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: &KEComSpanishLocale, sl@0: #else sl@0: &KEComSpanishLang, sl@0: &KEComSpanishReg, sl@0: &KEComSpanishColl, sl@0: #endif sl@0: {ELangSpanish, ELangItalian, ELangNone}, sl@0: &KEComDefaultResult sl@0: } sl@0: }; sl@0: sl@0: class REComLanguagePluginTest sl@0: { sl@0: public: sl@0: void StaticRunTestsL(); sl@0: void DynamicRunTestsOnCL(); sl@0: void DynamicRunTestsOnZL(); sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: void SetLanguage(const TDesC& aLangFile, const TLanguage aLang[3]); sl@0: #else sl@0: void SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3]); sl@0: #endif sl@0: void CopyFiles(TInt aIndex); sl@0: static void DeleteFiles(TInt aIndex); sl@0: void DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit); sl@0: }; sl@0: sl@0: /** sl@0: Copies plugins. sl@0: */ sl@0: void REComLanguagePluginTest::CopyFiles(TInt aIndex) sl@0: { sl@0: for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source; i++) sl@0: { sl@0: TRAPD(err, EComTestUtils::FileManCopyFileL( *(LangTestData[aIndex].files[i].source), sl@0: *(LangTestData[aIndex].files[i].dest)) ); sl@0: TEST(err==KErrNone, __LINE__); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Deletes plugins. sl@0: */ sl@0: void REComLanguagePluginTest::DeleteFiles(TInt aIndex) sl@0: { sl@0: for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source != NULL; i++) sl@0: { sl@0: TRAPD(err, EComTestUtils::FileManDeleteFileL(*(LangTestData[aIndex].files[i].dest)) ); sl@0: UNUSED_VAR(err); sl@0: } sl@0: } sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: /** sl@0: Sets up the system-wide locale and language downgrade path. sl@0: */ sl@0: void REComLanguagePluginTest::SetLanguage(const TDesC& aLangFile, const TLanguage aLang[3]) sl@0: { sl@0: TLocale locale; sl@0: TInt loadval = 0; sl@0: TExtendedLocale extendedLocale; sl@0: sl@0: extendedLocale.LoadSystemSettings(); sl@0: loadval = extendedLocale.LoadLocale(aLangFile); sl@0: TEST(loadval==KErrNone, __LINE__); sl@0: extendedLocale.SaveSystemSettings(); sl@0: sl@0: locale.SetLanguageDowngrade(0, aLang[0]); sl@0: locale.SetLanguageDowngrade(1, aLang[1]); sl@0: locale.SetLanguageDowngrade(2, aLang[2]); sl@0: locale.Set(); sl@0: } sl@0: #else sl@0: /** sl@0: Sets up the system-wide locale and language downgrade path for the new locale model. sl@0: */ sl@0: void REComLanguagePluginTest::SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3]) sl@0: { sl@0: TLocale locale; sl@0: TExtendedLocale extendedLocale; sl@0: TInt loadval = 0; sl@0: sl@0: extendedLocale.LoadSystemSettings(); sl@0: loadval = extendedLocale.LoadLocale(aLanguage,aReg,aColl); sl@0: TEST(loadval==KErrNone, __LINE__); sl@0: extendedLocale.SaveSystemSettings(); sl@0: sl@0: locale.SetLanguageDowngrade(0, aLang[0]); sl@0: locale.SetLanguageDowngrade(1, aLang[1]); sl@0: locale.SetLanguageDowngrade(2, aLang[2]); sl@0: locale.Set(); sl@0: } sl@0: #endif sl@0: sl@0: void REComLanguagePluginTest::DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit) sl@0: { sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: REComSession::ListImplementationsL(aInterfaceId, implArray); sl@0: sl@0: // Verify results sl@0: TBuf<100> buf; sl@0: RDebug::Print(_L("\tArray Count = %d\n"), implArray.Count()); sl@0: buf.Copy(implArray[0]->OpaqueData()); sl@0: RDebug::Print(_L("\tOpaque Data = %S\n"), &buf); sl@0: TInt drive = implArray[0]->Drive(); sl@0: RDebug::Print(_L("\tDrive = %d\n"), drive); sl@0: sl@0: TEST(implArray.Count() == 1); sl@0: sl@0: if(aDriveUnit == EDriveZ) sl@0: { sl@0: TEST(implArray[0]->OpaqueData() == *(LangTestData2[testDataId].result)); sl@0: } sl@0: else sl@0: { sl@0: TEST(implArray[0]->OpaqueData() == *(LangTestData[testDataId].result)); sl@0: } sl@0: sl@0: TEST(implArray[0]->Drive() == aDriveUnit); sl@0: sl@0: // Post test clean up sl@0: REComSession::FinalClose(); sl@0: implArray.ResetAndDestroy(); sl@0: } sl@0: sl@0: /** sl@0: Test case for DEF087773: ECOM ValidateRegistry checks for existence of RSC file only sl@0: sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0655 sl@0: @SYMTestCaseDesc Checks for existence of resource files for different downgrade paths sl@0: @SYMTestPriority high sl@0: @SYMTestActions Data driven tests. sl@0: Create different sets of language dependant resource file on "C" sl@0: Drive and verify the ECom discovery process sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMDEF DEF087773 sl@0: */ sl@0: void REComLanguagePluginTest::StaticRunTestsL() sl@0: { sl@0: TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0655 ")); sl@0: TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry); sl@0: sl@0: TUid ifUid={0x10009DB9}; sl@0: for(TInt i = 0; i < numberOfElements; i++) sl@0: { sl@0: // kill ecom server so that language downgrade changes are picked up sl@0: ECOMTU_KILL_SERVER_L(TEST); sl@0: sl@0: // Prepare test sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup); sl@0: #else sl@0: SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup); sl@0: #endif sl@0: sl@0: CopyFiles(i); sl@0: sl@0: // 1st boot sl@0: TEST.Printf(_L("\tLanguage Plugin Test %d - 1st boot \n"), i); sl@0: DoCheckL(i,ifUid, EDriveC ); sl@0: sl@0: // kill ecom server for second boot sl@0: ECOMTU_KILL_SERVER_L(TEST); sl@0: sl@0: // 2nd boot sl@0: TEST.Printf(_L("\tLanguage Plugin Test %d - 2nd boot \n"), i); sl@0: DoCheckL(i, ifUid, EDriveC); sl@0: sl@0: DeleteFiles(i); sl@0: WAIT_FOR3s; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Test case for CR0209: Enable Dynamic Language Switching in ECOM sl@0: sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-3169 sl@0: @SYMTestCaseDesc Checks for picking up correct resource files for different downgrade paths in running time sl@0: @SYMTestPriority high sl@0: @SYMTestActions Data driven tests. sl@0: Start up Ecom server sl@0: Create different sets of language dependant resource file on "C" on running time. sl@0: Drive and verify the ECom discovery process sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMDEF CR0209 sl@0: */ sl@0: void REComLanguagePluginTest::DynamicRunTestsOnCL() sl@0: { sl@0: TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3169 ")); sl@0: TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry); sl@0: sl@0: RImplInfoPtrArray implArray; sl@0: TUid ifUid={0x10009DB9}; sl@0: sl@0: //start up ecom server sl@0: REComSession::ListImplementationsL(ifUid, implArray); sl@0: sl@0: for(TInt i = 0; i < numberOfElements; i++) sl@0: { sl@0: sl@0: // Prepare test sl@0: CopyFiles(i); sl@0: sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup); sl@0: #else sl@0: SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup); sl@0: #endif sl@0: WAIT_FOR3s; sl@0: sl@0: TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on C \n"), i); sl@0: DoCheckL(i,ifUid, EDriveC); sl@0: sl@0: DeleteFiles(i); sl@0: WAIT_FOR3s; sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: } sl@0: sl@0: // Post test clean up sl@0: REComSession::FinalClose(); sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: //kill ecomserver after finishing test sl@0: ECOMTU_KILL_SERVER_L(TEST); sl@0: sl@0: } sl@0: sl@0: /** sl@0: Test case for CR0209: Enable Dynamic Language Switching in ECOM on Z: drive sl@0: sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-3170 sl@0: @SYMTestCaseDesc Checks for picking up correct resource files for different downgrade paths in running time. sl@0: @SYMTestPriority high sl@0: @SYMTestActions Data driven tests. sl@0: Start up Ecom server sl@0: Change languae downgrade path on running time. sl@0: Drive and verify the ECom discovery process. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMDEF CR0209 sl@0: */ sl@0: void REComLanguagePluginTest::DynamicRunTestsOnZL() sl@0: { sl@0: TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3170 ")); sl@0: TInt numberOfElements = sizeof(LangTestData2)/sizeof(TLangTestEntry2); sl@0: sl@0: //Interface ID in a DLL existing on Z: Drive sl@0: TUid ifUid={0x10009DE1}; sl@0: sl@0: //start up ecom server sl@0: RImplInfoPtrArray implArray; sl@0: REComSession::ListImplementationsL(ifUid, implArray); sl@0: WAIT_FOR3s; sl@0: sl@0: for(TInt i = 0; i < numberOfElements; i++) sl@0: { sl@0: sl@0: // Prepare test sl@0: #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: SetLanguage(*(LangTestData2[i].localeFile), LangTestData2[i].downgradePathSetup); sl@0: #else sl@0: SetLanguage(*(LangTestData2[i].lang),*(LangTestData2[i].region),*(LangTestData2[i].collation),LangTestData2[i].downgradePathSetup); sl@0: #endif sl@0: WAIT_FOR3s; sl@0: sl@0: // Dynamic language downgrade path changing sl@0: TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on Z \n"), i); sl@0: DoCheckL(i,ifUid, EDriveZ); sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: } sl@0: sl@0: // Post test clean up sl@0: REComSession::FinalClose(); sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: } sl@0: sl@0: LOCAL_C void RunTestL() sl@0: { sl@0: __UHEAP_MARK; sl@0: REComLanguagePluginTest testSuite; sl@0: testSuite.StaticRunTestsL(); sl@0: testSuite.DynamicRunTestsOnCL(); sl@0: testSuite.DynamicRunTestsOnZL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: sl@0: TEST.Title(); sl@0: TEST.Start(_L("ECom Language Plugins tests.")); sl@0: sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: CActiveScheduler* scheduler = new(ELeave)CActiveScheduler; sl@0: CActiveScheduler::Install(scheduler); sl@0: sl@0: TRAPD(err,RunTestL()); sl@0: sl@0: // tidy up in case of leave sl@0: if(err != KErrNone) sl@0: { sl@0: TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry); sl@0: for(TInt i = 0; i < numberOfElements; i++) sl@0: { sl@0: REComLanguagePluginTest::DeleteFiles(i); sl@0: } sl@0: } sl@0: sl@0: TEST(err==KErrNone, __LINE__); sl@0: sl@0: delete scheduler; sl@0: delete cleanup; sl@0: sl@0: TEST.End(); sl@0: TEST.Close(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: return(0); sl@0: }