commonuisupport/uikon/test/tsprites/thlsprite/thlsprite.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 step performs tests to display sprites from a sprite set.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent - Internal Symbian test code
       
    21 */
       
    22 
       
    23 
       
    24 #include <eikenv.h>
       
    25 #include <coecntrl.h>
       
    26 #include <coemain.h>
       
    27 #include <techview/eikdialg.h>
       
    28 #include <techview/eikbtgpc.h>
       
    29 
       
    30 #include <eikappui.h>
       
    31 #include <eikapp.h>
       
    32 #include <eikdoc.h>
       
    33 #include <uikon.hrh>
       
    34 #include <eikon.mbg>
       
    35 #include <gulsprite.h>
       
    36 #include <e32math.h>
       
    37 #include <techview/eikmenup.h>
       
    38 #include <techview/eikdialg.h>
       
    39 #include <ecom/ecom.h>
       
    40 
       
    41 #include "thlsprite.hrh"
       
    42 #include "thlsprite.h"
       
    43 
       
    44 
       
    45 
       
    46 _LIT(KHLSpriteResourceFilePath, "");
       
    47 
       
    48 
       
    49 CHLSpriteAppView::~CHLSpriteAppView()
       
    50 /**
       
    51   Destructor
       
    52 */
       
    53 	{
       
    54 	delete iSourceSpriteSet;
       
    55 	delete iTargetSpriteSet;
       
    56 	}
       
    57 
       
    58 /**
       
    59    Auxiliary function for all Test Cases
       
    60   
       
    61    The method creates a view that displays a sprite and invokes method
       
    62    CHLSpriteAppView::TryCreateSpriteSetL() which creates objects of class 
       
    63    CSpriteSet. The CSpriteSet object created stores number of bitmap/mask
       
    64    pairs.
       
    65   
       
    66  */
       
    67 void CHLSpriteAppView::ConstructL(const TRect& aRect)
       
    68 	{
       
    69 	CreateWindowL();
       
    70 	SetRect(aRect);
       
    71 	iMaskIsInverted = EFalse;
       
    72 	iClippingRect = TRect(0,0,0,0);
       
    73 	TryCreateSpriteSetL();
       
    74 	iSpriteSideLength = 0; // start with 0 side for sprite
       
    75 	iResizeMode = CSpriteSet::ENoResizing;	// start with no resizing
       
    76 	TInt baseline = (2*(iEikonEnv->TitleFont()->AscentInPixels() + 10)) + 30;
       
    77 	TInt targetTlX = ((Rect().iBr.iX - 11)/2) + 10;
       
    78 	iTargetSpriteTl = TPoint(targetTlX,baseline);
       
    79 	ActivateL();
       
    80 	iSpriteIsDisplayed = ETrue;
       
    81 	}
       
    82 
       
    83 
       
    84 /**
       
    85    Auxiliary function for TestCaseID THLSPRITE-HandleCommandL
       
    86   
       
    87    The method creates two sprite sets by calling CSpriteSet::NewL() to
       
    88    initialize member variables iSourceSpriteSet and iTargetSpriteSet. The
       
    89    method loads bitmaps/masks pair from a multi-bitmap file and
       
    90    packages them into CGulIcon object.They are then added to the sprite set
       
    91    pointed by iSourceSpriteSet by calling CSpriteSet::AddMemberL().
       
    92   
       
    93  */
       
    94 void CHLSpriteAppView::TryCreateSpriteSetL()
       
    95 	{
       
    96 	_LIT(KDefaultBitmapPath,"z:\\Resource\\Uiklaf\\eikon.mbm");
       
    97 
       
    98 	// following 2 if statements are for the convenience of the appui handlecommand function (not really required for initial construction).
       
    99 	if(iSourceSpriteSet)
       
   100 		{
       
   101 		delete iSourceSpriteSet;
       
   102 		iSourceSpriteSet = NULL;
       
   103 		}
       
   104 	if(iTargetSpriteSet)
       
   105 		{
       
   106 		delete iTargetSpriteSet;
       
   107 		iTargetSpriteSet = NULL;
       
   108 		}
       
   109 
       
   110 	CFbsBitmap* sourceBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlight);
       
   111 	CleanupStack::PushL(sourceBitmap);
       
   112 	CFbsBitmap* sourceMaskBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightm);
       
   113 	CleanupStack::PushL(sourceMaskBitmap);
       
   114 	CGulIcon* normalSourceSpriteMember = CGulIcon::NewL(sourceBitmap, sourceMaskBitmap);
       
   115 	CleanupStack::Pop(2, sourceBitmap);
       
   116 	CleanupStack::PushL(normalSourceSpriteMember);
       
   117 	iSourceSpriteSet = CSpriteSet::NewL(*DrawableWindow(),iEikonEnv->WsSession(),*iEikonEnv->ScreenDevice(),normalSourceSpriteMember,EFalse);
       
   118 	CleanupStack::Pop(normalSourceSpriteMember);
       
   119 	CFbsBitmap* sourceDimmedBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightd);
       
   120 	CleanupStack::PushL(sourceDimmedBitmap);
       
   121 	CFbsBitmap* sourceDimmedMaskBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightm);
       
   122 	CleanupStack::PushL(sourceDimmedMaskBitmap);
       
   123 	CGulIcon* dimmedSourceSpriteMember = CGulIcon::NewL(sourceDimmedBitmap, sourceDimmedMaskBitmap);
       
   124 	CleanupStack::Pop(2, sourceDimmedBitmap);
       
   125 	CleanupStack::PushL(dimmedSourceSpriteMember);
       
   126 	iSourceSpriteSet->AddMemberL(dimmedSourceSpriteMember);
       
   127 	CleanupStack::Pop(dimmedSourceSpriteMember);
       
   128 
       
   129 	CFbsBitmap* targetBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlight);
       
   130 	CleanupStack::PushL(targetBitmap);
       
   131 	CFbsBitmap* targetMaskBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightm);
       
   132 	CleanupStack::PushL(targetMaskBitmap);
       
   133 	CGulIcon* normalTargetSpriteMember = CGulIcon::NewL(targetBitmap, targetMaskBitmap);
       
   134 	CleanupStack::Pop(2, targetBitmap);
       
   135 	CleanupStack::PushL(normalTargetSpriteMember);
       
   136 	iTargetSpriteSet = CSpriteSet::NewL(*DrawableWindow(),iEikonEnv->WsSession(),*iEikonEnv->ScreenDevice(),normalTargetSpriteMember,iMaskIsInverted);
       
   137 	CleanupStack::Pop(normalTargetSpriteMember);
       
   138 	CFbsBitmap* targetDimmedBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightd);
       
   139 	CleanupStack::PushL(targetDimmedBitmap);
       
   140 	CFbsBitmap* targetDimmedMaskBitmap = CEikonEnv::Static()->CreateBitmapL(KDefaultBitmapPath,EMbmEikonMenuhighlightm);
       
   141 	CleanupStack::PushL(targetDimmedMaskBitmap);
       
   142 	CGulIcon* dimmedTargetSpriteMember = CGulIcon::NewL(targetDimmedBitmap, targetDimmedMaskBitmap);
       
   143 	CleanupStack::Pop(2, targetDimmedBitmap);
       
   144 	CleanupStack::PushL(dimmedTargetSpriteMember);
       
   145 	iSourceSpriteSet->AddMemberL(dimmedTargetSpriteMember);
       
   146 	CleanupStack::Pop(dimmedTargetSpriteMember);
       
   147 	}
       
   148 
       
   149 
       
   150 
       
   151 void CHLSpriteAppView::HandleTimerCallbackL()
       
   152 	{
       
   153 	iSpriteSideLength++;
       
   154 	DrawTargetSpriteNowL();
       
   155 	}
       
   156 
       
   157 
       
   158 /**
       
   159    Auxiliary function for TestCaseID THLSPRITE-HandleCommandL
       
   160   
       
   161    The method is an override from CCoeControl. It refreshes the view. It is
       
   162    used to draw the source and target sprite on the view.
       
   163   
       
   164  */
       
   165 void CHLSpriteAppView::Draw(const TRect& /*aRect*/) const
       
   166 	{
       
   167 	CWindowGc& gc = SystemGc();
       
   168 	TRect rect = Rect();
       
   169 	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   170 	gc.SetBrushColor(KRgbYellow);
       
   171 	gc.SetPenStyle(CGraphicsContext::ESolidPen);
       
   172 	gc.SetPenColor(KRgbBlack);
       
   173 	gc.DrawRect(rect);
       
   174 	rect.Shrink(10,10);
       
   175 	gc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
   176 	gc.DrawRect(rect);
       
   177 	rect.Shrink(1,1);
       
   178 	const CFont* font = iEikonEnv->TitleFont();
       
   179 	gc.UseFont(font);
       
   180 	TInt baseline = font->AscentInPixels() + 10;
       
   181 	gc.DrawText(_L("HIGHLIGHT SPRITES APP"), rect, baseline, CGraphicsContext::ECenter);
       
   182 	baseline*=2;
       
   183 	gc.DrawText(_L("SOURCE"), rect, baseline, CGraphicsContext::ELeft);
       
   184 	gc.DrawText(_L("TARGET"), rect, baseline, CGraphicsContext::ERight);
       
   185 	baseline+=10;
       
   186 	gc.DrawLine(TPoint(rect.iBr.iX/2,baseline),TPoint(rect.iBr.iX/2,rect.iBr.iY - 10));
       
   187 	gc.DiscardFont();
       
   188 
       
   189 	baseline+=20;
       
   190 	TInt sourceTlX = rect.iTl.iX + 10;
       
   191 	TRAPD(err,	//TRAPD is used to stop leavescan errors occurring, and ignore error value.
       
   192 		iSourceSpriteSet->PrepareSpriteForDisplayL(0,TPoint(sourceTlX,baseline),TSize(),CSpriteSet::ENoResizing); 
       
   193 		iSourceSpriteSet->StartDisplayingSpriteL();	
       
   194 		DrawTargetSpriteNowL();
       
   195 		);
       
   196 	__ASSERT_ALWAYS(!err,User::Panic(_L("CHLSpriteAppView"),err));	
       
   197 	gc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
   198 	gc.SetPenStyle(CGraphicsContext::ESolidPen);
       
   199 	gc.SetPenColor(KRgbWhite);
       
   200 	gc.DrawRect(iClippingRect);
       
   201 	}
       
   202 
       
   203 
       
   204 /**
       
   205    Auxiliary function for TestCaseID THLSPRITE-HandleCommandL
       
   206   
       
   207    The method prepares and brings the sprite onto the visible area of the
       
   208    screen if the variable iSpriteIsDisplayed is set to true and if
       
   209    iTargetSpriteSet is not null.If this conditions is not met then the method 
       
   210    stops the display of the sprite on the visible area of the screen.
       
   211   
       
   212  */
       
   213 void CHLSpriteAppView::DrawTargetSpriteNowL() const
       
   214 	{
       
   215 	if(iSpriteIsDisplayed && iTargetSpriteSet)
       
   216 		{
       
   217 		iTargetSpriteSet->PrepareSpriteForDisplayL(0,iTargetSpriteTl,TSize(iSpriteSideLength,iSpriteSideLength),iResizeMode);
       
   218 		iTargetSpriteSet->StartDisplayingSpriteL();
       
   219 		}
       
   220 	else
       
   221 		{
       
   222 		iTargetSpriteSet->StopDisplayingSprite();
       
   223 		}
       
   224 	}
       
   225 
       
   226 
       
   227 
       
   228 CHLSpriteAppUi::CHLSpriteAppUi(CTmsTestStep *aStep) :
       
   229 	CTestAppUi(aStep,
       
   230 		KHLSpriteResourceFilePath)
       
   231 /**
       
   232    Constructor
       
   233  */
       
   234 	{
       
   235 	}
       
   236 
       
   237 
       
   238 /**
       
   239    Auxiliary function for all Test Cases
       
   240   
       
   241    The method initiates the creation of a view that displays a sprite and sets
       
   242    active object with lowest priority for running test in auto mode. It also
       
   243    creates a timer that is used for running tests.
       
   244   
       
   245  */
       
   246 void CHLSpriteAppUi::ConstructL()
       
   247 	{
       
   248 	CTestAppUi::ConstructL();
       
   249 	iAppView = new(ELeave) CHLSpriteAppView;
       
   250 	TRect rect(ClientRect());
       
   251 	iTimer=CPeriodic::NewL(CActive::EPriorityStandard);
       
   252 	
       
   253 	ReduceRect(rect);
       
   254 	iAppView->ConstructL(rect);
       
   255 	// setup the random number seed (a singleton)
       
   256 	TTime time;
       
   257 	time.HomeTime();
       
   258 	iSeed = time.Int64();
       
   259 
       
   260 	AutoTestManager().StartAutoTest();
       
   261 	}
       
   262 	
       
   263 
       
   264 CHLSpriteAppUi::~CHLSpriteAppUi()
       
   265 /**
       
   266    Destructor
       
   267  */
       
   268 	{
       
   269 	delete iAppView;
       
   270 	delete iTimer;
       
   271 	}
       
   272 
       
   273 
       
   274 /**
       
   275    @SYMTestCaseID UIF-THLSPRITE-HandleCommandL
       
   276   
       
   277    @SYMPREQ
       
   278   
       
   279    @SYMTestCaseDesc Tests displaying sprite in the set on the screen under various
       
   280    conditions.
       
   281   
       
   282    @SYMTestPriority High
       
   283   
       
   284    @SYMTestStatus Implemented
       
   285    
       
   286    @SYMTestActions The method performs the following tests:\n
       
   287    1) Displaying the sprite in the set for various resize modes namely
       
   288    (a) ENoResizing (b) EResizeHorizToFit (c) EResizeVertToFit
       
   289    (d) EResizeHorizAndVertToFit\n
       
   290    2) Displaying the sprite in the set with size specified by the test.\n
       
   291    3) Toggle between displaying & erasing the sprite in the set.\n
       
   292    4) Toggle between displaying & erasing a bitmap/mask pair with inverted
       
   293    mask in the set.\n
       
   294    5) Displaying the sprite in the set at the position specified by the test.\n
       
   295    6) Displaying the sprite in the set within boundary specified by a
       
   296    rectangle.\n
       
   297   
       
   298    @SYMTestExpectedResults Each of the tests should display the sprite as
       
   299    expected for the values assigned to parameters of methods covered by the
       
   300    test.\n
       
   301    
       
   302  */
       
   303 void CHLSpriteAppUi::HandleCommandL(TInt aCommand)
       
   304 	{
       
   305 	_LIT(KNullAppView,"No App View");
       
   306 	__ASSERT_ALWAYS(iAppView != NULL, User::Panic(KNullAppView,0));
       
   307 	switch(aCommand)
       
   308 		{
       
   309 	case ECmdNoResizing:
       
   310 		{
       
   311 		iAppView->iResizeMode = CSpriteSet::ENoResizing;
       
   312 		iAppView->DrawTargetSpriteNowL();
       
   313 		break;
       
   314 		}
       
   315 	case ECmdResizeHorizToFit:
       
   316 		{
       
   317 		iAppView->iResizeMode = CSpriteSet::EResizeHorizToFit;
       
   318 		iAppView->DrawTargetSpriteNowL();
       
   319 		break;
       
   320 		}
       
   321 	case ECmdResizeVertToFit:
       
   322 		{
       
   323 		iAppView->iResizeMode = CSpriteSet::EResizeVertToFit;
       
   324 		iAppView->DrawTargetSpriteNowL();
       
   325 		break;
       
   326 		}
       
   327 	case ECmdResizeHorizAndVertToFit:
       
   328 		{
       
   329 		iAppView->iResizeMode = CSpriteSet::EResizeHorizAndVertToFit;
       
   330 		iAppView->DrawTargetSpriteNowL();
       
   331 		break;
       
   332 		}
       
   333 	case ECmdStart:
       
   334 		{
       
   335 		if (iTimer && !(iTimer->IsActive()))
       
   336 			{
       
   337 			iTimer->Start(1000000,1000000,TCallBack(TimerCallbackL,iAppView));
       
   338 			iEikonEnv->InfoMsg(_L("Timer Started !"));
       
   339 			}
       
   340 		iAppView->DrawTargetSpriteNowL();
       
   341 		break;
       
   342 		}
       
   343 	case ECmdStop:
       
   344 		{
       
   345 		if(iTimer->IsActive())
       
   346 			{
       
   347 			iTimer->Cancel();
       
   348 			iEikonEnv->InfoMsg(_L("Timer Cancelled !"));
       
   349 			iAppView->iSpriteSideLength = 0;	// reset this value
       
   350 			}
       
   351 		iAppView->DrawTargetSpriteNowL();
       
   352 		break;
       
   353 		}
       
   354 	case ECmdRandom:
       
   355 		{
       
   356 		// pick a random number in the range [0, (iAppView->Rect().Height()/2)]
       
   357 		TInt randomNum;
       
   358 		do
       
   359 			{
       
   360 			randomNum = Math::Rand(iSeed);
       
   361 			randomNum = (randomNum & (iAppView->Rect().Height()/2));
       
   362 			}
       
   363 		while(randomNum<=0);
       
   364 
       
   365 		if(iTimer->IsActive())
       
   366 			{
       
   367 			iTimer->Cancel();
       
   368 			iEikonEnv->InfoMsg(_L("Timer Cancelled !"));
       
   369 			}
       
   370 		iAppView->iSpriteSideLength = randomNum;	// reset this value
       
   371 		iAppView->DrawTargetSpriteNowL();
       
   372 		break;
       
   373 		}
       
   374 	case ECmdToggleDisplaySprite:
       
   375 		{
       
   376 		iAppView->iSpriteIsDisplayed = (!iAppView->iSpriteIsDisplayed);
       
   377 		iAppView->DrawTargetSpriteNowL();
       
   378 		break;
       
   379 		}
       
   380 	case ECmdToggleInvertedMask:
       
   381 		{
       
   382 		iAppView->iMaskIsInverted = (!iAppView->iMaskIsInverted);
       
   383 		iAppView->TryCreateSpriteSetL();
       
   384 		iAppView->DrawTargetSpriteNowL();
       
   385 		break;
       
   386 		}
       
   387 	case ECmdTranslateSprite:
       
   388 		{
       
   389 		//TPoint translateOffset(50,50);
       
   390 		
       
   391 			if(iAppView->iTargetSpriteSet)
       
   392 				{
       
   393 				iAppView->iTargetSpriteTl += iTranslateOffset;
       
   394 				iAppView->iTargetSpriteSet->TranslateSpritePosition(iTranslateOffset);
       
   395 				}
       
   396 		iAppView->DrawTargetSpriteNowL();
       
   397 		break;
       
   398 		}
       
   399 	case ECmdSetClippingRect:
       
   400 		{
       
   401 		if(iAppView->iTargetSpriteSet)
       
   402 			{
       
   403 			iAppView->iTargetSpriteSet->SetClippingRect(iAppView->iClippingRect);
       
   404 			}
       
   405 
       
   406 		iAppView->DrawNow();
       
   407 		break;
       
   408 		}
       
   409 	case EEikCmdExit:
       
   410 		{
       
   411 		Exit();
       
   412 		break;
       
   413 		}
       
   414 	default:
       
   415 		break;
       
   416 		}
       
   417 	}
       
   418 
       
   419 
       
   420 
       
   421 TInt CHLSpriteAppUi::TimerCallbackL(TAny* aPtr)
       
   422 	// static
       
   423 	{
       
   424 	STATIC_CAST(CHLSpriteAppView*,aPtr)->HandleTimerCallbackL();
       
   425 	return 0;
       
   426 	}
       
   427 	
       
   428 	
       
   429 /**
       
   430    Auxiliary function for all Test Cases
       
   431   
       
   432    The method is an override from CTestAppUi. The method initiates all tests
       
   433    to be performed by calling CHLSpriteAppUi::HandleCommandL().
       
   434    
       
   435  */
       
   436 void CHLSpriteAppUi::RunTestStepL(TInt aNumStep)
       
   437 	{
       
   438 	//only for debug
       
   439 //#ifdef FORCE_AUTO
       
   440 	User::After(TTimeIntervalMicroSeconds32(500000));
       
   441 //#endif	
       
   442 	
       
   443 	switch(aNumStep)
       
   444 		{
       
   445 		case 1:
       
   446 		INFO_PRINTF1(_L("Toggle display sprite"));
       
   447 		HandleCommandL(ECmdToggleDisplaySprite);
       
   448 		break;
       
   449 		case 2:
       
   450 		INFO_PRINTF1(_L("Toggle display sprite"));
       
   451 		HandleCommandL(ECmdToggleDisplaySprite);
       
   452 		break;
       
   453 		case 3:
       
   454 		INFO_PRINTF1(_L("Toggle inverted mask"));
       
   455 		HandleCommandL(ECmdToggleInvertedMask);
       
   456 		// left sprite might be hidden, so redraw client area
       
   457 		iAppView->DrawNow();
       
   458 		break;
       
   459 		case 4:
       
   460 		INFO_PRINTF1(_L("Toggle inverted mask"));
       
   461 		HandleCommandL(ECmdToggleInvertedMask);
       
   462 		// left sprite might be hidden, so redraw client area
       
   463 		iAppView->DrawNow();
       
   464 		break;
       
   465 		case 5: case 6:
       
   466 		INFO_PRINTF1(_L("Translate sprite to new position"));
       
   467 		iTranslateOffset = TPoint(50, 50);
       
   468 		HandleCommandL(ECmdTranslateSprite);
       
   469 		break;
       
   470 		case 7: case 8:
       
   471 		INFO_PRINTF1(_L("Translate sprite to new position"));
       
   472 		iTranslateOffset = TPoint(-50, -50);
       
   473 		HandleCommandL(ECmdTranslateSprite);
       
   474 		break;
       
   475 		case 9: 
       
   476 		INFO_PRINTF1(_L("Set clipping rectangle"));
       
   477 		iAppView->iClippingRect = TRect(0, 0, 300, 150);
       
   478 		HandleCommandL(ECmdSetClippingRect);
       
   479 		break;
       
   480 		case 10:
       
   481 		INFO_PRINTF1(_L("Set clipping rectangle"));
       
   482 		iAppView->iClippingRect = TRect(0, 0, 350, 150);
       
   483 		HandleCommandL(ECmdSetClippingRect);
       
   484 		break;
       
   485 		case 11:
       
   486 		INFO_PRINTF1(_L("Set clipping rectangle"));
       
   487 		iAppView->iClippingRect = TRect(0, 0, 0, 0);
       
   488 		HandleCommandL(ECmdSetClippingRect);
       
   489 		break;
       
   490 		case 12:
       
   491 		INFO_PRINTF1(_L("Resize random number"));
       
   492 		HandleCommandL(ECmdRandom);
       
   493 		break;
       
   494 		case 13:
       
   495 		INFO_PRINTF1(_L("Set horiz to fit"));
       
   496 		HandleCommandL(ECmdResizeHorizToFit);
       
   497 		break;
       
   498 		case 14:
       
   499 		INFO_PRINTF1(_L("Set vert to fit"));
       
   500 		HandleCommandL(ECmdResizeVertToFit);
       
   501 		break;
       
   502 		case 15:
       
   503 		INFO_PRINTF1(_L("Set no resizing"));
       
   504 		HandleCommandL(ECmdNoResizing);
       
   505 		break;
       
   506 		case 16:
       
   507 		INFO_PRINTF1(_L("Set vert and horiz to fit"));
       
   508 		HandleCommandL(ECmdResizeHorizAndVertToFit);
       
   509 		break;
       
   510 		case 17:
       
   511 		INFO_PRINTF1(_L("Set no resizing"));
       
   512 		HandleCommandL(ECmdNoResizing);
       
   513 		break;
       
   514 		case 18:
       
   515 		AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
   516 		break;
       
   517 		}
       
   518 	}
       
   519 
       
   520 
       
   521 
       
   522 CTestThlspriteStep::CTestThlspriteStep()
       
   523 /**
       
   524    Constructor
       
   525  */
       
   526 	{
       
   527 	SetTestStepName(KHlSpriteStep);
       
   528 	}
       
   529 
       
   530 
       
   531 
       
   532 CTestThlspriteStep::~CTestThlspriteStep()
       
   533 /**
       
   534    Destructor
       
   535  */
       
   536 	{
       
   537 	}
       
   538 
       
   539 
       
   540 
       
   541 /**
       
   542    Auxiliary function for all Test Cases
       
   543   
       
   544    The method creates & sets the application's user interface object.
       
   545    
       
   546  */
       
   547 void CTestThlspriteStep::ConstructAppL(CEikonEnv* aCoe)
       
   548     { // runs inside a TRAP harness
       
   549 	aCoe->ConstructL();
       
   550 
       
   551 	CTestAppUi* appUi= new (ELeave) CHLSpriteAppUi(this);
       
   552     aCoe->SetAppUi(appUi);
       
   553     appUi->ConstructL();
       
   554     }
       
   555 
       
   556 
       
   557 /**
       
   558    Auxiliary function for all Test Cases
       
   559   
       
   560    The method creates & sets the application's user interface object to
       
   561    launch the application which will initiate the tests.
       
   562    
       
   563  */
       
   564 TVerdict CTestThlspriteStep::doTestStepL() // main function called by E32
       
   565 	{
       
   566 	PreallocateHALBuffer();
       
   567 	__UHEAP_MARK;
       
   568 
       
   569 	CEikonEnv* coe=new CEikonEnv;
       
   570 	TRAPD(err,ConstructAppL(coe));
       
   571 
       
   572 	if (!err)
       
   573 		coe->ExecuteD();
       
   574 
       
   575 	REComSession::FinalClose();	
       
   576 	__UHEAP_MARKEND;
       
   577 
       
   578 	return TestStepResult();
       
   579 	}
       
   580