fep/frontendprocessor/test/src/TFEP1TESTTARGET.CPP
changeset 0 eb1f2e154e89
child 6 6ceef9a83b1a
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 // Copyright (c) 2006-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 // Launch the test dialog application with edit boxes and load the FEP.
       
    15 // Create the character codes of the key events.
       
    16 // Send them to the dialog box for the FEP to intercept and to display on the editboxes of the target dialog box.
       
    17 // NOTE: This test is mostly automated as the result of the dialog boxes is checked. However, due to time constraints
       
    18 // it has not been investigated a way to automate parts of it, particularly key combinations of 'shift+A', 'shift+B' or 'shift+S',
       
    19 // which still rely on a live creature checking that the output on the screen is correct (that creature may want to put a delay
       
    20 // when sending messages to be able to see that message, otherwise it may be too fast for it/him/her).
       
    21 // 
       
    22 //
       
    23 
       
    24 /**
       
    25  @file
       
    26  @test
       
    27  @internalComponent - Internal Symbian test code
       
    28 */
       
    29 
       
    30 
       
    31 #include <e32math.h>
       
    32 #include <ecom/ecom.h>
       
    33 #include <fepbase.h>
       
    34 
       
    35 #include <tfep1testtarget.rsg>
       
    36 
       
    37 #include "TFEP1TESTTARGET.h"
       
    38 #include "TFEP1TESTTARGET.hrh"
       
    39 
       
    40 
       
    41 
       
    42 const TUid KUidTFep1 = { 0x102024D0 };
       
    43 const TUid KUidTFep4 = { 0x1028716D };
       
    44 
       
    45 // String literal to represent the language-specific resource file path.
       
    46 _LIT(KFep1TestTargetResourceFilePath, "z:\\system\\test\\fepbasetest\\tfep1testtarget.r01");
       
    47 
       
    48 // global variables
       
    49 TBuf<16> gTextNormalEdwin;
       
    50 TBuf<16> gTextNormalNumEdwin;
       
    51 TBuf<16> gTextKatakanaEdwin;
       
    52 TBuf<32> gTextPhoneticalEdwin;
       
    53 TBuf<32> gTextCJKEdwin;
       
    54 
       
    55 // expected results (according to FEP1 settings and the actions performed in the CFep1TestTargetUi::RunTestStepL method below)
       
    56 _LIT(KExpectedTextNormalEdwin, "ABCGHIJKLMQRST@");
       
    57 _LIT(KExpectedTextNormalNumEdwin, "1230056");
       
    58 _LIT(KExpectedTextKatakanaEdwin, "EFG");
       
    59 _LIT(KExpectedTextPhoneticalEdwin, "JulietteKiloLimaMNO");
       
    60 _LIT(KExpectedTextCJKEdwin, "!\x0411\x0E02\x2E81\x303A\x4E19\xAD00\xD840\xDC00\xD87E\xDC00 !\"#");
       
    61 
       
    62 
       
    63 /*************************************************************
       
    64  **  
       
    65  **  TTstResourceFileId - TCleanupItem derived class
       
    66  **  
       
    67  *************************************************************/
       
    68 /*
       
    69 	Encapsulates the clean up operations. The class unloads the resource file from the list maintained by CCoeEnv 
       
    70 */
       
    71 TTstResourceFileId::TTstResourceFileId(CCoeEnv& aConeEnvironment, TInt aResourceFileId)
       
    72 	:TCleanupItem(UnloadResourceFile, this),
       
    73 	 iConeEnvironment(aConeEnvironment),
       
    74 	 iResourceFileId(aResourceFileId)
       
    75 	{
       
    76 	}
       
    77 
       
    78 void TTstResourceFileId::UnloadResourceFile(TAny* aThis)
       
    79 	{
       
    80 	TTstResourceFileId& resourceFileId=*static_cast<TTstResourceFileId*>(aThis);
       
    81 	resourceFileId.iConeEnvironment.DeleteResourceFile(resourceFileId.iResourceFileId);
       
    82 	}
       
    83 
       
    84 
       
    85 
       
    86 /*************************************************************
       
    87  **  
       
    88  **  CTstTestTargetDialog - CEikDialog derived class
       
    89  **  
       
    90  *************************************************************/
       
    91 
       
    92 /**
       
    93   This fucntion is derived to perform the pre-layout dialog initialisation.\n
       
    94   This is called by the dialog framework before the dialog is sized and laid out. \n
       
    95   It is overloaded to initialise the control values that influence sizing and layout.\n
       
    96 */
       
    97 void CTstTestTargetDialog::PreLayoutDynInitL()
       
    98 	{
       
    99 	CEikEdwin& halfWidthKatakanaEdwin=*static_cast<CEikEdwin*>(Control(EControlIdHalfWidthKatakanaEdwin));
       
   100 	TCoeInputCapabilities inputCapabilities=halfWidthKatakanaEdwin.InputCapabilities();
       
   101 	inputCapabilities.SetCapabilities(TCoeInputCapabilities::EJapaneseKatakanaHalfWidth|TCoeInputCapabilities::ENavigation);
       
   102 	halfWidthKatakanaEdwin.SetInputCapabilitiesL(inputCapabilities);
       
   103 	CEikEdwin& phoneticAlphabetEdwin=*static_cast<CEikEdwin*>(Control(EControlIdPhoneticAlphabetEdwin));
       
   104 	inputCapabilities=phoneticAlphabetEdwin.InputCapabilities();
       
   105 	phoneticAlphabetEdwin.SetInputCapabilitiesL(TCoeInputCapabilities(TCoeInputCapabilities::EWesternAlphabetic|TCoeInputCapabilities::ENavigation, inputCapabilities.FepAwareTextEditor(), inputCapabilities.CaptionRetrieverForFep(), TUid::Uid(KTfep1Uid), this));
       
   106 	CEikEdwin& cjkEdwin=*static_cast<CEikEdwin*>(Control(EControlIdCJKEdwin));
       
   107 	inputCapabilities=cjkEdwin.InputCapabilities();
       
   108 	inputCapabilities.SetCapabilities(TCoeInputCapabilities::EAllText|TCoeInputCapabilities::ENavigation);
       
   109 	cjkEdwin.SetInputCapabilitiesL(inputCapabilities);
       
   110 	}
       
   111 
       
   112 
       
   113 TBool CTstTestTargetDialog::OkToExitL(TInt /*aKeyCode*/)
       
   114 	{
       
   115 	// Get fields text values...
       
   116 	CEikEdwin* edwinNormal = static_cast<CEikEdwin*>(Control(EControlIdNormalEdwin));
       
   117 	edwinNormal->GetText(gTextNormalEdwin);
       
   118 
       
   119 	CEikEdwin* edwinNormalNum = static_cast<CEikEdwin*>(Control(EControlIdNormalNumEdwin));
       
   120 	edwinNormalNum->GetText(gTextNormalNumEdwin);
       
   121 
       
   122 	CEikEdwin* edwinKatana = static_cast<CEikEdwin*>(Control(EControlIdHalfWidthKatakanaEdwin));
       
   123 	edwinKatana->GetText(gTextKatakanaEdwin);
       
   124 
       
   125 	CEikEdwin* edwinPhonetical = static_cast<CEikEdwin*>(Control(EControlIdPhoneticAlphabetEdwin));
       
   126 	edwinPhonetical->GetText(gTextPhoneticalEdwin);
       
   127 
       
   128 	CEikEdwin* edwinCJK = static_cast<CEikEdwin*>(Control(EControlIdCJKEdwin));
       
   129 	edwinCJK->GetText(gTextCJKEdwin);
       
   130 
       
   131 	//It's always ok to return OK in our case...
       
   132 	return ETrue;
       
   133 	}
       
   134 
       
   135 
       
   136 /**
       
   137    Flag TRUE for support of Phonetic alphabets 
       
   138 */
       
   139 TBool CTstTestTargetDialog::SupportsPhoneticAlphabet() const
       
   140 	{
       
   141 	return ETrue;
       
   142 	}
       
   143 
       
   144 
       
   145 
       
   146 
       
   147 /*************************************************************
       
   148  **  
       
   149  **  CFep1TestTargetUi
       
   150  **  
       
   151  *************************************************************/
       
   152 
       
   153 CFep1TestTargetUi::CFep1TestTargetUi(CTmsTestStep* aStep) :
       
   154   	CTestAppUi(aStep, KNullDesC)
       
   155 	{
       
   156   	}
       
   157 
       
   158 CFep1TestTargetUi::~CFep1TestTargetUi()
       
   159 	{
       
   160 	}
       
   161 
       
   162 /**
       
   163   Install the FEP.\n 
       
   164   Set the windows server event as User defined.\n
       
   165   Connect the client session to widows server.\n 
       
   166   Create the Client side handle \n
       
   167   Send the user events and close the session on completion\n
       
   168 */
       
   169 void CFep1TestTargetUi::ConstructL()
       
   170 	{
       
   171 	CTestAppUi::ConstructL();
       
   172 
       
   173 	iCoeEnv->InstallFepL(KNullUid);
       
   174 	iCoeEnv->InstallFepL(KUidTFep1);
       
   175 
       
   176 	TWsEvent theEvent;
       
   177 	theEvent.SetType(EEventUser);
       
   178 
       
   179 	RWsSession	ws;
       
   180 	TInt theRes = ws.Connect();
       
   181 
       
   182 	if(theRes == KErrNone)
       
   183 		{
       
   184 		RWindowGroup& winGroup = iCoeEnv->RootWin();
       
   185 		theEvent.SetType(EEventUser + 1);
       
   186 		theEvent.SetTimeNow();
       
   187 		TInt theId = winGroup.Identifier();
       
   188 		ws.SendEventToWindowGroup(theId, theEvent);
       
   189 		}
       
   190 	ws.Close();
       
   191 	}
       
   192 
       
   193 
       
   194 
       
   195 
       
   196 
       
   197 void CFep1TestTargetUi::RunTestStepL(TInt aStep)
       
   198 	{
       
   199 	switch(aStep)
       
   200 		{
       
   201 		
       
   202 //----------------------------------------------------------------------------------------------
       
   203 
       
   204 /**
       
   205    @SYMTestCaseID 		UIF-FEPTEST-0004
       
   206    @SYMPREQ				0000
       
   207    @SYMTestCaseDesc  	Offer key events to the dialog having the TFEP1 activated.
       
   208    @SYMTestPriority 	High 
       
   209    @SYMTestStatus 		Implemented
       
   210    @SYMTestActions 		Simulate key events sent to the dialog box, and do some actions with the fep,
       
   211    						like commit, cancel and go back to add a 'missing' letter.
       
   212    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   213  */
       
   214 
       
   215 //----------------------------------------------------------------------------------------------
       
   216 		case 1:
       
   217 			SetTestStepID(_L("UIF-FEPTEST-0004"));
       
   218 		case 2: case 3:
       
   219 			{
       
   220 			TUint code = 'A' + aStep - 1;
       
   221 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   222 			SendKey(code);
       
   223 			}
       
   224 			break;
       
   225 			
       
   226 		case 4:
       
   227 			{
       
   228 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'ABC'"));
       
   229 			SendKey(EKeyEnter);			
       
   230 			}
       
   231 			break;
       
   232 
       
   233 		case 5: case 6: case 7: 
       
   234 			{
       
   235 			TUint code = 'D' + aStep - 5;
       
   236 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   237 			SendKey(code);
       
   238 			}
       
   239 			break;
       
   240 			
       
   241 		case 8:
       
   242 			{
       
   243 			INFO_PRINTF1(_L("...simulate Key Event Escape ---> Cancels 'DEF'"));
       
   244 			SendKey(EKeyEscape);			
       
   245 			}
       
   246 			break;
       
   247 
       
   248 		case 9: case 10: case 11: 
       
   249 			{
       
   250 			TUint code = 'H' + aStep - 9;
       
   251 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   252 			SendKey(code);
       
   253 			}
       
   254 			break;
       
   255 			
       
   256 		case 12: case 13: case 14: case 15: case 16:
       
   257 			{
       
   258 			INFO_PRINTF1(_L("...simulate Key Cursor Left --->  Go left 5 positions (should not go further than the previous 'H' however"));
       
   259 			SendKey(EKeyLeftArrow);			
       
   260 			}
       
   261 			break;
       
   262 
       
   263 		case 17:
       
   264 			{
       
   265 			TUint code = 'G' + aStep - 17;
       
   266 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   267 			SendKey(code);
       
   268 			}
       
   269 			break;
       
   270 
       
   271 		case 18:
       
   272 			{
       
   273 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'GHIJ'"));
       
   274 			SendKey(EKeyEnter);			
       
   275 			}
       
   276 			break;
       
   277 
       
   278 		case 19: case 20: case 21: case 22: case 23:
       
   279 			{
       
   280 			INFO_PRINTF1(_L("...simulate Key Cursor Right --->  Go right few positions in case we were within inline editing fep mode"));
       
   281 			SendKey(EKeyRightArrow);			
       
   282 			if(aStep == 23)
       
   283 				{
       
   284 				RecordTestResultL();
       
   285 				}
       
   286 			}
       
   287 			break;
       
   288 
       
   289 
       
   290 //----------------------------------------------------------------------------------------------
       
   291 
       
   292 /**
       
   293    @SYMTestCaseID 		UIF-FEPTEST-0005
       
   294    @SYMPREQ				0000
       
   295    @SYMTestCaseDesc  	Repeat the same as the other but changing mode (inline <--> non inline)
       
   296    @SYMTestPriority 	High 
       
   297    @SYMTestStatus 		Implemented
       
   298    @SYMTestActions 		Simulate key events sent to the dialog box, and do some actions with the fep,
       
   299    						like commit, cancel and go back to add a 'missing' letter.
       
   300    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   301  */
       
   302 
       
   303 //----------------------------------------------------------------------------------------------
       
   304 
       
   305 		case 51:
       
   306 			{
       
   307 			SetTestStepID(_L("UIF-FEPTEST-0005"));
       
   308 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + I' ---> Changes fep mode!"));
       
   309 			SendKey('I', EModifierRightShift);			
       
   310 			}
       
   311 			break;
       
   312 
       
   313 		case 52: case 53: case 54: 
       
   314 			{
       
   315 			TUint code = 'K' + aStep - 52;
       
   316 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   317 			SendKey(code);
       
   318 			}
       
   319 			break;
       
   320 			
       
   321 		case 55:
       
   322 			{
       
   323 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'KLM'"));			// Submit "KLM" ----> We should have "ABCGHIJKLM"
       
   324 			SendKey(EKeyEnter);			
       
   325 			}
       
   326 			break;
       
   327 
       
   328 		case 56: case 57: case 58: 
       
   329 			{
       
   330 			TUint code = 'N' + aStep - 56;
       
   331 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   332 			SendKey(code);
       
   333 			}
       
   334 			break;
       
   335 			
       
   336 		case 59:
       
   337 			{
       
   338 			INFO_PRINTF1(_L("...simulate Key Event Escape ---> Cancels 'NOP'"));
       
   339 			SendKey(EKeyEscape);			
       
   340 			}
       
   341 			break;
       
   342 
       
   343 		case 60: case 61: case 62: 
       
   344 			{
       
   345 			TUint code = 'R' + aStep - 60;
       
   346 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   347 			SendKey(code);
       
   348 			}
       
   349 			break;
       
   350 			
       
   351 		case 63: case 64: case 65: case 66: case 67:
       
   352 			{
       
   353 			INFO_PRINTF1(_L("...simulate Key Cursor Left --->  Go left 5 positions (should not go further than the previous 'R' however"));
       
   354 			SendKey(EKeyLeftArrow);			
       
   355 			}
       
   356 			break;
       
   357 
       
   358 		case 68:
       
   359 			{
       
   360 			TUint code = 'Q' + aStep - 68;
       
   361 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   362 			SendKey(code);
       
   363 			}
       
   364 			break;
       
   365 
       
   366 		case 69:
       
   367 			{
       
   368 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'QRST'"));	// Submit "QRST" ----> We should have "ABCGHIJKLMQRST"
       
   369 			SendKey(EKeyEnter);			
       
   370 			}
       
   371 			break;
       
   372 
       
   373 		case 70: case 71: case 72: case 73: case 74:
       
   374 			{
       
   375 			INFO_PRINTF1(_L("...simulate Key Cursor Right --->  Go right few positions in case we were within inline editing fep mode"));
       
   376 			SendKey(EKeyRightArrow);			
       
   377 			if(aStep == 74)
       
   378 					{
       
   379 					RecordTestResultL();
       
   380 					}
       
   381 			}
       
   382 			break;
       
   383 
       
   384 
       
   385 //----------------------------------------------------------------------------------------------
       
   386 
       
   387 /**
       
   388    @SYMTestCaseID 		UIF-FEPTEST-0006
       
   389    @SYMPREQ				0000
       
   390    @SYMTestCaseDesc  	Test changing focus
       
   391    @SYMTestPriority 	High 
       
   392    @SYMTestStatus 		Implemented
       
   393    @SYMTestActions 		Simulate key events to change focus of the Fep window and move the windows around.
       
   394    						In addition, simulate the key event that sends the Fep window to the current dialog cursor.
       
   395    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   396  */
       
   397 
       
   398 //----------------------------------------------------------------------------------------------
       
   399 
       
   400 		case 101:
       
   401 			{
       
   402 			SetTestStepID(_L("UIF-FEPTEST-0006"));
       
   403 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + N' ---> Moves the Fep window to dialog cursor!"));
       
   404 			SendKey('N', EModifierRightShift);			
       
   405 			}
       
   406 			break;
       
   407 
       
   408 		case 102:
       
   409 			{
       
   410 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + F' ---> Changes focus!"));
       
   411 			SendKey('F', EModifierRightShift);			
       
   412 			}
       
   413 			break;
       
   414 
       
   415 		case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: case 112: case 113: case 114: case 115:
       
   416 			{
       
   417 			INFO_PRINTF1(_L("...send several cursor right events to move the window"));
       
   418 			for (TInt ii=10; ii>0; --ii)
       
   419 				SendKey(EKeyRightArrow);			
       
   420 			}
       
   421 			break;
       
   422 
       
   423 		case 116:
       
   424 			{
       
   425 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Finishes moving the Fep window!"));
       
   426 			SendKey(EKeyEnter);			
       
   427 			RecordTestResultL();
       
   428 			}
       
   429 			break;
       
   430 
       
   431 
       
   432 //----------------------------------------------------------------------------------------------
       
   433 
       
   434 /**
       
   435    @SYMTestCaseID 		UIF-FEPTEST-0007
       
   436    @SYMPREQ				0000
       
   437    @SYMTestCaseDesc  	Test TFEP1 in HEXadecimal mode
       
   438    @SYMTestPriority 	High 
       
   439    @SYMTestStatus 		Implemented
       
   440    @SYMTestActions 		Change Fep to HEX mode by means of the corresponding key event.
       
   441    						Simulate that the combination of 0x0040 produces the symbol '@'
       
   442    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   443  */
       
   444 
       
   445 //----------------------------------------------------------------------------------------------
       
   446 
       
   447 		case 151:
       
   448 			{
       
   449 			SetTestStepID(_L("UIF-FEPTEST-0007"));
       
   450 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + M' ---> Changes to hex fep!"));
       
   451 			SendKey('M', EModifierRightShift);			
       
   452 			}
       
   453 			break;
       
   454 
       
   455 		case 153:
       
   456 			{
       
   457 			TUint code = '0';
       
   458 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   459 			SendKey(code);
       
   460 			}
       
   461 			break;
       
   462 
       
   463 		case 154:
       
   464 			{
       
   465 			TUint code = '0';
       
   466 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   467 			SendKey(code);
       
   468 			}
       
   469 			break;
       
   470 
       
   471 		case 155:
       
   472 			{
       
   473 			TUint code = '4';
       
   474 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   475 			SendKey(code);
       
   476 			}
       
   477 			break;
       
   478 
       
   479 		case 156:
       
   480 			{
       
   481 			TUint code = '0';
       
   482 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   483 			SendKey(code);
       
   484 			}
       
   485 			break;
       
   486 
       
   487 		case 157:
       
   488 			{
       
   489 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits '0040' ==> At symbol (@)"));
       
   490 			SendKey(EKeyEnter);			
       
   491 			}
       
   492 			break;
       
   493 
       
   494 		case 158:
       
   495 			{
       
   496 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + M' ---> Changes back to normal fep!"));
       
   497 			SendKey('M', EModifierRightShift);			
       
   498 			RecordTestResultL();
       
   499 			}
       
   500 			break;
       
   501 
       
   502 
       
   503 //----------------------------------------------------------------------------------------------
       
   504 
       
   505 /**
       
   506    @SYMTestCaseID 		UIF-FEPTEST-0008
       
   507    @SYMPREQ				0000
       
   508    @SYMTestCaseDesc  	Text selection within a dialog box editor.
       
   509    @SYMTestPriority 	High 
       
   510    @SYMTestStatus 		Implemented
       
   511    @SYMTestActions 		To test this functionality we simulate a key event to go to the next dialog
       
   512    						field (cursor down). Once in there, some numerical key events are sent to the
       
   513    						application.
       
   514    						The selection of uncommited text and replacing it for new characters is also tested.
       
   515    						Simulate the selection of some of the characters in the box, and by means
       
   516    						of Fep capabilities, show what's been selected, what's after the selection, and
       
   517    						what's the text before the selection.
       
   518    @SYMTestExpectedResults 	Fep shows the selection by means of User::InfoPrint() on the screen (partly manual)
       
   519    							When the dialog is dismissed, the text box reads as is expected.
       
   520  */
       
   521 
       
   522 //----------------------------------------------------------------------------------------------
       
   523 
       
   524 		case 201:
       
   525 			{
       
   526 			SetTestStepID(_L("UIF-FEPTEST-0008"));
       
   527 			INFO_PRINTF1(_L("Send cursor down events to move the next dialog"));
       
   528 			SendKey(EKeyDownArrow);			
       
   529 			}
       
   530 			break;
       
   531 
       
   532 		case 202: case 203: case 204:
       
   533 			{
       
   534 			TUint code = 'x' + aStep - 202;
       
   535 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   536 			SendKey(code);
       
   537 			}
       
   538 			break;
       
   539 
       
   540 		case 205:
       
   541 			{
       
   542 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + W' ---> Change cursor type in case of inline editing!"));
       
   543 			SendKey('W', EModifierRightShift);			
       
   544 			}
       
   545 			break;
       
   546 			
       
   547 		case 206: case 207: case 208: 
       
   548 			{
       
   549 			INFO_PRINTF1(_L("...simulate Key Cursor 'shift + Left' --->  Selects non-submitted text"));
       
   550 			SendKey(EKeyLeftArrow, EModifierLeftShift|EModifierShift);
       
   551 			}
       
   552 			break;
       
   553 
       
   554 		case 209: case 210: case 211:
       
   555 			{
       
   556 			TUint code = '1' + aStep - 209;
       
   557 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);	//should replace uncommitted 'xyz' to '123'
       
   558 			SendKey(code);
       
   559 			}
       
   560 			break;
       
   561 
       
   562 		case 212:
       
   563 			{
       
   564 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits '123'"));
       
   565 			SendKey(EKeyEnter);			
       
   566 			}
       
   567 			break;
       
   568 
       
   569 		case 213:
       
   570 			{
       
   571 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + I' ---> Changes fep mode!"));
       
   572 			SendKey('I', EModifierRightShift);			
       
   573 			}
       
   574 			break;
       
   575 
       
   576 		case 214: case 215: case 216:
       
   577 			{
       
   578 			TUint code = 'x' + aStep - 214;
       
   579 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   580 			SendKey(code);
       
   581 			}
       
   582 			break;
       
   583 
       
   584 		case 217:
       
   585 			{
       
   586 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + W' ---> Change cursor type in case of inline editing!"));
       
   587 			SendKey('W', EModifierRightShift);			
       
   588 			}
       
   589 			break;
       
   590 			
       
   591 		case 218: case 219: case 220: 
       
   592 			{
       
   593 			INFO_PRINTF1(_L("...simulate Key Cursor 'shift + Right' --->  Selects non-submitted text"));
       
   594 			SendKey(EKeyLeftArrow, EModifierLeftShift|EModifierShift);
       
   595 			}
       
   596 			break;
       
   597 
       
   598 		case 221: case 222: case 223:
       
   599 			{
       
   600 			TUint code = '4' + aStep - 221;
       
   601 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);	//should replace uncommitted 'xyz' to '456'
       
   602 			SendKey(code);
       
   603 			}
       
   604 			break;
       
   605 
       
   606 		case 224:
       
   607 			{
       
   608 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits '456'"));
       
   609 			SendKey(EKeyEnter);			
       
   610 			}
       
   611 			break;
       
   612 
       
   613 		case 225: case 226: case 227:
       
   614 			{
       
   615 			INFO_PRINTF1(_L("...simulate Key Cursor Left --->  Go left 3 positions (we should be between digits 3 and 4!"));
       
   616 			SendKey(EKeyLeftArrow);			
       
   617 			}
       
   618 			break;
       
   619 
       
   620 		case 228:
       
   621 			{
       
   622 			INFO_PRINTF1(_L("...simulate Key Cursor 'shift + Right' --->  Selects 4!"));
       
   623 			SendKey(EKeyRightArrow, EModifierLeftShift|EModifierShift);
       
   624 			}
       
   625 			break;
       
   626 
       
   627 		case 229:
       
   628 			{
       
   629 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + A' ---> Tells about what's AFTER the selected 4!"));	// Should be 56
       
   630 			SendKey('A', EModifierRightShift);			
       
   631 			}
       
   632 			break;
       
   633 			
       
   634 		case 230:
       
   635 			{
       
   636 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + S' ---> Tells about what's SELECTED!"));	// Should be 4
       
   637 			SendKey('S', EModifierRightShift);			
       
   638 			}
       
   639 			break;
       
   640 			
       
   641 		case 231:
       
   642 			{
       
   643 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + B' ---> Tells about what's BEFORE the selected 4!"));	// Should be 123
       
   644 			SendKey('B', EModifierRightShift);			
       
   645 			}
       
   646 			break;
       
   647 
       
   648 		case 232: case 233:
       
   649 			{
       
   650 			TUint code = '0';
       
   651 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   652 			SendKey(code);
       
   653 			}
       
   654 			break;
       
   655 
       
   656 		case 234:
       
   657 			{
       
   658 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits '00'"));						// We should have 1230056
       
   659 			SendKey(EKeyEnter);			
       
   660 			RecordTestResultL();
       
   661 			}
       
   662 			break;
       
   663 
       
   664 
       
   665 
       
   666 //----------------------------------------------------------------------------------------------
       
   667 
       
   668 /**
       
   669    @SYMTestCaseID 		UIF-FEPTEST-0009
       
   670    @SYMPREQ				0000
       
   671    @SYMTestCaseDesc  	Fep state within a dialog box editor.
       
   672    @SYMTestPriority 	High 
       
   673    @SYMTestStatus 		Implemented
       
   674    @SYMTestActions 		To test this functionality we simulate a key event to go to change the state
       
   675    						variable (in TFEP1 case it's just a counter), repeating the same event few times.
       
   676    						he next dialog.
       
   677    						Move to the next text editor box and go back to the previous one. State is maintained 
       
   678    @SYMTestExpectedResults 	The state is maintained even though we move across to other text editor boxes (partly manual)
       
   679  */
       
   680 
       
   681 //----------------------------------------------------------------------------------------------
       
   682 		case 251:
       
   683 			SetTestStepID(_L("UIF-FEPTEST-0009"));
       
   684 
       
   685 		case 252: case 253: case 254: case 255:
       
   686 			{
       
   687 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + T' ---> Changes State variable!"));
       
   688 			SendKey('T', EModifierRightShift);			
       
   689 			}
       
   690 			break;
       
   691 
       
   692 		case 256:
       
   693 			{
       
   694 			INFO_PRINTF1(_L("Send cursor up events to move the next dialog"));
       
   695 			SendKey(EKeyUpArrow);			
       
   696 			}
       
   697 			break;
       
   698 
       
   699 		case 257:
       
   700 			{
       
   701 			INFO_PRINTF1(_L("Send cursor down events to move the next dialog"));
       
   702 			SendKey(EKeyDownArrow);			
       
   703 			}
       
   704 			break;
       
   705 
       
   706 		case 258: case 259: case 260: case 261: case 262:
       
   707 			{
       
   708 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + T' ---> Changes State variable!"));
       
   709 			SendKey('T', EModifierRightShift);			
       
   710 			if(aStep == 262)
       
   711 				{
       
   712 				RecordTestResultL();
       
   713 				}
       
   714 			}
       
   715 			break;
       
   716 
       
   717 
       
   718 //----------------------------------------------------------------------------------------------
       
   719 
       
   720 /**
       
   721    @SYMTestCaseID 		UIF-FEPTEST-0010
       
   722    @SYMPREQ				0000
       
   723    @SYMTestCaseDesc  	Kata-kata dialog box editor.
       
   724    @SYMTestPriority 	High 
       
   725    @SYMTestStatus 		Implemented
       
   726    @SYMTestActions 		To test this functionality we simulate a key event to go to next dialog box 
       
   727    						editor (Katakana dialog box). Simulate some characters and check that 
       
   728    						they appear on the box accordingly.
       
   729    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   730  */
       
   731 
       
   732 //----------------------------------------------------------------------------------------------
       
   733 
       
   734 		case 351:
       
   735 			{
       
   736 			SetTestStepID(_L("UIF-FEPTEST-0010"));
       
   737 			INFO_PRINTF1(_L("Send cursor down events to move the next dialog"));
       
   738 			SendKey(EKeyDownArrow);			
       
   739 			}
       
   740 			break;
       
   741 
       
   742 		case 352: case 353: case 354:  
       
   743 			{
       
   744 			SetTestStepID(_L("UIF-FEPTEST-0010"));
       
   745 			TUint code = 'E' + aStep - 352;
       
   746 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   747 			SendKey(code);
       
   748 			if(aStep == 354)
       
   749 					{
       
   750 					RecordTestResultL();
       
   751 					}
       
   752 			}
       
   753 			break;
       
   754 
       
   755 
       
   756 //----------------------------------------------------------------------------------------------
       
   757 
       
   758 /**
       
   759    @SYMTestCaseID 		UIF-FEPTEST-0011
       
   760    @SYMPREQ				0000
       
   761    @SYMTestCaseDesc  	Phoneticall dialog box editor.
       
   762    @SYMTestPriority 	High 
       
   763    @SYMTestStatus 		Implemented
       
   764    @SYMTestActions 		To test this functionality we simulate a key event to go to next dialog box 
       
   765    						editor (Phoneticall dialog box). Simulate some characters and check that 
       
   766    						they appear on the box accordingly, i.e, converting single characters to those
       
   767    						in the phoneticall alphabet (A-->Alpha, B-->Bravo...)
       
   768    						In addition, uninstall the Fep and write more characters, so they are not 
       
   769    						phonetically 'translated' by the Fep. 		
       
   770    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   771  */
       
   772 
       
   773 //----------------------------------------------------------------------------------------------
       
   774 
       
   775 		case 451:
       
   776 			{
       
   777 			SetTestStepID(_L("UIF-FEPTEST-0011"));
       
   778 			INFO_PRINTF1(_L("Send cursor down events to move the next dialog"));
       
   779 			SendKey(EKeyDownArrow);			
       
   780 			}
       
   781 			break;
       
   782 
       
   783 		case 452: case 453: case 454:  
       
   784 			{
       
   785 			TUint code = 'J' + aStep - 452;
       
   786 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   787 			SendKey(code);
       
   788 			}
       
   789 			break;
       
   790 			
       
   791 		case 455:
       
   792 			{
       
   793 			INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'JulietteKiloLima'"));
       
   794 			SendKey(EKeyEnter);			
       
   795 			}
       
   796 			break;
       
   797 
       
   798 		case 456:
       
   799 			{
       
   800 			INFO_PRINTF1(_L("Uninstall the FEP"));
       
   801 			iCoeEnv->InstallFepL(KNullUid);
       
   802 			User::After(TTimeIntervalMicroSeconds32(2000000));
       
   803 			}
       
   804 			break;
       
   805 
       
   806 		case 457: case 458: case 459:
       
   807 			{
       
   808 			TUint code = 'M' + aStep - 457;
       
   809 			INFO_PRINTF2(_L("...simulate Key Event '%d'"), code);
       
   810 			SendKey(code);
       
   811 			}
       
   812 			break;
       
   813 			
       
   814 		case 460:
       
   815 			{
       
   816 			//INFO_PRINTF1(_L("...simulate Key Event Enter ---> Submits 'MNO' (not Fep installed --> No Alphabetical!"));
       
   817 			//SendKey(EKeyEnter);			
       
   818 			RecordTestResultL();
       
   819 			}
       
   820 			break;
       
   821 
       
   822 //----------------------------------------------------------------------------------------------
       
   823 
       
   824 /**
       
   825    @SYMTestCaseID 		TI18N-FEPBASE-CIT-4001
       
   826    @SYMPREQ				2471
       
   827    @SYMTestCaseDesc  	Check FEPBASE Unicode 5.0 support.
       
   828    @SYMTestPriority 	High 
       
   829    @SYMTestStatus 		Implemented
       
   830    @SYMTestActions 		1. Pass BMP code points to WORD.exe
       
   831                         2. Pass non-BMP code points to WORD.exe 
       
   832  		
       
   833    @SYMTestExpectedResults 	When the dialog is dismissed, the text box reads as is expected.
       
   834  */
       
   835 
       
   836 //----------------------------------------------------------------------------------------------
       
   837 
       
   838 		case 461:
       
   839 			{
       
   840 			SetTestStepID(_L("TI18N-FEPBASE-CIT-4001"));
       
   841 			INFO_PRINTF1(_L("Send cursor down events to move the next dialog"));
       
   842 			SendKey(EKeyDownArrow);			
       
   843 			INFO_PRINTF1(_L("Install the FEP 1"));
       
   844 			iCoeEnv->InstallFepL(KUidTFep1);
       
   845 			User::After(TTimeIntervalMicroSeconds32(2000000));
       
   846 			}
       
   847 			break;
       
   848 
       
   849 		case 462:
       
   850 			{
       
   851 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + M' ---> Changes to hex fep!"));
       
   852 			SendKey('M', EModifierRightShift);			
       
   853 			TUint codes[] = {'0', '0', '2', '1'};
       
   854 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   855 				{
       
   856 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   857 				SendKey(codes[i]);
       
   858 				User::After(TTimeIntervalMicroSeconds32(200000));
       
   859 				}
       
   860 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   861 			SendKey(EKeyEnter);			
       
   862 			}
       
   863 			break;
       
   864 		case 463:  
       
   865 			{
       
   866 			TUint codes[] = {'0', '4', '1', '1'};
       
   867 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   868 				{
       
   869 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   870 				SendKey(codes[i]);
       
   871 				User::After(TTimeIntervalMicroSeconds32(200000));
       
   872 				}
       
   873 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   874 			SendKey(EKeyEnter);			
       
   875 			}
       
   876 			break;
       
   877 		case 464:  
       
   878 			{
       
   879 			TUint codes[] = {'0', 'E', '0', '2'};
       
   880 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   881 				{
       
   882 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   883 				SendKey(codes[i]);
       
   884 				User::After(TTimeIntervalMicroSeconds32(200000));
       
   885 				}
       
   886 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   887 			SendKey(EKeyEnter);			
       
   888 			}
       
   889 			break;
       
   890 			
       
   891 		case 465:
       
   892 			{
       
   893 			TUint codes[] = {'2', 'E', '8', '1'};
       
   894 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   895 				{
       
   896 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   897 				SendKey(codes[i]);
       
   898 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   899 				}
       
   900 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   901 			SendKey(EKeyEnter);			
       
   902 			}
       
   903 			break;
       
   904 		case 466:
       
   905 			{
       
   906 			TUint codes[] = {'3', '0', '3', 'A'};
       
   907 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   908 				{
       
   909 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   910 				SendKey(codes[i]);
       
   911 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   912 				}
       
   913 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   914 			SendKey(EKeyEnter);			
       
   915 			}
       
   916 			break;
       
   917 		case 467:
       
   918 			{
       
   919 			TUint codes[] = {'4', 'E', '1', '9'};
       
   920 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   921 				{
       
   922 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   923 				SendKey(codes[i]);
       
   924 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   925 				}
       
   926 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   927 			SendKey(EKeyEnter);			
       
   928 			}
       
   929 			break;
       
   930 		case 468:
       
   931 			{
       
   932 			TUint codes[] = {'A', 'D', '0', '0'};
       
   933 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   934 				{
       
   935 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   936 				SendKey(codes[i]);
       
   937 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   938 				}
       
   939 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   940 			SendKey(EKeyEnter);			
       
   941 			}
       
   942 			break;
       
   943 
       
   944 		case 469:
       
   945 			{
       
   946 			INFO_PRINTF1(_L("Uninstall the FEP"));
       
   947 			iCoeEnv->InstallFepL(KNullUid);
       
   948 			INFO_PRINTF1(_L("Install the FEP 4"));
       
   949 			iCoeEnv->InstallFepL(KUidTFep4);
       
   950 			User::After(TTimeIntervalMicroSeconds32(2000000));
       
   951 			}
       
   952 			break;
       
   953 
       
   954 		case 471:
       
   955 			{
       
   956 			TUint codes[] = {'2', '0', '0', '0', '0'};
       
   957 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   958 				{
       
   959 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   960 				SendKey(codes[i]);
       
   961 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   962 				}
       
   963 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   964 			SendKey(EKeyEnter);			
       
   965 			}
       
   966 			break;
       
   967 		case 472: 
       
   968 			{
       
   969 			TUint codes[] =  {'2', 'F', '8', '0', '0'};
       
   970 			for (int i = 0; i < sizeof(codes)/sizeof(TUint); i++)
       
   971 				{
       
   972 				INFO_PRINTF2(_L("...simulate Key Event '%d'"), codes[i]);
       
   973 				SendKey(codes[i]);
       
   974 				User::After(TTimeIntervalMicroSeconds32(1000000));
       
   975 				}
       
   976 			INFO_PRINTF1(_L("...simulate Key Event Enter"));
       
   977 			SendKey(EKeyEnter);			
       
   978 			}
       
   979 			break;
       
   980 			
       
   981 		case 473:
       
   982 			{
       
   983             INFO_PRINTF1(_L("...simulate Key Event 'Shift + X' ---> test SimulateKeyEventsL!"));
       
   984             SendKey('X', EModifierRightShift);
       
   985             User::After(TTimeIntervalMicroSeconds32(2000000));
       
   986 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + M' ---> Changes to Pinyin!"));
       
   987 			SendKey('M', EModifierRightShift);
       
   988             User::After(TTimeIntervalMicroSeconds32(2000000));
       
   989 			}
       
   990 			break;
       
   991 		case 474:
       
   992 			{
       
   993 			INFO_PRINTF1(_L("...simulate Key Event 'Shift + M' ---> Changes back to Plain!"));
       
   994 			SendKey('M', EModifierRightShift);
       
   995 			User::After(TTimeIntervalMicroSeconds32(2000000));
       
   996 			}
       
   997 			break;
       
   998 		case 475:
       
   999 			{
       
  1000 			INFO_PRINTF1(_L("Uninstall the FEP"));
       
  1001 			iCoeEnv->InstallFepL(KNullUid);
       
  1002 			SendKey(EKeyEnter);  
       
  1003 			RecordTestResultL();
       
  1004 			}
       
  1005 			break;
       
  1006 						
       
  1007 //----------------------------------------------------------------------------------------------
       
  1008 
       
  1009 /**
       
  1010    @SYMTestCaseID 		UIF-FEPTEST-0012
       
  1011    @SYMPREQ				0000
       
  1012    @SYMTestCaseDesc  	Dismiss dialog.
       
  1013    @SYMTestPriority 	High 
       
  1014    @SYMTestStatus 		Implemented
       
  1015    @SYMTestActions 		To test this functionality we simulate a key event to dismiss the dialog.
       
  1016    						When the dialog is closed, CTstTestTargetDialog::OkToExitL() is called and 
       
  1017    						general variables are set with the values from the dialog text editors.
       
  1018    @SYMTestExpectedResults 	All global variables read as expected.
       
  1019  */
       
  1020 
       
  1021 //----------------------------------------------------------------------------------------------
       
  1022 
       
  1023 		case 501:
       
  1024 			{
       
  1025 			SetTestStepID(_L("UIF-FEPTEST-0012"));
       
  1026 			INFO_PRINTF1(_L("Ssimulate Key Enter Event to dismiss the dialog"));
       
  1027 			AutoTestManager().Cancel();
       
  1028 			SendKey(EKeyEnter);			
       
  1029 			}
       
  1030 			break;
       
  1031 			
       
  1032 		case 502:
       
  1033 			{
       
  1034 			INFO_PRINTF1(_L("Wait for 2 seconds..."));
       
  1035 			User::After(TTimeIntervalMicroSeconds32(2000000));
       
  1036 			}
       
  1037 			break;
       
  1038 
       
  1039 		case 503:
       
  1040 			{
       
  1041 			INFO_PRINTF1(_L("Checking dialog values..."));
       
  1042 			INFO_PRINTF3(_L("gTextNormalEdwin was '%S' (expected '%S')"), &gTextNormalEdwin, &KExpectedTextNormalEdwin);
       
  1043 			INFO_PRINTF3(_L("gTextNormalNumEdwin was '%S' (expected '%S')"), &gTextNormalNumEdwin, &KExpectedTextNormalNumEdwin);
       
  1044 			INFO_PRINTF3(_L("gTextKatakanaEdwin was '%S' (expected '%S')"), &gTextKatakanaEdwin, &KExpectedTextKatakanaEdwin);
       
  1045 			INFO_PRINTF3(_L("gTextPhoneticalEdwin was '%S' (expected '%S')"), &gTextPhoneticalEdwin, &KExpectedTextPhoneticalEdwin);
       
  1046 			INFO_PRINTF3(_L("gTextCJKEdwin was '%S' (expected '%S')"), &gTextCJKEdwin, &KExpectedTextCJKEdwin);
       
  1047 
       
  1048 			TEST(gTextNormalEdwin == KExpectedTextNormalEdwin);
       
  1049 			TEST(gTextNormalNumEdwin == KExpectedTextNormalNumEdwin);
       
  1050 			TEST(gTextKatakanaEdwin == KExpectedTextKatakanaEdwin);
       
  1051 			TEST(gTextPhoneticalEdwin == KExpectedTextPhoneticalEdwin);
       
  1052 			TEST(gTextCJKEdwin == KExpectedTextCJKEdwin);
       
  1053 			RecordTestResultL();
       
  1054 			CloseTMSGraphicsStep();
       
  1055 			}
       
  1056 			break;
       
  1057 
       
  1058 		case 504:
       
  1059 			{
       
  1060 			AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
  1061 			}
       
  1062 			break;
       
  1063 		}
       
  1064 		
       
  1065 	}
       
  1066 
       
  1067 
       
  1068 
       
  1069 void CFep1TestTargetUi::SendKey(TUint aCode, TUint aModifiers, TInt aRepeats, TInt aScanCode)
       
  1070 	{
       
  1071 	TWsEvent theEvent;
       
  1072 	TKeyEvent *theKey = theEvent.Key();
       
  1073 	theKey->iScanCode = aScanCode;
       
  1074 	theKey->iModifiers = aModifiers;
       
  1075 	theKey->iRepeats = aRepeats;
       
  1076 	theKey->iCode = aCode;
       
  1077 	SendEventToWindowGroups(theEvent);
       
  1078 	}
       
  1079 
       
  1080 
       
  1081 /** 
       
  1082   Handle the window events.\n
       
  1083   Create a window server session and connect the client\n
       
  1084   Create a client side handle for the server.\n
       
  1085   Set the window event type and call the SendEventToWindowGroup().\n
       
  1086   Close the session on completion \n
       
  1087 */
       
  1088 void CFep1TestTargetUi::SendEventToWindowGroups(TWsEvent&	aEvent)
       
  1089 	{
       
  1090 User::After(100000);
       
  1091 
       
  1092 	RWsSession	ws;
       
  1093 	TInt theRes = ws.Connect();
       
  1094 	TEST(theRes == KErrNone);
       
  1095 
       
  1096 	RWindowGroup& winGroup = iCoeEnv->RootWin();
       
  1097 	TInt theId = winGroup.Identifier();
       
  1098 	
       
  1099 	aEvent.SetType(EEventKeyDown);
       
  1100 	aEvent.SetTimeNow();
       
  1101 	ws.SendEventToWindowGroup(theId, aEvent);
       
  1102 		
       
  1103 	aEvent.SetType(EEventKey);
       
  1104 	aEvent.SetTimeNow();
       
  1105 	ws.SendEventToWindowGroup(theId, aEvent);
       
  1106 
       
  1107 	aEvent.SetType(EEventKeyUp);
       
  1108 	aEvent.SetTimeNow();
       
  1109 	ws.SendEventToWindowGroup(theId, aEvent);
       
  1110 	
       
  1111 	ws.Close();
       
  1112 	}
       
  1113 	
       
  1114 /**
       
  1115   Handle the user defined events.\n
       
  1116   Search for the resource file that support the language.\n
       
  1117   Adds the specified resource file to the list maintained by CCoeEnv. \n
       
  1118 */
       
  1119 void CFep1TestTargetUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
       
  1120 	{
       
  1121 	if(aEvent.Type() == (EEventUser + 1))
       
  1122 		{
       
  1123 		CCoeEnv& coneEnvironment=*CCoeEnv::Static();
       
  1124 		TFileName* resourceFileName=new(ELeave) TFileName(KFep1TestTargetResourceFilePath);
       
  1125 	
       
  1126 		TBuf8<128> buf;
       
  1127 		buf.Copy(*resourceFileName);
       
  1128 	
       
  1129 		CleanupStack::PushL(resourceFileName);
       
  1130 		BaflUtils::NearestLanguageFile(coneEnvironment.FsSession(), *resourceFileName);
       
  1131 		TTstResourceFileId resourceFileId(coneEnvironment, coneEnvironment.AddResourceFileL(*resourceFileName));
       
  1132 		CleanupStack::PopAndDestroy(resourceFileName);
       
  1133 		CleanupStack::PushL(resourceFileId);
       
  1134 		CTstTestTargetDialog* dlg = new(ELeave) CTstTestTargetDialog;
       
  1135 
       
  1136 		AutoTestManager().StartAutoTest();
       
  1137 		dlg->ExecuteLD(R_TFT_DIALOG);
       
  1138 		CleanupStack::PopAndDestroy(&resourceFileId);
       
  1139 		}
       
  1140 	else 
       
  1141 		{
       
  1142 		CTestAppUi::HandleApplicationSpecificEventL(aType, aEvent);	
       
  1143 		}
       
  1144 	}
       
  1145 
       
  1146 
       
  1147 /*************************************************************
       
  1148  **  
       
  1149  **  CTestFep1TargetStep
       
  1150  **  
       
  1151  *************************************************************/
       
  1152 
       
  1153 CTestFep1TargetStep::CTestFep1TargetStep()
       
  1154 	{
       
  1155 	SetTestStepName(KFep1TestTargetStep);
       
  1156 	}
       
  1157 
       
  1158 CTestFep1TargetStep::~CTestFep1TargetStep()
       
  1159 	{
       
  1160 	}
       
  1161 
       
  1162 
       
  1163 /**  
       
  1164   Call ConstructL() of CEikonEnv and initialize a pointer to CFep1TestTargetUi \n
       
  1165   Set the application's user interface object \n
       
  1166   Call ConstructL() of CFep1TestTargetUi 
       
  1167 */
       
  1168 void CTestFep1TargetStep::ConstructAppL(CEikonEnv* aCoe)
       
  1169     { // runs inside a TRAP harness
       
  1170 	aCoe->ConstructL();
       
  1171 	CTestAppUi* appUi= new (ELeave) CFep1TestTargetUi(this);
       
  1172     aCoe->SetAppUi(appUi);
       
  1173     appUi->ConstructL();
       
  1174 	}
       
  1175 
       
  1176 
       
  1177 /**
       
  1178    Entry function for the test steps.\n
       
  1179    Provide an active environment for creating controls and utility functions \n
       
  1180    Launches the application using ExecuteD().\n
       
  1181  */
       
  1182 TVerdict CTestFep1TargetStep::doTestStepL()
       
  1183 	{
       
  1184 	PreallocateHALBuffer();
       
  1185 
       
  1186 	INFO_PRINTF1(_L("TestFep1Target started..."));
       
  1187 
       
  1188 	__UHEAP_MARK;
       
  1189 
       
  1190 	CEikonEnv* coe=new(ELeave) CEikonEnv;
       
  1191 	TRAPD(err,ConstructAppL(coe));
       
  1192 
       
  1193 	if (!err)
       
  1194 		coe->ExecuteD();
       
  1195 	else
       
  1196 		{
       
  1197 		delete coe;
       
  1198 		SetTestStepResult(EFail);
       
  1199 		}
       
  1200 
       
  1201 	__UHEAP_MARKEND;
       
  1202 
       
  1203 	INFO_PRINTF1(_L("...TestFep1Target finished!"));
       
  1204 	
       
  1205 	return TestStepResult();
       
  1206 	}
       
  1207 
       
  1208