os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/teststepvclnt2crp.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/teststepvclnt2crp.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,144 @@
     1.4 +// Copyright (c) 2008-2009 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 "teststepvclnt2crp.h"
    1.20 +#include <graphics/surfaceconfiguration.h>
    1.21 +
    1.22 +const TInt KScreenNumber = 0;
    1.23 +
    1.24 +_LIT(KUseCRP, "UseCRP");
    1.25 +_LIT(KAddDisplay, "AddDisplay");
    1.26 +_LIT(KAddWindow, "AddWindow");
    1.27 +_LIT(Kfilename, "filename");
    1.28 +
    1.29 +RTestStepVclnt2CRP* RTestStepVclnt2CRP::NewL(const TDesC& aName)
    1.30 +	{
    1.31 +	RTestStepVclnt2CRP* self = new (ELeave) RTestStepVclnt2CRP(aName);
    1.32 +	return self;
    1.33 +	}
    1.34 +
    1.35 +RTestStepVclnt2CRP::RTestStepVclnt2CRP(const TDesC& aName) :
    1.36 +	RTestVclnt2PlayFile(aName, aName, Kfilename, KErrNone)
    1.37 +	{
    1.38 +	}
    1.39 +
    1.40 +RTestStepVclnt2CRP::~RTestStepVclnt2CRP()
    1.41 +	{	
    1.42 +	if (iSurfaceWindow)
    1.43 +		{	
    1.44 +		iSurfaceWindow->Close();
    1.45 +		}
    1.46 +
    1.47 +	delete iSurfaceWindow;
    1.48 +	}
    1.49 +
    1.50 +TVerdict RTestStepVclnt2CRP::DoTestStepPreambleL()
    1.51 +	{
    1.52 +	iTestStepResult = RTestVclnt2PlayFile::DoTestStepPreambleL();
    1.53 +
    1.54 +	if (iTestStepResult == EPass)
    1.55 +		{
    1.56 +		iTestStepResult = EFail;
    1.57 +		// Assume if values are not set to revert to defaults
    1.58 +		// e.g. EFalse default
    1.59 +		GetBoolFromConfig(iTestStepName, KUseCRP, iUseCRP);
    1.60 +		// EFalse default
    1.61 +		GetBoolFromConfig(iTestStepName, KAddDisplay, iAddDisplay);
    1.62 +		// EFalse default
    1.63 +		GetBoolFromConfig(iTestStepName, KAddWindow, iAddWindow);
    1.64 +
    1.65 +		iSurfaceWindow = new (ELeave) RWindow(iWs);
    1.66 +		// Don't use this but instead something 'unique' since this is used in the base class to
    1.67 +		// construct a window
    1.68 +		User::LeaveIfError(iSurfaceWindow->Construct(*iWindow, reinterpret_cast<TInt>(this + 3431)));
    1.69 +		iTestStepResult = EPass;
    1.70 +		}
    1.71 +
    1.72 +	return iTestStepResult;	
    1.73 +	}
    1.74 +
    1.75 +TVerdict RTestStepVclnt2CRP::DoTestStepPostambleL()
    1.76 +	{
    1.77 +	if (iSurfaceWindow)
    1.78 +		{
    1.79 +		iSurfaceWindow->Close();
    1.80 +		iSurfaceWindow = NULL;
    1.81 +		}
    1.82 +
    1.83 +	return RTestVclnt2PlayFile::DoTestStepPostambleL();	
    1.84 +	}
    1.85 +
    1.86 +void RTestStepVclnt2CRP::HandleOpenCompleteL()
    1.87 +	{
    1.88 +	if (!iAddWindow)
    1.89 +		{
    1.90 +		iVideoPlayer2->RemoveDisplayWindow(*iWindow);
    1.91 +		}
    1.92 +	
    1.93 +	if (iAddDisplay)
    1.94 +		{
    1.95 +		iVideoPlayer2->AddDisplayL(iWs, KScreenNumber, *this);
    1.96 +		}
    1.97 +
    1.98 +	RTestVclnt2PlayFile::HandleOpenCompleteL();
    1.99 +	}
   1.100 +
   1.101 +void RTestStepVclnt2CRP::MmsehSurfaceCreated(TInt aDisplayId, const TSurfaceId& aId, const TRect& aCropRect, TVideoAspectRatio /*aAspectRatio*/)
   1.102 +	{
   1.103 +	if (aDisplayId != KScreenNumber)
   1.104 +		{
   1.105 +		FailTest(_L("Mismatching display id provided to MmsehSurfaceCreated"));
   1.106 +		return;
   1.107 +		}
   1.108 +
   1.109 +	iSurfaceId = aId;
   1.110 +	iCropRect = aCropRect;	
   1.111 +
   1.112 +	const TRect windowSize(iSurfaceWindow->Size());
   1.113 +
   1.114 +	TSurfaceConfiguration config;
   1.115 +	config.SetSurfaceId(iSurfaceId);
   1.116 +	config.SetExtent(windowSize);
   1.117 +	config.SetViewport(iCropRect);
   1.118 +
   1.119 +	iSurfaceWindow->SetVisible(ETrue);
   1.120 +	iSurfaceWindow->SetBackgroundColor(TRgb(0, 0));
   1.121 +
   1.122 +	TRAP_IGNORE(iVideoPlayer2->SetRotationL(*iWindow, EVideoRotationClockwise90));
   1.123 +	TRAP_IGNORE(iVideoPlayer2->RotationL(*iWindow));
   1.124 +	TRAP_IGNORE(iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleBestFit));
   1.125 +
   1.126 +	iSurfaceWindow->SetBackgroundSurface(config, KScreenNumber);
   1.127 +	iSurfaceWindow->BeginRedraw();
   1.128 +	iSurfaceWindow->EndRedraw();
   1.129 +	}
   1.130 +
   1.131 +void RTestStepVclnt2CRP::MmsehSurfaceParametersChanged(const TSurfaceId& /*aId*/, const TRect& /*aCropRect*/, TVideoAspectRatio /*aAspectRatio*/)
   1.132 +	{
   1.133 +	FailTest(_L("Unexpected call to MmsehSurfaceParametersChanged"));
   1.134 +	}
   1.135 +
   1.136 +void RTestStepVclnt2CRP::MmsehRemoveSurface(const TSurfaceId& /*aId*/)
   1.137 +	{
   1.138 +	FailTest(_L("Unexpected call to MmsehRemoveSurface"));
   1.139 +	}
   1.140 +
   1.141 +void RTestStepVclnt2CRP::FailTest(const TDesC& aMessage)
   1.142 +	{
   1.143 +	ERR_PRINTF2(_L("%S"), &aMessage);
   1.144 +	iTestStepResult = EFail;
   1.145 +	iActiveScheduler->Stop();
   1.146 +	}
   1.147 +