windowing/windowserver/test/tauto/tcrpanim.h
changeset 103 2717213c588a
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // TCrpAnim.H Defines class CTCrpAnim
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #ifndef __TCRPANIM_H__
       
    25 #define __TCRPANIM_H__
       
    26 
       
    27 #include "AUTO.H"
       
    28 
       
    29 _LIT(KTCrpAnimStep,"TCrpAnim");
       
    30 
       
    31 namespace	//anonymous local scope
       
    32 	{
       
    33 	class CCrpAnim;
       
    34 	typedef  CCrpAnim CAnonAnimWindow;
       
    35 	class CActiveWait;
       
    36 	typedef  CActiveWait CAnonActiveWait;
       
    37 	}
       
    38 	
       
    39 class CTCrpAnim : public CTWsGraphicsBase
       
    40 	{
       
    41 public:
       
    42 	CTCrpAnim(CTestStep* aStep);
       
    43 	~CTCrpAnim();
       
    44 	void ConstructL();
       
    45 protected:
       
    46 	virtual void RunTestCaseL(TInt aCurTestCase);
       
    47 private:
       
    48 	// TAnimFrameResult is a struct designed to track the various frame results
       
    49 	// as the animation progresses. Once the animation is complete, TAnimFrameResult
       
    50 	// provides an easy to read indication as to the animation's performance
       
    51 	struct TAnimFrameResult
       
    52 		{
       
    53 		TInt iFrameOK;
       
    54 		TInt iFramePartial;
       
    55 		TInt iFrameIdentical;
       
    56 		TInt iFrameEmpty;
       
    57 		TInt iFrameTearing;
       
    58 		TInt iFrameSkipped;
       
    59 		};
       
    60 	void InvalidatePauseAndRedraw(const TRect &aRect,TTimeIntervalMicroSeconds32 aInterval);
       
    61 	void RedrawAndCheckWindows(TBool aBlankIt=EFalse);
       
    62 	void TestSpriteLoopL(TBool aAnimForeground,TBool aDrawForeground);
       
    63     void CheckAnimProgressedL(CAnonAnimWindow* aAnimWin, TInt aAdditionalFrameCount, TBool aCaptureFrameResult = ETrue);
       
    64 	TInt DetermineApproxFrameNum(CFbsBitmap* aBitmap, TBool aCaptureFrameResult);
       
    65 	void ResetFrameCounters();
       
    66 	TInt LogResults();
       
    67 // The tests
       
    68     void	TestSpriteInterruptsForegroundL();
       
    69     void	TestSpriteRestartInterruptsForegroundL();
       
    70 	void	BasicCRPDemo();
       
    71 	void	TestOverlappingWindowsL();
       
    72 	void	TestClippingWindowsL();
       
    73 	void	DemoClippingWindowsL();
       
    74 	void	TestInvalidateL();
       
    75 private:
       
    76 	CAnonAnimWindow *iTestWin;
       
    77 	CAnonAnimWindow *iOverWin;
       
    78 	CAnonAnimWindow *iRedrawWin;
       
    79 	CAnonAnimWindow *iBaseWin;
       
    80 	TInt iPreviousFrameNum;				// identifies the last successfully drawn frame number calculated
       
    81 	TInt iMinimumCalcRedLine;			// the calculated minimum length of the red line in the animation
       
    82 	TAnimFrameResult iFrameStatus;		// tracker for the performance of each animated frame
       
    83 	CActiveWait* iWaiter;				// active object with configurable timer
       
    84 	CWsGraphicBitmapAnimation* iAnim; 	// ptr to server-side animation object
       
    85 	CFbsBitmap* iScreenBitmap;			// bitmap holding screen snap-shot
       
    86 	HBufC8* iScanlineBuf;				// buffer holding pixel data on a single vertical scan line
       
    87 	};
       
    88 
       
    89 class CTCrpAnimStep : public CTGraphicsStep
       
    90 	{
       
    91 public:
       
    92 	CTCrpAnimStep();
       
    93 protected:
       
    94 	//from CTGraphicsStep
       
    95 	virtual CTGraphicsBase* CreateTestL();
       
    96 	};
       
    97 
       
    98 #endif  //__TCRPANIM_H__