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