os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/testvideoplayer2.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/testvideoplayer2.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2383 @@
     1.4 +// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 + 
    1.19 +#include <e32math.h>
    1.20 +#include "testvideoplayer2.h"
    1.21 +
    1.22 +#ifdef SYMBIAN_BUILD_GCE
    1.23 +#include <graphics/surfacemanager.h>
    1.24 +#endif
    1.25 +
    1.26 +const TInt KSettingsAndAlignmentTest = 3;
    1.27 +
    1.28 +//
    1.29 +// RTestVclntPlayAviFile
    1.30 +//
    1.31 +
    1.32 +/**
    1.33 + * RTestVclnt2PlayFile::Constructor
    1.34 + */
    1.35 +RTestVclnt2PlayFile::RTestVclnt2PlayFile(const TDesC& aTestName, 
    1.36 +                                         const TDesC& aSectName, 
    1.37 +                                         const TDesC& aKeyName, 
    1.38 +                                         TInt aExpectedError)
    1.39 +    : RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
    1.40 +    {
    1.41 +    }
    1.42 +
    1.43 +/**
    1.44 + * RTestVclnt2PlayFile::NewL
    1.45 + */
    1.46 +RTestVclnt2PlayFile* RTestVclnt2PlayFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
    1.47 +    {
    1.48 +    RTestVclnt2PlayFile* self = new (ELeave) RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError);
    1.49 +    return self;
    1.50 +    }
    1.51 +
    1.52 +/**
    1.53 + * RTestVclnt2PlayFile::DoTestStepPreambleL
    1.54 + */
    1.55 +TVerdict RTestVclnt2PlayFile::DoTestStepPreambleL()
    1.56 +    {
    1.57 +    return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
    1.58 +    }
    1.59 +
    1.60 +/**
    1.61 + * RTestVclnt2PlayFile::DoTestStepPostambleL
    1.62 + */
    1.63 +TVerdict RTestVclnt2PlayFile::DoTestStepPostambleL()
    1.64 +    {
    1.65 +    return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();        
    1.66 +    }
    1.67 +
    1.68 +/**
    1.69 + * RTestVclnt2PlayFile::FsmL
    1.70 + */
    1.71 +void RTestVclnt2PlayFile::FsmL(TVclntTestPlayEvents aEventCode)
    1.72 +    {
    1.73 +    if (FsmCheck(aEventCode))
    1.74 +        {
    1.75 +        switch (aEventCode)
    1.76 +            {
    1.77 +            case EVPIdle:
    1.78 +                HandleIdleL();
    1.79 +                break;
    1.80 +                
    1.81 +            case EVPOpenComplete:
    1.82 +                HandleOpenCompleteL();
    1.83 +                break;
    1.84 +                
    1.85 +            case EVPPrepareComplete:                    
    1.86 +                HandlePrepareCompleteL();
    1.87 +                break;
    1.88 +                
    1.89 +            case EVPPlayComplete:
    1.90 +                HandlePlayCompleteL();
    1.91 +                break;
    1.92 +            }
    1.93 +        }
    1.94 +    }
    1.95 +    
    1.96 +void RTestVclnt2PlayFile::HandleIdleL()
    1.97 +	{
    1.98 +	// Open iVideoPlayer
    1.99 +    INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
   1.100 +    iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
   1.101 +    PrepareState(EVPOpenComplete, KErrNone);
   1.102 +	}
   1.103 +
   1.104 +void RTestVclnt2PlayFile::HandleOpenCompleteL()
   1.105 +	{
   1.106 +	// Prepare iVideoPlayer2
   1.107 +    INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
   1.108 +    iVideoPlayer2->Prepare();
   1.109 +    PrepareState(EVPPrepareComplete, KErrNone);
   1.110 +	}
   1.111 +	
   1.112 +void RTestVclnt2PlayFile::HandlePrepareCompleteL()
   1.113 +	{
   1.114 +	// Add display window using default values - ie. video extent & window clipping 
   1.115 +	// defaulted to whole window
   1.116 +	INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
   1.117 +	iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
   1.118 +
   1.119 +    // trigger the video to start playing                
   1.120 +    StartPlayback();
   1.121 +	}
   1.122 +
   1.123 +void RTestVclnt2PlayFile::HandlePlayCompleteL()
   1.124 +	{
   1.125 +	iTestStepResult = EPass;
   1.126 +	CActiveScheduler::Stop();
   1.127 +	}
   1.128 +
   1.129 +void RTestVclnt2PlayFile::StartPlayback()
   1.130 +	{
   1.131 +    iError = KErrTimedOut;
   1.132 +    INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
   1.133 +    PrepareState(EVPPlayComplete, KErrNone);
   1.134 +    iVideoPlayer2->Play();
   1.135 +	}
   1.136 +	
   1.137 +#ifdef SYMBIAN_BUILD_GCE
   1.138 +//
   1.139 +// RTestMediaClientVideoDisplay
   1.140 +//
   1.141 +
   1.142 +/**
   1.143 + * RTestMediaClientVideoDisplay::Constructor
   1.144 + */
   1.145 +
   1.146 +
   1.147 +RTestMediaClientVideoDisplay::RTestMediaClientVideoDisplay(const TDesC& aTestName, 
   1.148 +                                         const TDesC& aSectName, 
   1.149 +                                         const TDesC& aKeyName, 
   1.150 +                                         TInt aExpectedError)
   1.151 +    : RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
   1.152 +    {
   1.153 +    }
   1.154 +
   1.155 +/**
   1.156 + * RTestMediaClientVideoDisplay::NewL
   1.157 + */
   1.158 +
   1.159 +RTestMediaClientVideoDisplay* RTestMediaClientVideoDisplay::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
   1.160 +    {
   1.161 +    RTestMediaClientVideoDisplay* self = new (ELeave) RTestMediaClientVideoDisplay(aTestName, aSectName, aKeyName, aExpectedError);
   1.162 +    return self;
   1.163 +    }
   1.164 +
   1.165 +/**
   1.166 + * RTestMediaClientVideoDisplay::DoTestStepPreambleL
   1.167 + */
   1.168 + 
   1.169 +TVerdict RTestMediaClientVideoDisplay::DoTestStepPreambleL()
   1.170 +    {
   1.171 +    return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
   1.172 +    }
   1.173 +
   1.174 +/**
   1.175 + * RTestMediaClientVideoDisplay::DoTestStepPostambleL
   1.176 + */
   1.177 + 
   1.178 +TVerdict RTestMediaClientVideoDisplay::DoTestStepPostambleL()
   1.179 +    {
   1.180 +    return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();        
   1.181 +    }
   1.182 +
   1.183 +/**
   1.184 + * RTestMediaClientVideoDisplay::FsmL
   1.185 + */
   1.186 +void RTestMediaClientVideoDisplay::FsmL(TVclntTestPlayEvents aEventCode)
   1.187 +    {
   1.188 +    if (FsmCheck(aEventCode))
   1.189 +        {
   1.190 +        switch (aEventCode)
   1.191 +            {
   1.192 +            case EVPIdle:
   1.193 +                HandleIdleL();
   1.194 +                break;
   1.195 +                
   1.196 +            case EVPOpenComplete:
   1.197 +                HandleOpenCompleteL();
   1.198 +                break;
   1.199 +                
   1.200 +            case EVPPrepareComplete:                    
   1.201 +                HandlePrepareCompleteL();
   1.202 +                break;
   1.203 +                
   1.204 +            case EVPPlayComplete:
   1.205 +                HandlePlayCompleteL();
   1.206 +                break;
   1.207 +            }
   1.208 +        }
   1.209 +    }
   1.210 +    
   1.211 +void RTestMediaClientVideoDisplay::HandleIdleL()
   1.212 +	{
   1.213 +	// Open iVideoPlayer
   1.214 +    INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
   1.215 +    iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
   1.216 +    PrepareState(EVPOpenComplete, KErrNone);
   1.217 +	}
   1.218 +
   1.219 +void RTestMediaClientVideoDisplay::HandleOpenCompleteL()
   1.220 +	{
   1.221 +	// Prepare iVideoPlayer2
   1.222 +    INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
   1.223 +    iVideoPlayer2->Prepare();
   1.224 +    PrepareState(EVPPrepareComplete, KErrNone);
   1.225 +	}
   1.226 +	
   1.227 +void RTestMediaClientVideoDisplay::HandlePrepareCompleteL()
   1.228 +	{
   1.229 +	// trigger the video to start playing  
   1.230 +	StartPlayback();
   1.231 +	
   1.232 +	TInt displayId = iScreen->GetScreenNumber();
   1.233 +	TRect clipRect = TRect(iWindow->Size());
   1.234 +	TRect cropRegion = clipRect;
   1.235 +	
   1.236 +	// ==========================
   1.237 +	
   1.238 +    iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
   1.239 +    
   1.240 + 	RSurfaceManager surfaceManager;
   1.241 + 	User::LeaveIfError(surfaceManager.Open());
   1.242 +	
   1.243 +	RSurfaceManager::TSurfaceCreationAttributesBuf bf;
   1.244 +	RSurfaceManager::TSurfaceCreationAttributes& b=bf();
   1.245 +	b.iSize.iWidth = 320;
   1.246 +	b.iSize.iHeight = 240;
   1.247 +	b.iBuffers = 1;
   1.248 +	b.iPixelFormat = EUidPixelFormatXRGB_8888;	
   1.249 +	b.iStride = 320 * 4;
   1.250 +	b.iOffsetToFirstBuffer = 0;
   1.251 +	b.iAlignment=4;
   1.252 +	b.iContiguous=ETrue;
   1.253 +	
   1.254 +	TRect cropRect(0, 0, 320, 240);
   1.255 +	TVideoAspectRatio par(1,2);
   1.256 +	TSurfaceId surfaceId;
   1.257 +	
   1.258 +	User::LeaveIfError(surfaceManager.CreateSurface(bf, surfaceId));
   1.259 + 	
   1.260 +    iMediaClientVideoDisplay->SurfaceCreated(surfaceId, cropRect, par, cropRegion);
   1.261 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceCreated()"));
   1.262 +    
   1.263 +    delete iMediaClientVideoDisplay;
   1.264 +    iMediaClientVideoDisplay = NULL;
   1.265 +    
   1.266 +    // ==================
   1.267 +    
   1.268 +    iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
   1.269 +    
   1.270 +	TRect videoExtent = clipRect;
   1.271 +	TReal32 scaleWidth(100.0f);
   1.272 +	TReal32 scaleHeight(100.0f);
   1.273 +	TInt horizPos(EHorizontalAlignCenter);
   1.274 +	TInt vertPos(EVerticalAlignCenter);	
   1.275 +	
   1.276 +	TReal32 widthPercentage(50.0f); 
   1.277 +	TReal32 heightPercentage(50.0f);
   1.278 +	TReal32 widthP; 
   1.279 +	TReal32 heightP;
   1.280 +	RWindow newWindow;
   1.281 +	
   1.282 +	// Check for invalid rotation when adding new window
   1.283 +	INFO_PRINTF1(_L("Testing invalid rotations for AddDisplayWindowL"));
   1.284 +	TInt err = KErrNone;
   1.285 +	TVideoRotation rotation = static_cast<TVideoRotation>(-1);
   1.286 +	TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
   1.287 +	if (err != KErrArgument)
   1.288 +		{
   1.289 +		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative rotation"));
   1.290 +    	iTestStepResult = EFail;
   1.291 +    	CActiveScheduler::Stop();
   1.292 +    	return;
   1.293 +		}
   1.294 +
   1.295 +	rotation = static_cast<TVideoRotation>(4);
   1.296 +	TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
   1.297 +	if (err != KErrArgument)
   1.298 +		{
   1.299 +		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range rotation"));
   1.300 +    	iTestStepResult = EFail;
   1.301 +    	CActiveScheduler::Stop();
   1.302 +    	return;
   1.303 +		}
   1.304 +
   1.305 +	rotation = EVideoRotationNone;
   1.306 +
   1.307 +	// Check for invalid autoScaleType when adding new window
   1.308 +	INFO_PRINTF1(_L("Testing invalid autoScaleType for AddDisplayWindowL"));
   1.309 +	TAutoScaleType autoScaleType = static_cast<TAutoScaleType>(-1);
   1.310 +	TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
   1.311 +	if (err != KErrArgument)
   1.312 +		{
   1.313 +		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative scale"));
   1.314 +    	iTestStepResult = EFail;
   1.315 +    	CActiveScheduler::Stop();
   1.316 +    	return;
   1.317 +		}
   1.318 +
   1.319 +	autoScaleType = static_cast<TAutoScaleType>(4);
   1.320 +	TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
   1.321 +	if (err != KErrArgument)
   1.322 +		{
   1.323 +		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range scale"));
   1.324 +    	iTestStepResult = EFail;
   1.325 +    	CActiveScheduler::Stop();
   1.326 +    	return;
   1.327 +		}
   1.328 +	
   1.329 +	iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow);
   1.330 +	INFO_PRINTF1(_L("iMediaClientVideoDisplay->AddDisplayWindowL()"));   
   1.331 +
   1.332 +	// Check for invalid rotation when setting rotation for window
   1.333 +	INFO_PRINTF1(_L("Testing invalid rotation for SetRotationL"));
   1.334 +	TVideoRotation videoRotation = static_cast<TVideoRotation>(-1);
   1.335 +	TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
   1.336 +	if (err != KErrArgument)
   1.337 +		{
   1.338 +		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for negative value"));
   1.339 +    	iTestStepResult = EFail;
   1.340 +    	CActiveScheduler::Stop();
   1.341 +    	return;
   1.342 +		}
   1.343 +
   1.344 +	videoRotation = static_cast<TVideoRotation>(4);
   1.345 +	TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
   1.346 +	if (err != KErrArgument)
   1.347 +		{
   1.348 +		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for out of range value"));
   1.349 +    	iTestStepResult = EFail;
   1.350 +    	CActiveScheduler::Stop();
   1.351 +    	return;
   1.352 +		}
   1.353 +
   1.354 +	// Check for invalid rotation when setting rotation for all windows
   1.355 +	videoRotation = static_cast<TVideoRotation>(-1);
   1.356 +	TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
   1.357 +	if (err != KErrArgument)
   1.358 +		{
   1.359 +		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for negative value"));
   1.360 +    	iTestStepResult = EFail;
   1.361 +    	CActiveScheduler::Stop();
   1.362 +    	return;
   1.363 +		}
   1.364 +
   1.365 +	videoRotation = static_cast<TVideoRotation>(4);
   1.366 +	TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
   1.367 +	if (err != KErrArgument)
   1.368 +		{
   1.369 +		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for out of range value"));
   1.370 +    	iTestStepResult = EFail;
   1.371 +    	CActiveScheduler::Stop();
   1.372 +    	return;
   1.373 +		}
   1.374 +
   1.375 +	videoRotation = EVideoRotationClockwise180;
   1.376 +
   1.377 +    iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion);
   1.378 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
   1.379 +    
   1.380 +    if (iMediaClientVideoDisplay->RotationL(*iWindow) != videoRotation)
   1.381 +        {
   1.382 +        ERR_PRINTF1(_L("iMediaClientVideoDisplay->RotationL() returns an unexpected value.  Test aborted."));
   1.383 +
   1.384 +		iTestStepResult = EInconclusive;
   1.385 +		CActiveScheduler::Stop();
   1.386 +        }
   1.387 +	else
   1.388 +		{
   1.389 +		INFO_PRINTF1(_L("iMediaClientVideoDisplay->RotationL()"));	
   1.390 +		}
   1.391 +    
   1.392 +    iMediaClientVideoDisplay->SetScaleFactorL(*iWindow, widthPercentage, heightPercentage, cropRegion);
   1.393 +    iMediaClientVideoDisplay->SetScaleFactorL(widthPercentage, heightPercentage, cropRegion);
   1.394 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetScaleFactorL()"));
   1.395 +    
   1.396 +    iMediaClientVideoDisplay->SetRotationL(EVideoRotationClockwise90, cropRegion);
   1.397 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
   1.398 +    
   1.399 +    iMediaClientVideoDisplay->GetScaleFactorL(*iWindow, widthP, heightP);
   1.400 +    INFO_PRINTF3(_L("iMediaClientVideoDisplay->GetScaleFactorL() %df %df"), &widthP, &heightP);
   1.401 +
   1.402 +    iMediaClientVideoDisplay->SetVideoExtentL(*iWindow, videoExtent, cropRegion);
   1.403 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetVideoExtentL()"));
   1.404 +    
   1.405 +    iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow, clipRect, cropRegion);
   1.406 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetWindowClipRectL()"));
   1.407 +
   1.408 +	// Check for invalid autoScaleType when setting autoScaleType for window
   1.409 +	INFO_PRINTF1(_L("Testing invalid autoScaleType for SetAutoScaleL"));
   1.410 +	autoScaleType = static_cast<TAutoScaleType>(-1);
   1.411 +	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
   1.412 +	if (err != KErrArgument)
   1.413 +		{
   1.414 +		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for negative value"));
   1.415 +    	iTestStepResult = EFail;
   1.416 +    	CActiveScheduler::Stop();
   1.417 +    	return;
   1.418 +		}
   1.419 +
   1.420 +	autoScaleType = static_cast<TAutoScaleType>(4);
   1.421 +	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
   1.422 +	if (err != KErrArgument)
   1.423 +		{
   1.424 +		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for out of range value"));
   1.425 +    	iTestStepResult = EFail;
   1.426 +    	CActiveScheduler::Stop();
   1.427 +    	return;
   1.428 +		}
   1.429 +
   1.430 +	// Check for invalid autoScaleType when setting autoScaleType for all windows
   1.431 +	autoScaleType = static_cast<TAutoScaleType>(-1);
   1.432 +	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
   1.433 +	if (err != KErrArgument)
   1.434 +		{
   1.435 +		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for negative value"));
   1.436 +    	iTestStepResult = EFail;
   1.437 +    	CActiveScheduler::Stop();
   1.438 +    	return;
   1.439 +		}
   1.440 +
   1.441 +	autoScaleType = static_cast<TAutoScaleType>(4);
   1.442 +	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
   1.443 +	if (err != KErrArgument)
   1.444 +		{
   1.445 +		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for out of range value"));
   1.446 +    	iTestStepResult = EFail;
   1.447 +    	CActiveScheduler::Stop();
   1.448 +    	return;
   1.449 +		}
   1.450 +    
   1.451 +    iMediaClientVideoDisplay->SetAutoScaleL(EAutoScaleBestFit, horizPos, vertPos, cropRegion);
   1.452 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetAutoScaleL()"));
   1.453 +    
   1.454 +    iMediaClientVideoDisplay->RedrawWindows(cropRegion);
   1.455 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->RedrawWindows()"));   
   1.456 +    
   1.457 +	iMediaClientVideoDisplay->SurfaceParametersChanged(surfaceId, cropRect, par);
   1.458 +	INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceParametersChanged()"));
   1.459 +	
   1.460 +	iMediaClientVideoDisplay->RemoveSurface();
   1.461 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->ReplaceSurface()"));
   1.462 +    
   1.463 +    iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
   1.464 +    INFO_PRINTF1(_L("iMediaClientVideoDisplay->RemoveDisplayWindow()"));
   1.465 +    
   1.466 +    surfaceManager.CloseSurface(surfaceId);
   1.467 +	surfaceId = TSurfaceId::CreateNullId();
   1.468 +	surfaceManager.Close();
   1.469 +    
   1.470 +    delete iMediaClientVideoDisplay;  
   1.471 +    iMediaClientVideoDisplay = NULL;              
   1.472 +   	}
   1.473 +
   1.474 +void RTestMediaClientVideoDisplay::HandlePlayCompleteL()
   1.475 +	{
   1.476 +	iTestStepResult = EPass;
   1.477 +	CActiveScheduler::Stop();
   1.478 +	}
   1.479 +
   1.480 +void RTestMediaClientVideoDisplay::StartPlayback()
   1.481 +	{
   1.482 +    iError = KErrTimedOut;
   1.483 +    INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
   1.484 +    PrepareState(EVPPlayComplete, KErrNone);
   1.485 +    iVideoPlayer2->Play();
   1.486 +	}
   1.487 +	
   1.488 +#endif
   1.489 +
   1.490 +//
   1.491 +// RTestVclnt2PerformActionDuringVideoPlayback
   1.492 +//
   1.493 +
   1.494 +/**
   1.495 + * RTestVclnt2PerformActionDuringVideoPlayback::Constructor
   1.496 + */
   1.497 +RTestVclnt2PerformActionDuringVideoPlayback::RTestVclnt2PerformActionDuringVideoPlayback(
   1.498 +    const TDesC& aTestName, 
   1.499 +    const TDesC& aSectName, 
   1.500 +    const TDesC& aKeyName, 
   1.501 +    TInt aExpectedError)
   1.502 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
   1.503 +    {
   1.504 +    }
   1.505 +
   1.506 +/**
   1.507 + * RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL
   1.508 + */
   1.509 +void RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL()
   1.510 +    {
   1.511 +    if (iActionError != KErrNone)
   1.512 +        {
   1.513 +        ERR_PRINTF2(_L("Playback event left with error %d."), iActionError);
   1.514 +        iTestStepResult = EFail;
   1.515 +        }
   1.516 +    else 
   1.517 +        {
   1.518 +        iTestStepResult = EPass;
   1.519 +        }
   1.520 +
   1.521 +	CActiveScheduler::Stop();        
   1.522 +    }
   1.523 +
   1.524 +/**
   1.525 + * RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback
   1.526 + */     
   1.527 +void RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback()
   1.528 +	{
   1.529 +	RTestVclnt2PlayFile::StartPlayback();
   1.530 +	
   1.531 +	iActionError = KErrNone;
   1.532 +    TRAP(iActionError, DoThisActionDuringPlaybackL(*iVideoPlayer2));
   1.533 +	}
   1.534 +
   1.535 +
   1.536 +//
   1.537 +// RTestVclnt2AddWin
   1.538 +//
   1.539 +/**
   1.540 + * RTestVclnt2AddWin::Constructor
   1.541 + */
   1.542 +RTestVclnt2AddWin::RTestVclnt2AddWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.543 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
   1.544 +    {
   1.545 +    }
   1.546 +
   1.547 +/**
   1.548 + * RTestVclnt2AddWin::NewL
   1.549 + */
   1.550 +RTestVclnt2AddWin* RTestVclnt2AddWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.551 +    {
   1.552 +    RTestVclnt2AddWin* self = new (ELeave) RTestVclnt2AddWin(aTestName, aSectName, aKeyName, aExpectedError);
   1.553 +    return self;
   1.554 +    }
   1.555 +   
   1.556 +/**
   1.557 + * RTestVclnt2AddWin::HandlePrepareCompleteL
   1.558 + */
   1.559 +void RTestVclnt2AddWin::HandlePrepareCompleteL()
   1.560 +    {
   1.561 +    // retrieve video size
   1.562 +    TSize videoSize;
   1.563 +    iVideoPlayer2->VideoFrameSizeL(videoSize);                
   1.564 +
   1.565 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0)
   1.566 +        {
   1.567 +        // create a clipping rect partially out of screen
   1.568 +        TRect windowRect(iWindow->Size());
   1.569 +        windowRect.SetWidth(windowRect.Width() * 2);
   1.570 +        
   1.571 +        // Add the display window with a partially out of screen clipping rect
   1.572 +        TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, 
   1.573 +                                                    *iScreen, 
   1.574 +                                                    *iWindow, 
   1.575 +                                                    TRect(iWindow->Size()), 
   1.576 +                                                    windowRect));
   1.577 +        if (err != iTestExpectedError)
   1.578 +            {
   1.579 +            ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error.  Test failed."));
   1.580 +
   1.581 +    		iTestStepResult = EFail;
   1.582 +    		CActiveScheduler::Stop();
   1.583 +
   1.584 +    		return;
   1.585 +            }
   1.586 +
   1.587 +        // create a clipping rect completely out of screen
   1.588 +        windowRect.SetRect(TPoint(0, 0), iWindow->Size());
   1.589 +        windowRect.Move(windowRect.Width() + 10, 0);
   1.590 +        
   1.591 +        // Add the display window with a completely out of screen clipping rect
   1.592 +        TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs, 
   1.593 +                                                   *iScreen, 
   1.594 +                                                   *iWindow, 
   1.595 +                                                   TRect(iWindow->Size()), 
   1.596 +                                                   windowRect));
   1.597 +        if (err != iTestExpectedError)
   1.598 +            {
   1.599 +            ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error.  Test failed."));
   1.600 +            
   1.601 +    		iTestStepResult = EFail;
   1.602 +    		CActiveScheduler::Stop();
   1.603 +
   1.604 +    		return;
   1.605 +            }
   1.606 +        else 
   1.607 +            {
   1.608 +            // Reset the expected error to KErrNone as all expected failure tests have been completed.  
   1.609 +            // Any error that appears after this should fail the test
   1.610 +            iTestExpectedError = KErrNone;
   1.611 +            }
   1.612 +
   1.613 +        // after failing to add window display with a partially & a completely out of screen
   1.614 +        // clipping rect, proceed to add a valid clipping rect below            
   1.615 +        }    
   1.616 +    
   1.617 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0401")) == 0 ||
   1.618 +        iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0) 
   1.619 +        {
   1.620 +        // shrink both the video & window size by half
   1.621 +        TRect videoRect(videoSize);     
   1.622 +        videoRect.SetHeight(videoSize.iHeight / 2);
   1.623 +        videoRect.SetWidth(videoSize.iWidth / 2); 
   1.624 +        
   1.625 +        TRect windowRect(iWindow->Size());
   1.626 +        windowRect.SetHeight(iWindow->Size().iHeight / 2);
   1.627 +        windowRect.SetWidth(iWindow->Size().iWidth / 2); 
   1.628 +
   1.629 +        // ensure the rect is within the boundary of the window        
   1.630 +        TRect finalRect(windowRect);
   1.631 +        finalRect.Intersection(videoRect);
   1.632 +
   1.633 +        // add display window using this valid clipping rect 
   1.634 +        iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
   1.635 +        }
   1.636 +    else
   1.637 +        {
   1.638 +        // Invalid test case
   1.639 +        User::Panic(_L("RTestVclnt2AddWin"), KErrArgument);        
   1.640 +        }
   1.641 +
   1.642 +    // Start video playback
   1.643 +    StartPlayback();
   1.644 +    }
   1.645 +
   1.646 +
   1.647 +//
   1.648 +// RTestVclnt2RemoveWin
   1.649 +//
   1.650 +
   1.651 +/**
   1.652 + * RTestVclnt2RemoveWin::Constructor
   1.653 + */ 
   1.654 +RTestVclnt2RemoveWin::RTestVclnt2RemoveWin(const TDesC& aTestName, 
   1.655 +                                           const TDesC& aSectName,
   1.656 +                                           const TDesC& aKeyName, 
   1.657 +                                           TInt aExpectedError,
   1.658 +                                           TBool aAddBack)
   1.659 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError),
   1.660 +      iAddBack(aAddBack)
   1.661 +    {
   1.662 +    }
   1.663 +
   1.664 +/**
   1.665 + * RTestVclnt2RemoveWin::NewL
   1.666 + */
   1.667 +RTestVclnt2RemoveWin* RTestVclnt2RemoveWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aAddBack)
   1.668 +    {
   1.669 +    RTestVclnt2RemoveWin* self = new (ELeave) RTestVclnt2RemoveWin(aTestName, aSectName, aKeyName, aExpectedError, aAddBack);
   1.670 +    return self;
   1.671 +    }
   1.672 +
   1.673 +/**
   1.674 + * RTestVclnt2RemoveWin::HandlePrepareCompleteL
   1.675 + */
   1.676 +void RTestVclnt2RemoveWin::HandlePrepareCompleteL()
   1.677 +    {
   1.678 +    // retrieve video size
   1.679 +    TSize videoSize;
   1.680 +    iVideoPlayer2->VideoFrameSizeL(videoSize);
   1.681 +
   1.682 +    // shrink both the video & window size by half
   1.683 +    TRect videoRect(videoSize);     
   1.684 +    videoRect.SetHeight(videoSize.iHeight / 2);
   1.685 +    videoRect.SetWidth(videoSize.iWidth / 2); 
   1.686 +
   1.687 +    TRect windowRect(iWindow->Size());
   1.688 +    windowRect.SetHeight(iWindow->Size().iHeight / 2);
   1.689 +    windowRect.SetWidth(iWindow->Size().iWidth / 2); 
   1.690 +
   1.691 +    // ensure the rect is within the boundary of the window        
   1.692 +    TRect finalRect(windowRect);
   1.693 +    finalRect.Intersection(videoRect);
   1.694 +
   1.695 +    // add display window using this valid clipping rect 
   1.696 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
   1.697 +
   1.698 +    // trigger the video to start playing
   1.699 +    StartPlayback();    
   1.700 +    }
   1.701 +
   1.702 +/**
   1.703 + * RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL
   1.704 + */ 
   1.705 +void RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
   1.706 +    {
   1.707 +    // Play the video clip using a specific display window & video clipping setting 
   1.708 +    // first
   1.709 +    TTimeIntervalMicroSeconds duration = aPlayer.DurationL();        
   1.710 +
   1.711 +    // After a quarter of the clip's duration
   1.712 +    User::After(duration.Int64() / 4);
   1.713 +
   1.714 +    // remove the original display        
   1.715 +    aPlayer.RemoveDisplayWindow(*iWindow);
   1.716 +
   1.717 +
   1.718 +    if (iAddBack)
   1.719 +    	{
   1.720 +	    // Add the window using default values to continues
   1.721 +	    aPlayer.AddDisplayWindowL(iWs, *iScreen, *iWindow);
   1.722 +    	}
   1.723 +    }
   1.724 +
   1.725 +
   1.726 +//
   1.727 +// RTestVclnt2WinPos
   1.728 +//
   1.729 +
   1.730 +/**
   1.731 + * RTestVclnt2WinPos::Constructor
   1.732 + */
   1.733 +RTestVclnt2WinPos::RTestVclnt2WinPos(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.734 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
   1.735 +    {
   1.736 +    }
   1.737 +
   1.738 +/**
   1.739 + * RTestVclnt2WinPos::NewL
   1.740 + */
   1.741 +RTestVclnt2WinPos* RTestVclnt2WinPos::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.742 +    {
   1.743 +    RTestVclnt2WinPos* self = new (ELeave) RTestVclnt2WinPos(aTestName, aSectName, aKeyName, aExpectedError);
   1.744 +    return self;
   1.745 +    }
   1.746 +
   1.747 +/**
   1.748 + * RTestVclnt2WinPos::DoThisActionDuringPlaybackL
   1.749 + */
   1.750 +void RTestVclnt2WinPos::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
   1.751 +    {
   1.752 +    TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
   1.753 +            
   1.754 +    // shrink the window clipping rect by half the height & width            
   1.755 +    aPlayer.SetWindowClipRectL(*iWindow, TRect(windowSize));    
   1.756 +    }
   1.757 +
   1.758 +
   1.759 +//
   1.760 +// RTestVclnt2VideoExt
   1.761 +//
   1.762 +
   1.763 +/**
   1.764 + * RTestVclnt2VideoExt::Constructor
   1.765 + */
   1.766 +RTestVclnt2VideoExt::RTestVclnt2VideoExt(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.767 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
   1.768 +    {
   1.769 +    }
   1.770 +
   1.771 +/**
   1.772 + * RTestVclnt2VideoExt::NewL
   1.773 + */
   1.774 +RTestVclnt2VideoExt* RTestVclnt2VideoExt::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.775 +    {
   1.776 +    RTestVclnt2VideoExt* self = new (ELeave) RTestVclnt2VideoExt(aTestName, aSectName, aKeyName, aExpectedError);
   1.777 +    return self;
   1.778 +    }
   1.779 +
   1.780 +/**
   1.781 + * RTestVclnt2VideoExt::DoThisActionDuringPlaybackL
   1.782 + */
   1.783 +void RTestVclnt2VideoExt::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
   1.784 +    {
   1.785 +    TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
   1.786 +            
   1.787 +    // shrink the video extent by half the height & width            
   1.788 +    aPlayer.SetVideoExtentL(*iWindow, TRect(windowSize));
   1.789 +    }
   1.790 +
   1.791 +
   1.792 +//
   1.793 +// RTestVclnt2ClipRect
   1.794 +//
   1.795 +
   1.796 +/**
   1.797 + * RTestVclnt2ClipRect::Constructor
   1.798 + */
   1.799 +RTestVclnt2ClipRect::RTestVclnt2ClipRect(const TDesC& aTestName, 
   1.800 +                                         const TDesC& aSectName,
   1.801 +                                         const TDesC& aKeyName, 
   1.802 +                                         TInt aExpectedError)
   1.803 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
   1.804 +    {
   1.805 +    }
   1.806 +
   1.807 +/**
   1.808 + * RTestVclnt2ClipRect::NewL
   1.809 + */
   1.810 +RTestVclnt2ClipRect* RTestVclnt2ClipRect::NewL(const TDesC& aTestName, 
   1.811 +                                               const TDesC& aSectName,
   1.812 +                                               const TDesC& aKeyName, 
   1.813 +                                               TInt aExpectedError)
   1.814 +    {
   1.815 +    RTestVclnt2ClipRect* self 
   1.816 +        = new (ELeave) RTestVclnt2ClipRect(aTestName, aSectName, aKeyName, aExpectedError);
   1.817 +    return self;
   1.818 +    }
   1.819 +
   1.820 +/**
   1.821 + * RTestVclnt2ClipRect::DoThisActionDuringPlaybackL
   1.822 + */
   1.823 +void RTestVclnt2ClipRect::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
   1.824 +    {
   1.825 +    TRect clipRect;    
   1.826 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0405")) == 0)
   1.827 +        {
   1.828 +        // shrink the current window clipping rect by half the height & width 
   1.829 +        clipRect.Resize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);            
   1.830 +        }
   1.831 +    else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0)
   1.832 +        {
   1.833 +        // grow the current window clipping rect by double the width         
   1.834 +        clipRect.Resize(iWindow->Size().iWidth * 2, iWindow->Size().iHeight);
   1.835 +        }
   1.836 +    else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
   1.837 +        {
   1.838 +        // move the current window clipping rect to be out of the window
   1.839 +        clipRect.SetSize(iWindow->Size());
   1.840 +        clipRect.Move(TPoint(iWindow->Size().iWidth + 1, 0));
   1.841 +        }
   1.842 +    else
   1.843 +        {
   1.844 +        User::Panic(_L("RTestVclnt2ClipRect"), KErrArgument);
   1.845 +        }
   1.846 +    
   1.847 +    // change the window clipping of the display window
   1.848 +    TRAPD(err, aPlayer.SetWindowClipRectL(*iWindow, clipRect));
   1.849 +    if (err != iTestExpectedError)
   1.850 +        {
   1.851 +        if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0 || 
   1.852 +            iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
   1.853 +            {
   1.854 +            // for negative tests, stop the test if the failure is not expected
   1.855 +            ERR_PRINTF1(_L("iVideoPlayer2->SetWindowClipRectL() did not failed as expected.  Test failed."));
   1.856 +
   1.857 +    		iTestStepResult = EInconclusive;
   1.858 +    		CActiveScheduler::Stop();
   1.859 +
   1.860 +    		return;
   1.861 +            }
   1.862 +        else
   1.863 +            {
   1.864 +            // fail only if error is returned for positive tests
   1.865 +            User::LeaveIfError(err);
   1.866 +            }
   1.867 +        }
   1.868 +    else
   1.869 +        {        
   1.870 +        // Reset the expected error to KErrNone as all expected failure tests have been completed.  
   1.871 +        // Any error that appears after this should fail the test
   1.872 +        iTestExpectedError = KErrNone;
   1.873 +        }
   1.874 +    }
   1.875 +
   1.876 +//
   1.877 +// RTestVclnt2Scale
   1.878 +//
   1.879 +
   1.880 +/**
   1.881 + * RTestVclnt2Scale::Constructor
   1.882 + */
   1.883 +RTestVclnt2Scale::RTestVclnt2Scale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.884 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
   1.885 +    {
   1.886 +    }
   1.887 +
   1.888 +/**
   1.889 + * RTestVclnt2Scale::NewL
   1.890 + */
   1.891 +RTestVclnt2Scale* RTestVclnt2Scale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.892 +    {
   1.893 +    RTestVclnt2Scale* self = new (ELeave) RTestVclnt2Scale(aTestName, aSectName, aKeyName, aExpectedError);
   1.894 +    return self;
   1.895 +    }
   1.896 +
   1.897 +/**
   1.898 + * RTestVclnt2Scale::DoThisActionDuringPlaybackL
   1.899 + */
   1.900 +void RTestVclnt2Scale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
   1.901 +    {
   1.902 +    // Change the scale factor during playback
   1.903 +    aPlayer.SetScaleFactorL(*iWindow, 150, 150);
   1.904 +    }
   1.905 +
   1.906 +/**
   1.907 + * RTestVclnt2Scale::HandlePrepareCompleteL
   1.908 + */ 
   1.909 +void RTestVclnt2Scale::HandlePrepareCompleteL()
   1.910 +    {
   1.911 +    // Continue to setup the video utility and then trigger playback
   1.912 +    RTestVclnt2PerformActionDuringVideoPlayback::HandlePrepareCompleteL();
   1.913 +    
   1.914 +    TReal32 scaleFactor = 50.0;
   1.915 +     
   1.916 +    // set scale factor to less than 100%
   1.917 +    iVideoPlayer2->SetScaleFactorL(*iWindow, scaleFactor, scaleFactor);
   1.918 +
   1.919 +    // get scale factor 
   1.920 +    TReal32 widthScale;
   1.921 +    TReal32 heightScale;
   1.922 +    iVideoPlayer2->GetScaleFactorL(*iWindow, widthScale, heightScale);
   1.923 +
   1.924 +    if (widthScale != scaleFactor || heightScale != scaleFactor)
   1.925 +        {
   1.926 +        ERR_PRINTF1(_L("iVideoPlayer2->GetScaleFactorL() returns unexpected values.  Test aborted."));
   1.927 +        
   1.928 +		iTestStepResult = EInconclusive;
   1.929 +		CActiveScheduler::Stop();
   1.930 +		
   1.931 +		return;
   1.932 +        }    
   1.933 +    }
   1.934 +
   1.935 +
   1.936 +//
   1.937 +// RTestVclnt2Viewport
   1.938 +//
   1.939 +
   1.940 +/**
   1.941 + * RTestVclnt2Viewport::Constructor
   1.942 + */
   1.943 +RTestVclnt2Viewport::RTestVclnt2Viewport(const TDesC& aTestName,
   1.944 +                                         const TDesC& aSectName,
   1.945 +                                         const TDesC& aKeyName, 
   1.946 +                                         const TSize& aViewportSize,
   1.947 +                                         TInt aExpectedError)
   1.948 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError),
   1.949 +      iViewportSize(aViewportSize)
   1.950 +    {
   1.951 +    }
   1.952 +
   1.953 +/**
   1.954 + * RTestVclnt2Viewport::NewL
   1.955 + */
   1.956 +RTestVclnt2Viewport* RTestVclnt2Viewport::NewL(const TDesC& aTestName, 
   1.957 +                                               const TDesC& aSectName,
   1.958 +                                               const TDesC& aKeyName, 
   1.959 +                                               const TSize& aViewportSize,
   1.960 +                                               TInt aExpectedError)
   1.961 +    {
   1.962 +    RTestVclnt2Viewport* self = new (ELeave) RTestVclnt2Viewport(aTestName, 
   1.963 +                                                                 aSectName, 
   1.964 +                                                                 aKeyName, 
   1.965 +                                                                 aViewportSize,
   1.966 +                                                                 aExpectedError); 
   1.967 +    return self;
   1.968 +    }
   1.969 +
   1.970 +void RTestVclnt2Viewport::HandlePrepareCompleteL()
   1.971 +	{
   1.972 +	// retrive original video size
   1.973 +    TSize videoSize;
   1.974 +    iVideoPlayer2->VideoFrameSizeL(videoSize);
   1.975 +        
   1.976 +    // crop the top left quarter of the video
   1.977 +    TRect cropRegion;
   1.978 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
   1.979 +        {
   1.980 +        // Crop the right half of the video
   1.981 +        cropRegion.SetHeight(videoSize.iHeight);        
   1.982 +        cropRegion.SetWidth(videoSize.iWidth / 2);
   1.983 +        cropRegion.Move(cropRegion.Width(), 0);
   1.984 +        }
   1.985 +    else
   1.986 +        {
   1.987 +        cropRegion.SetWidth(iViewportSize.iWidth == -1 ? videoSize.iWidth : iViewportSize.iWidth);
   1.988 +        cropRegion.SetHeight(iViewportSize.iHeight == -1 ? videoSize.iHeight : iViewportSize.iHeight);
   1.989 +        }
   1.990 +    
   1.991 +    TRect videoExtentRect;
   1.992 +    TRect clipRegion;
   1.993 +    
   1.994 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
   1.995 +        {
   1.996 +        videoExtentRect.SetRect(TPoint(0, 0), videoSize);
   1.997 +        clipRegion.SetRect(TPoint(0, 0), videoSize); 
   1.998 +        clipRegion.SetWidth(clipRegion.Width() / 2);
   1.999 +        clipRegion.Move(clipRegion.Width(), 0);
  1.1000 +        }
  1.1001 +    else 
  1.1002 +        {
  1.1003 +        // Calculate the video extent to be exactly the same size as the cropped video picture, 
  1.1004 +        // placed at the center of the window
  1.1005 +        TInt offsetX = (iWindow->Size().iWidth - cropRegion.Width()) / 2;
  1.1006 +        TInt offsetY = (iWindow->Size().iHeight - cropRegion.Height()) / 2;
  1.1007 +        videoExtentRect.SetRect(TPoint(offsetX, offsetY), cropRegion.Size());                    
  1.1008 +
  1.1009 +        // Set the window clipping region to the top vertical half of the cropped image, originating
  1.1010 +        // from the top left corner of the window                    
  1.1011 +        clipRegion = videoExtentRect;                    
  1.1012 +        clipRegion.SetHeight(videoExtentRect.Height() / 2);
  1.1013 +        }
  1.1014 +    
  1.1015 +    HandlePrepareCompleteL(cropRegion, videoExtentRect, clipRegion);
  1.1016 +    
  1.1017 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
  1.1018 +    	{
  1.1019 +    	// Align the image to the left of the window
  1.1020 +        iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, 0);
  1.1021 +    	}
  1.1022 +    // trigger the video to start playing                
  1.1023 +    StartPlayback();
  1.1024 +	}
  1.1025 +
  1.1026 +void RTestVclnt2Viewport::HandlePrepareCompleteL(const TRect& aCropRegion, 
  1.1027 +                                                 const TRect& aVideoExtent, 
  1.1028 +                                                 const TRect& aClipRect)
  1.1029 +    {
  1.1030 +    iVideoPlayer2->SetCropRegionL(aCropRegion);
  1.1031 +    
  1.1032 +    // get the video crop region to ensure the crop region is set
  1.1033 +    TRect currentCropRegion;
  1.1034 +    iVideoPlayer2->GetCropRegionL(currentCropRegion);
  1.1035 +    
  1.1036 +    if (currentCropRegion != aCropRegion)
  1.1037 +        {
  1.1038 +        ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value.  Test aborted."));
  1.1039 +        
  1.1040 +		iTestStepResult = EInconclusive;
  1.1041 +		CActiveScheduler::Stop();
  1.1042 +        }
  1.1043 +        
  1.1044 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, aVideoExtent, aClipRect);                    
  1.1045 +    }
  1.1046 +
  1.1047 +//
  1.1048 +// RTestVclnt2InvalidViewport
  1.1049 +//
  1.1050 +
  1.1051 +/**
  1.1052 + * RTestVclnt2InvalidViewport::Constructor
  1.1053 + */
  1.1054 +RTestVclnt2InvalidViewport::RTestVclnt2InvalidViewport(const TDesC& aTestName,
  1.1055 +                                                       const TDesC& aSectName,
  1.1056 +                                                       const TDesC& aKeyName, 
  1.1057 +                                                       TInt aExpectedError)
  1.1058 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1059 +    {
  1.1060 +    }
  1.1061 +
  1.1062 +/**
  1.1063 + * RTestVclnt2InvalidViewport::NewL
  1.1064 + */
  1.1065 +RTestVclnt2InvalidViewport* RTestVclnt2InvalidViewport::NewL(const TDesC& aTestName, 
  1.1066 +                                                             const TDesC& aSectName,
  1.1067 +                                                             const TDesC& aKeyName, 
  1.1068 +                                                             TInt aExpectedError)
  1.1069 +    {
  1.1070 +    RTestVclnt2InvalidViewport* self = new (ELeave) RTestVclnt2InvalidViewport(aTestName, 
  1.1071 +                                                                               aSectName, 
  1.1072 +                                                                               aKeyName, 
  1.1073 +                                                                               aExpectedError); 
  1.1074 +    return self;
  1.1075 +    }
  1.1076 +
  1.1077 +/**
  1.1078 + * RTestVclnt2InvalidViewport::HandlePrepareCompleteL
  1.1079 + */
  1.1080 +void RTestVclnt2InvalidViewport::HandlePrepareCompleteL()
  1.1081 +    {
  1.1082 +	// retrive original video size
  1.1083 +    TSize videoSize;
  1.1084 +    iVideoPlayer2->VideoFrameSizeL(videoSize);
  1.1085 +
  1.1086 +    // set the crop region to be completely out of the video image bound 
  1.1087 +    TRect cropRegion;
  1.1088 +    cropRegion.SetRect(TPoint(videoSize.iWidth, videoSize.iHeight), TSize(100, 100));
  1.1089 +
  1.1090 +    // continue playback even if this fails
  1.1091 +    TRAPD(err, iVideoPlayer2->SetCropRegionL(cropRegion));
  1.1092 +    if (err == iTestExpectedError)
  1.1093 +        {
  1.1094 +        // the invalid crop area is not supposed to be set 
  1.1095 +        INFO_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() returned expected.  Test continues."));
  1.1096 +
  1.1097 +        // reset the expected error.  Any error that appears after this should fail the test
  1.1098 +        iTestExpectedError = KErrNone;
  1.1099 +        }
  1.1100 +    else 
  1.1101 +        {
  1.1102 +        // the invalid crop area is not supposed to be set 
  1.1103 +        ERR_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() didn't leave with expected error.  Test cannot be continued."));
  1.1104 +
  1.1105 +		iTestStepResult = EInconclusive;
  1.1106 +		CActiveScheduler::Stop();
  1.1107 +		return;
  1.1108 +        }
  1.1109 +
  1.1110 +    // get the video crop region to ensure the crop region is set
  1.1111 +    TRect currentCropRegion;
  1.1112 +    iVideoPlayer2->GetCropRegionL(currentCropRegion);
  1.1113 +
  1.1114 +    if (currentCropRegion != cropRegion)
  1.1115 +        {
  1.1116 +        // the invalid crop area is not supposed to be set 
  1.1117 +        ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value.  Test cannot be continued."));
  1.1118 +        
  1.1119 +		iTestStepResult = EInconclusive;
  1.1120 +		CActiveScheduler::Stop();
  1.1121 +		return;
  1.1122 +        }
  1.1123 +
  1.1124 +    // setup the display then trigger the video to start playing
  1.1125 +    RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.1126 +    }
  1.1127 +
  1.1128 +
  1.1129 +//
  1.1130 +// RTestVclnt2Rotation
  1.1131 +//
  1.1132 +/**
  1.1133 + * RTestVclnt2Rotation::Constructor
  1.1134 + */
  1.1135 +RTestVclnt2Rotation::RTestVclnt2Rotation(const TDesC& aTestName,
  1.1136 +                                         const TDesC& aSectName,
  1.1137 +                                         const TDesC& aKeyName, 
  1.1138 +                                         TInt aExpectedError)
  1.1139 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1140 +    {
  1.1141 +    }
  1.1142 +
  1.1143 +/**
  1.1144 + * RTestVclnt2Rotation::NewL
  1.1145 + */
  1.1146 +RTestVclnt2Rotation* RTestVclnt2Rotation::NewL(const TDesC& aTestName, 
  1.1147 +                                               const TDesC& aSectName,
  1.1148 +                                               const TDesC& aKeyName, 
  1.1149 +                                               TInt aExpectedError)
  1.1150 +    {
  1.1151 +    RTestVclnt2Rotation* self = new (ELeave) RTestVclnt2Rotation(aTestName, 
  1.1152 +                                                                 aSectName, 
  1.1153 +                                                                 aKeyName, 
  1.1154 +                                                                 aExpectedError);
  1.1155 +    return self;
  1.1156 +    }
  1.1157 +
  1.1158 +/**
  1.1159 + * RTestVclnt2Rotation::HandlePrepareCompleteL
  1.1160 + */
  1.1161 +void RTestVclnt2Rotation::HandlePrepareCompleteL()
  1.1162 +    {
  1.1163 +    // call parent's HandlePrepareCompleteL to finish off all preparation
  1.1164 +    RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.1165 +    
  1.1166 +    // set the video to be displayed upside-down
  1.1167 +    TVideoRotation videoRotation(EVideoRotationClockwise180);
  1.1168 +    iVideoPlayer2->SetRotationL(*iWindow, videoRotation);
  1.1169 +
  1.1170 +    // retrieve the rotation setting, and check if it's been properly updated
  1.1171 +    if (iVideoPlayer2->RotationL(*iWindow) != videoRotation)
  1.1172 +        {
  1.1173 +        ERR_PRINTF1(_L("iVideoPlayer2->RotationL() returns an unexpected value.  Test aborted."));
  1.1174 +
  1.1175 +		iTestStepResult = EInconclusive;
  1.1176 +		CActiveScheduler::Stop();
  1.1177 +
  1.1178 +		return;
  1.1179 +        }
  1.1180 +    }
  1.1181 +
  1.1182 +//
  1.1183 +// RTestVclnt2Settings
  1.1184 +//
  1.1185 +/**
  1.1186 + * RTestVclnt2Settings::Constructor
  1.1187 + */
  1.1188 +RTestVclnt2Settings::RTestVclnt2Settings(const TDesC& aTestName,
  1.1189 +                                         const TDesC& aSectName,
  1.1190 +                                         const TDesC& aKeyName, 
  1.1191 +                                         TInt aExpectedError)
  1.1192 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1193 +    {
  1.1194 +    }
  1.1195 +
  1.1196 +/**
  1.1197 + * RTestVclnt2Settings::NewL
  1.1198 + */
  1.1199 +RTestVclnt2Settings* RTestVclnt2Settings::NewL(const TDesC& aTestName, 
  1.1200 +                                               const TDesC& aSectName,
  1.1201 +                                               const TDesC& aKeyName, 
  1.1202 +                                               TInt aExpectedError)
  1.1203 +    {
  1.1204 +    RTestVclnt2Settings* self = new (ELeave) RTestVclnt2Settings(aTestName, aSectName, aKeyName, aExpectedError);
  1.1205 +    return self;
  1.1206 +    }
  1.1207 +   
  1.1208 +/**
  1.1209 + * RTestVclnt2Settings::HandlePrepareCompleteL
  1.1210 + */
  1.1211 +void RTestVclnt2Settings::HandlePrepareCompleteL()
  1.1212 +    {
  1.1213 +    // retrieve the current frame size
  1.1214 +    TSize frameSize;
  1.1215 +    iVideoPlayer2->VideoFrameSizeL(frameSize);    
  1.1216 +    
  1.1217 +    TRect cropRegion(frameSize);
  1.1218 +    // shrink the crop region to half its original height
  1.1219 +    cropRegion.SetHeight(cropRegion.Height() / 2);
  1.1220 +    iVideoPlayer2->SetCropRegionL(cropRegion);
  1.1221 +    
  1.1222 +    TRect videoExtentRect;
  1.1223 +    videoExtentRect.SetWidth(cropRegion.Width());
  1.1224 +    videoExtentRect.SetHeight(cropRegion.Height());
  1.1225 +    
  1.1226 +    videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2,
  1.1227 +                         (iWindow->Size().iHeight - videoExtentRect.Height()) / 2); 
  1.1228 +    
  1.1229 +    TRect clippingRect(videoExtentRect);
  1.1230 +    clippingRect.SetWidth(clippingRect.Height() / 2);
  1.1231 +
  1.1232 +    // add display window using this valid clipping rect 
  1.1233 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);
  1.1234 +
  1.1235 + 	// Scale the movie with best fit scaling, and vertically center the picture
  1.1236 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleBestFit);
  1.1237 +    
  1.1238 +    // Start video playback
  1.1239 +    StartPlayback();
  1.1240 +    }
  1.1241 +
  1.1242 +
  1.1243 +
  1.1244 +//
  1.1245 +// RTestVclnt2SettingsAndAlignments
  1.1246 +//
  1.1247 +/**
  1.1248 + * RTestVclnt2SettingsAndAlignments::Constructor
  1.1249 + */
  1.1250 +RTestVclnt2SettingsAndAlignments::RTestVclnt2SettingsAndAlignments(const TDesC& aTestName,
  1.1251 +                                                                   const TDesC& aSectName,
  1.1252 +                                                                   const TDesC& aKeyName, 
  1.1253 +                                                                   TInt aExpectedError)
  1.1254 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1255 +    {
  1.1256 +    }
  1.1257 +
  1.1258 +/**
  1.1259 + * RTestVclnt2SettingsAndAlignments::NewL
  1.1260 + */
  1.1261 +RTestVclnt2SettingsAndAlignments* RTestVclnt2SettingsAndAlignments::NewL(const TDesC& aTestName, 
  1.1262 +                                                                         const TDesC& aSectName,
  1.1263 +                                                                         const TDesC& aKeyName, 
  1.1264 +                                                                         TInt aExpectedError)
  1.1265 +    {
  1.1266 +    RTestVclnt2SettingsAndAlignments* self = new (ELeave) RTestVclnt2SettingsAndAlignments(aTestName, aSectName, aKeyName, aExpectedError);
  1.1267 +    return self;
  1.1268 +    }
  1.1269 +
  1.1270 +TVerdict RTestVclnt2SettingsAndAlignments::DoTestStepPreambleL()
  1.1271 +	{
  1.1272 +	iCount = 0;
  1.1273 +	return RTestVclnt2PlayFile::DoTestStepPreambleL();
  1.1274 +	}
  1.1275 +
  1.1276 +/**
  1.1277 + * RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL
  1.1278 + */
  1.1279 +void RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL()
  1.1280 +    {    
  1.1281 +    TRect cropRegion;
  1.1282 +    SetCropRegionL(cropRegion);
  1.1283 +
  1.1284 +	AddDisplayWindowL(cropRegion);
  1.1285 +    
  1.1286 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0418")) == 0)
  1.1287 +        {            
  1.1288 +        SetContentOffsetL();
  1.1289 +        }
  1.1290 +    else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0419")) == 0)        
  1.1291 +        {
  1.1292 +        SetContentAlignmentL();            
  1.1293 +        }        
  1.1294 +
  1.1295 +    SetScaleFactorL();
  1.1296 +       
  1.1297 +    // Start video playback
  1.1298 +    StartPlayback();
  1.1299 +    }
  1.1300 +
  1.1301 +/**
  1.1302 + * RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL
  1.1303 + */
  1.1304 +void RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL()
  1.1305 +    {    
  1.1306 +    iCount++;
  1.1307 +    
  1.1308 +    if (iCount == KSettingsAndAlignmentTest)
  1.1309 +        {
  1.1310 +    	iTestStepResult = EPass;
  1.1311 +    	CActiveScheduler::Stop();
  1.1312 +        }
  1.1313 +    else
  1.1314 +        {
  1.1315 +        HandlePrepareCompleteL();                                
  1.1316 +        }
  1.1317 +    }
  1.1318 +
  1.1319 +/**
  1.1320 + * RTestVclnt2SettingsAndAlignments::SetCropRegionL
  1.1321 + */
  1.1322 +void RTestVclnt2SettingsAndAlignments::SetCropRegionL(TRect& aCropRegion)
  1.1323 +    {
  1.1324 +    // retrieve the current frame size
  1.1325 +    TSize frameSize;
  1.1326 +    iVideoPlayer2->VideoFrameSizeL(frameSize);    
  1.1327 +    
  1.1328 +    // Framesize is used in this case as crop region is not returning default values
  1.1329 +    aCropRegion.SetRect(TPoint(0, 0), frameSize);
  1.1330 +    
  1.1331 +    // set the crop region 
  1.1332 +    switch (iCount % KSettingsAndAlignmentTest)
  1.1333 +        {
  1.1334 +        case 0:                
  1.1335 +            // set the crop region to the top half of the image
  1.1336 +            aCropRegion.SetHeight(aCropRegion.Height() / 2);
  1.1337 +            iVideoPlayer2->SetCropRegionL(aCropRegion);
  1.1338 +            break;
  1.1339 +
  1.1340 +        case 1:
  1.1341 +            // set the crop region to the left half of the image
  1.1342 +            aCropRegion.SetWidth(aCropRegion.Width() / 2);
  1.1343 +            iVideoPlayer2->SetCropRegionL(aCropRegion);
  1.1344 +            break;
  1.1345 +
  1.1346 +        default:
  1.1347 +            // set the crop region to the bottom, right quarter of the image
  1.1348 +            aCropRegion.SetHeight(aCropRegion.Height() / 2);
  1.1349 +            aCropRegion.SetWidth(aCropRegion.Width() / 2);
  1.1350 +            aCropRegion.Move(aCropRegion.Width(), aCropRegion.Height());                        
  1.1351 +            iVideoPlayer2->SetCropRegionL(aCropRegion);
  1.1352 +            break;
  1.1353 +        }
  1.1354 +    }
  1.1355 +
  1.1356 +/**
  1.1357 + * RTestVclnt2SettingsAndAlignments::SetContentOffsetL
  1.1358 + */
  1.1359 +void RTestVclnt2SettingsAndAlignments::SetContentOffsetL()
  1.1360 +    {
  1.1361 +    switch (iCount % KSettingsAndAlignmentTest)
  1.1362 +        {
  1.1363 +        case 0:
  1.1364 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, 100);
  1.1365 +            break;
  1.1366 +        
  1.1367 +        case 1:
  1.1368 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 0);
  1.1369 +            break;
  1.1370 +        
  1.1371 +        default:
  1.1372 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
  1.1373 +            break;
  1.1374 +        }    
  1.1375 +    }
  1.1376 +
  1.1377 +/**
  1.1378 + * RTestVclnt2SettingsAndAlignments::SetContentAlignmentL
  1.1379 + */
  1.1380 +void RTestVclnt2SettingsAndAlignments::SetContentAlignmentL()
  1.1381 +    {
  1.1382 +    switch (iCount % KSettingsAndAlignmentTest)
  1.1383 +        {
  1.1384 +        case 0:
  1.1385 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, EVerticalAlignCenter);
  1.1386 +            break;
  1.1387 +        
  1.1388 +        case 1:
  1.1389 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, 0);
  1.1390 +            break;
  1.1391 +        
  1.1392 +        default:
  1.1393 +            iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
  1.1394 +            break;
  1.1395 +        }    
  1.1396 +    }
  1.1397 +    
  1.1398 +/**
  1.1399 + * RTestVclnt2SettingsAndAlignments::SetScaleFactorL
  1.1400 + */
  1.1401 +void RTestVclnt2SettingsAndAlignments::SetScaleFactorL()
  1.1402 +    {
  1.1403 +    switch (iCount % KSettingsAndAlignmentTest)
  1.1404 +        {
  1.1405 +        case 0:
  1.1406 +            iVideoPlayer2->SetScaleFactorL(*iWindow, 1, 200);
  1.1407 +            break;
  1.1408 +        
  1.1409 +        case 1:
  1.1410 +            iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 1);
  1.1411 +            break;
  1.1412 +        
  1.1413 +        default:
  1.1414 +            iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 200);
  1.1415 +            break;
  1.1416 +        }    
  1.1417 +    }    
  1.1418 +
  1.1419 +/**
  1.1420 + * RTestVclnt2SettingsAndAlignments::AddDisplayWindowL
  1.1421 + */
  1.1422 +void RTestVclnt2SettingsAndAlignments::AddDisplayWindowL(const TRect& aCropRegion)
  1.1423 +    {
  1.1424 +    TRect videoExtentRect(iWindow->Size());
  1.1425 +    TRect clippingRect(iWindow->Size());
  1.1426 +    
  1.1427 +    switch (iCount % KSettingsAndAlignmentTest)
  1.1428 +        {
  1.1429 +        case 0:
  1.1430 +            videoExtentRect.SetWidth(aCropRegion.Width());
  1.1431 +            if (iWindow->Size().iWidth > videoExtentRect.Width())
  1.1432 +                {                    
  1.1433 +                videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2, 0);
  1.1434 +                }
  1.1435 +            clippingRect = videoExtentRect;
  1.1436 +            break;
  1.1437 +            
  1.1438 +        case 1:
  1.1439 +            videoExtentRect.SetHeight(aCropRegion.Height());
  1.1440 +            if (iWindow->Size().iHeight > videoExtentRect.Height())
  1.1441 +                {                    
  1.1442 +                videoExtentRect.Move(0, (iWindow->Size().iHeight - videoExtentRect.Height()) / 2);
  1.1443 +                }
  1.1444 +            clippingRect = videoExtentRect;
  1.1445 +            break;
  1.1446 +            
  1.1447 +        default:
  1.1448 +            clippingRect.SetHeight(clippingRect.Height() / 2);
  1.1449 +            clippingRect.SetWidth(clippingRect.Width() / 2);            
  1.1450 +            clippingRect.Move(clippingRect.Width(), clippingRect.Height());            
  1.1451 +            break;                        
  1.1452 +        }
  1.1453 +    
  1.1454 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);    
  1.1455 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);    
  1.1456 +    }
  1.1457 +       
  1.1458 +    
  1.1459 +//
  1.1460 +// RTestVclnt2SecDisplay
  1.1461 +//
  1.1462 +/**
  1.1463 + * RTestVclnt2SecDisplay::Constructor
  1.1464 + */
  1.1465 +RTestVclnt2SecDisplay::RTestVclnt2SecDisplay(const TDesC& aTestName,
  1.1466 +                                             const TDesC& aSectName,
  1.1467 +                                             const TDesC& aKeyName, 
  1.1468 +                                             TInt aExpectedError)
  1.1469 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1470 +    {
  1.1471 +    }
  1.1472 +
  1.1473 +/**
  1.1474 + * RTestVclnt2SecDisplay::NewL
  1.1475 + */
  1.1476 +RTestVclnt2SecDisplay* RTestVclnt2SecDisplay::NewL(const TDesC& aTestName, 
  1.1477 +                                                   const TDesC& aSectName,
  1.1478 +                                                   const TDesC& aKeyName, 
  1.1479 +                                                   TInt aExpectedError)
  1.1480 +    {
  1.1481 +    RTestVclnt2SecDisplay* self = new (ELeave) RTestVclnt2SecDisplay(aTestName, aSectName, aKeyName, aExpectedError);
  1.1482 +    return self;
  1.1483 +    }
  1.1484 +   
  1.1485 +/**
  1.1486 + * RTestVclnt2SecDisplay::DoTestStepPreambleL
  1.1487 + */
  1.1488 +TVerdict RTestVclnt2SecDisplay::DoTestStepPreambleL()
  1.1489 +    {
  1.1490 +    TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();    
  1.1491 +    if (verdict == EPass)
  1.1492 +        {
  1.1493 +        // make a 2nd device for this session
  1.1494 +        iSecondScreen = new (ELeave) CWsScreenDevice(iWs); 
  1.1495 +        User::LeaveIfError(iSecondScreen->Construct()); 
  1.1496 +        }
  1.1497 +    
  1.1498 +    return verdict;
  1.1499 +    }
  1.1500 +
  1.1501 +/**
  1.1502 + * RTestVclnt2SecDisplay::DoTestStepPostambleL
  1.1503 + */
  1.1504 +TVerdict RTestVclnt2SecDisplay::DoTestStepPostambleL()
  1.1505 +    {
  1.1506 +    delete iSecondScreen;
  1.1507 +    
  1.1508 +    return EPass;
  1.1509 +    }
  1.1510 +
  1.1511 +/**
  1.1512 + * RTestVclnt2SecDisplay::HandlePrepareCompleteL
  1.1513 + */
  1.1514 +void RTestVclnt2SecDisplay::HandlePrepareCompleteL()
  1.1515 +	{
  1.1516 +	// Add display window using default values - ie. video extent & window clipping 
  1.1517 +	// defaulted to whole window
  1.1518 +	INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
  1.1519 +	iVideoPlayer2->AddDisplayWindowL(iWs, *iSecondScreen, *iWindow);
  1.1520 +
  1.1521 +    // trigger the video to start playing                
  1.1522 +    StartPlayback();
  1.1523 +	}
  1.1524 +
  1.1525 +
  1.1526 +//
  1.1527 +// RTestVclnt2CropRectPause
  1.1528 +//
  1.1529 +/**
  1.1530 + * RTestVclnt2CropRectPause::Constructor
  1.1531 + */
  1.1532 +RTestVclnt2CropRectPause::RTestVclnt2CropRectPause(const TDesC& aTestName, 
  1.1533 +                                                   const TDesC& aSectName, 
  1.1534 +                                                   const TDesC& aKeyName, 
  1.1535 +                                                   TInt aExpectedError)
  1.1536 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
  1.1537 +    {
  1.1538 +    }
  1.1539 +
  1.1540 +/**
  1.1541 + * RTestVclnt2CropRectPause::NewL
  1.1542 + */
  1.1543 +RTestVclnt2CropRectPause* RTestVclnt2CropRectPause::NewL(const TDesC& aTestName, 
  1.1544 +                                                         const TDesC& aSectName,
  1.1545 +                                                         const TDesC& aKeyName, 
  1.1546 +                                                         TInt aExpectedError)
  1.1547 +    {
  1.1548 +    RTestVclnt2CropRectPause* self 
  1.1549 +        = new (ELeave) RTestVclnt2CropRectPause(aTestName, aSectName, aKeyName, aExpectedError);
  1.1550 +    return self;
  1.1551 +    }
  1.1552 +	
  1.1553 +/**
  1.1554 + * RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL
  1.1555 + */
  1.1556 +void RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
  1.1557 +    {    
  1.1558 +    TRect cropRegion;
  1.1559 +	aPlayer.GetCropRegionL(cropRegion);
  1.1560 +	
  1.1561 +	// change the crop region and continue to play the clip
  1.1562 +	cropRegion.SetHeight(cropRegion.Height() / 2);
  1.1563 +    aPlayer.SetCropRegionL(cropRegion);    
  1.1564 +    }
  1.1565 +    
  1.1566 +    
  1.1567 +    
  1.1568 +//
  1.1569 +// RTestVclnt2Overlay
  1.1570 +//
  1.1571 +/**
  1.1572 + * RTestVclnt2Overlay::Constructor
  1.1573 + */
  1.1574 +RTestVclnt2Overlay::RTestVclnt2Overlay(const TDesC& aTestName,
  1.1575 +                                       const TDesC& aSectName,
  1.1576 +                                       const TDesC& aKeyName, 
  1.1577 +                                       TInt aExpectedError)
  1.1578 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1579 +    {
  1.1580 +    }
  1.1581 +
  1.1582 +/**
  1.1583 + * RTestVclnt2Overlay::NewL
  1.1584 + */
  1.1585 +RTestVclnt2Overlay* RTestVclnt2Overlay::NewL(const TDesC& aTestName, 
  1.1586 +                                             const TDesC& aSectName,
  1.1587 +                                             const TDesC& aKeyName, 
  1.1588 +                                             TInt aExpectedError)
  1.1589 +    {
  1.1590 +    RTestVclnt2Overlay* self = new (ELeave) RTestVclnt2Overlay(aTestName, 
  1.1591 +                                                               aSectName, 
  1.1592 +                                                               aKeyName, 
  1.1593 +                                                               aExpectedError);
  1.1594 +    return self;
  1.1595 +    }
  1.1596 +
  1.1597 +/**
  1.1598 + * RTestVclnt2Overlay::DoTestStepPreambleL
  1.1599 + */
  1.1600 +TVerdict RTestVclnt2Overlay::DoTestStepPreambleL()
  1.1601 +    {
  1.1602 +    TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();    
  1.1603 +    if (verdict == EPass)
  1.1604 +        {
  1.1605 +        TFontSpec fontSpec; // use default fonts
  1.1606 +        fontSpec.iHeight = 20;
  1.1607 +
  1.1608 +        // Get a font to draw overlay text
  1.1609 +        if (iScreen->GetNearestFontToDesignHeightInPixels(iFont, fontSpec) != KErrNone)
  1.1610 +            {
  1.1611 +            // if no font can be retrieved, abort the test
  1.1612 +            ERR_PRINTF1(_L("Cannot retrieve font to perform test.  Test aborted."));
  1.1613 +            
  1.1614 +    		return EInconclusive;
  1.1615 +            }
  1.1616 +
  1.1617 +        iGc->Activate(*iWindow);
  1.1618 +        iGc->UseFont(iFont);
  1.1619 +        }
  1.1620 +    
  1.1621 +    return verdict;
  1.1622 +    }
  1.1623 +
  1.1624 +/**
  1.1625 + * RTestVclnt2Overlay::DoTestStepPostambleL
  1.1626 + */
  1.1627 +TVerdict RTestVclnt2Overlay::DoTestStepPostambleL()
  1.1628 +    {
  1.1629 +    iGc->DiscardFont();    
  1.1630 +    iGc->Deactivate();                    
  1.1631 +               
  1.1632 +    return RTestVclnt2PlayFile::DoTestStepPostambleL();        
  1.1633 +    }
  1.1634 +
  1.1635 +/**
  1.1636 + * RTestVclnt2Overlay::HandlePrepareCompleteL
  1.1637 + */
  1.1638 +void RTestVclnt2Overlay::HandlePrepareCompleteL()
  1.1639 +	{
  1.1640 +    TRect rect(iWindow->Size());
  1.1641 +    TInt baseline = (rect.Height() + iFont->AscentInPixels()) >> 1;
  1.1642 +    
  1.1643 +    // Draw the overlay text if needed
  1.1644 +    iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
  1.1645 +    iGc->SetBrushColor(KRgbRed);
  1.1646 +         
  1.1647 +    iGc->SetPenStyle(CGraphicsContext::ESolidPen);
  1.1648 +    iGc->SetPenColor(KRgbBlue);
  1.1649 +    
  1.1650 +    iGc->DrawText(_L("Overlay Testing"), rect, baseline, CGraphicsContext::ELeft);
  1.1651 +
  1.1652 +    // setup the display window and trigger the video to start playing
  1.1653 +    RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.1654 +	}
  1.1655 +	
  1.1656 +
  1.1657 +//
  1.1658 +// RTestVclnt2AddWin2
  1.1659 +//
  1.1660 +
  1.1661 +/**
  1.1662 + * RTestVclnt2AddWin2::Constructor
  1.1663 + */
  1.1664 +RTestVclnt2AddWin2::RTestVclnt2AddWin2(const TDesC& aTestName,
  1.1665 +                                       const TDesC& aSectName,
  1.1666 +                                       const TDesC& aKeyName, 
  1.1667 +                                       TInt aExpectedError)
  1.1668 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1669 +    {
  1.1670 +    }
  1.1671 +
  1.1672 +/**
  1.1673 + * RTestVclnt2AddWin2::NewL
  1.1674 + */
  1.1675 +RTestVclnt2AddWin2* RTestVclnt2AddWin2::NewL(const TDesC& aTestName, 
  1.1676 +                                             const TDesC& aSectName,
  1.1677 +                                             const TDesC& aKeyName, 
  1.1678 +                                             TInt aExpectedError)
  1.1679 +    {
  1.1680 +    RTestVclnt2AddWin2* self = new (ELeave) RTestVclnt2AddWin2(aTestName, 
  1.1681 +                                                               aSectName, 
  1.1682 +                                                               aKeyName, 
  1.1683 +                                                               aExpectedError);
  1.1684 +    return self;
  1.1685 +    }
  1.1686 +
  1.1687 +/**
  1.1688 + * RTestVclnt2AddWin2::HandlePrepareCompleteL
  1.1689 + */
  1.1690 +void RTestVclnt2AddWin2::HandlePrepareCompleteL()
  1.1691 +	{
  1.1692 +    // add the display window for the player to use for displaying the video
  1.1693 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
  1.1694 +    
  1.1695 +    // Add the same display window again
  1.1696 +    TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
  1.1697 +    if (err != iTestExpectedError)
  1.1698 +        {
  1.1699 +        ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error.  Test failed."));
  1.1700 +
  1.1701 +		iTestStepResult = EFail;
  1.1702 +		CActiveScheduler::Stop();
  1.1703 +
  1.1704 +		return;
  1.1705 +        }
  1.1706 +    else
  1.1707 +        {
  1.1708 +        INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error.  Test continues."));
  1.1709 +
  1.1710 +        // reset the expected error.  Any error that appears after this should fail the test
  1.1711 +        iTestExpectedError = KErrNone;        
  1.1712 +        }
  1.1713 +
  1.1714 +    // trigger the video to start playing
  1.1715 +    StartPlayback();
  1.1716 +	}
  1.1717 +
  1.1718 +//
  1.1719 +// RTestVclnt2AddWin2WithSettings
  1.1720 +//
  1.1721 +
  1.1722 +/**
  1.1723 + * RTestVclnt2AddWin2WithSettings::Constructor
  1.1724 + */
  1.1725 +RTestVclnt2AddWin2WithSettings::RTestVclnt2AddWin2WithSettings(const TDesC& aTestName,
  1.1726 +                                                               const TDesC& aSectName,
  1.1727 +                                                               const TDesC& aKeyName, 
  1.1728 +                                                               TInt aExpectedError)
  1.1729 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1730 +    {
  1.1731 +    }
  1.1732 +
  1.1733 +/**
  1.1734 + * RTestVclnt2AddWin2WithSettings::NewL
  1.1735 + */
  1.1736 +RTestVclnt2AddWin2WithSettings* RTestVclnt2AddWin2WithSettings::NewL(const TDesC& aTestName, 
  1.1737 +                                                                     const TDesC& aSectName,
  1.1738 +                                                                     const TDesC& aKeyName,     
  1.1739 +                                                                     TInt aExpectedError)
  1.1740 +    {
  1.1741 +    RTestVclnt2AddWin2WithSettings* self = new (ELeave) RTestVclnt2AddWin2WithSettings(aTestName, 
  1.1742 +                                                                                       aSectName, 
  1.1743 +                                                                                       aKeyName, 
  1.1744 +                                                                                       aExpectedError);
  1.1745 +    return self;
  1.1746 +    }
  1.1747 +
  1.1748 +/**
  1.1749 + * RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL
  1.1750 + */
  1.1751 +void RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL()
  1.1752 +	{
  1.1753 +	TRect windowRect(iWindow->Size());
  1.1754 +	windowRect.SetHeight(windowRect.Height() / 2);
  1.1755 +
  1.1756 +	iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, windowRect, windowRect);
  1.1757 +
  1.1758 +	// Add the same display window again with default values
  1.1759 +	TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
  1.1760 +	if (err != iTestExpectedError)
  1.1761 +	    {
  1.1762 +	    ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error.  Test failed."));
  1.1763 +
  1.1764 +		iTestStepResult = EFail;
  1.1765 +		CActiveScheduler::Stop();
  1.1766 +
  1.1767 +		return;
  1.1768 +	    }
  1.1769 +    else
  1.1770 +        {
  1.1771 +        INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error.  Test continues."));
  1.1772 +
  1.1773 +        // reset the expected error.  Any error that appears after this should fail the test
  1.1774 +        iTestExpectedError = KErrNone;
  1.1775 +	    }
  1.1776 +
  1.1777 +	// trigger the video to start playing
  1.1778 +    StartPlayback();
  1.1779 +	}
  1.1780 +
  1.1781 +//
  1.1782 +// RTestVclnt2ContOffset
  1.1783 +//
  1.1784 +
  1.1785 +/**
  1.1786 + * RTestVclnt2ContOffset::Constructor
  1.1787 + */
  1.1788 +RTestVclnt2ContOffset::RTestVclnt2ContOffset(const TDesC& aTestName, 
  1.1789 +                                             const TDesC& aSectName, 
  1.1790 +                                             const TDesC& aKeyName, 
  1.1791 +                                             TInt aExpectedError)
  1.1792 +    : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.1793 +    {
  1.1794 +    iHeapSize = 2000000; //~2MB
  1.1795 +    }
  1.1796 +
  1.1797 +/**
  1.1798 + * RTestVclnt2ContOffset::NewL
  1.1799 + */
  1.1800 +RTestVclnt2ContOffset* RTestVclnt2ContOffset::NewL(const TDesC& aTestName, 
  1.1801 +                                                   const TDesC& aSectName,
  1.1802 +                                                   const TDesC& aKeyName, 
  1.1803 +                                                   TInt aExpectedError)
  1.1804 +    {
  1.1805 +    RTestVclnt2ContOffset* self = new (ELeave) RTestVclnt2ContOffset(aTestName, 
  1.1806 +                                                                     aSectName, 
  1.1807 +                                                                     aKeyName, 
  1.1808 +                                                                     aExpectedError);
  1.1809 +    return self;
  1.1810 +    }
  1.1811 +
  1.1812 +/**
  1.1813 + * RTestVclnt2ContOffset::HandlePrepareCompleteL
  1.1814 + */
  1.1815 +void RTestVclnt2ContOffset::HandlePrepareCompleteL()
  1.1816 +	{
  1.1817 +    // call parent's HandlePrepareCompleteL to finish off all preparation    
  1.1818 +	RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.1819 +    // Set the content offset before starting to play the video.
  1.1820 +    INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
  1.1821 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
  1.1822 +    
  1.1823 +    if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0409")) == 0)
  1.1824 +        {
  1.1825 +        // Set the content alignment after setting the content offset
  1.1826 +        iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
  1.1827 +        }
  1.1828 +	}
  1.1829 +
  1.1830 +//
  1.1831 +// RTestVclnt2ContOffsetAtPlay
  1.1832 +//
  1.1833 +/**
  1.1834 + * RTestVclnt2ContOffsetAtPlay::Constructor
  1.1835 + */
  1.1836 +RTestVclnt2ContOffsetAtPlay::RTestVclnt2ContOffsetAtPlay(const TDesC& aTestName, 
  1.1837 +                                                         const TDesC& aSectName, 
  1.1838 +                                                         const TDesC& aKeyName, 
  1.1839 +                                                         TInt aExpectedError)
  1.1840 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
  1.1841 +    {
  1.1842 +    iHeapSize = 2000000; //~2MB
  1.1843 +    }
  1.1844 +
  1.1845 +/**
  1.1846 + * RTestVclnt2ContOffsetAtPlay::NewL
  1.1847 + */
  1.1848 +RTestVclnt2ContOffsetAtPlay* RTestVclnt2ContOffsetAtPlay::NewL(const TDesC& aTestName, 
  1.1849 +                                                               const TDesC& aSectName,
  1.1850 +                                                               const TDesC& aKeyName, 
  1.1851 +                                                               TInt aExpectedError)
  1.1852 +    {
  1.1853 +    RTestVclnt2ContOffsetAtPlay* self = new (ELeave) RTestVclnt2ContOffsetAtPlay(aTestName, 
  1.1854 +                                                                                 aSectName, 
  1.1855 +                                                                                 aKeyName, 
  1.1856 +                                                                                 aExpectedError);
  1.1857 +    return self;
  1.1858 +    }
  1.1859 +        
  1.1860 +/**
  1.1861 + * RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL
  1.1862 + */
  1.1863 +void RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
  1.1864 +    {
  1.1865 +    // Change the scale factor during playback
  1.1866 +	INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
  1.1867 +	iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 10, 10);    
  1.1868 +    }
  1.1869 +
  1.1870 +
  1.1871 +//
  1.1872 +// RTestVclnt2Align
  1.1873 +//
  1.1874 +/**
  1.1875 + * RTestVclnt2Align::Constructor
  1.1876 + */
  1.1877 +RTestVclnt2Align::RTestVclnt2Align(const TDesC& aTestName, 
  1.1878 +                                   const TDesC& aSectName, 
  1.1879 +                                   const TDesC& aKeyName, 
  1.1880 +                                   TInt aExpectedError)
  1.1881 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
  1.1882 +    {
  1.1883 +    iHeapSize = 2000000; //~2MB
  1.1884 +    }
  1.1885 +
  1.1886 +/**
  1.1887 + * RTestVclnt2Align::NewL
  1.1888 + */
  1.1889 +RTestVclnt2Align* RTestVclnt2Align::NewL(const TDesC& aTestName, 
  1.1890 +                                         const TDesC& aSectName,
  1.1891 +                                         const TDesC& aKeyName, 
  1.1892 +                                         TInt aExpectedError)
  1.1893 +    {
  1.1894 +    RTestVclnt2Align* self = new (ELeave) RTestVclnt2Align(aTestName, aSectName, aKeyName, aExpectedError);
  1.1895 +    return self;
  1.1896 +    }
  1.1897 +
  1.1898 +/**
  1.1899 + * RTestVclnt2Align::HandlePrepareCompleteL
  1.1900 + */ 
  1.1901 +void RTestVclnt2Align::HandlePrepareCompleteL()
  1.1902 +    {
  1.1903 +    // Continue to setup the video utility and then trigger playback
  1.1904 +    RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.1905 +	// Set the content offset before starting to play the video.
  1.1906 +    INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
  1.1907 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
  1.1908 +    }
  1.1909 +    
  1.1910 +/**
  1.1911 + * RTestVclnt2Align::DoThisActionDuringPlaybackL
  1.1912 + */
  1.1913 +void RTestVclnt2Align::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
  1.1914 +    {    
  1.1915 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignCenter);    
  1.1916 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1917 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 3, 4, 220));        
  1.1918 +    
  1.1919 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignCenter);    
  1.1920 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1921 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);        
  1.1922 +        
  1.1923 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignTop);    
  1.1924 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1925 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 5, 5, 200));        
  1.1926 +    
  1.1927 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
  1.1928 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1929 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);        
  1.1930 +    
  1.1931 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignTop);
  1.1932 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1933 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 5, 200));        
  1.1934 +        
  1.1935 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignBottom);
  1.1936 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1937 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);        
  1.1938 +    
  1.1939 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignBottom);
  1.1940 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1941 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 300, 230));        
  1.1942 +    
  1.1943 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignBottom);
  1.1944 +    iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.1945 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);        
  1.1946 +    }
  1.1947 +
  1.1948 +
  1.1949 +//
  1.1950 +// RTestVclnt2AutoScale
  1.1951 +//
  1.1952 +/**
  1.1953 + * RTestVclnt2AutoScale::Constructor
  1.1954 + */
  1.1955 +RTestVclnt2AutoScale::RTestVclnt2AutoScale(const TDesC& aTestName, 
  1.1956 +                                           const TDesC& aSectName, 
  1.1957 +                                           const TDesC& aKeyName, 
  1.1958 +                                           TInt aExpectedError)
  1.1959 +    : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
  1.1960 +    {
  1.1961 +    iHeapSize = 2000000; //~2MB
  1.1962 +    }
  1.1963 +
  1.1964 +/**
  1.1965 + * RTestVclnt2AutoScale::NewL
  1.1966 + */
  1.1967 +RTestVclnt2AutoScale* RTestVclnt2AutoScale::NewL(const TDesC& aTestName, 
  1.1968 +                                                 const TDesC& aSectName,
  1.1969 +                                                 const TDesC& aKeyName, 
  1.1970 +                                                 TInt aExpectedError)
  1.1971 +    {
  1.1972 +    RTestVclnt2AutoScale* self = new (ELeave) RTestVclnt2AutoScale(aTestName, aSectName, aKeyName, aExpectedError);
  1.1973 +    return self;
  1.1974 +    }
  1.1975 +
  1.1976 +/**
  1.1977 + * RTestVclnt2AutoScale::HandlePrepareCompleteL
  1.1978 + */ 
  1.1979 +void RTestVclnt2AutoScale::HandlePrepareCompleteL()
  1.1980 +    {
  1.1981 +    iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
  1.1982 +	// Set the content offset before starting to play the video.
  1.1983 +    INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
  1.1984 +    iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleClip);
  1.1985 +    
  1.1986 +    // trigger the video to start playing                
  1.1987 +    StartPlayback();
  1.1988 +    }
  1.1989 +	
  1.1990 +/**
  1.1991 + * RTestVclnt2AutoScale::DoThisActionDuringPlaybackL
  1.1992 + */
  1.1993 +void RTestVclnt2AutoScale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
  1.1994 +    {    
  1.1995 +	aPlayer.SetAutoScaleL(*iWindow, EAutoScaleBestFit);
  1.1996 +	aPlayer.SetAutoScaleL(*iWindow, EAutoScaleNone);
  1.1997 +	aPlayer.SetAutoScaleL(*iWindow, EAutoScaleStretch);
  1.1998 +    }
  1.1999 +
  1.2000 +//
  1.2001 +// RTestVclnt2OldController
  1.2002 +//
  1.2003 +
  1.2004 +RTestVclnt2OldController::RTestVclnt2OldController(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2005 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2006 +	{
  1.2007 +	}
  1.2008 +
  1.2009 +/**
  1.2010 + * RTestVclnt2OldController::NewL
  1.2011 + */
  1.2012 +RTestVclnt2OldController* RTestVclnt2OldController::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2013 +    {
  1.2014 +    RTestVclnt2OldController* self = new (ELeave) RTestVclnt2OldController(aTestName, aSectName, aKeyName, aExpectedError);
  1.2015 +    return self;
  1.2016 +    }
  1.2017 +
  1.2018 +void RTestVclnt2OldController::HandleIdleL()
  1.2019 +	{
  1.2020 +	// Open iVideoPlayer using a controller that does not support surfaces. 
  1.2021 +    INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
  1.2022 +    iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviNonGcePlayControllerUid);
  1.2023 +    PrepareState(EVPOpenComplete, KErrNone);
  1.2024 +	}
  1.2025 +
  1.2026 +void RTestVclnt2OldController::HandlePrepareCompleteL()
  1.2027 +	{
  1.2028 +	TRAPD(err, RTestVclnt2PlayFile::HandlePrepareCompleteL());
  1.2029 +	
  1.2030 +	if (err != KErrNotSupported)
  1.2031 +		{
  1.2032 +		ERR_PRINTF1(_L("AddDisplay did not leave with KErrNotSupported."));
  1.2033 +		iTestStepResult = EFail;
  1.2034 +		}
  1.2035 +	else
  1.2036 +		{
  1.2037 +		iTestStepResult = EPass;
  1.2038 +		}
  1.2039 +	
  1.2040 +	// Stop the test.
  1.2041 +	CActiveScheduler::Stop();
  1.2042 +	}
  1.2043 +//
  1.2044 +// RTestVclnt2NoFile
  1.2045 +//
  1.2046 +
  1.2047 +RTestVclnt2NoFile::RTestVclnt2NoFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2048 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2049 +	{
  1.2050 +	}
  1.2051 +
  1.2052 +/**
  1.2053 + * RTestVclnt2NoFile::NewL
  1.2054 + */
  1.2055 +RTestVclnt2NoFile* RTestVclnt2NoFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2056 +    {
  1.2057 +    RTestVclnt2NoFile* self = new (ELeave) RTestVclnt2NoFile(aTestName, aSectName, aKeyName, aExpectedError);
  1.2058 +    return self;
  1.2059 +    }
  1.2060 +
  1.2061 +void RTestVclnt2NoFile::HandleIdleL()
  1.2062 +	{
  1.2063 +	iTestStepResult = EFail;
  1.2064 +	TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
  1.2065 +	
  1.2066 +	if (err != iTestExpectedError)
  1.2067 +		{
  1.2068 +		ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
  1.2069 +		User::Leave(KErrGeneral);
  1.2070 +		}
  1.2071 +	
  1.2072 +	TSize windowSize = iWindow->Size();
  1.2073 +	TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
  1.2074 +	TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
  1.2075 +	TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect));
  1.2076 +	
  1.2077 +	if (err != iTestExpectedError)
  1.2078 +		{
  1.2079 +		ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
  1.2080 +		User::Leave(KErrGeneral);
  1.2081 +		}
  1.2082 +	
  1.2083 +	TRAP(err, iVideoPlayer2->SetWindowClipRectL(*iWindow, windowClipRect));
  1.2084 +	
  1.2085 +	if (err != iTestExpectedError)
  1.2086 +		{
  1.2087 +		ERR_PRINTF1(_L("SetWindowClipRectL did not leave with KErrNotReady."));
  1.2088 +		User::Leave(KErrGeneral);
  1.2089 +		}
  1.2090 +	
  1.2091 +	TRAP(err, iVideoPlayer2->SetVideoExtentL(*iWindow, videoExtent));
  1.2092 +	
  1.2093 +	if (err != iTestExpectedError)
  1.2094 +		{
  1.2095 +		ERR_PRINTF1(_L("SetVideoExtentL did not leave with KErrNotReady."));
  1.2096 +		User::Leave(KErrGeneral);
  1.2097 +		}
  1.2098 +	
  1.2099 +	// reset the expected error to KErrNone as any error happens after this is unexpected
  1.2100 +    iTestExpectedError = KErrNone;	
  1.2101 +	
  1.2102 +	// The video should still play when we try to play the video.  Perform 
  1.2103 +	// the basic play test now.
  1.2104 +	RTestVclnt2PlayFile::HandleIdleL();
  1.2105 +	}
  1.2106 +
  1.2107 +//
  1.2108 +// RTestVclnt2PlayAfterRemoveWin
  1.2109 +//
  1.2110 +
  1.2111 +RTestVclnt2PlayAfterRemoveWin::RTestVclnt2PlayAfterRemoveWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2112 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2113 +	{
  1.2114 +	}
  1.2115 +
  1.2116 +/**
  1.2117 + * RTestVclnt2PlayAfterRemoveWin::NewL
  1.2118 + */
  1.2119 +RTestVclnt2PlayAfterRemoveWin* RTestVclnt2PlayAfterRemoveWin::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2120 +    {
  1.2121 +    RTestVclnt2PlayAfterRemoveWin* self = new (ELeave) RTestVclnt2PlayAfterRemoveWin(aTestName, aSectName, aKeyName, aExpectedError);
  1.2122 +    return self;
  1.2123 +    }
  1.2124 +
  1.2125 +void RTestVclnt2PlayAfterRemoveWin::HandlePrepareCompleteL()
  1.2126 +	{
  1.2127 +	// Don't add a window. Just play the video.
  1.2128 +	StartPlayback();
  1.2129 +	}
  1.2130 +
  1.2131 +void RTestVclnt2PlayAfterRemoveWin::HandlePlayCompleteL()
  1.2132 +	{
  1.2133 +	switch(iPlayAttempt)
  1.2134 +		{
  1.2135 +	case 0:
  1.2136 +		{
  1.2137 +		TSize windowSize = iWindow->Size();
  1.2138 +		TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
  1.2139 +		TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
  1.2140 +		iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect);
  1.2141 +		iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.2142 +		iVideoPlayer2->Play();
  1.2143 +		PrepareState(EVPPlayComplete, KErrNone);
  1.2144 +		break;
  1.2145 +		}
  1.2146 +	case 1:
  1.2147 +		// Removing the window again should have no effect.
  1.2148 +		iVideoPlayer2->RemoveDisplayWindow(*iWindow);
  1.2149 +		iVideoPlayer2->Play();
  1.2150 +		PrepareState(EVPPlayComplete, KErrNone);
  1.2151 +		break;
  1.2152 +	case 2:
  1.2153 +		// The previous play commands should have no effect when we try to add a 
  1.2154 +		// display window and render to surfaces. Use the base class to do this.
  1.2155 +		RTestVclnt2PlayFile::HandlePrepareCompleteL();
  1.2156 +		break;
  1.2157 +	default:
  1.2158 +		// Use the parent handler after we have tried the above play commands.
  1.2159 +		RTestVclnt2PlayFile::HandlePlayCompleteL();
  1.2160 +		break;
  1.2161 +		}
  1.2162 +	
  1.2163 +	iPlayAttempt++;
  1.2164 +	}
  1.2165 +
  1.2166 +//
  1.2167 +// RTestVclnt2NoGce
  1.2168 +//
  1.2169 +
  1.2170 +RTestVclnt2NoGce::RTestVclnt2NoGce(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2171 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2172 +	{
  1.2173 +	}
  1.2174 +
  1.2175 +/**
  1.2176 + * RTestVclnt2NoGce::NewL
  1.2177 + */
  1.2178 +RTestVclnt2NoGce* RTestVclnt2NoGce::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2179 +    {
  1.2180 +    RTestVclnt2NoGce* self = new (ELeave) RTestVclnt2NoGce(aTestName, aSectName, aKeyName, aExpectedError);
  1.2181 +    return self;
  1.2182 +    }
  1.2183 +
  1.2184 +void RTestVclnt2NoGce::HandleIdleL()
  1.2185 +	{
  1.2186 +	// Open iVideoPlayer
  1.2187 +    INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
  1.2188 +    iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
  1.2189 +    PrepareState(EVPOpenComplete, KErrNotSupported);
  1.2190 +	}
  1.2191 +
  1.2192 +void RTestVclnt2NoGce::HandleOpenCompleteL()
  1.2193 +	{
  1.2194 +	iTestStepResult = EPass;
  1.2195 +	CActiveScheduler::Stop();
  1.2196 +	}
  1.2197 +	
  1.2198 +//
  1.2199 +// RTestVclnt2Alloc
  1.2200 +//
  1.2201 +
  1.2202 +RTestVclnt2Alloc::RTestVclnt2Alloc(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2203 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2204 +	{
  1.2205 +	}
  1.2206 +
  1.2207 +/**
  1.2208 + * RTestVclnt2Alloc::NewL
  1.2209 + */
  1.2210 +RTestVclnt2Alloc* RTestVclnt2Alloc::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2211 +    {
  1.2212 +    RTestVclnt2Alloc* self = new (ELeave) RTestVclnt2Alloc(aTestName, aSectName, aKeyName, aExpectedError);
  1.2213 +    return self;
  1.2214 +    }
  1.2215 +
  1.2216 +TVerdict RTestVclnt2Alloc::DoTestStepPreambleL()
  1.2217 +	{
  1.2218 +    INFO_PRINTF1(_L("RTestVclnt2Alloc::DoTestStepPreambleL()"));
  1.2219 +        
  1.2220 +    // Call RTestMmfVclntAviStep::DoTestStepPreambleL instead of the immediate parent's 
  1.2221 +    // DoTestStepPreambleL as there is no need for CVideoPlayerUtility setup.
  1.2222 +    // Similarly, there is no need to initialize CVideoPlayerUtility2, as it will be
  1.2223 +    // created in each alloc iteration.
  1.2224 +    return RTestMmfVclntAviStep::DoTestStepPreambleL();
  1.2225 +	}
  1.2226 +
  1.2227 +TVerdict RTestVclnt2Alloc::PerformTestL()
  1.2228 +	{
  1.2229 +	iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
  1.2230 +	ResetState();
  1.2231 +	iError = KErrNone;
  1.2232 +	TVerdict result = RTestVclnt2AviPlayerStep::DoTestStepL();
  1.2233 +	delete iVideoPlayer2;
  1.2234 +	iVideoPlayer2 = NULL;
  1.2235 +	return result;
  1.2236 +	}
  1.2237 +
  1.2238 +/**
  1.2239 + * RTestVclnt2Alloc::DoTestStepL()
  1.2240 + */
  1.2241 +TVerdict RTestVclnt2Alloc::DoTestStepL()
  1.2242 +    {
  1.2243 +    TVerdict allocTestStepResult = EPass;
  1.2244 +    TInt err = KErrNone;
  1.2245 +    TBool result = EFalse;
  1.2246 +    
  1.2247 +    //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
  1.2248 +    if (PerformTestL() != EPass)
  1.2249 +        {
  1.2250 +        err = iError;
  1.2251 +        }
  1.2252 +
  1.2253 +    if (err != KErrNone)
  1.2254 +        {
  1.2255 +        INFO_PRINTF2(_L("Test error, returned error code =  %d"), err);
  1.2256 +        User::Leave(err);
  1.2257 +        }
  1.2258 +    else
  1.2259 +        {
  1.2260 +        //Check the iAllocTestStepResult
  1.2261 +        if (allocTestStepResult != EPass)
  1.2262 +            {
  1.2263 +            result = ETrue;
  1.2264 +            }
  1.2265 +        }    
  1.2266 +    
  1.2267 +    TInt failCount = 1;
  1.2268 +    TBool completed = EFalse;
  1.2269 +    allocTestStepResult = EPass;
  1.2270 +    TBool reachedEnd = EFalse;
  1.2271 +    for(;;)    
  1.2272 +        {
  1.2273 +        __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
  1.2274 +        __MM_HEAP_MARK;
  1.2275 +
  1.2276 +        //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
  1.2277 +        TVerdict verdict = EFail;
  1.2278 +        TRAP(err, verdict = PerformTestL());
  1.2279 +        if (err == KErrNone && verdict != EPass)
  1.2280 +            {
  1.2281 +            err = iError;
  1.2282 +            }
  1.2283 +
  1.2284 +        completed = EFalse;
  1.2285 +        if (err == KErrNone)
  1.2286 +            {
  1.2287 +            TAny* testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
  1.2288 +            if (testAlloc == NULL)
  1.2289 +                {
  1.2290 +                reachedEnd = ETrue;
  1.2291 +                failCount -= 1;
  1.2292 +                }
  1.2293 +            else
  1.2294 +                {
  1.2295 +                User::Free(testAlloc);    
  1.2296 +                }            
  1.2297 +            
  1.2298 +            //Check the iAllocTestStepResult
  1.2299 +            if (allocTestStepResult != EPass)
  1.2300 +                {
  1.2301 +                result = ETrue;
  1.2302 +                }
  1.2303 +            
  1.2304 +            completed = reachedEnd || result;
  1.2305 +            }
  1.2306 +        else if (err != KErrNoMemory) // bad error code
  1.2307 +            {
  1.2308 +            completed = ETrue;
  1.2309 +            result = EFail;
  1.2310 +            }            
  1.2311 +
  1.2312 +        __MM_HEAP_MARKEND;
  1.2313 +        __UHEAP_SETFAIL(RHeap::ENone, 0);
  1.2314 +
  1.2315 +        if (completed)
  1.2316 +            {
  1.2317 +            break; // exit loop
  1.2318 +            }
  1.2319 +
  1.2320 +        failCount++;
  1.2321 +        }
  1.2322 +
  1.2323 +    failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
  1.2324 +
  1.2325 +    if (err != KErrNone || result)
  1.2326 +        {
  1.2327 +        allocTestStepResult = EFail;
  1.2328 +        TBuf<80> format;
  1.2329 +        if (result)
  1.2330 +            {
  1.2331 +            format.Format(_L("  Bad result with %d memory allocations tested\n"), failCount);
  1.2332 +            }
  1.2333 +        else
  1.2334 +            {
  1.2335 +            format.Format(_L("  Error(%d) with %d memory allocations tested\n"), err, failCount);
  1.2336 +            }
  1.2337 +        Log(format);
  1.2338 +        }
  1.2339 +    else 
  1.2340 +        {
  1.2341 +        TBuf<80> format;
  1.2342 +        format.Format(_L("  Completed OK with %d memory allocations tested\n"), failCount);
  1.2343 +        Log(format);
  1.2344 +        }
  1.2345 +
  1.2346 +    return allocTestStepResult;
  1.2347 +    }
  1.2348 +
  1.2349 +//
  1.2350 +// RTestVclnt2InvalidScaleFactor
  1.2351 +//
  1.2352 +RTestVclnt2InvalidScaleFactor::RTestVclnt2InvalidScaleFactor(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2353 +	: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
  1.2354 +	{
  1.2355 +	}
  1.2356 +
  1.2357 +/**
  1.2358 + * RTestVclnt2InvalidScaleFactor::NewL
  1.2359 + */
  1.2360 +RTestVclnt2InvalidScaleFactor* RTestVclnt2InvalidScaleFactor::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2361 +    {
  1.2362 +    RTestVclnt2InvalidScaleFactor* self = new (ELeave) RTestVclnt2InvalidScaleFactor(aTestName, aSectName, aKeyName, aExpectedError);
  1.2363 +    return self;
  1.2364 +    }
  1.2365 +
  1.2366 +void RTestVclnt2InvalidScaleFactor::HandlePrepareCompleteL()
  1.2367 +	{
  1.2368 +	INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
  1.2369 +	iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
  1.2370 +
  1.2371 +	// Try to scale the video to an invalid values
  1.2372 +	TRAPD(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 0, 100));
  1.2373 +	if (err != KErrArgument)
  1.2374 +		{
  1.2375 +		User::Leave(err == KErrNone ? KErrGeneral : err); 
  1.2376 +		}
  1.2377 +	
  1.2378 +	TRAP(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 100, -100));
  1.2379 +	if (err != KErrArgument)
  1.2380 +		{
  1.2381 +		User::Leave(err == KErrNone ? KErrGeneral : err); 
  1.2382 +		}
  1.2383 +	
  1.2384 +	// trigger the video to start playing                
  1.2385 +    StartPlayback();
  1.2386 +	}