103
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@test
|
|
19 |
@internalComponent - Internal Symbian test code
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef __TPOINTER_H__
|
|
23 |
#define __TPOINTER_H__
|
|
24 |
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <w32std.h>
|
|
27 |
#include <hal.h>
|
|
28 |
#include "../tlib/testbase.h"
|
|
29 |
#include "AUTO.H"
|
|
30 |
#include "TGraphicsHarness.h"
|
|
31 |
|
|
32 |
class CTPointer;
|
|
33 |
class CGrabWindow;
|
|
34 |
|
|
35 |
class CPointerWindow : public CTWin
|
|
36 |
{
|
|
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,
|
|
50 |
KStateFinished};
|
|
51 |
public:
|
|
52 |
CPointerWindow(CTPointer *aTest);
|
|
53 |
void SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
|
|
54 |
void Draw();
|
|
55 |
void StartNextRepeatTest();
|
|
56 |
void QueueNextRepeat();
|
|
57 |
void PointerL(const TPointerEvent &aPointer,const TTime&);
|
|
58 |
void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
|
|
59 |
private:
|
|
60 |
void SwitchOn(const TTime &);
|
|
61 |
void ResetTest(TInt aState);
|
|
62 |
void SetState(TInt aState);
|
|
63 |
void FinishedTests();
|
|
64 |
void TestFailed(TBool aRetest=EFalse);
|
|
65 |
void SendEvent();
|
|
66 |
private:
|
|
67 |
CTPointer *iTest;
|
|
68 |
TInt iRepeatCount;
|
|
69 |
TInt iState;
|
|
70 |
TTimeIntervalMicroSeconds32 iInterval;
|
|
71 |
TTime iPrevTime;
|
|
72 |
TRect iRepeatRect;
|
|
73 |
TPoint iTl;
|
|
74 |
TSize iSize;
|
|
75 |
};
|
|
76 |
|
|
77 |
class CGrabWindow2 : public CTWin
|
|
78 |
{
|
|
79 |
public:
|
|
80 |
CGrabWindow2(CGrabWindow *aWindow);
|
|
81 |
void SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
|
|
82 |
private:
|
|
83 |
void Draw();
|
|
84 |
void PointerL(const TPointerEvent &aPointer,const TTime&);
|
|
85 |
private:
|
|
86 |
CGrabWindow *iGrabWindow;
|
|
87 |
};
|
|
88 |
|
|
89 |
class CGrabWindow : public CTWin
|
|
90 |
{
|
|
91 |
enum {KGrabStateWaitingForDown,KGrabStateWaitingForDragOut,KGrabStateWaitingForUp,KGrabStateFinished,
|
|
92 |
KGrabStateWaitingForDown2,KGrabStateWaitingForUp2a,KGrabStateWaitingForDrag2,KGrabStateWaitingForUp2b,
|
|
93 |
KGrabStateWaitingForDown3,KGrabStateWaitingForUp3a,KGrabStateWaitingForUp3b,
|
|
94 |
KGrabStateWaitingForDown4,KGrabStateWaitingForUp4,
|
|
95 |
KGrabStateWaitingForDown5,KGrabStateWaitingForUp5,KGrabStateWaitingForDrag5,
|
|
96 |
KStateFailed};
|
|
97 |
public:
|
|
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);
|
|
102 |
private:
|
|
103 |
void Draw();
|
|
104 |
void SetState(TInt aState);
|
|
105 |
void ResetTest();
|
|
106 |
void PointerL(const TPointerEvent &aPointer,const TTime&);
|
|
107 |
void TestFailed();
|
|
108 |
void FinishedTests();
|
|
109 |
void SendEvent();
|
|
110 |
private:
|
|
111 |
TInt iState;
|
|
112 |
CTPointer *iTest;
|
|
113 |
TPoint iTl;
|
|
114 |
TSize iSize;
|
|
115 |
};
|
|
116 |
|
|
117 |
|
|
118 |
class CTPointer : public CTWsGraphicsBase
|
|
119 |
{
|
|
120 |
public:
|
|
121 |
enum {KTimeOutAfter=20000000}; //20secs
|
|
122 |
public:
|
|
123 |
CTPointer(CTestStep* aStep);
|
|
124 |
~CTPointer();
|
|
125 |
void ConstructL();
|
|
126 |
|
|
127 |
TBool TestFailed(TInt aCase,TBool aRetry=EFalse);
|
|
128 |
void StartGrabTestL();
|
|
129 |
static TInt TimeOut(TAny* aTest);
|
|
130 |
void TimeOut();
|
|
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);}
|
|
135 |
protected:
|
|
136 |
virtual void RunTestCaseL(TInt aCurTestCase);
|
|
137 |
private:
|
|
138 |
TInt doTestFailedL();
|
|
139 |
inline TestClient* Client() {return TheClient;}
|
|
140 |
TInt iState;
|
|
141 |
|
|
142 |
private:
|
|
143 |
CTimeOut* iTimeOut;
|
|
144 |
TInt iTimeOutCount;
|
|
145 |
CPointerWindow *iRepeatWin;
|
|
146 |
CGrabWindow *iGrabWin;
|
|
147 |
CGrabWindow2 *iGrabWin2;
|
|
148 |
TSize iWinSize;
|
|
149 |
//TInt iState;
|
|
150 |
TBool iOldPointerState;
|
|
151 |
TBool iNoDigitiser;
|
|
152 |
};
|
|
153 |
|
|
154 |
|
|
155 |
class CTPointerStep : public CTGraphicsStep
|
|
156 |
{
|
|
157 |
public:
|
|
158 |
CTPointerStep();
|
|
159 |
protected:
|
|
160 |
//from CTGraphicsStep
|
|
161 |
virtual CTGraphicsBase* CreateTestL();
|
|
162 |
};
|
|
163 |
|
|
164 |
_LIT(KTPointerStep,"TPointer");
|
|
165 |
|
|
166 |
|
|
167 |
#endif
|