sl@0
|
1 |
|
sl@0
|
2 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
// All rights reserved.
|
sl@0
|
4 |
// This component and the accompanying materials are made available
|
sl@0
|
5 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
// which accompanies this distribution, and is available
|
sl@0
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
//
|
sl@0
|
9 |
// Initial Contributors:
|
sl@0
|
10 |
// Nokia Corporation - initial contribution.
|
sl@0
|
11 |
//
|
sl@0
|
12 |
// Contributors:
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// Description:
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
/**
|
sl@0
|
18 |
@file
|
sl@0
|
19 |
@test
|
sl@0
|
20 |
@internalComponent - Internal Symbian test code
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
|
sl@0
|
23 |
#ifndef __TPNTCAP_H__
|
sl@0
|
24 |
#define __TPNTCAP_H__
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <e32std.h>
|
sl@0
|
27 |
#include <e32svr.h>
|
sl@0
|
28 |
#include <w32std.h>
|
sl@0
|
29 |
#include "../tlib/testbase.h"
|
sl@0
|
30 |
#include "AUTO.H"
|
sl@0
|
31 |
#include "TGraphicsHarness.h"
|
sl@0
|
32 |
|
sl@0
|
33 |
enum TTestState
|
sl@0
|
34 |
{
|
sl@0
|
35 |
ECaptureDisabled=0,
|
sl@0
|
36 |
ENormalCapture,
|
sl@0
|
37 |
ECaptureAllGroups,
|
sl@0
|
38 |
EDragDropCapture,
|
sl@0
|
39 |
EDragDropCaptureAllGroups,
|
sl@0
|
40 |
ENormalCaptureWithoutFocus,
|
sl@0
|
41 |
};
|
sl@0
|
42 |
|
sl@0
|
43 |
enum TTestSubState
|
sl@0
|
44 |
{
|
sl@0
|
45 |
EMainWindow,
|
sl@0
|
46 |
EChildWindow,
|
sl@0
|
47 |
EOtherGroup,
|
sl@0
|
48 |
EOtherSession,
|
sl@0
|
49 |
ERootWindow,
|
sl@0
|
50 |
};
|
sl@0
|
51 |
|
sl@0
|
52 |
enum TPointerCheckRet
|
sl@0
|
53 |
{
|
sl@0
|
54 |
EFailed,
|
sl@0
|
55 |
EOkay,
|
sl@0
|
56 |
ENeedsDDEvent,
|
sl@0
|
57 |
};
|
sl@0
|
58 |
|
sl@0
|
59 |
const TInt ESubStates1=2;
|
sl@0
|
60 |
const TInt ESubStates2=5;
|
sl@0
|
61 |
const TInt ESubStates3=5;
|
sl@0
|
62 |
const TInt ESubStates4=5;
|
sl@0
|
63 |
const TInt ESubStates5=5;
|
sl@0
|
64 |
const TInt ESubStates6=5;
|
sl@0
|
65 |
|
sl@0
|
66 |
const TInt EWinBorderSize=10;
|
sl@0
|
67 |
|
sl@0
|
68 |
class CPcWindowBase;
|
sl@0
|
69 |
class CTPointerCapture;
|
sl@0
|
70 |
|
sl@0
|
71 |
class CPcConnection : public CTClient
|
sl@0
|
72 |
{
|
sl@0
|
73 |
public:
|
sl@0
|
74 |
CPcConnection(CTPointerCapture *aTest);
|
sl@0
|
75 |
~CPcConnection();
|
sl@0
|
76 |
virtual void ConstructL();
|
sl@0
|
77 |
protected:
|
sl@0
|
78 |
CTPointerCapture *iTest;
|
sl@0
|
79 |
};
|
sl@0
|
80 |
|
sl@0
|
81 |
class CPcWindowBase : public CTWin
|
sl@0
|
82 |
{
|
sl@0
|
83 |
public:
|
sl@0
|
84 |
CPcWindowBase(CTPointerCapture *aTest);
|
sl@0
|
85 |
void SetUpL(TPoint pos,TSize size,CTWinBase *parent);
|
sl@0
|
86 |
void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
|
sl@0
|
87 |
void Draw(TDesC &aBuf);
|
sl@0
|
88 |
void PointerL(const TPointerEvent &pointer,const TTime &);
|
sl@0
|
89 |
void DragDropL(const TPointerEvent &pointer,const TTime &);
|
sl@0
|
90 |
virtual TPointerCheckRet PointerDown()=0;
|
sl@0
|
91 |
virtual TPointerCheckRet DragDrop()=0;
|
sl@0
|
92 |
virtual void SubStateChanged();
|
sl@0
|
93 |
protected:
|
sl@0
|
94 |
CTPointerCapture *iTest;
|
sl@0
|
95 |
TRgb iBack;
|
sl@0
|
96 |
};
|
sl@0
|
97 |
|
sl@0
|
98 |
class CPcWindowChild : public CPcWindowBase
|
sl@0
|
99 |
{
|
sl@0
|
100 |
public:
|
sl@0
|
101 |
CPcWindowChild(CTPointerCapture *aTest);
|
sl@0
|
102 |
void Draw();
|
sl@0
|
103 |
TPointerCheckRet PointerDown();
|
sl@0
|
104 |
TPointerCheckRet DragDrop();
|
sl@0
|
105 |
};
|
sl@0
|
106 |
|
sl@0
|
107 |
class CPcWindowMain : public CPcWindowBase
|
sl@0
|
108 |
{
|
sl@0
|
109 |
public:
|
sl@0
|
110 |
CPcWindowMain(CTPointerCapture *aTest);
|
sl@0
|
111 |
void Draw();
|
sl@0
|
112 |
TPointerCheckRet PointerDown();
|
sl@0
|
113 |
TPointerCheckRet DragDrop();
|
sl@0
|
114 |
void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
115 |
};
|
sl@0
|
116 |
|
sl@0
|
117 |
class CPcWindowAltGroup : public CPcWindowBase
|
sl@0
|
118 |
{
|
sl@0
|
119 |
public:
|
sl@0
|
120 |
CPcWindowAltGroup(CTPointerCapture *aTest);
|
sl@0
|
121 |
void Draw();
|
sl@0
|
122 |
TPointerCheckRet PointerDown();
|
sl@0
|
123 |
TPointerCheckRet DragDrop();
|
sl@0
|
124 |
};
|
sl@0
|
125 |
|
sl@0
|
126 |
class CPcWindowNickFocusGroup : public CTWindowGroup
|
sl@0
|
127 |
{
|
sl@0
|
128 |
public:
|
sl@0
|
129 |
CPcWindowNickFocusGroup(CTPointerCapture *aTest, CTClient *aClient);
|
sl@0
|
130 |
void KeyL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
131 |
private:
|
sl@0
|
132 |
CTPointerCapture *iTest;
|
sl@0
|
133 |
};
|
sl@0
|
134 |
|
sl@0
|
135 |
class CPcWindowAltConnection : public CPcWindowBase
|
sl@0
|
136 |
{
|
sl@0
|
137 |
public:
|
sl@0
|
138 |
CPcWindowAltConnection(CTPointerCapture *aTest);
|
sl@0
|
139 |
void Draw();
|
sl@0
|
140 |
TPointerCheckRet PointerDown();
|
sl@0
|
141 |
TPointerCheckRet DragDrop();
|
sl@0
|
142 |
};
|
sl@0
|
143 |
|
sl@0
|
144 |
class CTPointerCapture : public CTWsGraphicsBase
|
sl@0
|
145 |
{
|
sl@0
|
146 |
private:
|
sl@0
|
147 |
enum TDState {DDStateNull, DDStateGot, DDStateWaiting};
|
sl@0
|
148 |
public:
|
sl@0
|
149 |
CTPointerCapture(CTestStep* aStep);
|
sl@0
|
150 |
~CTPointerCapture();
|
sl@0
|
151 |
void ConstructL();
|
sl@0
|
152 |
void NextTest();
|
sl@0
|
153 |
void AbortTests();
|
sl@0
|
154 |
TInt State() const;
|
sl@0
|
155 |
TInt SubState() const;
|
sl@0
|
156 |
void doIncSubStateL();
|
sl@0
|
157 |
void IncSubStateL(TBool aNeedsDD=EFalse);
|
sl@0
|
158 |
void GotDDL();
|
sl@0
|
159 |
void StateChanged();
|
sl@0
|
160 |
void TestFailed();
|
sl@0
|
161 |
void NickFocusL();
|
sl@0
|
162 |
void SetCapture(TInt aCaptureFlags);
|
sl@0
|
163 |
inline TestClient* Client() {return TheClient;}
|
sl@0
|
164 |
protected:
|
sl@0
|
165 |
//from CTGraphicsStep
|
sl@0
|
166 |
virtual void RunTestCaseL(TInt aCurTestCase);
|
sl@0
|
167 |
private:
|
sl@0
|
168 |
TInt doTestFailedL();
|
sl@0
|
169 |
void SendEventsL();
|
sl@0
|
170 |
private:
|
sl@0
|
171 |
CPcConnection *iAltConnection;
|
sl@0
|
172 |
CTWindowGroup *iMainGroup;
|
sl@0
|
173 |
CTWindowGroup *iAltGroup;
|
sl@0
|
174 |
CPcWindowChild *iChildWin;
|
sl@0
|
175 |
CPcWindowMain *iMainWin;
|
sl@0
|
176 |
CPcWindowAltGroup *iAltGroupWin;
|
sl@0
|
177 |
CPcWindowAltConnection *iAltConnectionWin;
|
sl@0
|
178 |
CPcWindowNickFocusGroup *iNickFocusGroup;
|
sl@0
|
179 |
CTBlankWindow *iNickFocusBlankWin;
|
sl@0
|
180 |
//TInt iState;
|
sl@0
|
181 |
TInt iSubState;
|
sl@0
|
182 |
TDState iDDState;
|
sl@0
|
183 |
TSize iScreenSize;
|
sl@0
|
184 |
public:
|
sl@0
|
185 |
TBool iFailed;
|
sl@0
|
186 |
};
|
sl@0
|
187 |
|
sl@0
|
188 |
class CTPointerCaptureStep : public CTGraphicsStep
|
sl@0
|
189 |
{
|
sl@0
|
190 |
public:
|
sl@0
|
191 |
CTPointerCaptureStep();
|
sl@0
|
192 |
protected:
|
sl@0
|
193 |
//from CTGraphicsStep
|
sl@0
|
194 |
virtual CTGraphicsBase* CreateTestL();
|
sl@0
|
195 |
};
|
sl@0
|
196 |
|
sl@0
|
197 |
_LIT(KTPointerCaptureStep,"TPointerCapture");
|
sl@0
|
198 |
|
sl@0
|
199 |
|
sl@0
|
200 |
#endif
|