os/mm/mmlibs/mmfw/tsrc/mmfunittest/videorenderer/inc/testrenderer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/videorenderer/inc/testrenderer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,134 @@
     1.4 +// Copyright (c) 2007-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 +#ifndef TESTRENDERER_H
    1.20 +#define TESTRENDERER_H
    1.21 +
    1.22 +#include <testframework.h>
    1.23 +#include <videorenderer.h>
    1.24 +
    1.25 +/* 
    1.26 +Basic test for video renderer in timed and non-timed mode 
    1.27 +MM-MMF-VIDREND-U-0002 and MM-MMF-VIDREND-U-0003
    1.28 +*/
    1.29 +class RTestRendererStep : public RTestStep, public MVideoRendererObserver
    1.30 +	{
    1.31 +public:
    1.32 +
    1.33 +	enum TTestRendererEvents
    1.34 +		{
    1.35 +		EStartTest,
    1.36 +		EBufferAvailable,
    1.37 +		EBufferDisplayed,
    1.38 +		EBufferSkipped,
    1.39 +		ETimerExpired
    1.40 +		};
    1.41 +
    1.42 +	enum TTestRendererState
    1.43 +		{
    1.44 +		EStateIdle,
    1.45 +		EStateCreate,
    1.46 +		EStateUpdate,
    1.47 +		EStateReleaseBuffer,
    1.48 +		EStateReplaceSurface,
    1.49 +		EStateUpdateAfterReplace
    1.50 +		};
    1.51 +
    1.52 +	static RTestRendererStep* NewL(const TDesC& aStepName, TBool aTimed);
    1.53 +
    1.54 +	// from MVideoRendererObserver
    1.55 +	void MvroVideoBufferAvailable();
    1.56 +	void MvroBufferDisplayed(TInt aBufferId, const TTime& aTime);
    1.57 +	void MvroBufferSkipped(TInt aBufferId);
    1.58 +
    1.59 +protected:
    1.60 +	RTestRendererStep(const TDesC& aStepName, TBool aTimed);
    1.61 +
    1.62 +	virtual void FsmL(TTestRendererEvents aEventCode);
    1.63 +    void InitWservL();
    1.64 +    void DeInitWserv();
    1.65 +    TInt SetBackgroundSurface(TSurfaceId& id);
    1.66 +    void RemoveBackgroundSurface();
    1.67 +    void EndTest(TVerdict aVerdict);
    1.68 +    void CreateRendererAndSurfaceL(TInt aNumBuffers);
    1.69 +    void CreateSurfaceL(TInt aNumBuffers);
    1.70 +    void GetNextBufferAndSubmitUpdateL(TInt aExpectedBufId, TRgb aColor, const TTime& aPresentationTime);
    1.71 +    TVideoFrameBuffer* GetNextBufferL(TInt aExpectedBufId, TRgb aColor);
    1.72 +    
    1.73 +	// from RTestStep
    1.74 +    TVerdict DoTestStepPreambleL();
    1.75 +    TVerdict DoTestStepPostambleL();
    1.76 +    TVerdict DoTestStepL();
    1.77 +
    1.78 +	
    1.79 +protected:
    1.80 +	CActiveScheduler* iActiveScheduler;
    1.81 +	TBool iActiveSchedulerStarted;
    1.82 +	CVideoRenderer* iVideoRenderer;
    1.83 +	TBool iTimed;
    1.84 +	TSurfaceId iSurfaceId;
    1.85 +
    1.86 +    // Surface creation parameter
    1.87 +	TSize iSize;
    1.88 +	TUncompressedVideoFormat iVideoFormat;
    1.89 +
    1.90 +    // Window server related objects
    1.91 +    RWsSession iWs;
    1.92 +    CWsScreenDevice* iScreen;
    1.93 +    RWindow* iWindow;
    1.94 +    RWindowGroup iRootWindow;
    1.95 +
    1.96 +	TTestRendererState iFsmState;
    1.97 +	TInt iBuffAvailCallback;
    1.98 +	TInt iBuffDisplayCallback;
    1.99 +	TInt iBuffSkipCallback;
   1.100 +	
   1.101 +    // values stored for Mvro callbacks
   1.102 +	TInt iBufferId;
   1.103 +	TTime iDisplayedTime;
   1.104 +	};
   1.105 +
   1.106 +/* 
   1.107 +Test replacing surface in timed and non-timed mode
   1.108 +MM-MMF-VIDREND-U-0010 and MM-MMF-VIDREND-U-0011
   1.109 +*/
   1.110 +class RTestRendererReplaceStep : public RTestRendererStep
   1.111 +	{
   1.112 +public:
   1.113 +	static RTestRendererReplaceStep* NewL(const TDesC& aStepName, TBool aTimed);
   1.114 +
   1.115 +protected:
   1.116 +	RTestRendererReplaceStep(const TDesC& aStepName, TBool aTimed);
   1.117 +	void FsmL(TTestRendererEvents aEventCode);
   1.118 +	void ReplaceSurfaceL();
   1.119 +	};
   1.120 +
   1.121 +/*
   1.122 +Timer callback class
   1.123 +*/
   1.124 +class CCallBackTimer : public CTimer
   1.125 +	{
   1.126 +public:
   1.127 +	static CCallBackTimer* NewL(TCallBack aCallBack, TPriority aPriority = EPriorityStandard);
   1.128 +
   1.129 +private:
   1.130 +	void RunL();
   1.131 +	CCallBackTimer(TCallBack aCallBack, TPriority aPriority);
   1.132 +
   1.133 +private:
   1.134 +	TCallBack iCallBack;
   1.135 +	};
   1.136 +
   1.137 +#endif // TESTRENDERER_H