commonuisupport/grid/tef/TGRID0STEP.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 // Tests APIs related to CGridImg,CGridLay and MGridTable classes
       
    15 // for tables with FIXED row boundaries\n
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include <e32keys.h>
       
    25 #include <f32file.h>
       
    26 #include <s32file.h>
       
    27 
       
    28 #include "TGrid0Step.h"
       
    29 
       
    30 
       
    31 //! Color combination for Black background.\n
       
    32 #define KRgbForeground			TRgb(0,0,0)			// Black
       
    33 //! Color combination for White background.\n
       
    34 #define KRgbBackground			TRgb(255,255,255)	// White
       
    35 //! Color comination for Gray grid lines.\n
       
    36 #define KRgbLines				TRgb(170,170,170)	// Light Gray
       
    37 //! Color combination for Label separators.\n
       
    38 #define KRgbLabelSeparators		TRgb(0,0,0)
       
    39 
       
    40 
       
    41 /**
       
    42   Constructor for the Grid App Ui class \n
       
    43 */
       
    44 CTestGridAppUi::CTestGridAppUi(CTmsTestStep* aStep) :
       
    45 	CTestCoeAppUi(aStep)
       
    46 {}
       
    47 /**
       
    48   Destructor for the Grid App Ui class\n
       
    49   Destroys all the member objects like \n
       
    50   Grid Window, Grid Image,Grid Lay, Grid Table etc \n
       
    51 */
       
    52 CTestGridAppUi::~CTestGridAppUi()
       
    53 	{
       
    54 	RemoveFromStack(iGridWin);
       
    55 	delete iGridWin;
       
    56     delete iGridImg;
       
    57     delete iGridLay;
       
    58 	delete iSheetCellImg;
       
    59 	delete iSheetLabelImg;
       
    60 	delete iGridTable;
       
    61 	delete iZoomFactor;
       
    62 	delete iDialog;
       
    63 	}
       
    64 
       
    65 
       
    66 /**
       
    67   
       
    68   Handles the following Key Events\n
       
    69   1. Ctrl+ e - Exits the application\n
       
    70   2. Ctrl+ t - Sets the Title Lines\n
       
    71   3. Ctrl+ r - Sets the cursor position to the cell at the top of the window\n
       
    72   4. Ctrl+ z - Sets the zoom factor \n 
       
    73   5. Ctrl+ p - 
       
    74   6. Ctrl+ i - Inserts columns \n
       
    75   7. Ctrl+ d - Deletes columns \n
       
    76   8. Ctrl+ c - Changes the grid colour settings\n
       
    77   9. Shift+t - Makes the cell containing cursor visible \n
       
    78   10.Shift+z - Sets the zoom factor\n
       
    79   11.Shift+r - Makes the query dialog visible\n
       
    80   12.Shift+Esc - Defocuses the query dialog if it is already visible\n
       
    81   13.Shift+c - Resizes the columns \n
       
    82   14.Shift+r - Resize the rows \n
       
    83  
       
    84   @return Response to the key event indicating whether the event is successfully handled or not.\n
       
    85   
       
    86 */
       
    87 TKeyResponse CTestGridAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
    88 	{
       
    89 	if (aType==EEventKey)
       
    90         {
       
    91         if ((aKeyEvent.iModifiers&EAllStdModifiers)==EModifierCtrl)
       
    92 		    {
       
    93 		    switch (aKeyEvent.iCode)
       
    94 			    {
       
    95 			    case CTRL('e'):
       
    96 				    SaveL();
       
    97 				    iCoeEnv->Flush();
       
    98 				    CBaActiveScheduler::Exit();
       
    99 				    break;
       
   100 			    case CTRL('t'):
       
   101 					{
       
   102 					CGridLay* gridLay=iGridWin->GridLay();
       
   103 					gridLay->SetTitleLinesL(EFalse);
       
   104 					iGridWin->ExposeCellL(iGridWin->CursorPos());
       
   105 				    gridLay->SetTitleLinesL(ETrue);
       
   106 					}
       
   107 				    break;
       
   108 			    case CTRL('r'):
       
   109 				    iGridWin->GridLay()->SetGridToDefault();
       
   110 				    iGridWin->DrawNow();
       
   111 				    iGridWin->SetCursorPosL(iGridWin->GridLay()->VisibleRange().iFrom);
       
   112 				    break;
       
   113                 case CTRL('z'):
       
   114 		            {
       
   115 		            TInt zoomFactor=iZoomFactor->ZoomFactor();
       
   116 		            zoomFactor=(zoomFactor<(TZoomFactor::EZoomOneToOne*4))
       
   117 			            ? zoomFactor*2 : TZoomFactor::EZoomOneToOne/4;
       
   118 		            SetZoomFactorL(zoomFactor);
       
   119 				    break;
       
   120 		            }
       
   121 				case CTRL('p'):
       
   122 					iGridWin->GridLay()->SetPageSizeInTwipsL
       
   123 						(TSize(EPageWidthInTwips,EPageHeightInTwips));
       
   124 					iGridWin->GridLay()->PaginateL();
       
   125 					iGridWin->DrawNow();
       
   126 				    break;
       
   127 				case CTRL('i'):
       
   128 				case CTRL('d'):
       
   129 					{
       
   130 					const CGridCellRegion* selected=iGridImg->Selected();
       
   131 					TInt count=selected->Count();
       
   132 					TInt noOfCols;
       
   133 					TInt startCol;
       
   134 					if (count)
       
   135 						{
       
   136 						TRangeRef range=(*selected)[count-1];	//last range
       
   137 						noOfCols=range.iTo.iCol-range.iFrom.iCol+1;
       
   138 						startCol=range.iFrom.iCol;
       
   139 						}
       
   140 					else
       
   141 						{
       
   142 						noOfCols=1;
       
   143 						startCol=iGridWin->CursorPos().iCol;
       
   144 						}
       
   145 					if (aKeyEvent.iCode==CTRL('d'))
       
   146 						noOfCols=-noOfCols;	// Delete 
       
   147 					iGridLay->InsertDeleteColumns(startCol,noOfCols);
       
   148 					iGridWin->DrawNow();
       
   149 					}
       
   150 					break;
       
   151 				case CTRL('c'):
       
   152 					{
       
   153 					iUndoColors = ~iUndoColors;
       
   154 					ChangeColors(iUndoColors);
       
   155 					iGridWin->DrawNow();
       
   156 					}
       
   157 					break;
       
   158                 default:
       
   159 				    break;
       
   160 			    }
       
   161 		    }
       
   162         else if ((aKeyEvent.iModifiers&EAllStdModifiers)==EModifierShift)
       
   163             {
       
   164             switch (User::LowerCase(aKeyEvent.iCode))
       
   165                 {
       
   166 				case 't':
       
   167 					iGridWin->GridLay()->SetTitleLinesL(EFalse);
       
   168 					iGridWin->ExposeCellL(iGridWin->CursorPos());
       
   169 				    break;
       
   170                 case 'z':
       
   171 		            {
       
   172 		            TInt zoomFactor=iZoomFactor->ZoomFactor();
       
   173 		            zoomFactor=(zoomFactor>(TZoomFactor::EZoomOneToOne/4))
       
   174 			            ? zoomFactor/2 : TZoomFactor::EZoomOneToOne*4;
       
   175 		            SetZoomFactorL(zoomFactor);
       
   176 		            break;
       
   177 		            }
       
   178 				case 'r':
       
   179 					{
       
   180 					iDialog->MakeVisible(ETrue);
       
   181 					iDialog->SetFocus(ETrue, EDrawNow);	
       
   182 					break;
       
   183 					}
       
   184                 default:
       
   185                     break;
       
   186                 } // switch
       
   187             }
       
   188         else if (iDialog->IsVisible())
       
   189 			{
       
   190 			switch(User::LowerCase(aKeyEvent.iCode))
       
   191 				{
       
   192 				case EKeyEscape:
       
   193 					iDialog->MakeVisible(EFalse);
       
   194 					break;
       
   195 				case 'c': //C or c
       
   196 					{
       
   197 					iGridImg->StartLabelResize(ETrue,iGridWin->CursorPos().iCol);
       
   198 					iGridWin->SetResizeMode(CGridWin::EResizeColumn);
       
   199 					break;
       
   200 					}
       
   201 				case 'r':  //R or r
       
   202 					{
       
   203 					iGridImg->StartLabelResize(EFalse,iGridWin->CursorPos().iRow);
       
   204 					iGridWin->SetResizeMode(CGridWin::EResizeRow);
       
   205 					break;
       
   206 					}
       
   207 				default:
       
   208 					break;
       
   209 					}
       
   210 			}
       
   211         }
       
   212 	return EKeyWasConsumed;
       
   213 	}
       
   214 /**
       
   215   Second Phase constructor for the TestGridAppUi class.\n
       
   216   Gets the current zoom factor.\n
       
   217   Sets the grid cell settings like font and zoom factor.\n 
       
   218   Constructs a GridTable which is an interface providing row and column info.\n
       
   219   Initializes a GridLay object passing the gridtable and null gridimage. \n
       
   220   The GridLay object is used to Handle the layout of a grid,
       
   221   and controls how columns, rows and selections appear.\n
       
   222   Initializes a GridImage object with gridcell settings.\n
       
   223   A Grid Image object is used to draw cell contents.\n
       
   224   A Grid Window is formed containing using GridTable,GridLay and GridImage objects.\n
       
   225   The GridWindow offers handlers to pointer and key events.\n
       
   226   Sets the current cursor position and activates the Grid Window.\n
       
   227 */
       
   228 void CTestGridAppUi::ConstructL()
       
   229     {
       
   230 	//iCoeEnv->WsSession().SetAutoFlush(ETrue);
       
   231 	
       
   232 	iUndoColors = EFalse;
       
   233     CTestCoeAppUi::ConstructL();
       
   234 	CGraphicsDevice* device=iCoeEnv->ScreenDevice();
       
   235 	iZoomFactor = new(ELeave) TZoomFactor(device);
       
   236     User::Heap().Check();
       
   237 
       
   238 	iSheetCellImg = new(ELeave) CSheetCellImg();
       
   239 	TFontSpec fontSpec(_L("Swiss"),240);
       
   240 	iSheetLabelImg = new(ELeave) CSheetLabelImg(fontSpec,iZoomFactor);
       
   241 	iSheetLabelImg->ConstructL();
       
   242     User::Heap().Check();
       
   243 
       
   244 	iGridLay = new(ELeave) CGridLay(iZoomFactor);
       
   245 	iGridTable = new(ELeave) MGridTable;
       
   246 	iGridLay->ConstructL(iGridTable,NULL,ENoRows,ENoCols);	// Test construction of gridLay with NULL gridImg
       
   247 	iGridLay->SetAutoPagination(ETrue);
       
   248 //	iGridLay->SetPageBreakLinesHidden(ETrue);
       
   249 	iGridLay->SetGridEdgeColor(KRgbGridLabels);
       
   250 //	iGridLay->SetRowPermanentlySelectedL(ETrue);
       
   251 	
       
   252 	TCellRef cursorPos;
       
   253 	TBool isNewCursorPos=LoadL(cursorPos);	// Get Persistent data
       
   254 
       
   255 	iGridImg = CGridImg::NewL(device,iSheetCellImg,iGridLay);	// Late construction of gridimg
       
   256 	iGridImg->SetGridLabelImg(iSheetLabelImg);
       
   257 	iGridLay->SetGridImgL(iGridImg);
       
   258 // Copies some colours for the label
       
   259 	//	Getting the grid colors
       
   260 	iSheetLabelImg->SetGridColors(iGridLay->GridColors());
       
   261 
       
   262 	iGridWin = CGridWin::NewL(NULL,iGridLay,iGridImg);	//
       
   263 	AddToStackL(iGridWin);
       
   264 	iGridWin->SetExtent(TPoint(EGridXPos,EGridYPos),TSize(EGridWidth,EGridHeight));
       
   265 	iGridWin->ActivateL();
       
   266 	iGridWin->DrawNow();
       
   267 	TBool isColumn = ETrue;
       
   268 	iDialog=new(ELeave) CTGridQueryDialog(isColumn);
       
   269 	iDialog->ConstructL();
       
   270 	iDialog->MakeVisible(EFalse);
       
   271 
       
   272 	//
       
   273 	//iGridWin->Draw(TRect(TPoint(EGridXPos,EGridYPos),TSize(EGridWidth,EGridHeight)));
       
   274 	if (isNewCursorPos)
       
   275 		iGridWin->SetCursorPosL(cursorPos);
       
   276 	iGridWin->ActivateL();
       
   277     User::Heap().Check();
       
   278 		
       
   279 	AutoTestManager().StartAutoTest();
       
   280 
       
   281 	}
       
   282 /**
       
   283   Auxiliary function for T-Grid0Step-RunTestStepL.\n
       
   284   Creates a File Store and returns the pointer.\n
       
   285  
       
   286   @return Pointer to Filestore used for storing Grid data.\n
       
   287  
       
   288 */
       
   289 CFileStore* CTestGridAppUi::CreateStoreLC(RFile &aFile)
       
   290 	{
       
   291     CFileStore *store=CDirectFileStore::NewLC(aFile);
       
   292 	TUid uid;
       
   293 	uid.iUid=TUint32('G'|('R'<<8)|('D'<<16));
       
   294 	store->SetTypeL(TUidType(KDirectFileStoreLayoutUid,uid));
       
   295     return(store);
       
   296 	}
       
   297 /**
       
   298   Auxiliary function for T-Grid0Step-RunTestStepL.\n
       
   299   Loads the GridLay settings and cursor position from dat file TGRID0.DAT.\n
       
   300  
       
   301   @return Boolean,True if the data stored in the Stream is displayed on the Grid.\n
       
   302  
       
   303 */
       
   304 TBool CTestGridAppUi::LoadL(TCellRef& aCursorPos)
       
   305 	{
       
   306 	RFile file;
       
   307     TInt err=(file.Open(iCoeEnv->FsSession(),_L("C:\\data\\TGRID0.DAT"),
       
   308 		EFileRead|EFileShareReadersOnly));
       
   309 	if (err==KErrNotFound || err==KErrPathNotFound)
       
   310 		return EFalse;	// Use default settings
       
   311 	User::LeaveIfError(err);
       
   312 
       
   313     CFileStore *store=CDirectFileStore::FromLC(file);
       
   314 	TStreamId root=store->Root();
       
   315     RStoreReadStream source;
       
   316     source.OpenLC(*store,root);
       
   317 	source >> *iGridLay;
       
   318 	source >> aCursorPos;
       
   319 
       
   320     CleanupStack::PopAndDestroy(2);	// stream+store
       
   321 	return ETrue;
       
   322 	}
       
   323 /**
       
   324   Auxiliary function for T-Grid0Step-RunTestStepL.\n
       
   325   Stores the current grid settings to a Dat File.\n
       
   326   Saves the current cursor postion.\n
       
   327 */
       
   328 void CTestGridAppUi::SaveL()
       
   329 	{
       
   330 	RFs fsSession=iCoeEnv->FsSession();
       
   331 	RFile file;
       
   332 	TInt err=fsSession.MkDir(_L("C:\\data\\"));
       
   333 	if (err!=KErrAlreadyExists)
       
   334 		User::LeaveIfError(err);
       
   335     User::LeaveIfError(file.Replace(fsSession,_L("C:\\data\\TGRID0.DAT"),EFileRead|EFileWrite));
       
   336 
       
   337 	CFileStore *store=CreateStoreLC(file);
       
   338 	RStoreWriteStream source;
       
   339 	TStreamId root = source.CreateLC(*store);
       
   340 	source << *iGridLay;
       
   341 	source << iGridWin->CursorPos();
       
   342 	store->SetRootL(root);
       
   343     CleanupStack::PopAndDestroy(2);
       
   344 	}
       
   345 /**
       
   346   Auxiliary function for T-Grid0Step-RunTestStepL.\n
       
   347   Sets the zoom factor depending on the argument.\n
       
   348   To Redraw the grid table again, does the following \n
       
   349   Recalculates the internal maps that map row and column numbers to heights and widths respectively.\n
       
   350   Resets the reference points.\n
       
   351   The reference points are the mainpoint and the titlepoint.\n
       
   352   Resets the row and column numbers visible at the bottom, and to the right, of the visible area of the grid.\n
       
   353 */
       
   354 void CTestGridAppUi::SetZoomFactorL(TInt aZoomFactor)
       
   355 	{
       
   356 	iZoomFactor->SetZoomFactor(aZoomFactor);
       
   357 	iSheetLabelImg->NotifyGraphicsDeviceMapChangeL();
       
   358 	iGridWin->GridLay()->RecalcPixelSparseMaps();
       
   359 	iGridWin->GridImg()->ResetReferencePoints();
       
   360 	iGridWin->GridLay()->ResetVisibleToCell();
       
   361 	iGridWin->DrawNow();
       
   362 	}
       
   363 /**
       
   364   Auxiliary function for T-Grid0Step-RunTestStepL.\n
       
   365   Sets the Grid colours depending on the argument.\n
       
   366   If Reset is enabled, the default colours will be enabled.\n
       
   367   Foreground to RGB value(0,0,0) , Background to RGB value(255,255,255) and Lines to (170,170,170).\n
       
   368   If Reset is not enabled, Sets the following combination
       
   369   Forground to Blue, Background to Yellow, Colour of lines to Yellow and Label separators
       
   370   to Green.\n 
       
   371 */		
       
   372 void CTestGridAppUi::ChangeColors(TBool aReset)
       
   373 	{
       
   374 	if (aReset)
       
   375 		{
       
   376 		TGridColors gridColors;
       
   377 		iGridLay->SetGridColors(gridColors);
       
   378 		}
       
   379 	else
       
   380 		{
       
   381 		TGridColors newGridColors(KRgbBlue, KRgbYellow, KRgbRed, KRgbGreen);
       
   382 		iGridLay->SetGridColors(newGridColors);
       
   383 		}
       
   384 	iUndoColors = aReset;
       
   385 
       
   386 	}
       
   387 /**
       
   388    @SYMTestCaseID UIF-Grid0Step-RunTestStepL
       
   389   
       
   390    @SYMPREQ 
       
   391   
       
   392    @SYMTestCaseDesc
       
   393     Tests different functionalities of Grid Window
       
   394   
       
   395    @SYMTestPriority High
       
   396   
       
   397    @SYMTestStatus Implemented
       
   398   
       
   399    @SYMTestActions \n
       
   400    The following tests are performed \n
       
   401    1. Setting a grid as default.\n
       
   402    2. Simulating right arrow key event.\n
       
   403    3. Simulating down arrow key event.\n
       
   404    4. Setting zoom in factor. \n
       
   405    5. Setting zoom out factor.\n
       
   406    6. Set/Undo Background Color. \n
       
   407    7. Making a dialog visible. \n
       
   408    8. Resize current row and column. \n
       
   409    9. Insertion and Deletion of Columns.\n
       
   410   
       
   411    @SYMTestExpectedResults All the test cases should execute successfully and the generated key events
       
   412    are handled without any error.\n
       
   413   
       
   414  */
       
   415 void CTestGridAppUi::RunTestStepL(TInt aNumStep)
       
   416 	{
       
   417 	TKeyEvent theKeyEvent;
       
   418 	TEventCode theType=EEventKey;
       
   419 	
       
   420 	Mem::FillZ(&theKeyEvent, sizeof(TKeyEvent));
       
   421 	//only for debug
       
   422 
       
   423 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   424 
       
   425 
       
   426 	switch(aNumStep)
       
   427 		{
       
   428 		case 1: //Set grid to default state
       
   429 		SetTestStepID(_L("UIF-Grid0Step-RunTestStepL"));
       
   430 		theKeyEvent.iCode = CTRL('r');
       
   431 		theKeyEvent.iModifiers=EModifierCtrl;
       
   432 		INFO_PRINTF1(_L("Set grid to default"));
       
   433 		HandleKeyEventL(theKeyEvent,theType);
       
   434 		break;
       
   435 		case 2: case 3: case 4: //Move cursor to left
       
   436 		theKeyEvent.iCode = EKeyRightArrow;
       
   437 		theKeyEvent.iModifiers=0;
       
   438 		INFO_PRINTF1(_L("Move cursor to left"));
       
   439 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   440 		break;
       
   441 		case 5: case 6: 
       
   442 		theKeyEvent.iCode = EKeyDownArrow;
       
   443 		theKeyEvent.iModifiers=0;//EModifierCtrl;
       
   444 		INFO_PRINTF1(_L("Move cursor to down"));
       
   445 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   446 		break;
       
   447 		case 7: case 8: 
       
   448 		theKeyEvent.iCode = CTRL('z'); //Set zoom in factor
       
   449 		theKeyEvent.iModifiers=EModifierCtrl;
       
   450 		INFO_PRINTF1(_L("Set zoom in factor"));
       
   451 		HandleKeyEventL(theKeyEvent,theType);
       
   452 		break;
       
   453 		case 9: case 10: 
       
   454 		theKeyEvent.iCode = 'z'; //Set zoom out factor
       
   455 		theKeyEvent.iModifiers=EModifierShift;
       
   456 		INFO_PRINTF1(_L("Set zoom out factor"));
       
   457 		HandleKeyEventL(theKeyEvent,theType);
       
   458 		break;
       
   459 		case 11: case 12: case 13:
       
   460 		theKeyEvent.iCode = CTRL('c'); //Set/undo color background
       
   461 		theKeyEvent.iModifiers=EModifierCtrl;
       
   462 		INFO_PRINTF1(_L("Set/undo color background"));
       
   463 		HandleKeyEventL(theKeyEvent,theType);
       
   464 		break;
       
   465 		
       
   466 		case 14:
       
   467 		theKeyEvent.iCode = 'r'; //Make dialog visible 
       
   468 		theKeyEvent.iModifiers=EModifierShift;
       
   469 		INFO_PRINTF1(_L("Make dialog visible "));
       
   470 		HandleKeyEventL(theKeyEvent,theType);
       
   471 		break;
       
   472 		case 15:
       
   473 		theKeyEvent.iCode = 'r';//Resize the current row
       
   474 		theKeyEvent.iModifiers=0;
       
   475 		INFO_PRINTF1(_L("Resize the current row"));
       
   476 		HandleKeyEventL(theKeyEvent,theType);
       
   477 		break;
       
   478 		case 16:case 17:case 18: //Resize the current row
       
   479 		INFO_PRINTF1(_L("Resize the current row"));
       
   480 		theKeyEvent.iCode = EKeyDownArrow;
       
   481 		theKeyEvent.iModifiers=0;
       
   482 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   483 		break;
       
   484 		case 19: //Finish resize
       
   485 		theKeyEvent.iCode = EKeyEnter; 
       
   486 		theKeyEvent.iModifiers=0;
       
   487 		INFO_PRINTF1(_L("Finish resize"));
       
   488 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   489 		break;
       
   490 		case 20:// Resize the current column
       
   491 		theKeyEvent.iCode = 'c';
       
   492 		theKeyEvent.iModifiers=0;
       
   493 		INFO_PRINTF1(_L("Resize the current column"));
       
   494 		HandleKeyEventL(theKeyEvent,theType);
       
   495 		break;
       
   496 		case 21:case 22:case 23: // Resize the current column
       
   497 		INFO_PRINTF1(_L("Resize the current column"));
       
   498 		theKeyEvent.iCode = EKeyRightArrow;
       
   499 		theKeyEvent.iModifiers=0;
       
   500 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   501 		break;
       
   502 		case 24: //Finish resize
       
   503 		theKeyEvent.iCode = EKeyEnter;
       
   504 		theKeyEvent.iModifiers=0;
       
   505 		INFO_PRINTF1(_L("Finish resize"));
       
   506 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   507 		break;
       
   508 		case 25: //Close dialog
       
   509 		theKeyEvent.iCode = EKeyEscape;
       
   510 		theKeyEvent.iModifiers=0;
       
   511 		INFO_PRINTF1(_L("Close dialog"));
       
   512 		iDialog->OfferKeyEventL(theKeyEvent,theType);
       
   513 		HandleKeyEventL(theKeyEvent,theType);
       
   514 		break;
       
   515 		case 26: //Insert column
       
   516 		theKeyEvent.iCode = CTRL('i');
       
   517 		theKeyEvent.iModifiers=EModifierCtrl;
       
   518 		INFO_PRINTF1(_L("Insert column"));
       
   519 		HandleKeyEventL(theKeyEvent,theType);
       
   520 		break;
       
   521 		case 27: //Move to right and delete column
       
   522 		theKeyEvent.iCode = EKeyRightArrow;
       
   523 		theKeyEvent.iModifiers=0;
       
   524 		INFO_PRINTF1(_L("Move to right and delete column"));
       
   525 		iGridWin->OfferKeyEventL(theKeyEvent,theType);
       
   526 		theKeyEvent.iCode = CTRL('d');
       
   527 		theKeyEvent.iModifiers=EModifierCtrl;
       
   528 
       
   529 		HandleKeyEventL(theKeyEvent,theType);
       
   530 		RecordTestResultL();
       
   531 		CloseTMSGraphicsStep();
       
   532 		break;
       
   533 		case 28: //exit
       
   534 		AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
   535 		break;		
       
   536 
       
   537 		}
       
   538 	}
       
   539 	
       
   540 
       
   541 /**
       
   542   Constructs the CTGrid0 Test application.\n
       
   543   Initializes the AppUi object.\n
       
   544   Sets the AppUi object as the default AppUi for the application.\n
       
   545  
       
   546 */
       
   547 void CTGrid0Step::ConstructAppL(CCoeEnv* aCoe)
       
   548 	{ // runs inside a TRAP harness
       
   549 	aCoe->ConstructL();
       
   550 	CTestGridAppUi* appUi= new (ELeave) CTestGridAppUi(this);
       
   551 	aCoe->SetAppUi(appUi);
       
   552 	appUi->ConstructL();
       
   553 	}
       
   554 
       
   555 
       
   556 CTGrid0Step::~CTGrid0Step()
       
   557 /**
       
   558   Destructor
       
   559  */
       
   560 	{
       
   561 	}
       
   562 
       
   563 CTGrid0Step::CTGrid0Step()
       
   564 /**
       
   565   Constructor
       
   566  */
       
   567 	{
       
   568 	// Call base class method to set up the human readable name for logging
       
   569 	SetTestStepName(KTGrid0Step);
       
   570 	}
       
   571 /**
       
   572   Entry Function for the TGrid0 Test Step.\n
       
   573   Initializes a control environment for the application.\n
       
   574   Starts the application.\n
       
   575 */
       
   576 TVerdict CTGrid0Step::doTestStepL()
       
   577 	{
       
   578 
       
   579 	INFO_PRINTF1(_L("Test Started"));
       
   580 	PreallocateHALBuffer();
       
   581 
       
   582 	__UHEAP_MARK;
       
   583 
       
   584 	CCoeEnv* coe=new(ELeave) CCoeEnv;
       
   585 	TRAPD(err,ConstructAppL(coe));
       
   586 
       
   587 	if (!err)
       
   588 		coe->ExecuteD();
       
   589 	else
       
   590 		{
       
   591 		SetTestStepResult(EFail);
       
   592 		delete coe;
       
   593 		}
       
   594 
       
   595 	__UHEAP_MARKEND;
       
   596 
       
   597 	INFO_PRINTF1(_L("test finished"));
       
   598 	return TestStepResult();
       
   599 	}
       
   600