commonuisupport/uikon/test/teikenv/teikenv.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The test code exercises uikon classes: CEikEnv, CEikDocument, CEikAppUi.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include <eikenv.h>
       
    25 #include "teikenv.hrh"
       
    26 #include "teikenv.h"
       
    27 #include <teikenv.rsg>
       
    28 #include "apgtask.h"
       
    29 #include <ecom/ecom.h>
       
    30 #include "tbitmap.h"
       
    31 #include <eikrutil.h>	
       
    32 #include <gulicon.h>
       
    33 #include <prnsetup.h>
       
    34 #include "eiksrvc.h"
       
    35 
       
    36 _LIT(KFileName, "c:\\dummy.doc");
       
    37 _LIT(KTEikEnvResourceFilePath, "z:\\system\\test\\teikenv\\teikenv.rsc");
       
    38 _LIT(KParameter,"Event");
       
    39 _LIT(KInfo, "Info Msg");
       
    40 const TInt KErrTestHandle=(10);
       
    41 
       
    42 const TUid KTestPictureType={5711};
       
    43 const TUid KTestPictureType1={5712};
       
    44 const TUid KTestPictureTypeUnused={5713};
       
    45 const TUid KMessageUid1={KUidApaMessageSwitchOpenFileValue};
       
    46 const TUid KMessageUid2={KUidApaMessageSwitchCreateFileValue};
       
    47 const TUid KMessageUid3={NULL};
       
    48 
       
    49 /**
       
    50    Auxiliary Function For all Test Cases
       
    51    
       
    52    Creates a new document. Called by the application DLL framework to create a
       
    53    new instance of the document associated with the application.
       
    54    
       
    55  */
       
    56 CApaDocument*	CTEikEnvApplication::CreateDocumentL()
       
    57 	{
       
    58 	CApaDocument*	theDocument = new (ELeave) CTEikEnvDocument(*this);
       
    59 	return theDocument;
       
    60 	}
       
    61 
       
    62 CTEikEnvApplication	theApplication;
       
    63 CTEikEnvDocument *theDocument;
       
    64 
       
    65 //
       
    66 // class CTEikEnvAppUi
       
    67 //
       
    68 CTEikEnvAppUi::CTEikEnvAppUi(CTmsTestStep* aStep) :
       
    69 	CTestAppUi(aStep, KTEikEnvResourceFilePath)
       
    70 /**
       
    71    Constructor
       
    72  */
       
    73 	{
       
    74 	}
       
    75 
       
    76 /**
       
    77    Auxiliary Fn for all Test Cases
       
    78   
       
    79    The method creates application’s user interface and prepares it for running
       
    80    tests in auto mode.
       
    81   
       
    82  */
       
    83 void CTEikEnvAppUi::ConstructL()
       
    84     {
       
    85     CTestAppUi::ConstructL();
       
    86 
       
    87 	AutoTestManager().StartAutoTest();
       
    88     }
       
    89 
       
    90 CTEikEnvAppUi::~CTEikEnvAppUi()
       
    91 /**
       
    92    Destructor
       
    93  */
       
    94     {
       
    95     RemoveFromStack(iParentControl);
       
    96 	delete iParentControl;
       
    97     }
       
    98     
       
    99 /**
       
   100    Auxiliary Fn for all Test Cases
       
   101   
       
   102    The method is an override from CTestAppUi. The method initiates all tests
       
   103    to be performed on uikon classes CEikEnv, CEikDocument, CEikAppUi.
       
   104    
       
   105  */
       
   106 void CTEikEnvAppUi::RunTestStepL(TInt aNumStep)
       
   107  	{
       
   108 	User::After(TTimeIntervalMicroSeconds32(500000));
       
   109  	switch(aNumStep)
       
   110  		{
       
   111 	case 1:
       
   112 		SetTestStepID(_L("UIF-teikenv-TestEikonEnv"));
       
   113 		TestEikonEnv();
       
   114 		RecordTestResultL();
       
   115 		break;
       
   116 	case 2:
       
   117  		{
       
   118  		SetTestStepID(_L("UIF-teikenv-TestEikonEnvPictureFactoryL"));
       
   119  		TRAPD(err, TestEikonEnvPictureFactoryL());
       
   120  		TEST(err == KErrNone);
       
   121  		RecordTestResultL();
       
   122  		break;
       
   123  		}
       
   124 	case 3:
       
   125  		{
       
   126  		SetTestStepID(_L("UIF-teikenv-TestPopUpMenuL"));
       
   127  		TRAPD(err, TestPopUpMenuL());
       
   128  		TEST(err == KErrNone);
       
   129  		RecordTestResultL();
       
   130  		break;
       
   131  		}
       
   132 	case 4:
       
   133  		{
       
   134  		SetTestStepID(_L("UIF-teikenv-TestEikonAppUiL"));
       
   135  		TRAPD(err, TestEikonAppUiL());
       
   136  		TEST(err == KErrNone);
       
   137  		RecordTestResultL();
       
   138  		break;
       
   139  		}
       
   140 	case 5:
       
   141  		{
       
   142  		SetTestStepID(_L("UIF-teikenv-TestCreateBitmapL"));
       
   143  		TRAPD(err, TestCreateBitmapL());
       
   144  		TEST(err == KErrNone);
       
   145  		RecordTestResultL();
       
   146  		break;
       
   147  		}
       
   148 	case 6:
       
   149  		{
       
   150  		SetTestStepID(_L("UIF-UIKTEST-0002"));
       
   151  		TRAPD(err,TestREikAppUiSessionApiL());
       
   152  		TEST(err == KErrNone);
       
   153  		RecordTestResultL();
       
   154  		break;
       
   155  		}	
       
   156 	case 7:
       
   157  		{
       
   158  		SetTestStepID(_L("UIF-UIKTEST-0001"));
       
   159  		TRAPD(err,TestMessageApiL());
       
   160 		TEST(err == KErrNone);
       
   161 		RecordTestResultL();
       
   162  		break;
       
   163  		}
       
   164  	case 8:
       
   165  		{
       
   166  		SetTestStepID(_L("UIF-teikenv-TestAddDialogLikeControlToStackL"));
       
   167  		TRAPD(err,TestAddDialogLikeControlToStackL());
       
   168  		TEST(err == KErrNone);
       
   169  		RecordTestResultL();
       
   170  		break;
       
   171  		}
       
   172  	case 9:
       
   173  		{
       
   174  		SetTestStepID(_L("UIF-teikenv-TestAddAlertDialogLikeControlToStackL"));
       
   175  		TRAPD(err,TestAddAlertDialogLikeControlToStackL());
       
   176  		TEST(err == KErrNone);
       
   177  		RecordTestResultL();
       
   178  		break;
       
   179  		}
       
   180 	case 10:
       
   181 		{
       
   182 		SetTestStepID(_L("UIF-teikenv-TestUpdateNameL"));
       
   183 		TRAPD(err,TestUpdateNameL());
       
   184 		TEST(err == KErrNone);
       
   185 		RecordTestResultL();
       
   186 		break;	
       
   187 		}
       
   188 	case 11:
       
   189 		{
       
   190 		SetTestStepID(_L("UIF-teikenv-TestFocusL"));
       
   191 		TRAPD(err,TestFocusL());
       
   192 		TEST(err == KErrNone);
       
   193 		RecordTestResultL();
       
   194 		CloseTMSGraphicsStep();
       
   195 		break;	
       
   196 		}
       
   197 	case 12:
       
   198 	 	{
       
   199 		INFO_PRINTF1(_L("Tests completed.\n"));
       
   200 		delete theDocument; 
       
   201  		AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
   202  		break; 		
       
   203  		}
       
   204 	default:
       
   205  		break;
       
   206  		}
       
   207  	}
       
   208 
       
   209 
       
   210 /**
       
   211    @SYMTestCaseID UIF-teikenv-TestCreateBitmapL
       
   212   
       
   213    @SYMPREQ
       
   214   
       
   215    @SYMTestCaseDesc Test CEikonEnv::CreateBitmapL(const TDesC &aFileName, TInt aId)
       
   216   
       
   217    @SYMTestPriority High
       
   218   
       
   219    @SYMTestStatus Implemented
       
   220    
       
   221    @SYMTestActions The method invokes CEikonEnv::Static() to get the instance of CEikonEnv.
       
   222    It then tests CreateBitmapL() (by passing wildcharacter ("*") as the filename) in TBITMAP.exe application.
       
   223      
       
   224    @SYMTestExpectedResults The method should return application default bitmap if wild character("*")
       
   225    is passed as the filename to CEikonEnv::CreateBitmapL(const TDesC &aFileName, TInt aId);
       
   226  */
       
   227 
       
   228 void CTEikEnvAppUi::TestCreateBitmapL()
       
   229 	{
       
   230 	_LIT(KBitMapAppFileName,"z:\\sys\\bin\\TBITMAP.exe");
       
   231 
       
   232 	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();	
       
   233 	RProcess bitmapProc;
       
   234 	TInt ret = bitmapProc.Create(KBitMapAppFileName,KNullDesC);
       
   235 	TEST(ret == KErrNone);
       
   236 	User::LeaveIfError(ret);
       
   237 	CleanupClosePushL(bitmapProc);
       
   238 
       
   239 	INFO_PRINTF1(_L("Create Bitmap Process"));
       
   240 
       
   241 	//attach commandline to Bitmap process
       
   242 	TRAP(ret,cmdLine->SetProcessEnvironmentL(bitmapProc));
       
   243 	TEST(ret == KErrNone);
       
   244 
       
   245 	TRequestStatus trs;
       
   246 	bitmapProc.Logon(trs);
       
   247 	bitmapProc.Resume();
       
   248 	User::WaitForRequest(trs);
       
   249 
       
   250 	// check exit values
       
   251 	TEST(bitmapProc.ExitReason() == KErrNone);	// specifically, it must be different to KErrBitMapDoesNotMatch
       
   252 	TEST(bitmapProc.ExitType() == EExitKill);
       
   253 
       
   254 	CleanupStack::PopAndDestroy(&bitmapProc);
       
   255 	CleanupStack::PopAndDestroy(cmdLine);
       
   256 	}
       
   257 	
       
   258 	/**
       
   259    @SYMTestCaseID		UIF-UIKTEST-0001
       
   260 
       
   261    @SYMPREQ	
       
   262   
       
   263    @SYMTestCaseDesc 	Testing the Apis which give messages to the user
       
   264   
       
   265    @SYMTestPriority 	High
       
   266   
       
   267    @SYMTestStatus 		Implemented
       
   268    
       
   269    @SYMTestActions  	The apis are called which handle messages,errors and give out
       
   270    						messages to the user.Also some other miscellaneous  apis are 
       
   271    						verified from classes CEikDocument,CEikAppUi
       
   272    
       
   273    @SYMTestExpectedResults Test should complete without any leave, panic or error.
       
   274    
       
   275  */
       
   276 
       
   277 void CTEikEnvAppUi::TestMessageApiL()
       
   278 	{
       
   279 	INFO_PRINTF1(_L("Test step MessageApiL started"));
       
   280 	TFileName noFile;
       
   281 	TBool exist=CEikAppUi::ProcessCommandParametersL(EApaCommandCreate,noFile);
       
   282 	TEST(!exist);
       
   283 		
       
   284 	TBuf8<128>	buf;
       
   285 	buf.Copy(KFileName);
       
   286 	TMessageResponse response;
       
   287 	response=CEikAppUi::HandleMessageL(1,KMessageUid1,buf);
       
   288 	TEST(response==EMessageHandled);
       
   289 	response=CEikAppUi::HandleMessageL(1,KMessageUid2,buf);
       
   290 	TEST(response==EMessageHandled);
       
   291 	response=CEikAppUi::HandleMessageL(1,KMessageUid3,buf);
       
   292 	TEST(response==EMessageNotHandled);
       
   293 	
       
   294 	TBool empty=theDocument->IsEmpty();
       
   295 	TEST(empty);
       
   296 		
       
   297 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   298 	
       
   299 	TRAPD(err,theEnv->UpdateSystemFontsL());
       
   300 	TEST(err==KErrNone);
       
   301 	
       
   302 	TBufC<16> bufc2(KParameter);
       
   303 	TPtr ptr = bufc2.Des();	
       
   304 	theEnv->SendEventToEikonServer(-16,&ptr,16);
       
   305 	bufc2=KNullDesC;
       
   306 	theEnv->SendEventToEikonServer(1,&ptr,16);
       
   307 		
       
   308    	// the following tests are tested through display of required info
       
   309 	TBufC<10> msg(KInfo);
       
   310 	theEnv->SetVerboseInfoReporting(ETrue);
       
   311 	theEnv->VerboseInfoMsg(msg);
       
   312 	
       
   313 
       
   314 	theEnv->DisplayTaskList();
       
   315 	User::After(1000000);
       
   316 	theEnv->DismissTaskList();//if the tasklist is displayed , it will be closed by this api....hence tested
       
   317 	
       
   318 	theEnv->WservAllocInfoMsg();
       
   319 	User::After(1000000);
       
   320 	theEnv->AllocInfoMsg();
       
   321 	User::After(1000000);	
       
   322 	theEnv->FservAllocInfoMsg();
       
   323 	User::After(1000000);
       
   324 
       
   325 	theEnv->HandleErrorWithContext(KErrTestHandle,R_EIKENV_APP_ERR_HANDLE);
       
   326 	// display tests over
       
   327 	INFO_PRINTF1(_L("Test step MessageApiL completed!"));
       
   328 	}
       
   329 
       
   330 /**
       
   331    @SYMTestCaseID UIF-teikenv-TestAddDialogLikeControlToStackL
       
   332   
       
   333    @SYMPREQ PDEF098453
       
   334   
       
   335    @SYMTestCaseDesc Test CEikonEnv::AddDialogLikeControlToStackL(CCoeControl* aControl)
       
   336   
       
   337    @SYMTestPriority High
       
   338   
       
   339    @SYMTestStatus Implemented
       
   340    
       
   341    @SYMTestActions The method invokes CEikonEnv::Static() to get the instance of CEikonEnv.
       
   342    It then tests AddDialogLikeControlToStackL() method with the following scenarios.
       
   343    1) Creates a control with "ECoeStackPrioritySoftkey" priority and displays on the screen
       
   344    and then invokes AddDialogLikeControlToStackL().
       
   345    2) Creates a control with "ECoeStackPrioritySoftkey-1" priority and displays on the screen
       
   346    and then invokes AddDialogLikeControlToStackL().
       
   347  
       
   348    @SYMTestExpectedResults 
       
   349    1) Should return KErrNone
       
   350    2) Should return KLeaveWithoutAlert
       
   351    
       
   352  */
       
   353 
       
   354 void CTEikEnvAppUi::TestAddDialogLikeControlToStackL()
       
   355 	{
       
   356 	TInt res=0;
       
   357 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   358 	CTestControl* control1 = CTestControl::NewL();
       
   359 	AddToStackL(control1,ECoeStackPrioritySoftkey);
       
   360 	INFO_PRINTF1(_L("Control with softkey priority is added to Control Stack"));
       
   361 	control1->DrawNow();
       
   362 	CTestControl* control2 = CTestControl::NewL();
       
   363 	TRAP(res,theEnv->AddDialogLikeControlToStackL(control2));
       
   364 	TEST(res==KErrNone);
       
   365 	INFO_PRINTF1(_L("Control with dialog priority is added to the Control Stack"));
       
   366 	control2->DrawNow();
       
   367 	theEnv->RemoveFromStack(control1);
       
   368 	theEnv->RemoveFromStack(control2);
       
   369 	
       
   370 	AddToStackL(control1,ECoeStackPrioritySoftkey-1);
       
   371 	INFO_PRINTF1(_L("Control with ECoeStackPrioritySoftkey-1 priority is added to Control Stack"));
       
   372 	control1->DrawNow();
       
   373 	TRAP(res,theEnv->AddDialogLikeControlToStackL(control2));
       
   374 	TEST(res==KLeaveWithoutAlert);
       
   375 	INFO_PRINTF1(_L("Control with dialog priority is not added to the Control Stack"));
       
   376 	theEnv->RemoveFromStack(control1);
       
   377 				
       
   378 	delete control1;
       
   379 	delete control2;
       
   380 	}
       
   381 
       
   382 /**
       
   383    @SYMTestCaseID UIF-teikenv-TestFocusL
       
   384   
       
   385    @SYMDEF 105102
       
   386   
       
   387    @SYMTestCaseDesc Test CCoeAppUi::HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination)
       
   388   
       
   389    @SYMTestPriority Critical
       
   390   
       
   391    @SYMTestStatus Implemented
       
   392    
       
   393    @SYMTestActions The method tests a particular scenario which is as follows.
       
   394    The defect is reproduced when a focus event is called on a control which doesn't exist in the stack.
       
   395    To simulate the scenario the following steps are carried and executed with and without fix.
       
   396    1) Create control 1(parent) with default settings.
       
   397       Add to control stack with 'ECoeStackPrioritySoftkey' priority. Activate parent.
       
   398    2) Create control 2(child) with default settings.
       
   399       Add to control stack with 'ECoeStackPriorityEnvironmentFilter' (higher than parent) priority.
       
   400       Activate child.	
       
   401    3) Raise focus lost event (EEventFocusLost). Call HandleWsEventL on child.
       
   402    4) When HandleWsEventL is called the overridden HandleForeGroundEventL is called internally.
       
   403    5) It deletes the child control which has the current focus.
       
   404       This should cause a KERN:EXEC 3 panic which is fixed by making changes in
       
   405    	  CCoeAppUi::HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination).	
       
   406  
       
   407    @SYMTestExpectedResults 
       
   408    1) Should not panic.
       
   409  
       
   410  */
       
   411 	
       
   412 void CTEikEnvAppUi::TestFocusL()
       
   413 	{
       
   414 	iParentControl = CTestControl::NewL();
       
   415 	AddToStackL(iParentControl,ECoeStackPrioritySoftkey);
       
   416 	INFO_PRINTF1(_L("Create parent control and add to control stack with ECoeStackPrioritySoftkey priority."));
       
   417 
       
   418 	iChildControl = CTestControl::NewL();
       
   419 	iChildControl->SetContainerWindowL(*iParentControl);
       
   420 	AddToStackL(iChildControl,ECoeStackPriorityEnvironmentFilter);
       
   421 	INFO_PRINTF1(_L("Create Child control and add to control stack with  priority more than parent."));
       
   422 
       
   423 	TWsEvent event;
       
   424 	event.SetType(EEventFocusLost);
       
   425 	INFO_PRINTF1(_L("Raise 'EEventFocusLost' event and call HandleWsEventL "));
       
   426 
       
   427 	HandleWsEventL(event,iChildControl);
       
   428 	}
       
   429 	
       
   430 /**
       
   431    @SYMTestCaseID UIF-teikenv-TestAddAlertDialogLikeControlToStackL
       
   432   
       
   433    @SYMPREQ PDEF098453 
       
   434   
       
   435    @SYMTestCaseDesc Test CEikonEnv::AddAlertDialogLikeControlToStackL(CCoeControl* aControl)
       
   436   
       
   437    @SYMTestPriority High
       
   438   
       
   439    @SYMTestStatus Implemented
       
   440    
       
   441    @SYMTestActions The method invokes CEikonEnv::Static() to get the instance of CEikonEnv.
       
   442    It then tests AddAlertDialogLikeControlToStackL() method with the following scenarios.
       
   443    1) Creates a control with "ECoeStackPrioritySoftkey" priority and displays on the screen
       
   444    and then invokes AddAlertDialogLikeControlToStackL().
       
   445    2) Creates a control with "ECoeStackPrioritySoftkey-1" priority and displays on the screen
       
   446    and then invokes AddAlertDialogLikeControlToStackL().
       
   447      
       
   448    @SYMTestExpectedResults 
       
   449    1) Should return KErrNone
       
   450    2) Should return KLeaveWithoutAlert
       
   451    
       
   452  */
       
   453 
       
   454 void CTEikEnvAppUi::TestAddAlertDialogLikeControlToStackL()
       
   455 	{
       
   456 	TInt res=0;
       
   457 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   458 	CTestControl* control1 = CTestControl::NewL();
       
   459 	AddToStackL(control1,ECoeStackPrioritySoftkey);
       
   460 	INFO_PRINTF1(_L("Control with softkey priority is added to Control Stack"));
       
   461 	control1->DrawNow();
       
   462 	CTestControl* control2 = CTestControl::NewL();
       
   463 	TRAP(res,theEnv->AddAlertDialogLikeControlToStackL(control2));
       
   464 	TEST(res==KErrNone);
       
   465 	INFO_PRINTF1(_L("Control with alert priority is added to the Control Stack"));
       
   466 	control2->DrawNow();
       
   467 	theEnv->RemoveFromStack(control1);
       
   468 	theEnv->RemoveFromStack(control2);
       
   469 	
       
   470 	AddToStackL(control1,ECoeStackPrioritySoftkey-1);
       
   471 	INFO_PRINTF1(_L("Control with ECoeStackPrioritySoftkey-1 priority is added to Control Stack"));
       
   472 	control1->DrawNow();
       
   473 	TRAP(res,theEnv->AddAlertDialogLikeControlToStackL(control2));
       
   474 	TEST(res==KLeaveWithoutAlert);
       
   475 	INFO_PRINTF1(_L("Control with alert priority is not added to the Control Stack"));
       
   476 	theEnv->RemoveFromStack(control1);
       
   477 				
       
   478 	delete control1;
       
   479 	delete control2;
       
   480 	}
       
   481 /**
       
   482    @SYMTestCaseID UIF-teikenv-TestEikonEnv
       
   483   
       
   484    @SYMPREQ
       
   485   
       
   486    @SYMTestCaseDesc Tests CEikonEnv APIs.
       
   487   
       
   488    @SYMTestPriority High
       
   489   
       
   490    @SYMTestStatus Implemented
       
   491    
       
   492    @SYMTestActions This method invokes CEikonEnv::Static() to get the instance
       
   493    of CEikonEnv.\n
       
   494    The following setter APIs are then tested for values ETrue and EFalse. 
       
   495    1. CEikonEnv::SetBusy()\n
       
   496    2. CEikonEnv::SetSystem()\n
       
   497    3. CEikonEnv::SetDocNameIsAFile()\n
       
   498    4. CEikonEnv::SetRespondsToShutdownEvent()\n
       
   499    5. CEikonEnv::SetRespondsToSwitchFilesEvent()\n
       
   500    It also tests APIs
       
   501    6. CEikonEnv::Version()
       
   502    7. CEikonEnv::GetErrorText()
       
   503    8. CEikonEnv::LeaveWithInfoMsg()
       
   504   
       
   505    @SYMTestExpectedResults The method verifies results against expected results. The
       
   506    setter APIs are verified by checking results produced by their getter method
       
   507    against expected results. 
       
   508    
       
   509  */
       
   510 void CTEikEnvAppUi::TestEikonEnv()
       
   511 	{
       
   512 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   513 
       
   514 	theEnv->SetBusy(ETrue);
       
   515 	INFO_PRINTF1(_L("Set env to busy"));
       
   516 	TBool theRes = theEnv->IsBusy();
       
   517 	TEST(theRes);
       
   518 	theEnv->SetBusy(EFalse);
       
   519 	INFO_PRINTF1(_L("Set env to free"));
       
   520 	theRes = theEnv->IsBusy();
       
   521 	TEST(!theRes);
       
   522 	
       
   523 	INFO_PRINTF1(_L("Check the version number"));
       
   524 	TVersion theVersion = theEnv->Version();
       
   525 	TEST(theVersion.iMajor >= 0);
       
   526 	TEST(theVersion.iMinor <= 99);
       
   527 	TEST(theVersion.iMinor >= 0);
       
   528 	TEST(theVersion.iMinor < theVersion.iMajor);
       
   529 	TEST(theVersion.iBuild >= 0);
       
   530 
       
   531 // Check a system attribute
       
   532 	INFO_PRINTF1(_L("Set system attribute"));
       
   533 	theEnv->SetSystem(ETrue);
       
   534 	theRes = theEnv->IsSystem();
       
   535 	TEST(theRes);
       
   536 
       
   537 	theEnv->SetSystem(EFalse);
       
   538 	theRes = theEnv->IsSystem();
       
   539 	TEST(!theRes);
       
   540 //
       
   541 
       
   542 	TBuf<256>	buf;
       
   543 	theEnv->GetErrorText(buf, -1);
       
   544 	TEST(buf==_L("Not found"));
       
   545 	theEnv->GetErrorText(buf, 2);
       
   546 	TEST(buf==_L("Unknown error"));
       
   547 	theEnv->GetErrorText(buf, 2, KNullUid);
       
   548 	TEST(buf==_L("Unknown error"));
       
   549 
       
   550 //
       
   551 	TRAPD(res1, theEnv->LeaveWithInfoMsg(R_EIKENV_APP_ERR_TEXT));
       
   552 	TEST(res1 != KErrNone);
       
   553 	TEST(res1==KLeaveWithoutAlert);
       
   554 
       
   555 //
       
   556 	theEnv->SetDocNameIsAFile(EFalse);
       
   557 	TBool res = theEnv->DocNameIsAFile();
       
   558 	TEST(!res);
       
   559 
       
   560 	theEnv->SetDocNameIsAFile(ETrue);
       
   561 	res = theEnv->DocNameIsAFile();
       
   562 	TEST(res);
       
   563 
       
   564 //
       
   565 	INFO_PRINTF1(_L("Test responds to shutdown event"));
       
   566 	theEnv->SetRespondsToShutdownEvent(EFalse);
       
   567 	res = theEnv->RespondsToShutdownEvent();
       
   568 	TEST(!res);
       
   569 
       
   570 	theEnv->SetRespondsToShutdownEvent(ETrue);
       
   571 	res = theEnv->RespondsToShutdownEvent();
       
   572 	TEST(res);
       
   573 
       
   574 	theEnv->SetRespondsToSwitchFilesEvent(EFalse);
       
   575 	res = theEnv->RespondsToSwitchFilesEvent();
       
   576 	TEST(!res);
       
   577 
       
   578 	theEnv->SetRespondsToSwitchFilesEvent(ETrue);
       
   579 	res = theEnv->RespondsToSwitchFilesEvent();
       
   580 	TEST(res);
       
   581 	}
       
   582 
       
   583 	/**
       
   584    @SYMTestCaseID		UIF-UIKTEST-0002
       
   585   
       
   586    @SYMPREQ	
       
   587   
       
   588    @SYMTestCaseDesc 	Testing the Apis 
       
   589   
       
   590    @SYMTestPriority 	Low
       
   591   
       
   592    @SYMTestStatus 		Implemented
       
   593    
       
   594    @SYMTestActions  	The APIs from REikAppUiSession classes of 
       
   595    						UIKON are called and verified.  
       
   596    						 
       
   597    
       
   598    @SYMTestExpectedResults Test should complete without any leave, panic or error.
       
   599    
       
   600  */
       
   601 
       
   602 void CTEikEnvAppUi::TestREikAppUiSessionApiL()
       
   603 {
       
   604 	INFO_PRINTF1(_L("Test step REikAppUiSessionApiL started"));
       
   605 	_LIT(KResolveError,"ResolveError");
       
   606 	TInt ret;
       
   607 	REikAppUiSession uiSession;
       
   608 
       
   609 	TEST(uiSession.Connect()==KErrNone);
       
   610 	CleanupClosePushL(uiSession);
       
   611 	
       
   612 	TSecurityInfo info;
       
   613 	info.Set(RProcess());
       
   614 	uiSession.BlankScreen();//BlankScreen is seen 
       
   615 	User::After(1000000);
       
   616 	uiSession.UnblankScreen();//Screen is seen Again, hence tested
       
   617 	
       
   618 	ret=uiSession.EnableTaskList();
       
   619 	TEST(ret==KErrNone);//on successful return	
       
   620 
       
   621 	CEikonEnv::TErrorValidity errValid;
       
   622 	TInt error=-90;
       
   623 	TUid appUid={0x10004c6A};
       
   624 	TBuf<250> buffer(KResolveError);
       
   625 	errValid=uiSession.ResolveError(buffer,error,appUid);
       
   626 	TEST(errValid==CEikonEnv::EErrorNumValid);
       
   627 	INFO_PRINTF2(_L("The errorValid is %d"),errValid);
       
   628 	
       
   629 	uiSession.Close();
       
   630 	CleanupStack::PopAndDestroy(&uiSession);
       
   631 
       
   632 	}
       
   633 
       
   634 /**
       
   635    @SYMTestCaseID UIF-teikenv-TestPopUpMenuL
       
   636   
       
   637    @SYMPREQ
       
   638   
       
   639    @SYMTestCaseDesc Test loading menu from resource.
       
   640   
       
   641    @SYMTestPriority High
       
   642   
       
   643    @SYMTestStatus Implemented
       
   644    
       
   645    @SYMTestActions The method invokes CEikonEnv::Static() to get the instance of
       
   646    CEikonEnv.It then calls auxiliary method LaunchPopupMenuL() which loads
       
   647    menu from resource file. The method then simulates the enter key event
       
   648    by invoking CEikonEnv::SimulateKeyEventL() close the menu.
       
   649   
       
   650    @SYMTestExpectedResults The method should load the menu and close the menu
       
   651    with the simulated enter key event.
       
   652    
       
   653  */
       
   654 void CTEikEnvAppUi::TestPopUpMenuL()
       
   655 	{
       
   656 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   657 
       
   658 	LaunchPopupMenuL();
       
   659 	
       
   660 	TKeyEvent theKeyEvent;
       
   661 	theKeyEvent.iCode = EKeyEnter;
       
   662 	theKeyEvent.iScanCode = EStdKeyEnter;
       
   663 	theKeyEvent.iModifiers = 0;
       
   664 	theKeyEvent.iRepeats = 0;
       
   665 	theEnv->SimulateKeyEventL(theKeyEvent,EEventKey);
       
   666 	}
       
   667 
       
   668 /**
       
   669    @SYMTestCaseID UIF-teikenv-TestEikonEnvPictureFactoryL
       
   670   
       
   671    @SYMPREQ
       
   672   
       
   673    @SYMTestCaseDesc Test adding/retrieving picture factory to/from Eikon environment.
       
   674   
       
   675    @SYMTestPriority High
       
   676   
       
   677    @SYMTestStatus Implemented
       
   678   
       
   679    @SYMTestActions The method creates two Picture factory objects and invokes 
       
   680    CEikonEnv::AddPictureFactoryL() to add them to the Eikon environment. It then
       
   681    invokes CEikonEnv::ExtendedPictureFactory() to retrieve these Picture factory
       
   682    objects. The test checks CEikonEnv::ExtendedPictureFactory() by using valid &
       
   683    invalid picture factory identifers. It tests CEikonEnv::RemovePictureFactory()
       
   684    to remove a specified picture factory object.
       
   685   
       
   686    @SYMTestExpectedResults Each of these tests verify the results against expected
       
   687    results.
       
   688   
       
   689  */
       
   690 void CTEikEnvAppUi::TestEikonEnvPictureFactoryL()
       
   691 	{
       
   692 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   693 
       
   694 	RFs theFs;
       
   695 	theFs.Connect(); 
       
   696 	CTPictureFactory* theFactory = new (ELeave) CTPictureFactory(theFs, KTestPictureType);
       
   697 	CTPictureFactory* theFactory1 = new (ELeave) CTPictureFactory(theFs, KTestPictureType1);
       
   698 
       
   699 	CleanupStack::PushL(theFactory);
       
   700 	CleanupStack::PushL(theFactory1);
       
   701 	
       
   702 	TUid Id = theFactory -> Id();
       
   703 	theEnv->AddPictureFactoryL(*theFactory);
       
   704 
       
   705 	theEnv->AddPictureFactoryL(*theFactory1);
       
   706 
       
   707 
       
   708 	MEikPictureFactory* thePictureFactury = theEnv->ExtendedPictureFactory(KTestPictureTypeUnused);
       
   709 	TEST(thePictureFactury == NULL);
       
   710 
       
   711 	thePictureFactury = theEnv->ExtendedPictureFactory(KTestPictureType1);
       
   712 	TEST(thePictureFactury == theFactory1);
       
   713 	
       
   714 	theEnv->RemovePictureFactory(Id);
       
   715 	thePictureFactury = theEnv->ExtendedPictureFactory(KTestPictureType);
       
   716 	TEST(thePictureFactury == NULL);
       
   717 	
       
   718     CleanupStack::PopAndDestroy(2, theFactory);
       
   719 
       
   720 	theFs.Close();
       
   721 	}
       
   722 
       
   723 /**
       
   724    Auxiliary Fn for teikenv-TestPopUpMenuL
       
   725   
       
   726    The method invokes CEikonEnv::LaunchPopupMenuL() to launch the pop up menu
       
   727    identified by the resource id R_EIKENV_MENU. It also test that no leave
       
   728    occurs in the process.
       
   729   
       
   730  */
       
   731 void CTEikEnvAppUi::LaunchPopupMenuL()
       
   732 	{
       
   733 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   734 	TPoint	theTargetPos(0, 0);
       
   735 	TInt theResourceId = R_EIKENV_MENU;
       
   736 	TRAPD(res, theEnv->LaunchPopupMenuL(theResourceId, theTargetPos));
       
   737 
       
   738 	TEST(!res);
       
   739 	}
       
   740 
       
   741 /**
       
   742    @SYMTestCaseID UIF-teikenv-TestEikonAppUiL
       
   743   
       
   744    @SYMPREQ
       
   745   
       
   746    @SYMTestCaseDesc Test CEikAppUi APIs.
       
   747   
       
   748    @SYMTestPriority High
       
   749   
       
   750    @SYMTestStatus Implemented
       
   751    
       
   752    @SYMTestActions The method checks whether CEikAppUi::ProcessMessageL() method,
       
   753    invokes overloaded methods of CEikAppUi::OpenFileL() and
       
   754    CEikAppUi::CreateFileL() when message UIDs KUidApaMessageSwitchOpenFile16
       
   755    and KUidApaMessageSwitchCreateFile16. It then tests whether 
       
   756    CEikonEnv::ClosePopup() closes the pop up menu launched by LaunchPopupMenuL()
       
   757    method. The method then invokes CEikonEnv::CreateHotKeyControlL() to create 
       
   758    hot key control specified by resource id R_TEST_ENV_HOTKEYS. The hot key
       
   759    combination is simulated to verify. Finally the method tests 
       
   760    CEikAppUi::HandleError() and CEikDocument::SetChanged() APIs.
       
   761   
       
   762    @SYMTestExpectedResults All test results are verified against expected results.
       
   763    
       
   764  */
       
   765 void CTEikEnvAppUi::TestEikonAppUiL()
       
   766 	{
       
   767 	TBuf8<128>	buf;
       
   768 	buf.Copy(KFileName);
       
   769 	ProcessMessageL(KUidApaMessageSwitchOpenFile16, buf);
       
   770 
       
   771 	ProcessMessageL(KUidApaMessageSwitchCreateFile16, buf);
       
   772 //
       
   773 	LaunchPopupMenuL();
       
   774 
       
   775 	ClosePopup();
       
   776 //
       
   777 	INFO_PRINTF1(_L("Create a hot key control from resource file"));
       
   778 	iResponseForHotKey = EFalse;
       
   779 	CreateHotKeyControlL(R_TEST_ENV_HOTKEYS);
       
   780 
       
   781 	TKeyEvent theKeyEvent;
       
   782 	theKeyEvent.iCode = 2;
       
   783 	theKeyEvent.iScanCode = 66; // for 'b'
       
   784 	theKeyEvent.iModifiers = EModifierLeftCtrl | EModifierCtrl | EModifierAutorepeatable;
       
   785 	theKeyEvent.iRepeats = 0;
       
   786 
       
   787 	CEikonEnv* theEnv = CEikonEnv::Static();
       
   788 	theEnv->SimulateKeyEventL(theKeyEvent, EEventKey);
       
   789 
       
   790 	User::After(2000000);
       
   791 
       
   792 	TEST(iResponseForHotKey);
       
   793 //
       
   794 	User::After(2000000);
       
   795 
       
   796 	theEnv->HandleError(KErrPathNotFound);
       
   797 
       
   798 //
       
   799 	TInt res = theDocument->HasChanged();
       
   800 	TEST(!res);
       
   801 
       
   802 	theDocument->SetChanged(ETrue);
       
   803 	res = theDocument->HasChanged();
       
   804 	TEST(res);
       
   805 	}
       
   806 
       
   807 
       
   808 /**
       
   809    Auxiliary Fn for teikenv-TestEikonAppUiL
       
   810   
       
   811    The method is overloaded from CEikAppUi class. It is used to test
       
   812    ProcessMessageL() when KUidApaMessageSwitchOpenFile16 message uid
       
   813    is passed to it as parameter.
       
   814   
       
   815  */
       
   816 void CTEikEnvAppUi::OpenFileL(const TDesC& aFileName)
       
   817 	{
       
   818 	TPtrC8 ptrc(((TText8*)aFileName.Ptr()),aFileName.Length() * sizeof(TText));
       
   819 
       
   820 	TBuf8<128> buf;
       
   821 	buf.Copy(KFileName);
       
   822 	
       
   823 	TInt res = ptrc.CompareC(buf);
       
   824 	TEST(res==0);
       
   825 	}
       
   826 
       
   827 /**
       
   828    Auxiliary Fn for teikenv-TestEikonAppUiL
       
   829   
       
   830    The method is overloaded from CEikAppUi class. It is used to verify
       
   831    the ProcessMessageL() when KUidApaMessageSwitchCreateFile16 message uid is
       
   832    passed to it as parameter.
       
   833   
       
   834  */
       
   835 void CTEikEnvAppUi::CreateFileL(const TDesC& aFileName)
       
   836 	{
       
   837 	TPtrC8 ptrc(((TText8*)aFileName.Ptr()),aFileName.Length() * sizeof(TText));
       
   838 
       
   839 	TBuf8<128> buf;
       
   840 	buf.Copy(KFileName);
       
   841 	
       
   842 	TInt res = ptrc.CompareC(buf);
       
   843 	TEST(res==0);
       
   844 	}
       
   845 /**
       
   846    Auxiliary Fn for teikenv-TestEikonAppUiL
       
   847   
       
   848    The method is overloaded from CEikAppUi class. It is used to test
       
   849    the simulated hot key event created by CEikonEnv::CreateHotKeyControlL().
       
   850   
       
   851  */
       
   852 void CTEikEnvAppUi::HandleCommandL(TInt aCommand)
       
   853 	{
       
   854 	switch(aCommand)
       
   855 		{
       
   856 		case ETestUiCmd1:
       
   857 			iResponseForHotKey = ETrue;
       
   858 			break;
       
   859 		case ETestUiCmd2:
       
   860 			iResponseForHotKey = ETrue;
       
   861 			break;
       
   862 		}
       
   863 	}
       
   864 
       
   865 /**
       
   866    Auxiliary Fn for teikenv-TestEikonAppUiL
       
   867   
       
   868    The method is overloaded from CEikAppUi class. It is used to test
       
   869    the simulated behaviour of CEikAppUi::HandleError() when 
       
   870    KErrPathNotFound is to be handled.
       
   871   
       
   872  */
       
   873 TErrorHandlerResponse CTEikEnvAppUi::HandleError(TInt aError, const SExtendedError& ,
       
   874 		TDes& aErrorText, TDes& aContextText)
       
   875 	{
       
   876 	if(aError == KErrPathNotFound)
       
   877 		{
       
   878 		aErrorText.Copy(_L("Path Not Found"));
       
   879 		aContextText.Copy(_L("File input/output operation"));
       
   880 		return EInfoDisplay;
       
   881 		}
       
   882 	 else if(aError==KErrTestHandle)
       
   883 		{
       
   884 		aErrorText.Copy(_L("error handled"));	
       
   885 		aContextText.Copy(_L("testing api"));
       
   886 		return EInfoDisplay;
       
   887 		}
       
   888 	   
       
   889 	return EErrorNotHandled;
       
   890 	}
       
   891 
       
   892 /**
       
   893    @SYMTestCaseID 	UIF-teikenv-TestUpdateNameL
       
   894   
       
   895    @SYMDEF			DEF119031
       
   896   
       
   897    @SYMTestCaseDesc Test the caption of a process is valid to rename this process or thread.
       
   898   
       
   899    @SYMTestPriority High
       
   900   
       
   901    @SYMTestStatus 	Implemented
       
   902    
       
   903    @SYMTestActions 	The method creates a process whose caption(in .rss file)is invalid
       
   904    					with more than 80 characters and with special symbols included. The API
       
   905    					CEikonEnv::UpdateTaskNameL() will verify this caption and update it accordingly. 
       
   906   
       
   907    @SYMTestExpectedResults 	Eventhough this test process caption is invalid, it will modified with 
       
   908    							suitable caption and RenameThread() and RenameProcess() in CEikonEnv::UpdateTaskNameL()
       
   909    							will successfully invoked.  
       
   910  */ 
       
   911 void CTEikEnvAppUi::TestUpdateNameL()
       
   912 	{
       
   913 	INFO_PRINTF1(_L("Create Caption test Process"));
       
   914 	_LIT(KNameTestAppFileName,"z:\\sys\\bin\\tnametest1.exe");
       
   915 	
       
   916 	RProcess nameProc;
       
   917 	TInt ret = nameProc.Create(KNameTestAppFileName,KNullDesC);
       
   918 	TEST(ret == KErrNone);
       
   919 	User::LeaveIfError(ret);
       
   920 	CleanupClosePushL(nameProc);
       
   921 	nameProc.Resume();
       
   922 	
       
   923 	//Time for the nametest process to launch itself
       
   924 	User::After(500000);
       
   925 	TEST(nameProc.ExitReason() == KErrNone);
       
   926 	
       
   927 	// This LIT is the anticipated modified form of that specified in tcaptiontest_reg.rss,
       
   928 	// to which the test process should be renamed.
       
   929 	// Note the wild-card to accomodate kernel decorations.
       
   930 	_LIT( KCheckUpdateProcName, "CheckforValidASCIICharactersBetween-=(32)and~(126)_RemoveIllegalCh*");
       
   931 	TFindProcess findProc( KCheckUpdateProcName );
       
   932 	TFullName fullName;
       
   933 	TEST( KErrNone == findProc.Next(fullName) );
       
   934 	
       
   935 	CleanupStack::PopAndDestroy(&nameProc);
       
   936 	}
       
   937 
       
   938 /** 
       
   939    This method is part of Two - phase construction. It creates a test control.
       
   940  */
       
   941 CTestControl* CTestControl::NewL()
       
   942 	{ // static
       
   943 	CTestControl* control=new(ELeave) CTestControl;
       
   944 	CleanupStack::PushL(control);
       
   945 	control->ConstructL();
       
   946 	CleanupStack::Pop(control);
       
   947 	return control;
       
   948 	}
       
   949 
       
   950 CTestControl::~CTestControl()
       
   951 /**
       
   952    Destructor
       
   953  */
       
   954 	{
       
   955 	}
       
   956 
       
   957 CTestControl::CTestControl()
       
   958 /**
       
   959    Constructor
       
   960  */
       
   961 	{
       
   962 	}
       
   963 
       
   964 /**
       
   965   Second phase constructor for the CTestControl.\n
       
   966   Creates a control window, sets the control's extent and activates the control.\n
       
   967  */
       
   968 void CTestControl::ConstructL()
       
   969 	{
       
   970 	RWsSession& windowServerSession=iCoeEnv->WsSession();
       
   971 	windowServerSession.SetAutoFlush(ETrue);
       
   972 	CreateWindowL();
       
   973 	CWsScreenDevice& screenDevice=*iCoeEnv->ScreenDevice();
       
   974 	const TSize screenSize(screenDevice.SizeInPixels());
       
   975 	SetExtent(TPoint(50, 50), TSize(screenSize.iWidth-100, screenSize.iHeight-100));
       
   976 	ActivateL(); 
       
   977 	}
       
   978 	
       
   979 void CTEikEnvAppUi::HandleForegroundEventL(TBool /*aBool*/)
       
   980 	{
       
   981 	if (iChildControl)
       
   982 		{
       
   983 		INFO_PRINTF1(_L("Remove Child control from Stack "));
       
   984 		RemoveFromStack(iChildControl);
       
   985 		delete iChildControl;
       
   986 		iChildControl=NULL;
       
   987 		}
       
   988 	}
       
   989 /**
       
   990 	This method is an override from CCoeControl.It draws the control.
       
   991  */
       
   992 void CTestControl::Draw(const TRect&) const
       
   993 	{
       
   994 	CWindowGc& graphicsContext=SystemGc();
       
   995 	graphicsContext.SetPenStyle(CGraphicsContext::ESolidPen);
       
   996 	graphicsContext.SetPenColor(KRgbRed);
       
   997 	graphicsContext.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   998 	graphicsContext.SetBrushColor(KRgbGray);
       
   999 	TRect rectangle(TPoint(0, 0), Rect().Size());
       
  1000 	graphicsContext.DrawRect(rectangle);
       
  1001 	}
       
  1002 
       
  1003 /**
       
  1004    Auxiliary Function for all Test Cases
       
  1005   
       
  1006    The method creates a document for the application,prepares the document for
       
  1007    editing & sets UI which manipulates this document’s data as application's UI.
       
  1008    
       
  1009  */
       
  1010 void CEikEnvStep::ConstructAppL(CEikonEnv* aEikEnv)
       
  1011 	{ // runs inside a TRAP harness
       
  1012 	aEikEnv->ConstructL();
       
  1013  	
       
  1014 	// goes out of scope when function leaves and private members are destroyed. App Architecture handles 
       
  1015 	// CEikAppUI destruction
       
  1016 	theDocument = (CTEikEnvDocument *) (theApplication.CreateDocumentL());
       
  1017 	theDocument->iStep = this;
       
  1018 	theDocument->PrepareToEditL();
       
  1019 	aEikEnv->SetAppUi(theDocument->AppUi());
       
  1020     }
       
  1021 
       
  1022 CEikEnvStep::~CEikEnvStep()
       
  1023 /**
       
  1024    Destructor
       
  1025  */
       
  1026 	{
       
  1027 	}
       
  1028 
       
  1029 CEikEnvStep::CEikEnvStep()
       
  1030 /**
       
  1031    Constructor
       
  1032  */
       
  1033 	{
       
  1034 	// Call base class method to set up the human readable name for logging
       
  1035 	SetTestStepName(KEikEnvStep);
       
  1036 	}
       
  1037 
       
  1038 
       
  1039 
       
  1040 /**
       
  1041    The method creates & sets the application's user interface object to
       
  1042    launch the application to initiate the tests.
       
  1043  */
       
  1044 TVerdict CEikEnvStep::doTestStepL()
       
  1045 	{
       
  1046 	INFO_PRINTF1(_L("Test Started"));
       
  1047  	PreallocateHALBuffer();
       
  1048     __UHEAP_MARK;
       
  1049  
       
  1050  	CEikonEnv* eikEnv=new CEikonEnv;
       
  1051  	if (eikEnv==NULL)
       
  1052 		{
       
  1053 		INFO_PRINTF1(_L("Failed to create Eikon Environment due to lack of Memory"));
       
  1054 		SetTestStepResult(EFail);
       
  1055  		return TestStepResult();
       
  1056 		}
       
  1057  	TRAPD(err,ConstructAppL(eikEnv));
       
  1058  	if (err!=KErrNone)
       
  1059 		{
       
  1060  		SetTestStepResult(EFail);
       
  1061 		delete eikEnv;
       
  1062 		INFO_PRINTF2(_L("Failed to construct Eikon Environment, error %d"), err);
       
  1063 		}
       
  1064  	else
       
  1065  		eikEnv->ExecuteD();
       
  1066  	
       
  1067  	REComSession::FinalClose();	
       
  1068 	 
       
  1069  	__UHEAP_MARKEND;
       
  1070  
       
  1071 	INFO_PRINTF1(_L("Test Finished"));
       
  1072 	return TestStepResult();
       
  1073     }
       
  1074 
       
  1075 //----------------
       
  1076 
       
  1077 
       
  1078 /**
       
  1079    The method is an overrride from MEikPictureFactory. It enables editing
       
  1080    viewing of an Picture Factory object.
       
  1081  */
       
  1082 void CTPictureFactory::EditL(const TPictureHeader&  ,TBool  )
       
  1083 	{
       
  1084 	}
       
  1085 
       
  1086 /**
       
  1087    This method is an override from MEikPictureFactory.It checks if the factory
       
  1088    supports the specified picture type aPictureType.
       
  1089  */
       
  1090 TBool CTPictureFactory::SupportsPictureType(TUid aPictureType) const
       
  1091 	{
       
  1092 	return aPictureType == iPictureType;
       
  1093 	}
       
  1094 
       
  1095 /**
       
  1096    This method is an override from MEikPictureFactory. It returns a pointer to
       
  1097    the picture factory object.
       
  1098  */
       
  1099 const MPictureFactory* CTPictureFactory::PictureFactory(TUid aPictureType) const
       
  1100 	{
       
  1101 	if(aPictureType == iPictureType)
       
  1102 		{
       
  1103 		return this;
       
  1104 		}
       
  1105 	return NULL;
       
  1106 	}
       
  1107 
       
  1108 /**
       
  1109    This method is an override from MEikPictureFactory. It returns TPictureHeader
       
  1110    object.
       
  1111  */
       
  1112 TPictureHeader CTPictureFactory::InsertL(TUid aPictureType,CBase* )
       
  1113 	{
       
  1114 	TPictureHeader header;
       
  1115 	if (aPictureType==iPictureType)
       
  1116 		{
       
  1117 		}
       
  1118 	return header;
       
  1119 
       
  1120 	}
       
  1121 
       
  1122 /**
       
  1123    This method is an override from MEikPictureFactory.
       
  1124  */
       
  1125 void CTPictureFactory::NewPictureL(TPictureHeader&  ,const CStreamStore&  )const
       
  1126 	{
       
  1127 	}