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