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