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 |
// Test pointer event handling
|
|
15 |
// Coverted from TMan test code (TMPOINTR.CPP) October 2000
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
@test
|
|
22 |
@internalComponent - Internal Symbian test code
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include "TPointer.H"
|
|
26 |
|
|
27 |
|
|
28 |
//#define LOGGING
|
|
29 |
|
|
30 |
#if defined(LOGGING)
|
|
31 |
LOCAL_D TLogMessageText LogMessageText;
|
|
32 |
#endif
|
|
33 |
|
|
34 |
|
|
35 |
CPointerWindow::CPointerWindow(CTPointer *aTest) : CTWin(), iTest(aTest)
|
|
36 |
{}
|
|
37 |
|
|
38 |
void CPointerWindow::SetState(TInt aState)
|
|
39 |
{
|
|
40 |
#if defined(LOGGING)
|
|
41 |
_LIT(KState,"CPointerWindow::SetState(%d) OldState=%d");
|
|
42 |
LogMessageText.Format(KState,aState,iState);
|
|
43 |
TheClient->LogMessage(LogMessageText);
|
|
44 |
#endif
|
|
45 |
iState=aState;
|
|
46 |
iWin.Invalidate();
|
|
47 |
switch(aState)
|
|
48 |
{
|
|
49 |
case KStateWaitingForTest1:
|
|
50 |
case KStateWaitingForTest2:
|
|
51 |
case KStateWaitingForTest3:
|
|
52 |
case KStateWaitingForTest4:
|
|
53 |
case KStateWaitingForTest5:
|
|
54 |
case KStateWaitingForTest6:
|
|
55 |
case KStateWaitingForTest8:
|
|
56 |
case KStateWaitingForTest7:
|
|
57 |
iRepeatRect=TRect();
|
|
58 |
break;
|
|
59 |
case KStateTesting8:
|
|
60 |
iWin.Close();
|
|
61 |
Client()->iWs.Flush();
|
|
62 |
User::After(500000);
|
|
63 |
FinishedTests();
|
|
64 |
break;
|
|
65 |
}
|
|
66 |
TheClient->WaitForRedrawsToFinish();
|
|
67 |
SendEvent();
|
|
68 |
}
|
|
69 |
|
|
70 |
void CPointerWindow::ResetTest(TInt aState)
|
|
71 |
{
|
|
72 |
TInt newState=KStateFinished;
|
|
73 |
switch(aState)
|
|
74 |
{
|
|
75 |
case KStateTesting1:
|
|
76 |
newState=KStateWaitingForTest1;
|
|
77 |
break;
|
|
78 |
case KStateTesting2:
|
|
79 |
newState=KStateWaitingForTest2;
|
|
80 |
break;
|
|
81 |
case KStateTesting3:
|
|
82 |
newState=KStateWaitingForTest3;
|
|
83 |
break;
|
|
84 |
case KStateTesting4:
|
|
85 |
newState=KStateWaitingForTest4;
|
|
86 |
break;
|
|
87 |
case KStateTesting5:
|
|
88 |
newState=KStateWaitingForTest5;
|
|
89 |
break;
|
|
90 |
case KStateTesting6:
|
|
91 |
newState=KStateWaitingForTest6;
|
|
92 |
break;
|
|
93 |
case KStateTesting8:
|
|
94 |
newState=KStateWaitingForTest8;
|
|
95 |
break;
|
|
96 |
case KStateTesting7:
|
|
97 |
newState=KStateWaitingForTest7;
|
|
98 |
break;
|
|
99 |
}
|
|
100 |
TheClient->iWs.PurgePointerEvents();
|
|
101 |
SetState(newState);
|
|
102 |
}
|
|
103 |
|
|
104 |
void CPointerWindow::SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
|
105 |
{
|
|
106 |
ConstructExtLD(*parent,pos,size);
|
|
107 |
iTl=pos;
|
|
108 |
iSize=size;
|
|
109 |
Activate();
|
|
110 |
AssignGC(aGc);
|
|
111 |
SetState(KStateWaitingForTest1);
|
|
112 |
BaseWin()->EnableOnEvents();
|
|
113 |
}
|
|
114 |
|
|
115 |
void CPointerWindow::Draw()
|
|
116 |
{
|
|
117 |
iGc->Clear();
|
|
118 |
iGc->DrawRect(Size());
|
|
119 |
iGc->DrawRect(iRepeatRect);
|
|
120 |
TBuf<0x80> buf;
|
|
121 |
TBuf<0x80> buf2;
|
|
122 |
switch(iState)
|
|
123 |
{
|
|
124 |
case KStateWaitingForTest1:
|
|
125 |
{
|
|
126 |
_LIT(Draw1,"Click anywhere in the window and hold the pointer steady");
|
|
127 |
buf.Format(Draw1);
|
|
128 |
}
|
|
129 |
break;
|
|
130 |
case KStateTesting1:
|
|
131 |
{
|
|
132 |
_LIT(Draw2,"Hold pointer inside the box");
|
|
133 |
buf.Format(Draw2);
|
|
134 |
}
|
|
135 |
break;
|
|
136 |
case KStateWaitingForTest2:
|
|
137 |
{
|
|
138 |
_LIT(Draw3,"Release the pointer then click in the window and hold the pointer steady");
|
|
139 |
buf.Format(Draw3);
|
|
140 |
}
|
|
141 |
break;
|
|
142 |
case KStateTesting2:
|
|
143 |
{
|
|
144 |
_LIT(Draw4,"Drag the pointer outside the box");
|
|
145 |
buf.Format(Draw4);
|
|
146 |
}
|
|
147 |
break;
|
|
148 |
case KStateWaitingForTest3:
|
|
149 |
{
|
|
150 |
_LIT(Draw5,"Release the pointer then click in the window and hold the pointer steady");
|
|
151 |
buf.Format(Draw5);
|
|
152 |
}
|
|
153 |
break;
|
|
154 |
case KStateTesting3:
|
|
155 |
{
|
|
156 |
_LIT(Draw6,"Release the pointer");
|
|
157 |
buf.Format(Draw6);
|
|
158 |
}
|
|
159 |
break;
|
|
160 |
case KStateWaitingForTest4:
|
|
161 |
{
|
|
162 |
_LIT(Draw7,"Click anywhere in the window and move the pointer slightly");
|
|
163 |
buf.Format(Draw7);
|
|
164 |
}
|
|
165 |
break;
|
|
166 |
case KStateTesting4:
|
|
167 |
{
|
|
168 |
_LIT(Draw8,"Release the pointer");
|
|
169 |
buf.Format(Draw8);
|
|
170 |
}
|
|
171 |
break;
|
|
172 |
case KStateWaitingForTest5:
|
|
173 |
{
|
|
174 |
_LIT(Draw9,"Click anywhere in the window and move the pointer slightly");
|
|
175 |
buf.Format(Draw9);
|
|
176 |
}
|
|
177 |
break;
|
|
178 |
case KStateTesting5:
|
|
179 |
{
|
|
180 |
_LIT(Draw10,"Release the pointer");
|
|
181 |
buf.Format(Draw10);
|
|
182 |
break;
|
|
183 |
}
|
|
184 |
case KStateWaitingForTest6:
|
|
185 |
{
|
|
186 |
_LIT(Draw11,"Click anywhere in the window");
|
|
187 |
buf.Format(Draw11);
|
|
188 |
}
|
|
189 |
break;
|
|
190 |
case KStateTesting6:
|
|
191 |
{
|
|
192 |
_LIT(Draw12,"Move the pointer");
|
|
193 |
buf.Format(Draw12);
|
|
194 |
}
|
|
195 |
break;
|
|
196 |
case KStateWaitingForTest8:
|
|
197 |
{
|
|
198 |
_LIT(Draw13,"Click anywhere in the window, and keep the pointer pressed");
|
|
199 |
buf.Format(Draw13);
|
|
200 |
}
|
|
201 |
break;
|
|
202 |
case KStateTesting8:
|
|
203 |
buf.Format(KNullDesC);
|
|
204 |
break;
|
|
205 |
case KStateWaitingForTest7:
|
|
206 |
{
|
|
207 |
_LIT(Draw14,"Switch off and touch the center of the screen");
|
|
208 |
buf.Format(Draw14);
|
|
209 |
}
|
|
210 |
break;
|
|
211 |
case KStateTesting7:
|
|
212 |
buf.Format(KNullDesC);
|
|
213 |
break;
|
|
214 |
}
|
|
215 |
switch(iState)
|
|
216 |
{
|
|
217 |
case KStateTesting1:
|
|
218 |
{
|
|
219 |
_LIT(Repeat2,"Repeat (%d/%d), interval=%d.%d");
|
|
220 |
buf2.Format(Repeat2,iRepeatCount,KRepeatCount,iInterval.Int()/1000000,(iInterval.Int()%1000000)/100000);
|
|
221 |
}
|
|
222 |
break;
|
|
223 |
case KStateTesting2:
|
|
224 |
case KStateTesting3:
|
|
225 |
{
|
|
226 |
_LIT(Repeat1,"Repeat (%d), interval=%d.%d");
|
|
227 |
buf2.Format(Repeat1,iRepeatCount,iInterval.Int()/1000000,(iInterval.Int()%1000000)/100000);
|
|
228 |
}
|
|
229 |
break;
|
|
230 |
}
|
|
231 |
iGc->DrawText(buf,TPoint(10,20));
|
|
232 |
iGc->DrawText(buf2,TPoint(10,40));
|
|
233 |
}
|
|
234 |
|
|
235 |
void CPointerWindow::FinishedTests()
|
|
236 |
{
|
|
237 |
iState=KStateFinished;
|
|
238 |
}
|
|
239 |
|
|
240 |
void CPointerWindow::StartNextRepeatTest()
|
|
241 |
{
|
|
242 |
iInterval=0;
|
|
243 |
iRepeatCount=0;
|
|
244 |
if (iState==KStateWaitingForTest4)
|
|
245 |
User::After(TTimeIntervalMicroSeconds32(1000000));
|
|
246 |
else if (iState==KStateWaitingForTest5)
|
|
247 |
User::After(TTimeIntervalMicroSeconds32(1000000));
|
|
248 |
QueueNextRepeat();
|
|
249 |
switch(iState)
|
|
250 |
{
|
|
251 |
case KStateWaitingForTest1:
|
|
252 |
SetState(KStateTesting1);
|
|
253 |
break;
|
|
254 |
case KStateWaitingForTest2:
|
|
255 |
SetState(KStateTesting2);
|
|
256 |
break;
|
|
257 |
case KStateWaitingForTest3:
|
|
258 |
SetState(KStateTesting3);
|
|
259 |
break;
|
|
260 |
case KStateWaitingForTest4:
|
|
261 |
SetState(KStateTesting4);
|
|
262 |
break;
|
|
263 |
case KStateWaitingForTest5:
|
|
264 |
SetState(KStateTesting5);
|
|
265 |
break;
|
|
266 |
case KStateWaitingForTest6:
|
|
267 |
SetState(KStateTesting6);
|
|
268 |
break;
|
|
269 |
case KStateWaitingForTest8:
|
|
270 |
SetState(KStateTesting8);
|
|
271 |
break;
|
|
272 |
case KStateWaitingForTest7:
|
|
273 |
SetState(KStateTesting7);
|
|
274 |
break;
|
|
275 |
}
|
|
276 |
}
|
|
277 |
|
|
278 |
void CPointerWindow::QueueNextRepeat()
|
|
279 |
{
|
|
280 |
iInterval=iInterval.Int()+KRepeatIntervalIncrements;
|
|
281 |
#if defined(LOGGING)
|
|
282 |
/*_LIT(KRequestRepeat,"Request Repeat, State=%d, Interval=%d");
|
|
283 |
TLogMessageText buf;
|
|
284 |
buf.Format(KRequestRepeat,iState,iInterval.Int());
|
|
285 |
TheClient->LogMessage(buf);*/
|
|
286 |
#endif
|
|
287 |
iWin.RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(iInterval),TRect(iRepeatRect));
|
|
288 |
iPrevTime.HomeTime();
|
|
289 |
iWin.Invalidate();
|
|
290 |
}
|
|
291 |
|
|
292 |
void CPointerWindow::PointerL(const TPointerEvent &aPointer,const TTime &aTime)
|
|
293 |
{
|
|
294 |
#if defined(LOGGING)
|
|
295 |
_LIT(KPointer,"CPointerWindow::PointerL(Type=%d, Pos=(%d,%d), ParPos=(%d,%d), Mod=0x%x) State=%d");
|
|
296 |
LogMessageText.Format(KPointer,aPointer.iType,aPointer.iPosition.iX,aPointer.iPosition.iY,aPointer.iParentPosition.iX,aPointer.iParentPosition.iY,aPointer.iModifiers,iState);
|
|
297 |
TheClient->LogMessage(LogMessageText);
|
|
298 |
#endif
|
|
299 |
if (aPointer.iType==TPointerEvent::EButtonRepeat)
|
|
300 |
{
|
|
301 |
if (iState!=KStateTesting1 && iState!=KStateTesting2 && iState!=KStateTesting3 && iState!=KStateTesting4)
|
|
302 |
TestFailed();
|
|
303 |
else
|
|
304 |
{
|
|
305 |
TTimeIntervalMicroSeconds32 interval(I64LOW(aTime.MicroSecondsFrom(iPrevTime).Int64()));
|
|
306 |
TBool fail1=(interval.Int()<(iInterval.Int()-KRepeatMargin) || interval.Int()>(iInterval.Int()+KRepeatMargin));
|
|
307 |
if (fail1)
|
|
308 |
{
|
|
309 |
_LIT(KPointerRepeat1,"Pointer Repeat Interval, Exp=%d, Act=%d, F1=%d, F2=%d");
|
|
310 |
TLogMessageText buf;
|
|
311 |
TBool fail2=(interval.Int()<(iInterval.Int()-2*KRepeatMargin) || interval.Int()>(iInterval.Int()+3*KRepeatMargin));
|
|
312 |
buf.Format(KPointerRepeat1,iInterval.Int(),interval.Int(),fail1,fail2);
|
|
313 |
TheClient->LogMessage(buf);
|
|
314 |
}
|
|
315 |
if (interval.Int()<(iInterval.Int()-
|
|
316 |
#if defined(__MARM_ARM4__)
|
|
317 |
2*
|
|
318 |
#endif
|
|
319 |
KRepeatMargin) || interval.Int()>(iInterval.Int()+
|
|
320 |
#if defined(__MARM_ARM4__)
|
|
321 |
3*
|
|
322 |
#endif
|
|
323 |
KRepeatMargin))
|
|
324 |
TestFailed();
|
|
325 |
else
|
|
326 |
{
|
|
327 |
if (!iRepeatRect.Contains(aPointer.iPosition) ||
|
|
328 |
aPointer.iParentPosition!=(aPointer.iPosition+iWin.InquireOffset(*Parent()->WinTreeNode())))
|
|
329 |
TestFailed();
|
|
330 |
else
|
|
331 |
{
|
|
332 |
iRepeatCount++;
|
|
333 |
if (iState==KStateTesting1 && iRepeatCount==KRepeatCount)
|
|
334 |
{
|
|
335 |
QueueNextRepeat();
|
|
336 |
Client()->iWs.Flush();
|
|
337 |
User::After(TTimeIntervalMicroSeconds32(iRepeatCount*KRepeatIntervalIncrements));
|
|
338 |
iWin.CancelPointerRepeatEventRequest();
|
|
339 |
SetState(KStateWaitingForTest2);
|
|
340 |
}
|
|
341 |
else
|
|
342 |
QueueNextRepeat();
|
|
343 |
}
|
|
344 |
}
|
|
345 |
}
|
|
346 |
}
|
|
347 |
else switch(iState)
|
|
348 |
{
|
|
349 |
case KStateWaitingForTest1:
|
|
350 |
case KStateWaitingForTest2:
|
|
351 |
case KStateWaitingForTest3:
|
|
352 |
case KStateWaitingForTest4:
|
|
353 |
case KStateWaitingForTest8:
|
|
354 |
if (aPointer.iType==TPointerEvent::EButton1Down)
|
|
355 |
{
|
|
356 |
iRepeatRect.iTl=aPointer.iPosition-TPoint(KRepeatRectXExtra,KRepeatRectYExtra);
|
|
357 |
iRepeatRect.iBr=aPointer.iPosition+TPoint(KRepeatRectXExtra,KRepeatRectYExtra);
|
|
358 |
StartNextRepeatTest();
|
|
359 |
}
|
|
360 |
break;
|
|
361 |
case KStateWaitingForTest5:
|
|
362 |
if (aPointer.iType==TPointerEvent::EButton1Down)
|
|
363 |
{
|
|
364 |
iRepeatRect.iTl=aPointer.iPosition;
|
|
365 |
iRepeatRect.iBr=aPointer.iPosition+TPoint(1,1);
|
|
366 |
StartNextRepeatTest();
|
|
367 |
}
|
|
368 |
break;
|
|
369 |
case KStateWaitingForTest6:
|
|
370 |
if (aPointer.iType==TPointerEvent::EButton1Down)
|
|
371 |
{
|
|
372 |
iRepeatRect.iTl=aPointer.iPosition+TPoint(KRepeatRectXExtra,KRepeatRectYExtra);
|
|
373 |
iRepeatRect.iBr=aPointer.iPosition+TPoint(2*KRepeatRectXExtra,2*KRepeatRectYExtra);
|
|
374 |
StartNextRepeatTest();
|
|
375 |
}
|
|
376 |
break;
|
|
377 |
case KStateTesting1:
|
|
378 |
{
|
|
379 |
TBool isDrag=(aPointer.iType==TPointerEvent::EDrag);
|
|
380 |
TestFailed(isDrag);
|
|
381 |
if (isDrag)
|
|
382 |
{
|
|
383 |
iTest->SimulatePointer(TRawEvent::EButton1Down,aPointer.iPosition.iX,aPointer.iPosition.iY);
|
|
384 |
iTest->SimulatePointer(TRawEvent::EButton1Up,aPointer.iPosition.iX,aPointer.iPosition.iY);
|
|
385 |
}
|
|
386 |
}
|
|
387 |
break;
|
|
388 |
case KStateTesting2:
|
|
389 |
if (aPointer.iType==TPointerEvent::EDrag)
|
|
390 |
SetState(KStateWaitingForTest3);
|
|
391 |
else
|
|
392 |
TestFailed();
|
|
393 |
break;
|
|
394 |
case KStateTesting3:
|
|
395 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
396 |
SetState(KStateWaitingForTest4);
|
|
397 |
else
|
|
398 |
TestFailed();
|
|
399 |
break;
|
|
400 |
case KStateTesting4:
|
|
401 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
402 |
SetState(KStateWaitingForTest5);
|
|
403 |
else
|
|
404 |
TestFailed();
|
|
405 |
break;
|
|
406 |
case KStateTesting5:
|
|
407 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
408 |
SetState(KStateWaitingForTest6);
|
|
409 |
else if (aPointer.iType!=TPointerEvent::EDrag)
|
|
410 |
TestFailed();
|
|
411 |
break;
|
|
412 |
case KStateTesting6:
|
|
413 |
if (aPointer.iType==TPointerEvent::EDrag)
|
|
414 |
{
|
|
415 |
//#if !defined(__WINS__) // Can't emulate touching dig when switched off under WINS
|
|
416 |
// if (iTest->Digitiser())
|
|
417 |
SetState(KStateWaitingForTest7);
|
|
418 |
/* else
|
|
419 |
#endif
|
|
420 |
SetState(KStateWaitingForTest8);*/
|
|
421 |
}
|
|
422 |
else
|
|
423 |
TestFailed();
|
|
424 |
break;
|
|
425 |
case KStateWaitingForTest7:
|
|
426 |
if (aPointer.iType==TPointerEvent::EButton1Down || aPointer.iType==TPointerEvent::ESwitchOn)
|
|
427 |
TestFailed();
|
|
428 |
break;
|
|
429 |
case KStateTesting7:
|
|
430 |
if (aPointer.iType!=TPointerEvent::ESwitchOn)
|
|
431 |
TestFailed();
|
|
432 |
else
|
|
433 |
SetState(KStateWaitingForTest8);
|
|
434 |
break;
|
|
435 |
case KStateTesting8:
|
|
436 |
break;
|
|
437 |
}
|
|
438 |
}
|
|
439 |
|
|
440 |
void CPointerWindow::TestFailed(TBool aRetest/*=EFalse*/)
|
|
441 |
{
|
|
442 |
if (iState!=KStateFailed)
|
|
443 |
{
|
|
444 |
TInt oldState=iState;
|
|
445 |
iState=KStateFailed;
|
|
446 |
if (iTest->TestFailed(oldState,aRetest) || aRetest)
|
|
447 |
ResetTest(oldState);
|
|
448 |
}
|
|
449 |
}
|
|
450 |
|
|
451 |
void CPointerWindow::WinKeyL(const TKeyEvent &aKey,const TTime &)
|
|
452 |
{
|
|
453 |
#if defined(LOGGING)
|
|
454 |
_LIT(KKey,"CPointerWindow::WinKeyL(Code=%d, ScanCode=%d) State=%d");
|
|
455 |
LogMessageText.Format(KKey,aKey.iCode,aKey.iScanCode,iState);
|
|
456 |
TheClient->LogMessage(LogMessageText);
|
|
457 |
#endif
|
|
458 |
if (aKey.iCode==EKeyEscape)
|
|
459 |
FinishedTests(); // Simply skip this test if the Escape key is pressed
|
|
460 |
}
|
|
461 |
|
|
462 |
void CPointerWindow::SwitchOn(const TTime &)
|
|
463 |
{
|
|
464 |
#if defined(LOGGING)
|
|
465 |
_LIT(KOn,"CPointerWindow::SwitchOn() State=%d");
|
|
466 |
LogMessageText.Format(KOn,iState);
|
|
467 |
TheClient->LogMessage(LogMessageText);
|
|
468 |
#endif
|
|
469 |
if (iState==KStateWaitingForTest7)
|
|
470 |
SetState(KStateTesting7);
|
|
471 |
else
|
|
472 |
TestFailed();
|
|
473 |
}
|
|
474 |
|
|
475 |
void CPointerWindow::SendEvent()
|
|
476 |
{
|
|
477 |
#if defined(LOGGING)
|
|
478 |
_LIT(KSend,"CPointerWindow::SendEvent() State=%d");
|
|
479 |
LogMessageText.Format(KSend,iState);
|
|
480 |
TheClient->LogMessage(LogMessageText);
|
|
481 |
#endif
|
|
482 |
switch (iState)
|
|
483 |
{
|
|
484 |
case KStateWaitingForTest1:
|
|
485 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/4,iTl.iY+iSize.iHeight/4);
|
|
486 |
break;
|
|
487 |
//case KStateTesting1: //Do Nothing
|
|
488 |
// break;
|
|
489 |
case KStateWaitingForTest2:
|
|
490 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+iSize.iWidth/4,iTl.iY+iSize.iHeight/4);
|
|
491 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/2,iTl.iY+iSize.iHeight/4);
|
|
492 |
break;
|
|
493 |
case KStateTesting2:
|
|
494 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+5*iSize.iWidth/8,iTl.iY+iSize.iHeight/4+2);
|
|
495 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+3*iSize.iWidth/4,iTl.iY+iSize.iHeight/4+4);
|
|
496 |
break;
|
|
497 |
case KStateWaitingForTest3:
|
|
498 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+3*iSize.iWidth/4,iTl.iY+iSize.iHeight/4+4);
|
|
499 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/4,iTl.iY+iSize.iHeight/2);
|
|
500 |
break;
|
|
501 |
case KStateTesting3:
|
|
502 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+iSize.iWidth/4,iTl.iY+iSize.iHeight/2);
|
|
503 |
break;
|
|
504 |
case KStateWaitingForTest4:
|
|
505 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/2,iTl.iY+iSize.iHeight/2);
|
|
506 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+3,iTl.iY+iSize.iHeight/2+1);
|
|
507 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+6,iTl.iY+iSize.iHeight/2+2);
|
|
508 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+9,iTl.iY+iSize.iHeight/2+3);
|
|
509 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+12,iTl.iY+iSize.iHeight/2+4);
|
|
510 |
break;
|
|
511 |
case KStateTesting4:
|
|
512 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+iSize.iWidth/2+12,iTl.iY+iSize.iHeight/2+4);
|
|
513 |
break;
|
|
514 |
case KStateWaitingForTest5:
|
|
515 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/2,iTl.iY+3*iSize.iHeight/4);
|
|
516 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+3,iTl.iY+3*iSize.iHeight/4+1);
|
|
517 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+6,iTl.iY+3*iSize.iHeight/4+2);
|
|
518 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+9,iTl.iY+3*iSize.iHeight/4+3);
|
|
519 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/2+12,iTl.iY+3*iSize.iHeight/4+4);
|
|
520 |
break;
|
|
521 |
case KStateTesting5:
|
|
522 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+iSize.iWidth/2+12,iTl.iY+3*iSize.iHeight/4+4);
|
|
523 |
break;
|
|
524 |
case KStateWaitingForTest6:
|
|
525 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+3*iSize.iWidth/4,iTl.iY+3*iSize.iHeight/4);
|
|
526 |
break;
|
|
527 |
case KStateTesting6:
|
|
528 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+3*iSize.iWidth/4+4,iTl.iY+3*iSize.iHeight/4+2);
|
|
529 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+3*iSize.iWidth/4+8,iTl.iY+3*iSize.iHeight/4+4);
|
|
530 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+3*iSize.iWidth/4+12,iTl.iY+3*iSize.iHeight/4+6);
|
|
531 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+3*iSize.iWidth/4+16,iTl.iY+3*iSize.iHeight/4+8);
|
|
532 |
break;
|
|
533 |
case KStateWaitingForTest8:
|
|
534 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/2,iTl.iY+3*iSize.iHeight/4);
|
|
535 |
break;
|
|
536 |
case KStateTesting8:
|
|
537 |
break;
|
|
538 |
case KStateWaitingForTest7:
|
|
539 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+3*iSize.iWidth/4+16,iTl.iY+3*iSize.iHeight/4+8);
|
|
540 |
iTest->SimulateEvent(TRawEvent::ESwitchOn);
|
|
541 |
iTest->SimulatePointer(TRawEvent::EPointerSwitchOn,iTl.iX+iSize.iWidth/2-1,iTl.iY+iSize.iHeight/2-1);
|
|
542 |
break;
|
|
543 |
//case KStateTesting7: //Do Nothing
|
|
544 |
// break;
|
|
545 |
/*case KStateFailed:
|
|
546 |
break;
|
|
547 |
case KStateFinished:
|
|
548 |
break;*/
|
|
549 |
}
|
|
550 |
}
|
|
551 |
|
|
552 |
//
|
|
553 |
// CGrabWindow //
|
|
554 |
//
|
|
555 |
|
|
556 |
CGrabWindow::CGrabWindow(CTPointer *aTest) : iTest(aTest)
|
|
557 |
{
|
|
558 |
}
|
|
559 |
|
|
560 |
void CGrabWindow::SetUpLD(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
|
561 |
{
|
|
562 |
ConstructExtLD(*parent,pos,size);
|
|
563 |
iTl=pos;
|
|
564 |
iSize=size;
|
|
565 |
Activate();
|
|
566 |
AssignGC(aGc);
|
|
567 |
SetState(KGrabStateWaitingForDown);
|
|
568 |
}
|
|
569 |
|
|
570 |
void CGrabWindow::Draw()
|
|
571 |
{
|
|
572 |
iGc->Clear();
|
|
573 |
iGc->DrawRect(Size());
|
|
574 |
TBuf<0x80> buf;
|
|
575 |
switch(iState)
|
|
576 |
{
|
|
577 |
case KGrabStateWaitingForDown:
|
|
578 |
case KGrabStateWaitingForDown2:
|
|
579 |
case KGrabStateWaitingForDown5:
|
|
580 |
{
|
|
581 |
_LIT(Draw1,"Press the pointer inside the window");
|
|
582 |
buf.Copy(Draw1);
|
|
583 |
}
|
|
584 |
break;
|
|
585 |
case KGrabStateWaitingForDown3:
|
|
586 |
case KGrabStateWaitingForUp3a:
|
|
587 |
{
|
|
588 |
_LIT(Draw2,"Press and release the pointer inside the window");
|
|
589 |
buf.Copy(Draw2);
|
|
590 |
}
|
|
591 |
break;
|
|
592 |
case KGrabStateWaitingForDragOut:
|
|
593 |
{
|
|
594 |
_LIT(Draw3,"Drag the pointer outside into the outside window");
|
|
595 |
buf.Copy(Draw3);
|
|
596 |
}
|
|
597 |
break;
|
|
598 |
case KGrabStateWaitingForUp:
|
|
599 |
case KGrabStateWaitingForUp2b:
|
|
600 |
case KGrabStateWaitingForUp5:
|
|
601 |
{
|
|
602 |
_LIT(Draw4,"Release the pointer");
|
|
603 |
buf.Copy(Draw4);
|
|
604 |
}
|
|
605 |
break;
|
|
606 |
case KGrabStateWaitingForDown4:
|
|
607 |
{
|
|
608 |
_LIT(Draw5,"Press then release the pointer");
|
|
609 |
buf.Copy(Draw5);
|
|
610 |
}
|
|
611 |
break;
|
|
612 |
default:;
|
|
613 |
}
|
|
614 |
iGc->DrawText(buf,TPoint(10,20));
|
|
615 |
}
|
|
616 |
|
|
617 |
void CGrabWindow::PointerL(const TPointerEvent &aPointer,const TTime&)
|
|
618 |
{
|
|
619 |
#if defined(LOGGING)
|
|
620 |
_LIT(KPointer,"CGrabWindow::PointerL(Type=%d, Pos=(%d,%d), ParPos=(%d,%d), Mod=0x%x) State=%d");
|
|
621 |
LogMessageText.Format(KPointer,aPointer.iType,aPointer.iPosition.iX,aPointer.iPosition.iY,aPointer.iParentPosition.iX,aPointer.iParentPosition.iY,aPointer.iModifiers,iState);
|
|
622 |
TheClient->LogMessage(LogMessageText);
|
|
623 |
#endif
|
|
624 |
switch(iState)
|
|
625 |
{
|
|
626 |
case KGrabStateWaitingForDown:
|
|
627 |
if (aPointer.iType==TPointerEvent::EButton1Down)
|
|
628 |
SetState(KGrabStateWaitingForDragOut);
|
|
629 |
break;
|
|
630 |
case KGrabStateWaitingForDragOut:
|
|
631 |
if (aPointer.iType!=TPointerEvent::EDrag)
|
|
632 |
TestFailed();
|
|
633 |
else
|
|
634 |
{
|
|
635 |
if (!TRect(Size()).Contains(aPointer.iPosition))
|
|
636 |
SetState(KGrabStateWaitingForUp);
|
|
637 |
}
|
|
638 |
break;
|
|
639 |
case KGrabStateWaitingForUp:
|
|
640 |
if (aPointer.iType==TPointerEvent::EDrag)
|
|
641 |
break;
|
|
642 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
643 |
SetState(KGrabStateWaitingForDown2);
|
|
644 |
else
|
|
645 |
TestFailed();
|
|
646 |
break;
|
|
647 |
case KGrabStateWaitingForDown2:
|
|
648 |
if (aPointer.iType!=TPointerEvent::EButton1Down)
|
|
649 |
TestFailed();
|
|
650 |
else
|
|
651 |
{
|
|
652 |
iTest->GrabWin2()->BaseWin()->ClaimPointerGrab();
|
|
653 |
iTest->GrabWin2()->BaseWin()->ClaimPointerGrab(); // Call twice to check it's harmless
|
|
654 |
SetState(KGrabStateWaitingForUp2a);
|
|
655 |
}
|
|
656 |
break;
|
|
657 |
case KGrabStateWaitingForUp2a:
|
|
658 |
SetState(KGrabStateWaitingForDrag2);
|
|
659 |
break;
|
|
660 |
case KGrabStateWaitingForDrag2:
|
|
661 |
break;
|
|
662 |
case KGrabStateWaitingForUp2b:
|
|
663 |
TestFailed();
|
|
664 |
break;
|
|
665 |
case KGrabStateWaitingForDown3:
|
|
666 |
if (aPointer.iType!=TPointerEvent::EButton1Down)
|
|
667 |
TestFailed();
|
|
668 |
else
|
|
669 |
SetState(KGrabStateWaitingForUp3a);
|
|
670 |
break;
|
|
671 |
case KGrabStateWaitingForUp3a:
|
|
672 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
673 |
{
|
|
674 |
iTest->GrabWin2()->BaseWin()->ClaimPointerGrab();
|
|
675 |
SetState(KGrabStateWaitingForUp3b);
|
|
676 |
}
|
|
677 |
break;
|
|
678 |
case KGrabStateWaitingForUp3b:
|
|
679 |
TestFailed();
|
|
680 |
break;
|
|
681 |
case KGrabStateWaitingForDown5:
|
|
682 |
if (aPointer.iType!=TPointerEvent::EButton1Down)
|
|
683 |
TestFailed();
|
|
684 |
else
|
|
685 |
{
|
|
686 |
iTest->GrabWin2()->BaseWin()->ClaimPointerGrab(EFalse);
|
|
687 |
SetState(KGrabStateWaitingForDrag5);
|
|
688 |
}
|
|
689 |
break;
|
|
690 |
case KGrabStateWaitingForDrag5:
|
|
691 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
692 |
TestFailed();
|
|
693 |
break;
|
|
694 |
case KGrabStateWaitingForUp5:
|
|
695 |
TestFailed();
|
|
696 |
break;
|
|
697 |
case KGrabStateWaitingForDown4:
|
|
698 |
iWin.Close(); // Close the window with the grab captured in it
|
|
699 |
SetState(KGrabStateWaitingForUp4);
|
|
700 |
break;
|
|
701 |
case KGrabStateFinished:
|
|
702 |
break;
|
|
703 |
}
|
|
704 |
}
|
|
705 |
|
|
706 |
void CGrabWindow::ResetTest()
|
|
707 |
{
|
|
708 |
TheClient->iWs.PurgePointerEvents();
|
|
709 |
SetState(KGrabStateWaitingForDown);
|
|
710 |
}
|
|
711 |
|
|
712 |
void CGrabWindow::Pointer2(const TPointerEvent &aPointer)
|
|
713 |
{
|
|
714 |
switch(iState)
|
|
715 |
{
|
|
716 |
case KGrabStateWaitingForDrag2:
|
|
717 |
{
|
|
718 |
if (aPointer.iType==TPointerEvent::EDrag)
|
|
719 |
{
|
|
720 |
SetState(KGrabStateWaitingForUp2b);
|
|
721 |
}
|
|
722 |
else
|
|
723 |
{
|
|
724 |
if (iTest->TestFailed(iState))
|
|
725 |
ResetTest();
|
|
726 |
}
|
|
727 |
break;
|
|
728 |
}
|
|
729 |
case KGrabStateWaitingForUp2b:
|
|
730 |
if (aPointer.iType==TPointerEvent::EDrag) // Harmless
|
|
731 |
break;
|
|
732 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
733 |
SetState(KGrabStateWaitingForDown3);
|
|
734 |
else
|
|
735 |
TestFailed();
|
|
736 |
break;
|
|
737 |
case KGrabStateWaitingForUp3b:
|
|
738 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
739 |
SetState(KGrabStateWaitingForDown5);
|
|
740 |
else
|
|
741 |
TestFailed();
|
|
742 |
break;
|
|
743 |
case KGrabStateWaitingForUp4:
|
|
744 |
FinishedTests();
|
|
745 |
break;
|
|
746 |
case KGrabStateWaitingForDrag5:
|
|
747 |
{
|
|
748 |
if (aPointer.iType==TPointerEvent::EDrag)
|
|
749 |
SetState(KGrabStateWaitingForUp5);
|
|
750 |
else if (iTest->TestFailed(iState))
|
|
751 |
ResetTest();
|
|
752 |
break;
|
|
753 |
}
|
|
754 |
case KGrabStateWaitingForUp5:
|
|
755 |
if (aPointer.iType==TPointerEvent::EDrag) // Harmless
|
|
756 |
break;
|
|
757 |
if (aPointer.iType==TPointerEvent::EButton1Up)
|
|
758 |
SetState(KGrabStateWaitingForDown4);
|
|
759 |
else
|
|
760 |
TestFailed();
|
|
761 |
break;
|
|
762 |
default:;
|
|
763 |
}
|
|
764 |
}
|
|
765 |
|
|
766 |
void CGrabWindow::SetState(TInt aState)
|
|
767 |
{
|
|
768 |
iState=aState;
|
|
769 |
if (aState!=KGrabStateWaitingForUp4)
|
|
770 |
iWin.Invalidate();
|
|
771 |
TheClient->WaitForRedrawsToFinish();
|
|
772 |
SendEvent();
|
|
773 |
}
|
|
774 |
|
|
775 |
void CGrabWindow::TestFailed()
|
|
776 |
{
|
|
777 |
#if defined(LOGGING)
|
|
778 |
_LIT(KFail,"CGrabWindow::TestFailed() State=%d");
|
|
779 |
LogMessageText.Format(KFail,iState);
|
|
780 |
TheClient->LogMessage(LogMessageText);
|
|
781 |
#endif
|
|
782 |
if (iState!=KStateFailed)
|
|
783 |
{
|
|
784 |
TInt oldState=iState;
|
|
785 |
iState=KStateFailed;
|
|
786 |
if (iTest->TestFailed(oldState))
|
|
787 |
ResetTest();
|
|
788 |
}
|
|
789 |
}
|
|
790 |
|
|
791 |
void CGrabWindow::FinishedTests()
|
|
792 |
{
|
|
793 |
iState=KGrabStateFinished;
|
|
794 |
}
|
|
795 |
|
|
796 |
void CGrabWindow::WinKeyL(const TKeyEvent &aKey,const TTime &)
|
|
797 |
{
|
|
798 |
#if defined(LOGGING)
|
|
799 |
_LIT(KKey,"CGrabWindow::WinKeyL(Code=%d, ScanCode=%d) State=%d");
|
|
800 |
LogMessageText.Format(KKey,aKey.iCode,aKey.iScanCode,iState);
|
|
801 |
TheClient->LogMessage(LogMessageText);
|
|
802 |
#endif
|
|
803 |
if (aKey.iCode==EKeyEscape)
|
|
804 |
FinishedTests(); // Simply skip this test if the Escape key is pressed
|
|
805 |
}
|
|
806 |
|
|
807 |
void CGrabWindow::SendEvent()
|
|
808 |
{
|
|
809 |
switch (iState)
|
|
810 |
{
|
|
811 |
case KGrabStateWaitingForDown:
|
|
812 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/3,iTl.iY+iSize.iHeight/3);
|
|
813 |
break;
|
|
814 |
case KGrabStateWaitingForDragOut:
|
|
815 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+iSize.iWidth/6,iTl.iY+iSize.iHeight/6);
|
|
816 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+1,iTl.iY+1);
|
|
817 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX-10,iTl.iY-10);
|
|
818 |
break;
|
|
819 |
case KGrabStateWaitingForUp:
|
|
820 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX-8,iTl.iY-8);
|
|
821 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX-5,iTl.iY-5);
|
|
822 |
break;
|
|
823 |
case KGrabStateWaitingForDown2:
|
|
824 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+2*iSize.iWidth/3,iTl.iY+iSize.iHeight/3);
|
|
825 |
break;
|
|
826 |
/*case KGrabStateWaitingForUp2a: //Don't need to do anything for these cases
|
|
827 |
break;
|
|
828 |
case KGrabStateWaitingForDrag2:
|
|
829 |
break;*/
|
|
830 |
case KGrabStateWaitingForUp2b:
|
|
831 |
iTest->SimulatePointer(TRawEvent::EPointerMove,iTl.iX+2*iSize.iWidth/3-3,iTl.iY+iSize.iHeight/3+3);
|
|
832 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+2*iSize.iWidth/3,iTl.iY+iSize.iHeight/3);
|
|
833 |
break;
|
|
834 |
case KGrabStateWaitingForDown3:
|
|
835 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+2*iSize.iWidth/3,2*iTl.iY+iSize.iHeight/3);
|
|
836 |
break;
|
|
837 |
case KGrabStateWaitingForUp3a:
|
|
838 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+2*iSize.iWidth/3,2*iTl.iY+iSize.iHeight/3);
|
|
839 |
break;
|
|
840 |
case KGrabStateWaitingForUp3b:
|
|
841 |
break;
|
|
842 |
case KGrabStateWaitingForDown4:
|
|
843 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+2*iSize.iWidth/5,iTl.iY+iSize.iHeight/3);
|
|
844 |
break;
|
|
845 |
case KGrabStateWaitingForUp4:
|
|
846 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+2*iSize.iWidth/5,iTl.iY+iSize.iHeight/3);
|
|
847 |
break;
|
|
848 |
case KGrabStateWaitingForDown5:
|
|
849 |
iTest->SimulatePointer(TRawEvent::EButton1Down,iTl.iX+iSize.iWidth/3,2*iTl.iY+iSize.iHeight/3);
|
|
850 |
break;
|
|
851 |
case KGrabStateWaitingForUp5:
|
|
852 |
iTest->SimulatePointer(TRawEvent::EButton1Up,iTl.iX+iSize.iWidth/3,2*iTl.iY+iSize.iHeight/3);
|
|
853 |
break;
|
|
854 |
//case KGrabStateWaitingForDrag5: //Don't need to do anything for these cases
|
|
855 |
// break;
|
|
856 |
/*case KStateFailed:
|
|
857 |
break;
|
|
858 |
case KGrabStateFinished:
|
|
859 |
break;*/
|
|
860 |
default:;
|
|
861 |
}
|
|
862 |
TheClient->iWs.Flush();
|
|
863 |
}
|
|
864 |
|
|
865 |
|
|
866 |
//
|
|
867 |
// CGrabWindow2, used as part of grab tests //
|
|
868 |
//
|
|
869 |
|
|
870 |
CGrabWindow2::CGrabWindow2(CGrabWindow *aWindow) : iGrabWindow(aWindow)
|
|
871 |
{
|
|
872 |
}
|
|
873 |
|
|
874 |
void CGrabWindow2::Draw()
|
|
875 |
{
|
|
876 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
877 |
iGc->SetBrushColor(TRgb::Gray4(2));
|
|
878 |
iGc->DrawRect(Size());
|
|
879 |
}
|
|
880 |
|
|
881 |
void CGrabWindow2::PointerL(const TPointerEvent &aPointer,const TTime&)
|
|
882 |
{
|
|
883 |
#if defined(LOGGING)
|
|
884 |
_LIT(KPointer,"CGrabWindow2::PointerL(Type=%d, Pos=(%d,%d), ParPos=(%d,%d), Mod=0x%x)");
|
|
885 |
LogMessageText.Format(KPointer,aPointer.iType,aPointer.iPosition.iX,aPointer.iPosition.iY,aPointer.iParentPosition.iX,aPointer.iParentPosition.iY,aPointer.iModifiers);
|
|
886 |
TheClient->LogMessage(LogMessageText);
|
|
887 |
#endif
|
|
888 |
iGrabWindow->Pointer2(aPointer);
|
|
889 |
}
|
|
890 |
|
|
891 |
//
|
|
892 |
// CTPointTest //
|
|
893 |
//
|
|
894 |
|
|
895 |
CTPointer::CTPointer(CTestStep* aStep) : CTWsGraphicsBase(aStep)
|
|
896 |
{
|
|
897 |
iState = 0;
|
|
898 |
}
|
|
899 |
|
|
900 |
|
|
901 |
CTPointer::~CTPointer()
|
|
902 |
{
|
|
903 |
HAL::Set(HALData::EPenDisplayOn,iOldPointerState);
|
|
904 |
delete iRepeatWin;
|
|
905 |
delete iGrabWin;
|
|
906 |
delete iGrabWin2;
|
|
907 |
Client()->ResetFocus();
|
|
908 |
delete iTimeOut;
|
|
909 |
}
|
|
910 |
|
|
911 |
void CTPointer::ConstructL()
|
|
912 |
{
|
|
913 |
iTimeOut=new(ELeave) CTimeOut();
|
|
914 |
iTimeOut->ConstructL();
|
|
915 |
iTimeOut->Start(KTimeOutAfter,TCallBack(CTPointer::TimeOut,this));
|
|
916 |
|
|
917 |
TheClient->iWs.SetPointerCursorArea(iTest->iNormalPointerCursorArea);
|
|
918 |
iRepeatWin=new(ELeave) CPointerWindow(this);
|
|
919 |
TSize screenSize(Client()->iScreen->SizeInPixels());
|
|
920 |
if (TestBase()->ConfigurationSupportsPointerEventTesting())
|
|
921 |
{
|
|
922 |
iRepeatWin->SetUpLD(TPoint(screenSize.iWidth/8,screenSize.iHeight/8),TSize(screenSize.iWidth*3/4,screenSize.iHeight*3/4),Client()->iGroup,*Client()->iGc);
|
|
923 |
}
|
|
924 |
Client()->iGroup->SetCurrentWindow(iRepeatWin);
|
|
925 |
iNoDigitiser=EFalse;
|
|
926 |
TInt err=HAL::Get(HALData::EPenDisplayOn,iOldPointerState);
|
|
927 |
if (err==KErrNotSupported)
|
|
928 |
iNoDigitiser=ETrue;
|
|
929 |
else if (err==KErrNone)
|
|
930 |
err=HAL::Set(HALData::EPenDisplayOn,ETrue);
|
|
931 |
if (err==KErrNotSupported)
|
|
932 |
iNoDigitiser=(!iOldPointerState);
|
|
933 |
else
|
|
934 |
{
|
|
935 |
TEST(err==KErrNone);
|
|
936 |
if (err!=KErrNone)
|
|
937 |
INFO_PRINTF3(_L("HAL::Set(HALData::EPenDisplayOn,ETrue) return value - Expected: %d, Actual: %d"), KErrNone, err);
|
|
938 |
}
|
|
939 |
|
|
940 |
}
|
|
941 |
|
|
942 |
TInt CTPointer::TimeOut(TAny* aTest) //static
|
|
943 |
{
|
|
944 |
static_cast<CTPointer*>(aTest)->TimeOut();
|
|
945 |
return(KErrNone);
|
|
946 |
}
|
|
947 |
|
|
948 |
void CTPointer::TimeOut()
|
|
949 |
{
|
|
950 |
TLogMessageText buf;
|
|
951 |
_LIT(KPointerTimeOut,"TIMEOUT: Pointer Test, %d, %S");
|
|
952 |
buf.AppendFormat(KPointerTimeOut,iState,&(iTest->iSubTitle));
|
|
953 |
TheClient->LogMessage(buf);
|
|
954 |
++iTimeOutCount;
|
|
955 |
if (!TestFailed(-1) && iState<2)
|
|
956 |
{
|
|
957 |
iTimeOut->Start(KTimeOutAfter,TCallBack(CTPointer::TimeOut,this));
|
|
958 |
}
|
|
959 |
}
|
|
960 |
|
|
961 |
TBool CTPointer::TestFailed(TInt aCase,TBool aRetry/*=EFalse*/)
|
|
962 |
{
|
|
963 |
_LIT(KPointerTest,": Pointer Test, %d, %S, Case %d");
|
|
964 |
_LIT(KRetry,"Retry");
|
|
965 |
_LIT(KFail,"FAIL");
|
|
966 |
TLogMessageText buf;
|
|
967 |
TInt ret=0;
|
|
968 |
if (aRetry)
|
|
969 |
buf.Append(KRetry);
|
|
970 |
else
|
|
971 |
{
|
|
972 |
ret=1;
|
|
973 |
buf.Append(KFail);
|
|
974 |
}
|
|
975 |
buf.AppendFormat(KPointerTest,iState,&(iTest->iSubTitle),aCase);
|
|
976 |
TheClient->LogMessage(buf);
|
|
977 |
#if !defined(DISABLE_FAIL_DIALOG)
|
|
978 |
if (!aRetry)
|
|
979 |
{
|
|
980 |
__DEBUGGER();
|
|
981 |
TRAPD(err,ret=doTestFailedL());
|
|
982 |
}
|
|
983 |
#endif
|
|
984 |
switch(ret)
|
|
985 |
{
|
|
986 |
case 0:
|
|
987 |
return(ETrue); // Re-try test
|
|
988 |
case 1:
|
|
989 |
break;
|
|
990 |
}
|
|
991 |
return(EFalse);
|
|
992 |
}
|
|
993 |
|
|
994 |
TInt CTPointer::doTestFailedL()
|
|
995 |
{
|
|
996 |
//_LIT(Failed,"Pointer repeat test failed");
|
|
997 |
_LIT(Retest,"Retest");
|
|
998 |
_LIT(Fail,"Fail");
|
|
999 |
CTDialog *dialog=new(ELeave) CTDialog();
|
|
1000 |
dialog->SetNumButtons(2);
|
|
1001 |
dialog->SetButtonText(0,Retest);
|
|
1002 |
dialog->SetButtonText(1,Fail);
|
|
1003 |
dialog->ConstructLD(*Client()->iGroup,*Client()->iGc);
|
|
1004 |
dialog->SetTitle(_L("Pointer repeat test failed"));
|
|
1005 |
dialog->SetFlags(CTDialog::EDialogWaitForButtonUp);
|
|
1006 |
return dialog->Display();
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
CGrabWindow2 *CTPointer::GrabWin2() const
|
|
1010 |
{
|
|
1011 |
return(iGrabWin2);
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
void CTPointer::StartGrabTestL()
|
|
1015 |
{
|
|
1016 |
iGrabWin=new(ELeave) CGrabWindow(this);
|
|
1017 |
iGrabWin2=new(ELeave) CGrabWindow2(iGrabWin);
|
|
1018 |
//
|
|
1019 |
TSize screenSize(Client()->iScreen->SizeInPixels());
|
|
1020 |
iGrabWin2->SetUpL(TPoint(screenSize.iWidth/8,screenSize.iHeight/8),TSize(screenSize.iWidth*3/4,screenSize.iHeight*3/4),Client()->iGroup,*Client()->iGc);
|
|
1021 |
Client()->iGroup->SetCurrentWindow(iGrabWin2);
|
|
1022 |
//
|
|
1023 |
iGrabWin->SetUpLD(TPoint(screenSize.iWidth/4,screenSize.iHeight/4),TSize(screenSize.iWidth/2,screenSize.iHeight/2),Client()->iGroup,*Client()->iGc);
|
|
1024 |
Client()->iGroup->SetCurrentWindow(iGrabWin);
|
|
1025 |
//
|
|
1026 |
}
|
|
1027 |
|
|
1028 |
|
|
1029 |
void CTPointer::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
1030 |
{
|
|
1031 |
_LIT(Repeat,"Repeat tests");
|
|
1032 |
_LIT(Grab,"Grab tests");
|
|
1033 |
|
|
1034 |
iTest->iState=iState;
|
|
1035 |
|
|
1036 |
if (!TestBase()->ConfigurationSupportsPointerEventTesting())
|
|
1037 |
{
|
|
1038 |
INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
|
|
1039 |
TestComplete();
|
|
1040 |
return;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
((CTPointerStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
|
1044 |
switch(iState)
|
|
1045 |
{
|
|
1046 |
case 0:
|
|
1047 |
((CTPointerStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
1048 |
iTest->LogSubTest(Repeat);
|
|
1049 |
iState++;
|
|
1050 |
break;
|
|
1051 |
/**
|
|
1052 |
|
|
1053 |
@SYMTestCaseID GRAPHICS-WSERV-0310
|
|
1054 |
|
|
1055 |
@SYMDEF DEF081259
|
|
1056 |
|
|
1057 |
@SYMTestCaseDesc Test pointer event handling
|
|
1058 |
|
|
1059 |
@SYMTestPriority High
|
|
1060 |
|
|
1061 |
@SYMTestStatus Implemented
|
|
1062 |
|
|
1063 |
@SYMTestActions Simulate pointer events and check the events are then handled correctly
|
|
1064 |
|
|
1065 |
@SYMTestExpectedResults Pointer events are handled correctly
|
|
1066 |
|
|
1067 |
*/
|
|
1068 |
case 1:
|
|
1069 |
((CTPointerStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0310"));
|
|
1070 |
iTest->LogSubTest(Grab);
|
|
1071 |
|
|
1072 |
StartGrabTestL();
|
|
1073 |
iState++;
|
|
1074 |
break;
|
|
1075 |
default:
|
|
1076 |
((CTPointerStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
1077 |
((CTPointerStep*)iStep)->CloseTMSGraphicsStep();
|
|
1078 |
iTimeOut->Cancel();
|
|
1079 |
if (iTimeOutCount>0) TEST(EFalse);
|
|
1080 |
if (iTest->IsFullRomL()) User::After(5000000);
|
|
1081 |
TestComplete();
|
|
1082 |
}
|
|
1083 |
((CTPointerStep*)iStep)->RecordTestResultL();
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
|
|
1087 |
__WS_CONSTRUCT_STEP__(Pointer)
|