First public contribution.
2 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
3 // All rights reserved.
4 // This component and the accompanying materials are made available
5 // under the terms of "Eclipse Public License v1.0"
6 // which accompanies this distribution, and is available
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
20 @internalComponent - Internal Symbian test code
23 #ifndef __TTEXTCURS_H__
24 #define __TTEXTCURS_H__
28 #include "../tlib/testbase.h"
30 #include "TGraphicsHarness.h"
33 * Wrapper class for a custom text cursor.
35 class CCustomTextCursor : public CBase
38 static CCustomTextCursor* CreateCustomTextCursorL(TInt aScreenNumber,TInt aBmpIndex,CTestBase* aTest);
42 CCustomTextCursor(CTestBase* aTest);
43 void ConstructL(TInt aScreenNumber,TInt aBmpIndex);
47 RArray<TSpriteMember> iSpriteMemberArray;
49 RWsSession::TCustomTextCursorAlignment iAlignment;
53 class CTCursorTest : public CTWsGraphicsBase
56 CTCursorTest(CTestStep* aStep);
60 virtual void RunTestCaseL(TInt aCurTestCase);
62 void SetCursor(const TPoint &aPos,const TSize &aSize,TRgb aColor, TUint aFlags=0);
63 void SetCursor(const TPoint &aPos,const TSize &aSize,TRgb aColor, const TRect &aRect, TUint aFlags=0);
64 void SetCursorPlusBox(const TPoint &aPos,const TSize &aSize,TRgb aColor, const TRect *aRect, TUint aFlags=0);
65 void CancelTextCursor();
67 void doMoveWindowTestL();
72 void MoveWindowTest1L();
73 void MoveWindowTest2L();
76 void CursorUpdatedBeforeWindowRenderedL();
79 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
80 void TextCursorNoFlashTestL();
81 void TextCursorFlashTestL();
82 void CheckCursorDoesNotFlash(const TSize& aSize);
83 void UpdateCountersOnCursorTransition(
84 const TBool aTransitionedToOn,
87 TTime& aLastDeltaTime,
88 TInt& aWarmUpIterations,
89 const TInt& aFlashChangeTime,
90 const TInt& aToleranceMargin,
92 TInt& aToleranceViolations
94 void CheckCursorDoesFlash(const TPoint& aPos, const TTextCursor& aTextCursor, TRgb aBackgroundColor);
95 void DrawTextCursorSimilarToRenderStage(CWindowGc& aGc, RWindow& aWin, const TPoint& aPos, const TTextCursor& aTextCursor);
97 TBool IncrementCursorType();
98 CTSprite* CreateTestSpriteLC(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aCount);
99 void TestForArtifacts(CBlankWindow* aWin1, TTextCursor& aCursor);
100 void CheckNoDoubleCursorTest1L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
101 void CheckNoDoubleCursorTest2L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
102 void CheckNoDoubleCursorTest3L(CBlankWindow* aWin1, CBlankWindow* win2, TTextCursor& aTextCursor,TTextCursor& aCustomCursor, CWindowGc* winGc);
103 void MakeCursors(TTextCursor& aTextCursor, TTextCursor& aCustomCursor);
104 void StartDoubleCursorTestL(TInt aTestNumber);
105 void doCheckNoDoubleCursor(CBlankWindow* aWin1,
107 const TPoint& aWin1Tl,
108 const TPoint& aWin1T2,
109 const TTextCursor& aCursor,
110 const TSize& aCursorSize,
111 CWsScreenDevice::TSpriteInCompare aFlags);
113 void ResetWindows(CWindowGc* aWinGc,CBlankWindow* aWin1,CBlankWindow* aWin2);
114 void ValidateWin(TestWindow *aWin, TRgb aColor);
115 void RedrawWin(RWindow &aWin, TRgb aColor);
116 void DeleteMoveWindows();
117 void ResetMoveWindowsL();
118 static TInt DoPanicTest(TInt aInt, TAny *aScreenNumber);
119 void TextCursorSetLCoverageTests();
125 CBlankWindow *iMoveWin;
126 CBlankWindow *iCheckWin;
127 CBlankWindow *iWorkInProgress;
128 CBlankWindow *iComparisonWindow;
129 TTextCursor::EType iCursorType;
130 static CTestBase* iStaticTest; // static because it is used by DoPanicTest
134 class CTCursorTestStep : public CTGraphicsStep
139 //from CTGraphicsStep
140 virtual CTGraphicsBase* CreateTestL();
143 _LIT(KTCursorTestStep,"TCursorTest");