sl@0: 
sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @test
sl@0:  @internalComponent - Internal Symbian test code
sl@0: */
sl@0: 
sl@0: #ifndef __TTEXTCURS_H__
sl@0: #define __TTEXTCURS_H__
sl@0: 
sl@0: #include <e32std.h>
sl@0: #include <w32std.h>
sl@0: #include "../tlib/testbase.h"
sl@0: #include "AUTO.H"
sl@0: #include "TGraphicsHarness.h"
sl@0: 
sl@0: /*
sl@0:  * Wrapper class for a custom text cursor.
sl@0:  */
sl@0: class CCustomTextCursor : public CBase
sl@0: 	{
sl@0: public:
sl@0: 	static CCustomTextCursor* CreateCustomTextCursorL(TInt aScreenNumber,TInt aBmpIndex,CTestBase* aTest);
sl@0: 	~CCustomTextCursor();
sl@0: 	
sl@0: private:
sl@0: 	CCustomTextCursor(CTestBase* aTest);
sl@0: 	void ConstructL(TInt aScreenNumber,TInt aBmpIndex);
sl@0: 	
sl@0: public:
sl@0: 	TInt iIdentifier;
sl@0: 	RArray<TSpriteMember> iSpriteMemberArray;
sl@0: 	TUint iSpriteFlags;
sl@0: 	RWsSession::TCustomTextCursorAlignment iAlignment;
sl@0: 	CTestBase* iTest;
sl@0: 	};
sl@0: 	
sl@0: class CTCursorTest : public CTWsGraphicsBase
sl@0: 	{
sl@0: public:
sl@0: 	CTCursorTest(CTestStep* aStep);
sl@0: 	~CTCursorTest();
sl@0: protected:
sl@0: //from 	CTGraphicsStep
sl@0: 	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0: private:
sl@0: 	void SetCursor(const TPoint &aPos,const TSize &aSize,TRgb aColor, TUint aFlags=0);
sl@0: 	void SetCursor(const TPoint &aPos,const TSize &aSize,TRgb aColor, const TRect &aRect, TUint aFlags=0);
sl@0: 	void SetCursorPlusBox(const TPoint &aPos,const TSize &aSize,TRgb aColor, const TRect *aRect, TUint aFlags=0);
sl@0: 	void CancelTextCursor();
sl@0: 	void ConstructL();
sl@0: 	void doMoveWindowTestL();
sl@0: 	TBool MoveWindow();
sl@0: 	void TestPanicsL();
sl@0: 	void ScrollTest();
sl@0: 	void GeneralTestsL();
sl@0: 	void MoveWindowTest1L();
sl@0: 	void MoveWindowTest2L();
sl@0: 	void INC041278L();
sl@0: 	void INC040489L();
sl@0: 	void CursorUpdatedBeforeWindowRenderedL();
sl@0: 	void INC097774();
sl@0: 	void INC117232();
sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0: 	void TextCursorNoFlashTestL();
sl@0: 	void TextCursorFlashTestL();
sl@0: 	void CheckCursorDoesNotFlash(const TSize& aSize);
sl@0: 	void UpdateCountersOnCursorTransition(
sl@0: 			const TBool	aTransitionedToOn,
sl@0: 			TTime& 		aNow,
sl@0: 			TInt64&		aDeltaTime,
sl@0: 			TTime&		aLastDeltaTime,
sl@0: 			TInt&		aWarmUpIterations,
sl@0: 			const TInt&	aFlashChangeTime,
sl@0: 			const TInt&	aToleranceMargin,
sl@0: 			TInt&		aSampleNumber,
sl@0: 			TInt&		aToleranceViolations
sl@0: 			);
sl@0: 	void CheckCursorDoesFlash(const TPoint& aPos, const TTextCursor& aTextCursor, TRgb aBackgroundColor);
sl@0: 	void DrawTextCursorSimilarToRenderStage(CWindowGc& aGc, RWindow& aWin, const TPoint& aPos, const TTextCursor& aTextCursor);
sl@0: #endif
sl@0: 	TBool IncrementCursorType();
sl@0: 	CTSprite* CreateTestSpriteLC(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aCount);
sl@0: 	void TestForArtifacts(CBlankWindow* aWin1, TTextCursor& aCursor);
sl@0: 	void CheckNoDoubleCursorTest1L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
sl@0: 	void CheckNoDoubleCursorTest2L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
sl@0: 	void CheckNoDoubleCursorTest3L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
sl@0: 	void MakeCursors(TTextCursor& aTextCursor, TTextCursor& aCustomCursor);										  
sl@0: 	void StartDoubleCursorTestL(TInt aTestNumber);
sl@0: 	void doCheckNoDoubleCursor(CBlankWindow* aWin1,
sl@0: 								CBlankWindow* aWin2,
sl@0: 								const TPoint& aWin1Tl,
sl@0: 								const TPoint& aWin1T2,
sl@0: 								const TTextCursor& aCursor,
sl@0: 								const TSize& aCursorSize,
sl@0: 								CWsScreenDevice::TSpriteInCompare aFlags);
sl@0: 	
sl@0: 	void ResetWindows(CWindowGc* aWinGc,CBlankWindow* aWin1,CBlankWindow* aWin2);
sl@0: 	void ValidateWin(TestWindow *aWin, TRgb aColor);
sl@0: 	void RedrawWin(RWindow &aWin, TRgb aColor);
sl@0: 	void DeleteMoveWindows();
sl@0: 	void ResetMoveWindowsL();
sl@0: 	static TInt DoPanicTest(TInt aInt, TAny *aScreenNumber);
sl@0: 	void TextCursorSetLCoverageTests();
sl@0: 	
sl@0: private:
sl@0: 	TSize iWinSize;
sl@0: 	TPoint iWinPos;
sl@0: 	TInt iWinState;
sl@0: 	CBlankWindow *iMoveWin;
sl@0: 	CBlankWindow *iCheckWin;
sl@0: 	CBlankWindow *iWorkInProgress;
sl@0: 	CBlankWindow *iComparisonWindow;
sl@0: 	TTextCursor::EType iCursorType;
sl@0: 	static CTestBase* iStaticTest;	// static because it is used by DoPanicTest
sl@0: 	};
sl@0: 
sl@0: 
sl@0: class CTCursorTestStep : public CTGraphicsStep
sl@0: 	{
sl@0: public:
sl@0: 	CTCursorTestStep();
sl@0: protected:	
sl@0: 	//from CTGraphicsStep
sl@0: 	virtual CTGraphicsBase* CreateTestL();
sl@0: 	};
sl@0: 
sl@0: _LIT(KTCursorTestStep,"TCursorTest");
sl@0: 
sl@0: 
sl@0: #endif