appfw/apparchitecture/tef/T_CaptionStep.cpp
changeset 0 2e3d3ce01487
child 19 924385140d98
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test for GT0247 Bravo.
       
    15 // CR0583: Apparc should allow short caption to be modified dynamically
       
    16 // Test for UIKON GT0143 Typhoon Work Series 60 Changes.
       
    17 // REQ758.1: Add support for short captions
       
    18 // This test requires that tstapp.app has been built
       
    19 // tstapp.mmp has RESOURCE tstapp_caption.rss what caption is built into the .rsc file
       
    20 // tstapp_loc.rss decides what version of the caption file to include:
       
    21 // tstapp01.rls
       
    22 // tstapp02.rls
       
    23 // tstapp03.rls
       
    24 // tstapp04.rls
       
    25 // tstapp05.rls
       
    26 // tstappsc.rls
       
    27 // 
       
    28 // t_captionstep.cpp
       
    29 //
       
    30 
       
    31 /**
       
    32  @file t_captionstep.cpp
       
    33  @test
       
    34  @internalComponent - Internal Symbian test code
       
    35 */
       
    36 
       
    37 #include <apgicnfl.h>
       
    38 #include <hal.h>
       
    39 #include <e32test.h>
       
    40 
       
    41 #include <apgctl.h>
       
    42 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    43 #include <apgctllist.h>
       
    44 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    45 #include <apfctlf.h>
       
    46 #include <apgcli.h>
       
    47 #include "../apserv/apsserv.h"
       
    48 #include <apaflrec.h>
       
    49 #include <apparc.h>
       
    50 #include <apgdoor.h>
       
    51 #include <centralrepository.h>
       
    52 
       
    53 #include <s32file.h>
       
    54 #include "tstapp.h"		// KUidTestApp defined here
       
    55 #include "T_CaptionStep.h"
       
    56 #include "appfwk_test_utils.h"
       
    57 #include "appfwk_test.h"
       
    58 #include "ticoncaptionoverride.h" //KUidTestIconCapOverride defined here
       
    59 #include "TIconLoaderAndIconArrayForLeaks.h"
       
    60 
       
    61 
       
    62 //
       
    63 //
       
    64 //		global consts and declarations
       
    65 //
       
    66 //
       
    67 
       
    68 
       
    69 _LIT(KTestTApaAppInfoCaptionEnglish,"TstCap UK");
       
    70 _LIT(KTestTApaAppInfoShortCaptionEnglish,"TC UK");
       
    71 
       
    72 _LIT(KTestTApaAppInfoCaptionFrench,"TstCap FR");
       
    73 _LIT(KTestTApaAppInfoShortCaptionFrench,"TC FR");
       
    74 
       
    75 _LIT(KTestTApaAppInfoCaptionGerman,"TstCap GE");
       
    76 _LIT(KTestTApaAppInfoShortCaptionGerman,"TC GE");
       
    77 
       
    78 // If _loc.rss does not define Short Caption, it takes long caption
       
    79 _LIT(KTestTApaAppInfoCaptionSpanish,"TstCap SP");
       
    80 _LIT(KTestTApaAppInfoShortCaptionSpanish,"TstCap SP");
       
    81 
       
    82 // If _loc.rss does not define Caption, it takes app name
       
    83 _LIT(KTestTApaAppInfoCaptionItalian,"tstapp");
       
    84 _LIT(KTestTApaAppInfoShortCaptionItalian,"TC IT");
       
    85 
       
    86 _LIT(KTestTApaAppInfoCaptionDefault,"TstCap UK");
       
    87 _LIT(KTestTApaAppInfoShortCaptionDefault,"TC UK");
       
    88 
       
    89 // Cenrep configuration details for English language
       
    90 _LIT(KCenRepCaption, "CRTstCap UK");
       
    91 _LIT(KCenRepShortCaption, "CRTC UK");
       
    92 _LIT(KCenRepIconFilename, "Z:\\resource\\apps\\ticoncapoverride.mbm");
       
    93 
       
    94 const TUid KUidIconCaptionRepository = {0x1028583d}; // Central Repository UID.
       
    95 const TInt KTextSize = 100;
       
    96 
       
    97 //
       
    98 //
       
    99 //		CT_CaptionStep
       
   100 //
       
   101 //
       
   102 
       
   103 
       
   104 void CT_CaptionStep::ChangeLocaleL(TLanguage aLanguage)
       
   105 	{
       
   106 #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL 
       
   107     _LIT(KLitLocaleDllNameBase, "elocl_lan");
       
   108     _LIT(KLitLocaleDllNameExtension, ".loc");
       
   109 #else
       
   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
       
   121     _LIT(TwoDigExt,".%02d");
       
   122     localeDllName.AppendFormat(TwoDigExt, aLanguage);
       
   123 #endif          
       
   124             
       
   125     TInt error=localeDll.Load(localeDllName, uidType);
       
   126     if (error==KErrNotFound)
       
   127         {
       
   128         localeDllName=KLitLocaleDllNameBase;
       
   129         localeDllName.Append(KLitLocaleDllNameExtension);
       
   130         error=localeDll.Load(localeDllName, uidType);
       
   131         }
       
   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   
       
   139     User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
       
   140 #endif
       
   141     CleanupStack::PopAndDestroy(&localeDll);
       
   142 	}
       
   143 
       
   144 
       
   145 void CT_CaptionStep::DoLanguageTestL()
       
   146 	{
       
   147 	TLanguage language = User::Language();	// keep a copy to restore it later on.
       
   148 	
       
   149 	TInt ch = 0;
       
   150 	for (ch=0; ch < 6; ch++)
       
   151 		{
       
   152 		TLanguage languageToTest = ELangTest;	// init to supress compiler remark
       
   153 		switch (ch)
       
   154 			{
       
   155 			case 0:
       
   156 				languageToTest=ELangEnglish;
       
   157 				INFO_PRINTF1(_L("--------- Testing English"));
       
   158 				break;
       
   159 			case 1:
       
   160 				languageToTest=ELangFrench;
       
   161 				INFO_PRINTF1(_L("--------- Testing French"));
       
   162 				break;
       
   163 			case 2:
       
   164 				languageToTest=ELangGerman;
       
   165 				INFO_PRINTF1(_L("--------- Testing German"));
       
   166 				break;
       
   167 			case 3:
       
   168 				languageToTest=ELangSpanish;
       
   169 				INFO_PRINTF1(_L("--------- Testing Spanish"));
       
   170 				break;
       
   171 			case 4:
       
   172 				languageToTest=ELangItalian;
       
   173 				INFO_PRINTF1(_L("--------- Testing Italian"));
       
   174 				break;
       
   175 			case 5:
       
   176 				languageToTest=ELangAmerican;
       
   177 				INFO_PRINTF1(_L("--------- Testing American"));
       
   178 				break;
       
   179 			default:
       
   180 				User::LeaveIfError(KErrNotSupported);
       
   181 				break;
       
   182 			};
       
   183 
       
   184 		// Change the locale
       
   185 		ChangeLocaleL(languageToTest);
       
   186 		TEST(User::Language() == languageToTest);
       
   187 		
       
   188 		// Force the applist to be updated (so test app gets new language settings)
       
   189 		RPointerArray<TDesC> dummy;
       
   190 		User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   191 		
       
   192 		// Do the same set of tests for each language
       
   193 		TestCApaSystemControlListL();
       
   194 		TestCApaDoorL();
       
   195 		TestTApaAppInfoStreamsL();
       
   196 		HEAP_TEST_LS_SESSION(iLs, 0, 0, TestTApaAppInfoL(), iLs.ClearAppInfoArray() );
       
   197 
       
   198 		INFO_PRINTF1(_L("Test for that language finished..."));
       
   199 		}
       
   200 
       
   201 	// restore original locale, just in case...
       
   202 	ChangeLocaleL(language);
       
   203 	TEST(User::Language() == language);
       
   204 	}	
       
   205 
       
   206 /**
       
   207    @SYMTestCaseID	t_caption_TestCApaSystemControlListL
       
   208   
       
   209    @SYMPREQ			0
       
   210   
       
   211    @SYMTestCaseDesc	Check (short)caption by means of a control on the list CApaSystemControlList 
       
   212 
       
   213    @SYMTestPriority High
       
   214   
       
   215    @SYMTestStatus 	Implemented
       
   216   
       
   217    @SYMTestActions	The test creates a CApaSystemControlList and checks the value of (short)caption
       
   218    					by creating a CApaSystemControl from index 0 of CApaSystemControlList
       
   219 
       
   220    @SYMTestExpectedResults	The (short)caption is set to a value not null (length is not zero)
       
   221  */	
       
   222 void CT_CaptionStep::TestCApaSystemControlListL()
       
   223 	{
       
   224 	INFO_PRINTF1(_L("Testing CApaSystemControlList... "));
       
   225 	CApaSystemControlList* list=NULL;
       
   226 	User::LeaveIfError(FbsStartup());
       
   227 	RFbsSession fbs;
       
   228 	User::LeaveIfError(fbs.Connect());
       
   229 	TRAPD(ret, list=CApaSystemControlList::NewL(iFs));
       
   230 	TEST(ret==KErrNone);
       
   231 	CApaSystemControl* control=list->Control(0);
       
   232 	TPtrC testShortCap=control->ShortCaption();
       
   233 	TEST(testShortCap.Length()>0);
       
   234 	TPtrC testCap=control->Caption();
       
   235 	TEST(testCap.Length()>0);
       
   236 	}
       
   237 
       
   238 
       
   239 /**
       
   240    @SYMTestCaseID	t_caption_TestTApaAppInfoL
       
   241   
       
   242    @SYMPREQ			0
       
   243   
       
   244    @SYMTestCaseDesc Check appInfo contains the right (short)caption for the current test language.
       
   245 
       
   246    @SYMTestPriority High
       
   247   
       
   248    @SYMTestStatus 	Implemented
       
   249   
       
   250    @SYMTestActions	The test searches for KUidTestApp by calling GetNextApp until the UIDs match. 
       
   251    					Once the right app is found, it retrieves its details by calling GetAppInfo().
       
   252    					The (short)caption is check to ensure it matches the expected result.
       
   253 
       
   254    @SYMTestExpectedResults	The (short)caption matches the one specified for the application, with the
       
   255    							american one being the default one.
       
   256  */	
       
   257 void CT_CaptionStep::TestTApaAppInfoL()
       
   258 	{
       
   259 	INFO_PRINTF1(_L("Testing GetAppInfo()... "));
       
   260 	
       
   261 	// go through the list of apps until it finds KUidTestApp
       
   262 	TApaAppInfo appInfo;
       
   263 	TInt ret = iLs.GetAllApps();
       
   264 	TEST(ret==KErrNone);
       
   265 	FOREVER
       
   266 		{
       
   267 		TApaAppInfo info;
       
   268 		ret=iLs.GetNextApp(info);
       
   269 		TEST(ret==KErrNone);
       
   270 		if (info.iUid==KUidTestApp)
       
   271 			{
       
   272 			iLs.GetAppInfo(appInfo, info.iUid);
       
   273 			break;
       
   274 			}
       
   275 		}
       
   276 
       
   277 	switch (User::Language())
       
   278 		{
       
   279 		case ELangEnglish:
       
   280 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionEnglish);
       
   281 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionEnglish);
       
   282 			break;
       
   283 		case ELangFrench:
       
   284 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionFrench);
       
   285 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionFrench);
       
   286 			break;
       
   287 		case ELangGerman:
       
   288 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionGerman);
       
   289 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionGerman);
       
   290 			break;
       
   291 		case ELangSpanish:
       
   292 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionSpanish);
       
   293 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionSpanish);
       
   294 			break;
       
   295 		case ELangItalian:
       
   296 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionItalian);
       
   297 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionItalian);
       
   298 			break;
       
   299 		case ELangAmerican:
       
   300 			TEST(appInfo.iCaption==KTestTApaAppInfoCaptionDefault);
       
   301 			TEST(appInfo.iShortCaption==KTestTApaAppInfoShortCaptionDefault);
       
   302 			break;
       
   303 		default:
       
   304 			User::Leave(KErrNotSupported);
       
   305 			break;
       
   306 		};
       
   307 	}
       
   308 
       
   309 
       
   310 /**
       
   311    @SYMTestCaseID	t_caption_TestCApaDoorL
       
   312   
       
   313    @SYMPREQ			0
       
   314   
       
   315    @SYMTestCaseDesc	Check the caption returned by a CApaDoor (a wrapper for an embedded document).
       
   316 
       
   317    @SYMTestPriority High
       
   318   
       
   319    @SYMTestStatus 	Implemented
       
   320   
       
   321    @SYMTestActions	The test starts by creating an active scheduler.
       
   322    					A CApaProcess is created, and a new CApaDocument is added to it using the specified 
       
   323    					application factory. This document is then used to create a CApaDoor object which 
       
   324    					is used to retrieve the test app caption.
       
   325 
       
   326    @SYMTestExpectedResults	The (short)caption matches the one specified for the application, with the
       
   327    							american one being the default one.
       
   328  */	
       
   329 void CT_CaptionStep::TestCApaDoorL()
       
   330 	{
       
   331 	INFO_PRINTF1(_L("Testing CApaDoor... "));
       
   332 	
       
   333 	// create an active scheduler
       
   334 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
   335 	CActiveScheduler::Install(scheduler);
       
   336 	CleanupStack::PushL(scheduler);
       
   337 	INFO_PRINTF1(_L("Created and installed active scheduler... "));
       
   338 
       
   339 	CApaProcess* process=NULL;
       
   340 	TRAPD(ret,process = CApaProcess::NewL(iFs));
       
   341 	TEST(ret==KErrNone);
       
   342 	INFO_PRINTF1(_L("CApaProcess is created... "));
       
   343 
       
   344 	CleanupStack::PushL(process);
       
   345 
       
   346 	CApaDocument* doc=NULL;
       
   347 	TApaApplicationFactory appFact(KUidTestApp);
       
   348 	TRAP(ret,doc=process->AddNewDocumentL(appFact));
       
   349 	INFO_PRINTF1(_L("Added a new document to the process by providing app factory which contains test app... "));
       
   350 	TEST(ret==KErrNone);
       
   351 
       
   352 	CApaDoor* door = NULL;
       
   353 	TRAP(ret,door=CApaDoor::NewL(iFs,*doc,TSize(400,400)));
       
   354 	INFO_PRINTF1(_L("Created a CApaDoor with document generated... "));
       
   355 	TEST(ret==KErrNone);
       
   356 
       
   357 	switch (User::Language())
       
   358 		{
       
   359 		case ELangEnglish:
       
   360 			TEST(*door->Caption()==KTestTApaAppInfoCaptionEnglish);
       
   361 			break;
       
   362 		case ELangFrench:
       
   363 			TEST(*door->Caption()==KTestTApaAppInfoCaptionFrench);
       
   364 			break;
       
   365 		case ELangGerman:
       
   366 			TEST(*door->Caption()==KTestTApaAppInfoCaptionGerman);
       
   367 			break;
       
   368 		case ELangSpanish:
       
   369 			TEST(*door->Caption()==KTestTApaAppInfoCaptionSpanish);
       
   370 			break;
       
   371 		case ELangItalian:
       
   372 			TEST(*door->Caption()==KTestTApaAppInfoCaptionItalian);
       
   373 			break;
       
   374 		case ELangAmerican:
       
   375 			TEST(*door->Caption()==KTestTApaAppInfoCaptionDefault);
       
   376 			break;
       
   377 		default:
       
   378 			User::Leave(KErrNotSupported);
       
   379 			break;
       
   380 		};
       
   381 	INFO_PRINTF1(_L("Tested the caption... "));
       
   382 	process->DestroyDocument(doc);
       
   383 	INFO_PRINTF1(_L("Deleted the process... "));
       
   384 	CleanupStack::PopAndDestroy(2); //process,scheduler
       
   385 	}
       
   386 
       
   387 
       
   388 /**
       
   389    @SYMTestCaseID	t_caption_TestTApaAppInfoStreamsL
       
   390   
       
   391    @SYMPREQ			0
       
   392   
       
   393    @SYMTestCaseDesc Check TApaAppInfo streaming works as expected
       
   394 
       
   395    @SYMTestPriority High
       
   396   
       
   397    @SYMTestStatus 	Implemented
       
   398   
       
   399    @SYMTestActions	Create and TApaAppInfo object with the KUidTestApp test app.
       
   400    					Also, create a temporal file, associates the file with a write stream, 
       
   401    					and prepares the stream for writing. 
       
   402    					When the object is externalized to the streem, we open a file containing a 
       
   403    					read stream and prepares the stream for reading.
       
   404 
       
   405    @SYMTestExpectedResults	The test case is completed without any errors or panics
       
   406  */	
       
   407 void CT_CaptionStep::TestTApaAppInfoStreamsL()
       
   408 	{
       
   409 	INFO_PRINTF1(_L("Testing TApaAppInfo streams... "));
       
   410 
       
   411 	TApaAppInfo appInfoShort(KUidTestApp, _L("z:\\sys\\bin\\tstapp.exe"), _L("TstCap UK"),_L("TC UK"));
       
   412 	TEST(appInfoShort.iShortCaption.Compare(_L("TC UK"))==0);
       
   413 
       
   414 	TFileName tempFile=_L("c:\\system\\test\\TC_temp.txt");
       
   415 	TInt ret = iFs.MkDirAll(tempFile);
       
   416 	if (ret != KErrNone && ret != KErrAlreadyExists)
       
   417 		User::LeaveIfError(ret);
       
   418 	
       
   419 	TApaAppInfo appInfo;
       
   420 
       
   421 	RFileWriteStream writer;
       
   422 	writer.PushL();
       
   423 	User::LeaveIfError(writer.Replace(iFs,tempFile,EFileWrite));
       
   424 	TRAP(ret, appInfo.ExternalizeL(writer));
       
   425 	TEST(ret==KErrNone);
       
   426 	writer.CommitL();
       
   427 	CleanupStack::PopAndDestroy(&writer);
       
   428 
       
   429 	RFileReadStream reader;
       
   430 	reader.PushL();
       
   431 	User::LeaveIfError(reader.Open(iFs,tempFile,EFileRead));
       
   432 	TRAP(ret, appInfo.InternalizeL(reader));
       
   433 	TEST(ret==KErrNone);
       
   434 
       
   435 	CleanupStack::PopAndDestroy(&reader);
       
   436 
       
   437 	User::LeaveIfError(iFs.Delete(tempFile));
       
   438 	}
       
   439 	
       
   440 
       
   441 
       
   442 /**
       
   443    @SYMTestCaseID APPFWK-APPARC-0041 APPFWK-APPARC-0042 APPFWK-APPARC-0043 APPFWK-APPARC-0044 APPFWK-APPARC-0045 APPFWK-APPARC-0046
       
   444   
       
   445    @SYMPREQ PCHY-6FTLPK
       
   446   
       
   447    @SYMTestCaseDesc Test the RApaLsSession::SetAppShortCaption function, used to set the app's short caption.
       
   448   
       
   449    @SYMTestPriority High
       
   450   
       
   451    @SYMTestStatus Implemented
       
   452   
       
   453    @SYMTestActions Call SetAppShortCaption() to set the caption and read it back using the GetApaAppInfo().
       
   454   
       
   455    @SYMTestExpectedResults The returned short caption must match the one set by the SetAppShortCaption function.
       
   456  */	
       
   457 void CT_CaptionStep::DoShortCaptionTestL()
       
   458 	{
       
   459 	INFO_PRINTF1(_L("Testing SetAppShortCaptionL() for short caption changes... "));
       
   460 
       
   461 	_LIT(KShortCaption1, "SC1");
       
   462 	_LIT(KShortCaption2, "SC2");
       
   463 	_LIT(KShortCaption3, "SC3");
       
   464 	_LIT(KShortCaption4, "SC4");
       
   465 	_LIT(KShortCaption5, "SC5");
       
   466 
       
   467 	// keep a copy of the current language, and set it to a known one
       
   468 	TLanguage language = User::Language();
       
   469 	ChangeLocaleL(ELangEnglish);
       
   470 	TEST(User::Language() == ELangEnglish);
       
   471 	
       
   472 	// Force the applist to be updated (so test app gets new language settings)
       
   473 	RPointerArray<TDesC> dummy;
       
   474 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   475 
       
   476 	// SetAppShortCaption should return KErrNotFound if it could not find the app
       
   477 	INFO_PRINTF1(_L(".....setting short caption for an unknown app"));
       
   478 	TInt err = iLs.SetAppShortCaption(KShortCaption1, ELangNone, TUid::Uid(0xFFF34556));
       
   479 	TEST(err == KErrNotFound);
       
   480 
       
   481 	// Set the NULL short caption i.e. "", should return KErrArgument,
       
   482 	INFO_PRINTF1(_L(".....setting an empty short caption"));
       
   483 	err = iLs.SetAppShortCaption(KNullDesC, ELangNone, KUidTestApp);
       
   484 	TEST(err == KErrArgument);
       
   485 
       
   486 	// SetAppShortCaption should return KErrArgument if short caption > KApaMaxAppCaption
       
   487 	INFO_PRINTF1(_L(".....setting short caption of more then KApaMaxAppCaption length"));
       
   488 	HBufC* longCaption = HBufC::NewL(KApaMaxAppCaption+1);
       
   489 	longCaption->Des().SetLength(KApaMaxAppCaption+1);
       
   490 	err = iLs.SetAppShortCaption(*longCaption, ELangNone, KUidTestApp);
       
   491 	TEST(err == KErrArgument);
       
   492 	delete longCaption;
       
   493 
       
   494 	// SetAppShortCaption should return KErrNone if short caption == KApaMaxAppCaption
       
   495 	INFO_PRINTF1(_L(".....setting short caption of same size as KApaMaxAppCaption"));
       
   496 	longCaption = HBufC::NewL(KApaMaxAppCaption);
       
   497 	longCaption->Des().SetLength(KApaMaxAppCaption);
       
   498 	err = iLs.SetAppShortCaption(*longCaption, ELangCatalan, KUidTestApp);	// just testing the arg length, not actual values
       
   499 	TEST(err == KErrNone);
       
   500 	delete longCaption;
       
   501 
       
   502 	// Set short caption of an app for the current locale language (ELangEnglish so far)
       
   503 	INFO_PRINTF1(_L(".....setting short caption of an app for the current locale language"));
       
   504 	err = iLs.SetAppShortCaption(KShortCaption1, ELangEnglish, KUidTestApp);
       
   505 	TEST(err == KErrNone);
       
   506 	TApaAppInfo appInfo;
       
   507 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   508 	TEST(appInfo.iShortCaption == KShortCaption1);
       
   509 
       
   510 	// 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"));
       
   512 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   513 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   514 	TEST(appInfo.iShortCaption == KShortCaption1);
       
   515 
       
   516 	// Check short caption remains updated after a locale change
       
   517 	INFO_PRINTF1(_L(".....checking short caption remains updated after a locale change"));
       
   518 	ChangeLocaleL(ELangJapanese);
       
   519 	TEST(User::Language() == ELangJapanese);	// Japanese locale exists in epoc32 tree but not defined in test app
       
   520 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   521 	ChangeLocaleL(ELangEnglish);				// back to English to see what happened in between
       
   522 	TEST(User::Language() == ELangEnglish);
       
   523 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   524 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   525 	TEST(appInfo.iShortCaption == KShortCaption1);
       
   526 
       
   527 	// 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"));
       
   529 	err = iLs.SetAppShortCaption(KShortCaption2, ELangFrench, KUidTestApp);
       
   530 	TEST(err == KErrNone);
       
   531 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   532 	TEST(appInfo.iShortCaption == KShortCaption1);	// English, the current app language, doesn't change...
       
   533 	ChangeLocaleL(ELangFrench);
       
   534 	TEST(User::Language() == ELangFrench);
       
   535 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   536 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   537 	TEST(appInfo.iShortCaption == KShortCaption2);	
       
   538 	
       
   539 	// 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"));
       
   541 	ChangeLocaleL(ELangAmerican);
       
   542 	TEST(User::Language() == ELangAmerican);
       
   543 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   544 	err = iLs.SetAppShortCaption(KShortCaption2, ELangAmerican, KUidTestApp);
       
   545 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   546 	TEST(appInfo.iShortCaption == KShortCaption1);	// American takes the default...so English...which has just been updated.
       
   547 
       
   548 	// Set short caption of an app for all languages with ELangNone
       
   549 	INFO_PRINTF1(_L(".....setting short caption for all languages with ELangNone"));
       
   550 	err = iLs.SetAppShortCaption(KShortCaption3, ELangNone, KUidTestApp);
       
   551 	TEST(err == KErrNone);
       
   552 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   553 	TEST(appInfo.iShortCaption == KShortCaption1);	// American takes the default...so English...which has just been updated.
       
   554 	ChangeLocaleL(ELangEnglish);
       
   555 	TEST(User::Language() == ELangEnglish);
       
   556 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   557 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   558 	TEST(appInfo.iShortCaption == KShortCaption1);	// English set individually ===> not updated by ELangNone
       
   559 	ChangeLocaleL(ELangFrench);
       
   560 	TEST(User::Language() == ELangFrench);
       
   561 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   562 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   563 	TEST(appInfo.iShortCaption == KShortCaption2);	// French set individually ===> not updated by ELangNone
       
   564 	ChangeLocaleL(ELangGerman);
       
   565 	TEST(User::Language() == ELangGerman);
       
   566 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   567 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   568 	TEST(appInfo.iShortCaption == KShortCaption3);	// German takes the one set by  ELangNone
       
   569 	ChangeLocaleL(ELangItalian);
       
   570 	TEST(User::Language() == ELangItalian);
       
   571 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   572 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   573 	TEST(appInfo.iShortCaption == KShortCaption3);	// Italian takes the one set by ELangNone
       
   574 	ChangeLocaleL(ELangSpanish);
       
   575 	TEST(User::Language() == ELangSpanish);
       
   576 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   577 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   578 	TEST(appInfo.iShortCaption == KShortCaption3);	// Spanish takes the one set by ELangNone
       
   579 
       
   580 	// 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"));
       
   582 	ChangeLocaleL(ELangItalian);
       
   583 	TEST(User::Language() == ELangItalian);
       
   584 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   585 	err = iLs.SetAppShortCaption(KShortCaption4, ELangItalian, KUidTestApp);
       
   586 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   587 	TEST(appInfo.iShortCaption == KShortCaption4);
       
   588 
       
   589 	// 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"));
       
   591 	err = iLs.SetAppShortCaption(KShortCaption5, ELangNone, KUidTestApp);
       
   592 	TEST(err == KErrNone);
       
   593 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   594 	TEST(appInfo.iShortCaption == KShortCaption4);	// Italian set individually ===> not updated by ELangNone
       
   595 	ChangeLocaleL(ELangEnglish);
       
   596 	TEST(User::Language() == ELangEnglish);
       
   597 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   598 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   599 	TEST(appInfo.iShortCaption == KShortCaption1);	// English set individually ===> not updated by ELangNone
       
   600 	ChangeLocaleL(ELangFrench);
       
   601 	TEST(User::Language() == ELangFrench);
       
   602 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   603 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   604 	TEST(appInfo.iShortCaption == KShortCaption2);	// French set individually ===> not updated by ELangNone
       
   605 	ChangeLocaleL(ELangGerman);
       
   606 	TEST(User::Language() == ELangGerman);
       
   607 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   608 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   609 	TEST(appInfo.iShortCaption == KShortCaption5);	// German takes the one set by  ELangNone
       
   610 	ChangeLocaleL(ELangSpanish);
       
   611 	TEST(User::Language() == ELangSpanish);
       
   612 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   613 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   614 	TEST(appInfo.iShortCaption == KShortCaption5);	// Spanish takes the one set by ELangNone
       
   615 	ChangeLocaleL(ELangAmerican);
       
   616 	TEST(User::Language() == ELangAmerican);
       
   617 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   618 	iLs.GetAppInfo(appInfo, KUidTestApp);
       
   619 	TEST(appInfo.iShortCaption == KShortCaption1);	// American takes the default...so English...which has just been updated.
       
   620 
       
   621 	// restore original settings....
       
   622 	INFO_PRINTF1(_L(".....restoring original settings"));
       
   623 	ChangeLocaleL(language);
       
   624 	TEST(User::Language() == language);
       
   625 	// restore original short captions for all langs....(h4 doesn't perform reboots between tests)
       
   626 	TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionEnglish, ELangEnglish, KUidTestApp) == KErrNone);
       
   627 	TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionFrench, ELangFrench, KUidTestApp) == KErrNone);
       
   628 	TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionGerman, ELangGerman, KUidTestApp) == KErrNone);
       
   629 	TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionItalian, ELangItalian, KUidTestApp) == KErrNone);
       
   630 	TEST(iLs.SetAppShortCaption(KTestTApaAppInfoShortCaptionSpanish, ELangSpanish, KUidTestApp) == KErrNone);
       
   631 	}
       
   632 
       
   633 
       
   634 CT_CaptionStep::~CT_CaptionStep()
       
   635 	{
       
   636 	iFs.Close();
       
   637 	iLs.Close();
       
   638 	}
       
   639 
       
   640 CT_CaptionStep::CT_CaptionStep()
       
   641 	{
       
   642 	SetTestStepName(KT_CaptionStep);
       
   643 	}
       
   644 
       
   645 /**
       
   646 @SYMTestCaseID 				APPFWK-APPARC-0087
       
   647 @SYMPREQ 					CR1187
       
   648 @SYMREQ						REQ9167
       
   649 @SYMTestCaseDesc			Tests whether the captions, icon configuration details have been retrieved properly from
       
   650 							the central repository settings and has the precedence over its resource file information.
       
   651 @SYMTestType				CIT
       
   652 @SYMTestPriority			Critical
       
   653 @SYMTestActions				A test application with its captions, icon details defined in a test central repository file
       
   654 							as well as resource file (suitable field values have been given for both cenrep and resource
       
   655 							configurations to identify it clearly).
       
   656 							Gets the information about the test application by passing its UID.
       
   657 							Check the given configuration details matches with central repository entries.
       
   658 @SYMTestExpectedResults 	The given configuration details should match with central repository entries.
       
   659 */
       
   660 
       
   661 void CT_CaptionStep::TestIconCaptionOverridesL()
       
   662 	{
       
   663 	INFO_PRINTF1(_L("APPFWK-APPARC-0087:TestIconCaptionOverridesL started..."));
       
   664 	
       
   665 	//Change the system language to English before starting the tests
       
   666 	TRAPD(ret,ChangeLocaleL(ELangEnglish));
       
   667 	TEST(ret == KErrNone);
       
   668 				
       
   669 	TApaAppInfo appInfo;
       
   670 	//Get test app's information
       
   671 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   672 
       
   673 	RFile file;
       
   674 	TBuf<KTextSize> fileName;
       
   675 	//Get test app's icon information
       
   676 	iLs.GetAppIcon(KUidTestIconCapOverride,file);
       
   677 	file.FullName(fileName);
       
   678 
       
   679 	//compare the captions, icon with values in CenRep file.
       
   680 	INFO_PRINTF1(_L("Compares Caption with value in CenRep..."));
       
   681 	TBuf<KTextSize> cencap(KCenRepCaption);
       
   682 	
       
   683 	INFO_PRINTF2(_L("----Expected caption==>%S"), &cencap);
       
   684 	INFO_PRINTF2(_L("----Retrieved caption==>%S"), &appInfo.iCaption);
       
   685 	TEST(appInfo.iCaption == KCenRepCaption);
       
   686 	INFO_PRINTF1(_L("Compares ShortCaption with the value in CenRep..."));
       
   687 	cencap.Zero();
       
   688 	cencap.Copy(KCenRepShortCaption);
       
   689 	
       
   690 	INFO_PRINTF2(_L("----Expected short caption==>%S"), &cencap);
       
   691 	INFO_PRINTF2(_L("----Retrieved short caption==>%S"), &appInfo.iShortCaption);
       
   692 	TEST(appInfo.iShortCaption == KCenRepShortCaption);
       
   693 	
       
   694 	INFO_PRINTF1(_L("Compares Icon file with the value in CenRep..."));
       
   695 	cencap.Zero();
       
   696 	cencap.Copy(KCenRepIconFilename);
       
   697 	INFO_PRINTF2(_L("----Expected icon filename==>%S"), &cencap);
       
   698 	INFO_PRINTF2(_L("----Retrieved icon filename==>%S"), &fileName);
       
   699 	TEST(fileName.Compare(KCenRepIconFilename)==0);
       
   700 	
       
   701 	file.Close();
       
   702 	INFO_PRINTF1(_L("APPFWK-APPARC-0087:TestIconCaptionOverridesL finished..."));
       
   703 	}	
       
   704 
       
   705 /**
       
   706 @SYMTestCaseID 				APPFWK-APPARC-0088
       
   707 @SYMPREQ 					CR1187
       
   708 @SYMREQ						REQ9167
       
   709 @SYMTestCaseDesc			Tests whether the shortcaption is set through the API has got the precedence over central
       
   710 							repository and resource file customisation.
       
   711 @SYMTestType				CIT	
       
   712 @SYMTestPriority			Critical
       
   713 @SYMTestActions				A test application with its short caption defined in central repository as well as in resource file.
       
   714 							Update the test application's short caption through API.
       
   715 							Gets the information about the test application by passing its UID.
       
   716 							Check whether the provided short caption matches with the one which has already been set through the API.
       
   717 @SYMTestExpectedResults 	It should retrieve the short caption set through the API and match with the given short caption value.
       
   718 */
       
   719 
       
   720 void CT_CaptionStep::TestApiPrecedenceOverCenRepConfigInfoL()
       
   721 	{
       
   722 	INFO_PRINTF1(_L("APPFWK-APPARC-0088:TestApiPrecedenceOverCenRepConfigInfoL started..."));
       
   723 	_LIT(KTApiShortCaption,"APITC UK");
       
   724 	
       
   725 	TInt err = iLs.SetAppShortCaption(KTApiShortCaption, ELangEnglish, KUidTestIconCapOverride);
       
   726 	TEST(err == KErrNone);
       
   727 
       
   728 	TApaAppInfo appInfo;
       
   729 	//Get test app's information
       
   730 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   731 	
       
   732 	TBuf<KTextSize> shortCaption(KTApiShortCaption);
       
   733 
       
   734 	//compares the short caption with the value which has been set through API.
       
   735 	INFO_PRINTF1(_L("Compares short caption with the value that has been set through API..."));
       
   736 	INFO_PRINTF2(_L("----Expected short caption==>%S"), &shortCaption);
       
   737 	INFO_PRINTF2(_L("----Retrieved short caption==>%S"), &appInfo.iShortCaption);
       
   738 	TEST(appInfo.iShortCaption == KTApiShortCaption);
       
   739 	
       
   740 	//Sets the short caption back to the actual one
       
   741 	INFO_PRINTF1(_L("Sets the short caption back to the actual one through API..."));
       
   742 	err = iLs.SetAppShortCaption(KCenRepShortCaption, ELangEnglish, KUidTestIconCapOverride);
       
   743 	TEST(err == KErrNone);
       
   744 
       
   745 	INFO_PRINTF1(_L("APPFWK-APPARC-0088:TestApiPrecedenceOverCenRepConfigInfoL finished..."));
       
   746 	}
       
   747 
       
   748 /**
       
   749 @SYMTestCaseID 				APPFWK-APPARC-0089
       
   750 @SYMPREQ 					CR1187
       
   751 @SYMREQ						REQ9167
       
   752 @SYMTestCaseDesc			Tests whether the changes made in central repository is notified by the central repository
       
   753 							observer (CApaIconCaptionCenrepObserver), which watches for changes in the Central Repository
       
   754 							and updates the overrides when they occur.
       
   755 @SYMTestType				CIT	
       
   756 @SYMTestPriority			Critical
       
   757 @SYMTestActions				A test application with its caption, icon configuration details defined in central repository file.
       
   758 							Access the central repository.
       
   759 							Update the test application short caption's value in the settings.
       
   760 							Get the information about the test application by passing its UID.
       
   761 							Check the short caption value retrieved from the central repository matches with the given information.
       
   762 @SYMTestExpectedResults 	The given new short caption value should match with the central repository entry.
       
   763 */
       
   764 void CT_CaptionStep::TestCenRepChangeNotificationL()
       
   765 	{
       
   766 	INFO_PRINTF1(_L("APPFWK-APPARC-0089:TestCenRepChangeNotificationL started..."));
       
   767 	
       
   768 	//access central repository
       
   769 	CRepository* cenRep = CRepository::NewL(KUidIconCaptionRepository);
       
   770 	CleanupStack::PushL(cenRep);
       
   771 
       
   772 	_LIT(KCenRepSC,"CRNTC UK");	
       
   773 	TUint32 shortCapKey = 0x00000001;  // for English
       
   774 	
       
   775 	//update the short caption value in central repository.
       
   776 	TInt error = cenRep->Set(shortCapKey,KCenRepSC);
       
   777 	
       
   778 	//tests whether the process with WriteDeviceData capability can update the configuration settings.
       
   779 	TEST(error == KErrNone);
       
   780 	
       
   781 	// Force the applist to be updated (so test app gets new language settings)
       
   782 	RPointerArray<TDesC> dummy;
       
   783 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   784 	
       
   785 	TApaAppInfo appInfo;
       
   786 	//Get test app's information
       
   787 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   788 
       
   789 	//compare the short caption with the updated value in central repository
       
   790 	INFO_PRINTF1(_L("Compares short caption with the updated value in CenRep..."));
       
   791 	TBuf<KTextSize> shortCaption(KCenRepSC);
       
   792 	
       
   793 	INFO_PRINTF2(_L("----Expected short caption==>%S"), &shortCaption);
       
   794 	INFO_PRINTF2(_L("----Retrieved shortcaption==>%S"), &appInfo.iShortCaption);
       
   795 	TEST(appInfo.iShortCaption == KCenRepSC);
       
   796 	
       
   797 	//sets the short caption back to the actual for other tests to work
       
   798 	error = cenRep->Set(shortCapKey,KCenRepShortCaption);
       
   799 	
       
   800 	// Force the applist to be updated (so test app gets new language settings)
       
   801 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   802 	
       
   803 	CleanupStack::PopAndDestroy(cenRep); //cenRep object
       
   804 	INFO_PRINTF1(_L("APPFWK-APPARC-0089:TestCenRepChangeNotificationL finished..."));
       
   805 	}
       
   806 
       
   807 /**
       
   808 @SYMTestCaseID 				APPFWK-APPARC-0090
       
   809 @SYMPREQ 					CR1187
       
   810 @SYMREQ						REQ9167
       
   811 @SYMTestCaseDesc			Tests whether the caption, icon configuration details have been retrieved properly from the
       
   812 							Central Repository with respect to change in system language.
       
   813 							Tests if the particular language entry is not there in the central repository file, it will
       
   814 							then try to get the information from the resource file.
       
   815 @SYMTestType				CIT	
       
   816 @SYMTestPriority			Critical
       
   817 @SYMTestActions				A multilingual test application with its caption, icon configuration details defined in central repository file.
       
   818 							Change the system language to French.
       
   819 							Gets the information about the test application by passing its UID.
       
   820 							Checks the retrieved captions, icon from Central Repository are in French.
       
   821 							Change the system language to German (the settings are not there for German in Central Repository).
       
   822 							Again gets the information about the test application by passing its UID.
       
   823 							Checks the retrieved captions, icon from the Resource file are in German.
       
   824 							Restores the system language to English.
       
   825 							Again gets the information about the test application by passing its UID.
       
   826 							Checks the retrieved captions, icon from Central Repository are in English.
       
   827 @SYMTestExpectedResults 	All the retrieved Central Repository configuration details should match with the given details by changing
       
   828 							system language.
       
   829 */
       
   830 
       
   831 void CT_CaptionStep::TestIconCaptionOverridesWithChangeLangL()
       
   832 	{
       
   833 	INFO_PRINTF1(_L("APPFWK-APPARC-0090:TestIconCaptionOverridesWithChangeLangL started..."));
       
   834 	
       
   835 	TInt ret = 0;
       
   836 	//French
       
   837 	_LIT(KCaptionFrench, "CRTstCap FR");
       
   838 	_LIT(KShortCaptionFrench, "CRTC FR");
       
   839 	_LIT(KIconFilenameFrench, "Z:\\resource\\apps\\svg_icon.svg");
       
   840 
       
   841 	//German
       
   842 	_LIT(KCaptionGerman, "TstCap GE");
       
   843 	_LIT(KShortCaptionGerman, "TC GE");
       
   844 	_LIT(KIconFilenameGerman, "Z:\\resource\\apps\\ticoncapoverride.mbm");
       
   845 
       
   846 	TApaAppInfo appInfo;
       
   847 	RFile file;
       
   848 	TBuf<KTextSize> fileName;
       
   849 		
       
   850 	// Change the locale to French
       
   851 	INFO_PRINTF1(_L("Change the locale to French..."));
       
   852 	TRAP(ret,ChangeLocaleL(ELangFrench));
       
   853 	TEST(ret == KErrNone);
       
   854 	INFO_PRINTF2(_L("----System Language==>%d"), User::Language());
       
   855 	
       
   856 	TEST(User::Language() == ELangFrench);//check language is set to French.
       
   857 	
       
   858 	// Force the applist to be updated (so test app gets new language settings)
       
   859 	RPointerArray<TDesC> dummy;
       
   860 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   861 	
       
   862 	//Get test app's information
       
   863 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   864 
       
   865 	//Get test app's icon information
       
   866 	iLs.GetAppIcon(KUidTestIconCapOverride,file);
       
   867 	file.FullName(fileName);
       
   868 	
       
   869 	TBuf<KTextSize> printString(KCaptionFrench);
       
   870 	
       
   871 	//compare the captions, icon in French with the value in central repository
       
   872 	INFO_PRINTF1(_L("Compares Caption with value in CenRep..."));
       
   873 	INFO_PRINTF2(_L("----Exepcted Caption in French==>%S"), &printString);
       
   874 	INFO_PRINTF2(_L("----Retrieved Caption==>%S"), &appInfo.iCaption);	
       
   875 	TEST(appInfo.iCaption == KCaptionFrench);
       
   876 	
       
   877 	INFO_PRINTF1(_L("Compares Short Caption with value in CenRep..."));
       
   878 	printString.Zero();
       
   879 	printString.Copy(KShortCaptionFrench);
       
   880 	INFO_PRINTF2(_L("----Expected short caption in French==>%S"), &printString);
       
   881 	INFO_PRINTF2(_L("----Retrieved short caption==>%S"), &appInfo.iShortCaption);
       
   882 	TEST(appInfo.iShortCaption == KShortCaptionFrench);
       
   883 	
       
   884 	INFO_PRINTF1(_L("Compares Icon filename with value in CenRep..."));
       
   885 	printString.Zero();
       
   886 	printString.Copy(KIconFilenameFrench);
       
   887 	INFO_PRINTF2(_L("----Expected icon filename in French==>%S"), &printString);
       
   888 	INFO_PRINTF2(_L("----Retrieved icon filename==>%S"), &fileName);
       
   889 	TEST(fileName.Compare(KIconFilenameFrench)==0);
       
   890 	
       
   891 	//Change the locale to German.
       
   892 	INFO_PRINTF1(_L("Change the locale to German..."));
       
   893 	TRAP(ret,ChangeLocaleL(ELangGerman));
       
   894 	TEST(ret == KErrNone);
       
   895 	INFO_PRINTF2(_L("----System Language==>%d"), User::Language());
       
   896 	TEST(User::Language() == ELangGerman);//check language is set to German.
       
   897 	
       
   898 	// Force the applist to be updated (so test app gets new language settings)
       
   899 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   900 	
       
   901 	//Get test app's information
       
   902 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   903 
       
   904 	file.Close();
       
   905 	//Get test app's icon information
       
   906 	iLs.GetAppIcon(KUidTestIconCapOverride,file);
       
   907 	
       
   908 	fileName.Zero();
       
   909 	file.FullName(fileName);
       
   910 	
       
   911 	// The entry for language German is not there in Central repository so it compares
       
   912 	// the captions, icon in this language with the values in resource file.
       
   913 	INFO_PRINTF1(_L("Compares Caption with value in Resource file..."));
       
   914 	printString.Zero();
       
   915 	printString.Copy(KCaptionGerman);
       
   916 	INFO_PRINTF2(_L("----Expected caption in German==>%S"), &printString);
       
   917 	INFO_PRINTF2(_L("----Retrieved caption==>%S"), &appInfo.iCaption);
       
   918 	TEST(appInfo.iCaption == KCaptionGerman);
       
   919 	
       
   920 	INFO_PRINTF1(_L("Compares short caption with value in Resource file..."));
       
   921 	printString.Zero();
       
   922 	printString.Copy(KShortCaptionGerman);
       
   923 	INFO_PRINTF2(_L("----Expected short caption in German==>%S"), &printString);
       
   924 	INFO_PRINTF2(_L("----Retrieved short caption==>%S"), &appInfo.iShortCaption);
       
   925 	TEST(appInfo.iShortCaption == KShortCaptionGerman);
       
   926 	
       
   927 	INFO_PRINTF1(_L("Compares icon filename with value in Resource file..."));
       
   928 	printString.Zero();
       
   929 	printString.Copy(KIconFilenameGerman);
       
   930 	INFO_PRINTF2(_L("----Expected icon filename in German==>%S"), &printString);
       
   931 	INFO_PRINTF2(_L("----Retrieved icon filename==>%S"), &fileName);
       
   932 	TEST(fileName.Compare(KIconFilenameGerman)==0);
       
   933 
       
   934 	// Change the locale to English for changing the settings back to the original
       
   935 	INFO_PRINTF1(_L("Change the locale back to English..."));
       
   936 	TRAP(ret,ChangeLocaleL(ELangEnglish));
       
   937 	TEST(ret == KErrNone);
       
   938 	INFO_PRINTF2(_L("----System Language==>%d"), User::Language());
       
   939 	
       
   940 	TEST(User::Language() == ELangEnglish);//check language is set to English.
       
   941 	
       
   942 	// Force the applist to be updated (so test app gets new language settings)
       
   943 	User::LeaveIfError(iLs.ForceRegistration(dummy));
       
   944 	
       
   945 	//Get test app's information
       
   946 	iLs.GetAppInfo(appInfo, KUidTestIconCapOverride);
       
   947 
       
   948 	file.Close();
       
   949 	//Get test app's icon information
       
   950 	iLs.GetAppIcon(KUidTestIconCapOverride,file);
       
   951 
       
   952 	fileName.Zero();
       
   953 	file.FullName(fileName);
       
   954 	
       
   955 	//compare the captions, icon in English with the value in central repository
       
   956 	INFO_PRINTF1(_L("Compares Caption with value in CenRep..."));
       
   957 	printString.Zero();
       
   958 	printString.Copy(KCenRepCaption);
       
   959 	INFO_PRINTF2(_L("----Expected caption in English==>%S"), &printString);
       
   960 	INFO_PRINTF2(_L("----Retrieved caption==>%S"), &appInfo.iCaption);
       
   961 	TEST(appInfo.iCaption == KCenRepCaption);
       
   962 	
       
   963 	INFO_PRINTF1(_L("Compares short caption with value in CenRep..."));
       
   964 	printString.Zero();
       
   965 	printString.Copy(KCenRepShortCaption);
       
   966 	INFO_PRINTF2(_L("----Expected short caption==>%S"), &printString);
       
   967 	INFO_PRINTF2(_L("----Retrieved short caption==>%S"), &appInfo.iShortCaption);
       
   968 	
       
   969 	TEST(appInfo.iShortCaption == KCenRepShortCaption);
       
   970 	INFO_PRINTF1(_L("Compares icon filename with value in CenRep..."));
       
   971 	printString.Zero();
       
   972 	printString.Copy(KCenRepIconFilename);
       
   973 	INFO_PRINTF2(_L("----Expected icon filename==>%S"), &printString);
       
   974 	INFO_PRINTF2(_L("----Retrieved icon filename==>%S"), &fileName);
       
   975 	TEST(fileName.Compare(KCenRepIconFilename)==0);
       
   976 	
       
   977 	INFO_PRINTF1(_L("APPFWK-APPARC-0090:TestIconCaptionOverridesWithChangeLangL finished..."));
       
   978 	}
       
   979 		
       
   980 /**
       
   981 @SYMTestCaseID 				APPFWK-APPARC-0091
       
   982 @SYMPREQ 					CR1187
       
   983 @SYMREQ						REQ9167
       
   984 @SYMDEF						DEF125262
       
   985 @SYMTestCaseDesc			Checks there is no memory leaks when CApaIconCaptionOverridesForApp & CApaIconCaptionCenrepObserver
       
   986 							objects are created and destroyed.
       
   987 @SYMTestType				CIT	
       
   988 @SYMTestPriority			Critical
       
   989 @SYMTestActions				Marks the Heap memory
       
   990 							Invokes the static method 'TestIconCaptionOverridesL()' defined in 'ticonloaderandiconarrayforleaks.dll',
       
   991 							that creates objects of CApaIconCaptionOverridesForApp, CApaIconCaptionCenrepObserver and deletes those.
       
   992 							And then tests, there is no memory leak from the creation to destruction of those objects.
       
   993 @SYMTestExpectedResults 	There should be no memory leaks.
       
   994 */
       
   995 
       
   996 void CT_CaptionStep::TestIconCaptionOverridesMemoryLeaksL()
       
   997 	{
       
   998 	INFO_PRINTF1(_L("APPFWK-APPARC-0091:TestIconCaptionOverridesMemoryLeaksL started..."));
       
   999 	__UHEAP_MARK;
       
  1000 	TIconLoaderAndIconArrayForLeaks::TestIconCaptionOverridesL();
       
  1001 	__UHEAP_MARKEND;
       
  1002 	INFO_PRINTF1(_L("APPFWK-APPARC-0091:TestIconCaptionOverridesMemoryLeaksL finished..."));
       
  1003 	}
       
  1004 
       
  1005 void CT_CaptionStep::DoIconCaptionOverridesTestL()
       
  1006 	{
       
  1007 	TestIconCaptionOverridesL();
       
  1008 	TestIconCaptionOverridesWithChangeLangL();
       
  1009 	TestCenRepChangeNotificationL();
       
  1010 	TestIconCaptionOverridesMemoryLeaksL();
       
  1011 	TestApiPrecedenceOverCenRepConfigInfoL();
       
  1012 	}
       
  1013 	
       
  1014 TVerdict CT_CaptionStep::doTestStepL()
       
  1015 	{
       
  1016 	INFO_PRINTF1(_L("Test T_Caption step started....\n"));
       
  1017 
       
  1018 	// Connect to Servers
       
  1019 	TEST(iFs.Connect() == KErrNone);
       
  1020 	TEST(iLs.Connect() == KErrNone);
       
  1021 
       
  1022 	// run language tests for the test caption
       
  1023 	TRAPD(r, DoLanguageTestL());
       
  1024 	TEST(r==KErrNone);
       
  1025 	INFO_PRINTF2(_L("DoLanguageTestL() finished with value '%d'\n"), r);
       
  1026 	
       
  1027 	// run icon caption overrides tests
       
  1028 	TRAP(r, DoIconCaptionOverridesTestL());
       
  1029 	TEST(r==KErrNone);
       
  1030 	INFO_PRINTF2(_L("DoIconCaptionOverridesTestL() finished with value '%d'\n"), r);
       
  1031 
       
  1032 	// run shortcaption setting tests
       
  1033 	TRAP(r, DoShortCaptionTestL());
       
  1034 	TEST(r==KErrNone);
       
  1035 	INFO_PRINTF2(_L("DoShortCaptionTestL() finished with value '%d'\n"), r);
       
  1036 
       
  1037 	INFO_PRINTF1(_L("....test T_Caption step finished!"));
       
  1038 	return TestStepResult();
       
  1039 	}
       
  1040