First public contribution.
1 // Copyright (c) 1996-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
22 #ifndef __TPOINTER_H__
23 #define __TPOINTER_H__
28 #include "../tlib/testbase.h"
30 #include "TGraphicsHarness.h"
35 class CPointerWindow : public CTWin
37 enum {KRepeatMargin=200000}; // 0.2 Seconds
38 enum {KRepeatCount=4};
39 enum {KRepeatIntervalIncrements=100000};
40 enum {KRepeatRectXExtra=50};
41 enum {KRepeatRectYExtra=50};
42 enum {KStateWaitingForTest1,KStateFailed,KStateTesting1,
43 KStateWaitingForTest2,KStateTesting2,
44 KStateWaitingForTest3,KStateTesting3,
45 KStateWaitingForTest4,KStateTesting4,
46 KStateWaitingForTest5,KStateTesting5,
47 KStateWaitingForTest6,KStateTesting6,
48 KStateWaitingForTest8,KStateTesting8,
49 KStateWaitingForTest7,KStateTesting7,
52 CPointerWindow(CTPointer *aTest);
53 void SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
55 void StartNextRepeatTest();
56 void QueueNextRepeat();
57 void PointerL(const TPointerEvent &aPointer,const TTime&);
58 void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
60 void SwitchOn(const TTime &);
61 void ResetTest(TInt aState);
62 void SetState(TInt aState);
64 void TestFailed(TBool aRetest=EFalse);
70 TTimeIntervalMicroSeconds32 iInterval;
77 class CGrabWindow2 : public CTWin
80 CGrabWindow2(CGrabWindow *aWindow);
81 void SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
84 void PointerL(const TPointerEvent &aPointer,const TTime&);
86 CGrabWindow *iGrabWindow;
89 class CGrabWindow : public CTWin
91 enum {KGrabStateWaitingForDown,KGrabStateWaitingForDragOut,KGrabStateWaitingForUp,KGrabStateFinished,
92 KGrabStateWaitingForDown2,KGrabStateWaitingForUp2a,KGrabStateWaitingForDrag2,KGrabStateWaitingForUp2b,
93 KGrabStateWaitingForDown3,KGrabStateWaitingForUp3a,KGrabStateWaitingForUp3b,
94 KGrabStateWaitingForDown4,KGrabStateWaitingForUp4,
95 KGrabStateWaitingForDown5,KGrabStateWaitingForUp5,KGrabStateWaitingForDrag5,
98 CGrabWindow(CTPointer *aTest);
99 void Pointer2(const TPointerEvent &aPointer);
100 void SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
101 void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
104 void SetState(TInt aState);
106 void PointerL(const TPointerEvent &aPointer,const TTime&);
108 void FinishedTests();
118 class CTPointer : public CTWsGraphicsBase
121 enum {KTimeOutAfter=20000000}; //20secs
123 CTPointer(CTestStep* aStep);
127 TBool TestFailed(TInt aCase,TBool aRetry=EFalse);
128 void StartGrabTestL();
129 static TInt TimeOut(TAny* aTest);
131 CGrabWindow2 *GrabWin2() const;
132 inline TBool Digitiser() const {return !iNoDigitiser;}
133 inline void SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY){iTest->SimulatePointer(aType, aX, aY);}
134 inline void SimulateEvent(TRawEvent::TType aType){iTest->SimulateEvent(aType);}
136 virtual void RunTestCaseL(TInt aCurTestCase);
138 TInt doTestFailedL();
139 inline TestClient* Client() {return TheClient;}
145 CPointerWindow *iRepeatWin;
146 CGrabWindow *iGrabWin;
147 CGrabWindow2 *iGrabWin2;
150 TBool iOldPointerState;
155 class CTPointerStep : public CTGraphicsStep
160 //from CTGraphicsStep
161 virtual CTGraphicsBase* CreateTestL();
164 _LIT(KTPointerStep,"TPointer");