|
1 // Copyright (c) 2008-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 // Multi pointer and Z-coordinate test code |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 #ifndef __INIPARSER_H__ |
|
25 #define __INIPARSER_H__ |
|
26 #endif // __INIPARSER_H__ |
|
27 |
|
28 #include "PARSEINIDATA.H" |
|
29 #include "tmultiptrevent.h" |
|
30 #include <e32cmn.h> |
|
31 #include <hal.h> |
|
32 |
|
33 //#define FAILLOG 1 // Uncomment this code to get detailed log |
|
34 #define TESTMULTIPOINTER 1 // Comment this line to get detailed log without testing |
|
35 |
|
36 _LIT(KMultiPtrPluginDll, "multiptrclick.dll"); |
|
37 |
|
38 const TInt KErrDescSize = 128; |
|
39 const TInt KMaxQueueSize = 32; // Queue size of wserv. In any test we cannot test more than MaxQueueSize events. |
|
40 |
|
41 LOCAL_C void DestroyAnim(TAny* aAnim) |
|
42 { |
|
43 (static_cast<RMultiPointerAnim*>(aAnim))->Destroy(); |
|
44 } |
|
45 |
|
46 |
|
47 //CTMultiPtrEventBuffer |
|
48 CTMultiPtrEventBuffer::CTMultiPtrEventBuffer(RWsSession *aWs, CTMultiPtrEventTest *aTest, CTMultiPtrEventClient* aClient) |
|
49 : CTEvent(aWs), iTest(aTest), iClient(aClient) |
|
50 { |
|
51 } |
|
52 |
|
53 void CTMultiPtrEventBuffer::ConstructL() |
|
54 { |
|
55 CTEventBase::Construct(); |
|
56 iEventBuffer.SetLengthL(EEventBufferSize); |
|
57 iMovePtsBuffer.SetLengthL(EMovePtsBuffer); |
|
58 } |
|
59 |
|
60 void CTMultiPtrEventBuffer::AddExpectedEvent(TWsEvent &aEvent) |
|
61 { |
|
62 iEventBuffer.Add(&aEvent); |
|
63 } |
|
64 |
|
65 void CTMultiPtrEventBuffer::AddExpectedMovePtEvent(TPoint &aMovePt) |
|
66 { |
|
67 iMovePtsBuffer.Add(&aMovePt); |
|
68 } |
|
69 |
|
70 TInt CTMultiPtrEventBuffer::EventsRemaining() |
|
71 { |
|
72 return iEventBuffer.Count(); |
|
73 } |
|
74 |
|
75 void CTMultiPtrEventBuffer::GetMoveBufferAndCompareL() |
|
76 { |
|
77 TBuf8<EMovePtsBuffer*sizeof(TPoint)> buf; |
|
78 iClient->ParentWin()->BaseWin()->RetrievePointerMoveBuffer(buf); |
|
79 |
|
80 TUint bufferSize = buf.Length(); |
|
81 TUint numLoop = bufferSize/sizeof(TPoint); |
|
82 |
|
83 if (iMovePtsBuffer.Count() != numLoop) |
|
84 { |
|
85 #if defined(FAILLOG) |
|
86 TLogMessageText logText; |
|
87 _LIT(KPointerNumber, "Actual number of move/drag buffer points from Wserv = %d Expected number of move/drag buffer points = %d "); |
|
88 logText.Format(KPointerNumber, numLoop, iMovePtsBuffer.Count()); |
|
89 iTest->LOG_MESSAGE(logText); |
|
90 #endif |
|
91 TestL(EFalse); |
|
92 } |
|
93 |
|
94 TPoint wsPoint; |
|
95 TPoint expPoint; |
|
96 TUint8* BasePtr = const_cast<TUint8*>(buf.Ptr()); |
|
97 for (TUint count = 0; count < numLoop; count++) |
|
98 { |
|
99 wsPoint = *(reinterpret_cast<TPoint*>(BasePtr)); |
|
100 iMovePtsBuffer.Remove(&expPoint); |
|
101 if (wsPoint != expPoint) |
|
102 { |
|
103 #if defined(FAILLOG) |
|
104 TLogMessageText logText; |
|
105 _LIT(KMoveBufferPoint, "Actual move/drag buffer point from Wserv = ([%d], [%d]) Expected move/drag buffer point = ([%d], [%d])"); |
|
106 logText.Format(KMoveBufferPoint, wsPoint.iX, wsPoint.iY, expPoint.iX, expPoint.iY); |
|
107 iTest->LOG_MESSAGE(logText); |
|
108 #endif |
|
109 TestL(EFalse); |
|
110 } |
|
111 BasePtr = BasePtr + sizeof(TPoint); |
|
112 } |
|
113 } |
|
114 |
|
115 |
|
116 #define TESTXL(expr1, oper, expr2, event, expected) \ |
|
117 TestL(expr1 oper expr2, expr1, expr2, #oper, #expr1 ## #oper ## #expr2, \ |
|
118 event, expected, __FILE__, __LINE__); |
|
119 |
|
120 // Main function which gets the event, checks with the event in buffer |
|
121 // Then calls function NextSetOfEventsL for running other tests of a particualar test case |
|
122 void CTMultiPtrEventBuffer::doRunL() |
|
123 { |
|
124 // Get the event from wserv |
|
125 TWsEvent wsEvent; |
|
126 iWs->GetEvent(wsEvent); |
|
127 |
|
128 TWsEvent expectedEvent; |
|
129 TInt wsType=wsEvent.Type(); |
|
130 if (wsEvent.Type()==EEventNull) |
|
131 { |
|
132 TESTXL(wsEvent.Handle(), ==, 0, &wsEvent, NULL); |
|
133 goto End; |
|
134 } |
|
135 // This code is for running successive anim test code |
|
136 if (wsEvent.Type()==EEventPointer && wsEvent.Pointer()->iType == TPointerEvent::ESwitchOn) |
|
137 { |
|
138 goto End; |
|
139 } |
|
140 |
|
141 // if this is called accidentally |
|
142 TInt count=iEventBuffer.Count(); |
|
143 if (count==0 && wsType==EEventFocusGained) |
|
144 { |
|
145 goto End; |
|
146 } |
|
147 |
|
148 iEventBuffer.Remove(&expectedEvent); |
|
149 |
|
150 iEventCount++; |
|
151 |
|
152 if (wsEvent.Type() == EEventPointerBufferReady) |
|
153 { |
|
154 GetMoveBufferAndCompareL(); |
|
155 #if defined(FAILLOG) |
|
156 TLogMessageText logText; |
|
157 _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d "); |
|
158 logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle()); |
|
159 iTest->LOG_MESSAGE(logText); |
|
160 #endif |
|
161 #if defined(TESTMULTIPOINTER) |
|
162 TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent); |
|
163 #endif |
|
164 goto End; |
|
165 } |
|
166 |
|
167 // Test wsEvent and expected event have same handle, position and type. |
|
168 #if defined(FAILLOG) |
|
169 TLogMessageText logText; |
|
170 _LIT(KEventCountCheck, "Checking event number = %d"); |
|
171 logText.Format(KEventCountCheck, iEventCount); |
|
172 iTest->LOG_MESSAGE(logText); |
|
173 _LIT(KEventType, "Actual Event type from Wserv = %d Expected Event Type = %d "); |
|
174 logText.Format(KEventType, wsEvent.Type(), expectedEvent.Type()); |
|
175 iTest->LOG_MESSAGE(logText); |
|
176 #endif |
|
177 |
|
178 #if defined(TESTMULTIPOINTER) |
|
179 TESTXL(wsEvent.Type(), ==, expectedEvent.Type(), &wsEvent, &expectedEvent); |
|
180 #endif |
|
181 // Test pointer number for Enter/Exit events |
|
182 if (wsType == EEventPointerEnter || wsType == EEventPointerExit) |
|
183 { |
|
184 #if defined(FAILLOG) |
|
185 _LIT(KPointerNumber, "Actual PointerNumber for Enter/Exit event from Wserv = %d Expected PointerNumber for Enter/Exit event = %d "); |
|
186 logText.Format(KPointerNumber, *wsEvent.Int(), *expectedEvent.Int()); |
|
187 iTest->LOG_MESSAGE(logText); |
|
188 #endif |
|
189 #if defined(TESTMULTIPOINTER) |
|
190 TESTXL(*wsEvent.Int(), ==, *expectedEvent.Int(), &wsEvent, &expectedEvent); |
|
191 #endif |
|
192 } |
|
193 |
|
194 TAdvancedPointerEvent *expectedPointerEvent = expectedEvent.Pointer(); |
|
195 TAdvancedPointerEvent *actualPointerEvent = wsEvent.Pointer(); |
|
196 |
|
197 // Test only if it is a Pointer event |
|
198 if (wsType == EEventPointer) |
|
199 { |
|
200 #if defined(FAILLOG) |
|
201 _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d "); |
|
202 logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle()); |
|
203 iTest->LOG_MESSAGE(logText); |
|
204 #endif |
|
205 #if defined(TESTMULTIPOINTER) |
|
206 TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent); |
|
207 #endif |
|
208 #if defined(FAILLOG) |
|
209 _LIT(KPointerType, "Actual PointerType from Wserv = %d Expected PointerType = %d "); |
|
210 logText.Format(KPointerType, actualPointerEvent->iType, expectedPointerEvent->iType); |
|
211 iTest->LOG_MESSAGE(logText); |
|
212 #endif |
|
213 #if defined(TESTMULTIPOINTER) |
|
214 TESTXL(actualPointerEvent->iType, ==, expectedPointerEvent->iType, &wsEvent, &expectedEvent); |
|
215 #endif |
|
216 #if defined(FAILLOG) |
|
217 _LIT(KPointerPosition, "Actual PointerPosition from Wserv = (%d, %d) Expected PointerPosition = (%d, %d) "); |
|
218 logText.Format(KPointerPosition, actualPointerEvent->iPosition.iX, actualPointerEvent->iPosition.iY, expectedPointerEvent->iPosition.iX, expectedPointerEvent->iPosition.iY); |
|
219 iTest->LOG_MESSAGE(logText); |
|
220 #endif |
|
221 #if defined(TESTMULTIPOINTER) |
|
222 TESTXL(actualPointerEvent->iPosition, ==, expectedPointerEvent->iPosition, &wsEvent, &expectedEvent); |
|
223 #endif |
|
224 #if defined(FAILLOG) |
|
225 _LIT(KPointerNumber, "Actual PointerNumber from Wserv = %d Expected PointerNumber = %d "); |
|
226 logText.Format(KPointerNumber, actualPointerEvent->PointerNumber(), expectedPointerEvent->PointerNumber()); |
|
227 iTest->LOG_MESSAGE(logText); |
|
228 #endif |
|
229 #if defined(TESTMULTIPOINTER) |
|
230 TESTXL(actualPointerEvent->PointerNumber(), ==, expectedPointerEvent->PointerNumber(), &wsEvent, &expectedEvent); |
|
231 #endif |
|
232 #if defined(FAILLOG) |
|
233 _LIT(KPointerProximity, "Actual PointerProximity from Wserv = %d Expected PointerProximity = %d "); |
|
234 logText.Format(KPointerProximity, actualPointerEvent->Proximity(), expectedPointerEvent->Proximity()); |
|
235 iTest->LOG_MESSAGE(logText); |
|
236 #endif |
|
237 #if defined(TESTMULTIPOINTER) |
|
238 TESTXL(actualPointerEvent->Proximity(), ==, expectedPointerEvent->Proximity(), &wsEvent, &expectedEvent); |
|
239 #endif |
|
240 #if defined(FAILLOG) |
|
241 _LIT(KPointerPressure, "Actual PointerPressure from Wserv = %d Expected PointerPressure = %d "); |
|
242 logText.Format(KPointerPressure, actualPointerEvent->Pressure(), expectedPointerEvent->Pressure()); |
|
243 iTest->LOG_MESSAGE(logText); |
|
244 #endif |
|
245 #if defined(TESTMULTIPOINTER) |
|
246 TESTXL(actualPointerEvent->Pressure(), ==, expectedPointerEvent->Pressure(), &wsEvent, &expectedEvent); |
|
247 #endif |
|
248 #if defined(FAILLOG) |
|
249 _LIT(KPointerModifier, "Actual Modifier value from Wserv = 0x%08x Expected Modfier value = 0x%08x "); |
|
250 logText.Format(KPointerModifier, actualPointerEvent->iModifiers, expectedPointerEvent->iModifiers); |
|
251 iTest->LOG_MESSAGE(logText); |
|
252 #endif |
|
253 #if defined(TESTMULTIPOINTER) |
|
254 TESTXL((actualPointerEvent->iModifiers&expectedPointerEvent->iModifiers), ==, expectedPointerEvent->iModifiers, &wsEvent, &expectedEvent); |
|
255 #endif |
|
256 } |
|
257 End: |
|
258 // Call NextSetOfEvents() only for primary client |
|
259 if (iEventBuffer.Count()==0 && !iClient->IsSecondaryClient()) |
|
260 { |
|
261 iTest->NextSetOfEventsL(); // Cannot Leave |
|
262 } |
|
263 |
|
264 // If this is for secondary client and active scheduler(nested loop) has started, this code stops that scheduler |
|
265 if (iEventBuffer.Count()==0 && iClient->IsSecondaryClient() && iNestedLoopStarted) |
|
266 { |
|
267 iNestedLoopStarted = EFalse; |
|
268 CActiveScheduler::Stop(); |
|
269 } |
|
270 } |
|
271 |
|
272 void CTMultiPtrEventBuffer::TestL(TInt aTest) |
|
273 { |
|
274 if (!aTest) |
|
275 { |
|
276 iTest->Failed(); |
|
277 User::Leave(ETestFailed); |
|
278 } |
|
279 } |
|
280 |
|
281 static void DumpEvent(const char *aName, const TWsEvent *aEvent) |
|
282 { |
|
283 // aEvent may be NULL - if it isn't NULL, we print it's data. |
|
284 if (aEvent) |
|
285 { |
|
286 RDebug::Printf("%s:", aName); |
|
287 RDebug::Printf("handle = %u", aEvent->Handle()); |
|
288 RDebug::Printf("type() = %d", aEvent->Type()); |
|
289 if (aEvent->Type() == EEventPointer) |
|
290 { |
|
291 TAdvancedPointerEvent *pointer = aEvent->Pointer(); |
|
292 RDebug::Printf("pointer type = %d, position = (%d, %d)", |
|
293 pointer->iType, pointer->iPosition.iX, pointer->iPosition.iY); |
|
294 RDebug::Printf("PointerNumber() = %d, proximity=%d, pressure=%d", |
|
295 pointer->PointerNumber(), pointer->Proximity(), pointer->Pressure()); |
|
296 RDebug::Printf("modifiers = 0x%08x", pointer->iModifiers); |
|
297 } |
|
298 else |
|
299 { |
|
300 RDebug::Printf("Not a pointer event, event type"); |
|
301 } |
|
302 } |
|
303 else |
|
304 { |
|
305 // aEvent is NULL, just let us know it is. |
|
306 RDebug::Printf("%s: is NULL which means not applicapable"); |
|
307 } |
|
308 } |
|
309 |
|
310 void CTMultiPtrEventBuffer::TestL(TInt aTest, TInt aVal1, TInt aVal2, const char *aOper, const char *aTestStr, |
|
311 const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine) |
|
312 { |
|
313 if (!aTest) |
|
314 { |
|
315 RDebug::Printf("Expression %d %s %d [%s] (=%d) failed [call from %s:%d]", aVal1, aOper, aVal2, aTestStr, aTest, aFile, aLine); |
|
316 DumpEvent("actual", aEvent); |
|
317 DumpEvent("expected", aExpected); |
|
318 iTest->Failed(); |
|
319 User::Leave(ETestFailed); |
|
320 } |
|
321 } |
|
322 |
|
323 |
|
324 void CTMultiPtrEventBuffer::TestL(TInt aTest, TPoint aVal1, TPoint aVal2, const char *oper, const char *aTestStr, |
|
325 const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine) |
|
326 { |
|
327 if (!aTest) |
|
328 { |
|
329 RDebug::Printf("Expression (%d, %d) %s (%d, %d) [%s] (=%d) failed [call from %s:%d]", |
|
330 aVal1.iX, aVal1.iY, oper, aVal2.iX, aVal2.iY, aTestStr, aTest, aFile, aLine); |
|
331 DumpEvent("actual", aEvent); |
|
332 DumpEvent("expected", aExpected); |
|
333 iTest->Failed(); |
|
334 User::Leave(ETestFailed); |
|
335 } |
|
336 } |
|
337 |
|
338 //CTMultiPtrEventClient |
|
339 CTMultiPtrEventClient::CTMultiPtrEventClient(CTMultiPtrEventTest *aTest, TBool aSecondaryClient) |
|
340 : iTest(aTest), iSecondaryClient(aSecondaryClient) |
|
341 { |
|
342 } |
|
343 |
|
344 CTMultiPtrEventClient::~CTMultiPtrEventClient() |
|
345 { |
|
346 if (iWinAutoFocus1 || iWinAutoFocus2 || iGroupWinAutoFocus2 || iGroupWinAutoFocus1) |
|
347 { |
|
348 DeleteGroupBlankWin(); |
|
349 } |
|
350 delete iChildWin; |
|
351 delete iParentWin; |
|
352 } |
|
353 |
|
354 void CTMultiPtrEventClient::ConstructL() |
|
355 { |
|
356 CTClient::ConstructL(); |
|
357 |
|
358 // Create a group window and assign it iGroup |
|
359 iGroup = new(ELeave) CTWindowGroup(this); |
|
360 iGroup->ConstructL(); |
|
361 |
|
362 iParentWinSize = iScreen->SizeInPixels(); |
|
363 iParentWinPos = TPoint(); |
|
364 |
|
365 // Change the parent window size and position for secondary client |
|
366 if (iSecondaryClient) |
|
367 { |
|
368 iParentWinSize.iWidth /= 2; |
|
369 iParentWinPos.iX = iParentWinSize.iWidth; |
|
370 } |
|
371 |
|
372 // Create window/s for this client so that events can come to this client |
|
373 iParentWin=new(ELeave) CTBlankWindow(); |
|
374 iParentWin->ConstructL(*iGroup); |
|
375 iParentWin->SetExt(iParentWinPos, iParentWinSize); |
|
376 iParentWin->SetColor(KRgbRed); |
|
377 if (iTest->TestBase()->iState != 12) |
|
378 { |
|
379 iParentWin->BaseWin()->EnableAdvancedPointers(); |
|
380 } |
|
381 iParentWin->Activate(); |
|
382 |
|
383 // Don't create child window for secodary client |
|
384 if (!iSecondaryClient) |
|
385 { |
|
386 iChildWinSize = TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight); |
|
387 iChildWinPos = TPoint(iParentWinSize.iWidth/2,0); |
|
388 |
|
389 iChildWin=new(ELeave) CTBlankWindow(); |
|
390 iChildWin->ConstructL(*iGroup); |
|
391 iChildWin->SetExt(iChildWinPos, iChildWinSize); |
|
392 iChildWin->SetColor(KRgbRed); |
|
393 iChildWin->BaseWin()->EnableAdvancedPointers(); |
|
394 iChildWin->Activate(); |
|
395 } |
|
396 } |
|
397 |
|
398 void CTMultiPtrEventClient::CalculatePtrPosAndSet3Ddata(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TUint aModifiers, TInt aZ, TUint8 aPointerNumber, TUint aHandle) |
|
399 { |
|
400 // If in future you need to change parent position then put this in corresponding if statements |
|
401 aEvent.Pointer()->iParentPosition = aPos; |
|
402 |
|
403 // This is for Auto foreground test |
|
404 if (iTest->TestBase()->iState == 11) |
|
405 { |
|
406 if (TRect(iWinPosAutoFocus1, iWinSizeAutoFocus1).Contains(aPos)) |
|
407 { |
|
408 aPos -= iWinPosAutoFocus1; |
|
409 aEvent.SetHandle((TUint)iWinAutoFocus1); |
|
410 } |
|
411 else if (TRect(iWinPosAutoFocus2, iWinSizeAutoFocus2).Contains(aPos)) |
|
412 { |
|
413 aPos -= iWinPosAutoFocus2; |
|
414 aEvent.SetHandle((TUint)iWinAutoFocus2); |
|
415 } |
|
416 goto SETOTHERDATA; |
|
417 } |
|
418 |
|
419 // Here simulated pointer position is w.r.t to 0,0 |
|
420 // Actual pointer position is w.r.t windowPosition |
|
421 if (iSecondaryClient) |
|
422 { |
|
423 if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth, iParentWinSize.iHeight)).Contains(aPos)) |
|
424 { |
|
425 // Since for secondary client parent window is at half of screensize |
|
426 aPos -= iParentWinPos; |
|
427 aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle); |
|
428 } |
|
429 } |
|
430 else |
|
431 { |
|
432 // If sent position is on blankWindow then |
|
433 if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight)).Contains(aPos)) |
|
434 { |
|
435 aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle); |
|
436 } |
|
437 else // else the pointer event occured on child window |
|
438 { |
|
439 // if aPos < 0 then position has been generated in test code and should not be adjusted |
|
440 if (aPos.iX >= 0) |
|
441 { |
|
442 aPos -= iChildWinPos; |
|
443 } |
|
444 aEvent.SetHandle((aHandle == 0) ? (TUint)iChildWin : aHandle); |
|
445 } |
|
446 } |
|
447 |
|
448 SETOTHERDATA: |
|
449 aEvent.Pointer()->iType = aType; |
|
450 aEvent.Pointer()->iPosition = aPos; |
|
451 if(iExpectNonAdvancedPointerEvents) |
|
452 { |
|
453 aEvent.Pointer()->iModifiers = aModifiers; |
|
454 } |
|
455 else |
|
456 { |
|
457 aEvent.Pointer()->iModifiers = aModifiers|EModifierAdvancedPointerEvent; |
|
458 aEvent.SetPointerNumber(aPointerNumber); |
|
459 aEvent.SetPointerZ(aZ); |
|
460 } |
|
461 } |
|
462 |
|
463 void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle) |
|
464 { |
|
465 AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle); |
|
466 } |
|
467 |
|
468 void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) |
|
469 { |
|
470 TWsEvent ptrEvent; |
|
471 ptrEvent.SetType(EEventPointer); |
|
472 if (aType != TPointerEvent::ESwitchOn) |
|
473 { |
|
474 CalculatePtrPosAndSet3Ddata(ptrEvent, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); |
|
475 } |
|
476 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent); |
|
477 } |
|
478 |
|
479 void CTMultiPtrEventClient::AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber, TUint aHandle) |
|
480 { |
|
481 TWsEvent ptrEvent; |
|
482 ptrEvent.SetType(aType); |
|
483 if (aType == EEventPointerEnter || aType == EEventPointerExit) |
|
484 { |
|
485 *ptrEvent.Int() = aPointerNumber; |
|
486 } |
|
487 if (aType == EEventPointerBufferReady) |
|
488 { |
|
489 ptrEvent.SetHandle(aHandle); |
|
490 } |
|
491 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent); |
|
492 } |
|
493 |
|
494 void CTMultiPtrEventClient::AddExpectedMovePoint(TPoint aPos) |
|
495 { |
|
496 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedMovePtEvent(aPos); |
|
497 } |
|
498 |
|
499 // Create and store CTMultiPtrEventBuffer in iEventHandler |
|
500 void CTMultiPtrEventClient::ConstructEventHandlerL() |
|
501 { |
|
502 CTMultiPtrEventBuffer* eventBufferAndHandler = new(ELeave) CTMultiPtrEventBuffer(&iWs, iTest, this); |
|
503 eventBufferAndHandler->ConstructL(); |
|
504 iEventHandler = eventBufferAndHandler; |
|
505 } |
|
506 |
|
507 // Create groupwindow and blank window for AutoFocus tests |
|
508 void CTMultiPtrEventClient::ConstructGroupBlankWinL() |
|
509 { |
|
510 iWinPosAutoFocus1 = TPoint(10,10); |
|
511 iWinSizeAutoFocus1 = TSize(40,40); |
|
512 |
|
513 iWinPosAutoFocus2 = TPoint(50,50); |
|
514 iWinSizeAutoFocus2 = TSize(80,80); |
|
515 |
|
516 iGroupWinAutoFocus1 = new(ELeave) CTWindowGroup(this); |
|
517 iGroupWinAutoFocus1->ConstructL(); |
|
518 iGroupWinAutoFocus1->GroupWin()->AutoForeground(ETrue); |
|
519 iGroupWinAutoFocus1->GroupWin()->EnableFocusChangeEvents(); |
|
520 |
|
521 iGroupWinAutoFocus2 = new(ELeave) CTWindowGroup(this); |
|
522 iGroupWinAutoFocus2->ConstructL(); |
|
523 iGroupWinAutoFocus2->GroupWin()->AutoForeground(ETrue); |
|
524 iGroupWinAutoFocus2->GroupWin()->EnableFocusChangeEvents(); |
|
525 |
|
526 iWinAutoFocus1=new(ELeave) CTBlankWindow(); |
|
527 iWinAutoFocus1->ConstructL(*iGroupWinAutoFocus1); |
|
528 iWinAutoFocus1->SetExt(iWinPosAutoFocus1, iWinSizeAutoFocus1); |
|
529 iWinAutoFocus1->SetColor(KRgbDarkYellow); |
|
530 iWinAutoFocus1->BaseWin()->EnableAdvancedPointers(); |
|
531 iWinAutoFocus1->Activate(); |
|
532 |
|
533 iWinAutoFocus2=new(ELeave) CTBlankWindow(); |
|
534 iWinAutoFocus2->ConstructL(*iGroupWinAutoFocus2); |
|
535 iWinAutoFocus2->SetExt(iWinPosAutoFocus2, iWinSizeAutoFocus2); |
|
536 iWinAutoFocus2->SetColor(KRgbDarkCyan); |
|
537 iWinAutoFocus2->BaseWin()->EnableAdvancedPointers(); |
|
538 iWinAutoFocus2->Activate(); |
|
539 } |
|
540 |
|
541 void CTMultiPtrEventClient::DeleteGroupBlankWin() |
|
542 { |
|
543 delete iWinAutoFocus2; |
|
544 iWinAutoFocus2 = NULL; |
|
545 delete iGroupWinAutoFocus2; |
|
546 iGroupWinAutoFocus2 = NULL; |
|
547 delete iWinAutoFocus1; |
|
548 iWinAutoFocus1 = NULL; |
|
549 delete iGroupWinAutoFocus1; |
|
550 iGroupWinAutoFocus1 = NULL; |
|
551 } |
|
552 |
|
553 TBool CTMultiPtrEventClient::CheckOrdinalPosition(TInt aAutoFocusWin) |
|
554 { |
|
555 if (aAutoFocusWin == 1) |
|
556 { |
|
557 return iWinAutoFocus1->BaseWin()->OrdinalPosition() == 0; |
|
558 } |
|
559 else |
|
560 { |
|
561 return iWinAutoFocus2->BaseWin()->OrdinalPosition() == 0; |
|
562 } |
|
563 } |
|
564 |
|
565 //CTMultiPtrEventTest |
|
566 CTMultiPtrEventTest::CTMultiPtrEventTest(CTestStep* aStep) |
|
567 : CTWsGraphicsBase(aStep) |
|
568 { |
|
569 } |
|
570 |
|
571 CTMultiPtrEventTest::~CTMultiPtrEventTest() |
|
572 { |
|
573 ((CTMultiPtrEventTestStep*)iStep)->CloseTMSGraphicsStep(); |
|
574 delete iMultiPtrEventClient; |
|
575 DestroyAnimDllAndAnim(); |
|
576 if (iPtrPluginLoaded) |
|
577 { |
|
578 iClick.Unload(); |
|
579 } |
|
580 iClick.Close(); |
|
581 if (iHeap) |
|
582 { |
|
583 iHeap->Close(); |
|
584 iChunk.Close(); |
|
585 } |
|
586 DeleteGroupWin(); |
|
587 } |
|
588 |
|
589 void CTMultiPtrEventTest::ConstructL() |
|
590 { |
|
591 // Here check if the HAL configuration are correct if not then finish the test case |
|
592 TInt ret = HAL::Get(HALData::EPointerMaxPointers, iMaxDevPointers); |
|
593 if (ret != KErrNone || iMaxDevPointers < 2 || iMaxDevPointers > 8) |
|
594 { |
|
595 TLogMessageText logText1; |
|
596 _LIT(KWrongHALConfig, "HAL configuration are incorrect. \n"); |
|
597 logText1.Append(KWrongHALConfig); |
|
598 LOG_MESSAGE(logText1); |
|
599 TEST(EFalse); |
|
600 User::Leave(ret); |
|
601 } |
|
602 |
|
603 // Get the data by using HAL api |
|
604 User::LeaveIfError(HAL::Get(HALData::EPointerMaxPointers,iMaxDevPointers)); |
|
605 User::LeaveIfError(HAL::Get(HALData::EPointerNumberOfPointers,iMaxUiPointers)); |
|
606 User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxPressure, iMaxPressure)); |
|
607 User::LeaveIfError(HAL::Get(HALData::EPointer3DPressureStep, iPressureStep)); |
|
608 User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxProximity, iMaxProximity)); |
|
609 User::LeaveIfError(HAL::Get(HALData::EPointer3DProximityStep, iProximityStep)); |
|
610 |
|
611 _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini"); |
|
612 CIniData* iniData = CIniData::NewL(KWsIniFile, ' '); |
|
613 _LIT( KWsiniYShifting, "YSHIFTING"); |
|
614 iniData->FindVar(KWsiniYShifting, iYOffset); |
|
615 delete iniData; |
|
616 TheClient->iScreen->SetAppScreenMode(0); |
|
617 TheClient->iScreen->SetScreenMode(0); |
|
618 iPhysicalScreenSize = TheClient->iScreen->SizeInPixels(); |
|
619 |
|
620 TheGc->Activate(*BaseWin->Win()); |
|
621 TheGc->SetBrushColor(TRgb::Gray16(12)); |
|
622 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
623 TheGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
624 TheGc->DrawRect(TRect(BaseWin->Win()->Size())); |
|
625 TheGc->Deactivate(); |
|
626 |
|
627 TheGc->Activate(*TestWin->Win()); |
|
628 TheGc->SetBrushColor(TRgb::Gray16(4)); |
|
629 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
630 TheGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
631 TheGc->DrawRect(TRect(TestWin->Win()->Size())); |
|
632 TheGc->Deactivate(); |
|
633 |
|
634 TheClient->iWs.Flush(); |
|
635 } |
|
636 |
|
637 // Create raw event setting type, X, Y, Z and pointernumber for rawevent |
|
638 // use UserSvr for simulating the event |
|
639 void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber) |
|
640 { |
|
641 TRawEvent rawEvent; |
|
642 rawEvent.Set(aType, aX, aY+iYOffset, aPointerNumber); |
|
643 UserSvr::AddEvent(rawEvent); |
|
644 } |
|
645 |
|
646 void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) |
|
647 { |
|
648 TRawEvent rawEvent; |
|
649 rawEvent.Set(aType, aX, aY+iYOffset, aZ, aPointerNumber); |
|
650 UserSvr::AddEvent(rawEvent); |
|
651 } |
|
652 |
|
653 // Simulate multipointer down and up event |
|
654 void CTMultiPtrEventTest::SimulatePointerDownUp(TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) |
|
655 { |
|
656 SimulatePointerEvent(TRawEvent::EButton1Down, aX, aY, aZ, aPointerNumber); |
|
657 SimulatePointerEvent(TRawEvent::EButton1Up, aX, aY, aZ, aPointerNumber); |
|
658 } |
|
659 |
|
660 void CTMultiPtrEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/) |
|
661 { |
|
662 TPckgBuf<TWsEvent> evtPkg; |
|
663 TWsEvent& event=evtPkg(); |
|
664 if (aEventCode==EEventKey && aCode==0) |
|
665 aCode=aScanCode; |
|
666 event.SetType(aEventCode); |
|
667 event.SetHandle((TUint)iMultiPtrEventClient->iGroup); |
|
668 event.Key()->iCode=aCode; |
|
669 event.Key()->iScanCode=aScanCode; |
|
670 event.Key()->iModifiers=aModifiers; |
|
671 event.Key()->iRepeats=aRepeats; |
|
672 iMultiPtrEventClient->EventBuffer()->AddExpectedEvent(event); |
|
673 } |
|
674 |
|
675 void CTMultiPtrEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/) |
|
676 { |
|
677 __ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital)); |
|
678 AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers); |
|
679 AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers); |
|
680 AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers); |
|
681 } |
|
682 |
|
683 void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle) |
|
684 { |
|
685 AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle); |
|
686 } |
|
687 |
|
688 void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle, TBool aSecondaryClient) |
|
689 { |
|
690 if (aSecondaryClient) |
|
691 { |
|
692 iSecMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); |
|
693 } |
|
694 else |
|
695 { |
|
696 iMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); |
|
697 } |
|
698 } |
|
699 |
|
700 void CTMultiPtrEventTest::SetExpectNonAdvancedPointerEvents(TBool aSecondaryClient) |
|
701 { |
|
702 if (aSecondaryClient) |
|
703 { |
|
704 iSecMultiPtrEventClient->SetExpectNonAdvancedPointerEvents(); |
|
705 } |
|
706 else |
|
707 { |
|
708 iMultiPtrEventClient->SetExpectNonAdvancedPointerEvents(); |
|
709 } |
|
710 } |
|
711 |
|
712 void CTMultiPtrEventTest::ClearExpectNonAdvancedPointerEvents(TBool aSecondaryClient) |
|
713 { |
|
714 if (aSecondaryClient) |
|
715 { |
|
716 iSecMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents(); |
|
717 } |
|
718 else |
|
719 { |
|
720 iMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents(); |
|
721 } |
|
722 } |
|
723 |
|
724 void CTMultiPtrEventTest::AddExpectedPointerDownUp(TPoint aPos, TInt aZ, TUint8 aPointerNumber) |
|
725 { |
|
726 AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPos, aZ, 0, aPointerNumber); |
|
727 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, aZ, 0, aPointerNumber); |
|
728 } |
|
729 |
|
730 void CTMultiPtrEventTest::AddExpectedWsEvent(TEventCode aType, TBool aSecondaryClient, TInt aPointerNumber, TUint aHandle) |
|
731 { |
|
732 if (aSecondaryClient) |
|
733 { |
|
734 iSecMultiPtrEventClient->AddExpectedWsEvent(aType); |
|
735 } |
|
736 else |
|
737 { |
|
738 iMultiPtrEventClient->AddExpectedWsEvent(aType, aPointerNumber, aHandle); |
|
739 } |
|
740 } |
|
741 |
|
742 void CTMultiPtrEventTest::TestDragForMultiPointer(TPoint aPtrPos, TInt aPrValue, TUint8 aPointerNumber) |
|
743 { |
|
744 SimulatePointerEvent(TRawEvent::EButton1Down, aPtrPos.iX, aPtrPos.iY, aPrValue, aPointerNumber); |
|
745 SimulatePointerEvent(TRawEvent::EPointerMove, aPtrPos.iX+2, aPtrPos.iY+1, aPrValue, aPointerNumber); |
|
746 SimulatePointerEvent(TRawEvent::EButton1Up, aPtrPos.iX+2, aPtrPos.iY+1, 0, aPointerNumber); |
|
747 AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPtrPos, aPrValue, 0, aPointerNumber); |
|
748 aPtrPos.iX += 2; aPtrPos.iY += 1; |
|
749 AddExpectedPointerEvent(TPointerEvent::EDrag, aPtrPos, aPrValue, 0, aPointerNumber); |
|
750 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPtrPos, 0, 0, aPointerNumber); |
|
751 } |
|
752 |
|
753 void CTMultiPtrEventTest::SimulateAndAddLoneUpEvents(TInt aNumSimulation, TInt aNumAddition, TPoint aPos) |
|
754 { |
|
755 for (TInt count = 0; count < aNumSimulation; count++) |
|
756 { |
|
757 SimulatePointerEvent(TRawEvent::EButton1Up, aPos.iX, aPos.iY, 0, 0); |
|
758 } |
|
759 for (TInt count = 0; count < aNumAddition; count++) |
|
760 { |
|
761 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, 0, 0, 0); |
|
762 } |
|
763 } |
|
764 |
|
765 void CTMultiPtrEventTest::TestFilteringForMultiPointer(TBool aFiltering) |
|
766 { |
|
767 TPoint ptrPos; |
|
768 TInt ptrNum; |
|
769 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
770 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
771 |
|
772 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
773 { |
|
774 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
775 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
776 if(!aFiltering) |
|
777 { |
|
778 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, ptrNum); |
|
779 } |
|
780 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
781 ptrPos.iX += xInc/2; |
|
782 ptrPos.iY += yInc/2; |
|
783 } |
|
784 |
|
785 ptrPos.SetXY(0,0); |
|
786 TPoint interPt = ptrPos; |
|
787 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
788 { |
|
789 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+2, interPt.iY+1, 0, ptrNum); |
|
790 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+4, interPt.iY+2, 0, ptrNum); |
|
791 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+6, interPt.iY+3, 0, ptrNum); |
|
792 if(!aFiltering) |
|
793 { |
|
794 interPt.iX += 6; interPt.iY += 3; |
|
795 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, ptrNum); |
|
796 } |
|
797 ptrPos.iX += xInc/2; |
|
798 ptrPos.iY += yInc/2; |
|
799 interPt = ptrPos; |
|
800 } |
|
801 |
|
802 ptrPos.SetXY(0,0); |
|
803 interPt = ptrPos; |
|
804 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
805 { |
|
806 interPt.iX += 6; |
|
807 interPt.iY += 3; |
|
808 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
809 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, ptrNum); |
|
810 ptrPos.iX += xInc/2; |
|
811 ptrPos.iY += yInc/2; |
|
812 interPt = ptrPos; |
|
813 } |
|
814 } |
|
815 |
|
816 void CTMultiPtrEventTest::TestGrabbingForMultiPointer(TBool aGrabbing) |
|
817 { |
|
818 TPoint ptrPos; |
|
819 TInt ptrNum; |
|
820 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
821 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
822 |
|
823 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
824 { |
|
825 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
826 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
827 ptrPos.iX += xInc/3; // Ensure all Button1Down events are on iParentWin |
|
828 ptrPos.iY += yInc/3; |
|
829 } |
|
830 |
|
831 ptrPos.SetXY(0,0); |
|
832 ptrPos.iX += iPhysicalScreenSize.iWidth/2; // Ensure all Drag and Button1Up events are on iChildWin |
|
833 ptrPos.iY += iPhysicalScreenSize.iHeight/2; |
|
834 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
835 { |
|
836 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
837 if(aGrabbing) |
|
838 { |
|
839 // CalculatePtrPosAndSet3Ddata will subtract iChildWinPos from ptrPos if pointer event occured on child window. Thus we add iChildWinPos here. |
|
840 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin()); |
|
841 } |
|
842 else |
|
843 { |
|
844 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); |
|
845 } |
|
846 ptrPos.iX += xInc/3; |
|
847 ptrPos.iY += yInc/3; |
|
848 } |
|
849 |
|
850 ptrPos.SetXY(0,0); |
|
851 ptrPos.iX += iPhysicalScreenSize.iWidth/2; |
|
852 ptrPos.iY += iPhysicalScreenSize.iHeight/2; |
|
853 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
854 { |
|
855 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
856 if(aGrabbing) |
|
857 { |
|
858 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin()); |
|
859 } |
|
860 else |
|
861 { |
|
862 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
863 } |
|
864 ptrPos.iX += xInc/3; |
|
865 ptrPos.iY += yInc/3; |
|
866 } |
|
867 } |
|
868 |
|
869 void CTMultiPtrEventTest::TestCapturingForMultiPointer(TBool aAllWinGroups) |
|
870 { |
|
871 TPoint ptrPos; |
|
872 TInt ptrNum = 0; |
|
873 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
874 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
875 |
|
876 // These are some typical values which are used only for testing purposes. |
|
877 // 20mm to screen |
|
878 // 50mm to screen |
|
879 // 4N of pressure |
|
880 // 2N of pressure |
|
881 SetThresholdValues(-20,-50,4000,2000); |
|
882 |
|
883 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerMoveEvents, 0); |
|
884 |
|
885 if(!aAllWinGroups) |
|
886 { |
|
887 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
888 { |
|
889 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -30, ptrNum); |
|
890 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -30, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
891 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum); |
|
892 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -10, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
893 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
894 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
895 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum); |
|
896 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 5000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
897 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum); |
|
898 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
899 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum); |
|
900 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
901 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
902 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
903 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, -60, ptrNum); |
|
904 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -60, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); |
|
905 ptrPos.iX += xInc/3; // Ensure all Pointer events are on iParentWin |
|
906 ptrPos.iY += yInc/3; |
|
907 } |
|
908 } |
|
909 else |
|
910 { |
|
911 ptrPos.iX = iPhysicalScreenSize.iWidth/2 + xInc/3; |
|
912 ptrPos.iY = 0; |
|
913 |
|
914 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
915 { |
|
916 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum); |
|
917 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), -10, 0, ptrNum, (TInt)iWinForCapturing); |
|
918 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
919 AddExpectedPointerEvent(TPointerEvent::EButton1Down, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); |
|
920 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum); |
|
921 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 5000, 0, ptrNum, (TInt)iWinForCapturing); |
|
922 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum); |
|
923 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing); |
|
924 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum); |
|
925 AddExpectedPointerEvent(TPointerEvent::EDrag, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing); |
|
926 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
927 AddExpectedPointerEvent(TPointerEvent::EButton1Up, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); |
|
928 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
929 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); |
|
930 ptrPos.iX += xInc/3; |
|
931 ptrPos.iY += yInc/3; |
|
932 } |
|
933 } |
|
934 } |
|
935 |
|
936 void CTMultiPtrEventTest::SetAutoFlush() |
|
937 { |
|
938 iTheClientFlush = TheClient->iWs.SetAutoFlush(ETrue); |
|
939 iClientFlush = iMultiPtrEventClient->iWs.SetAutoFlush(ETrue); |
|
940 } |
|
941 |
|
942 void CTMultiPtrEventTest::ResetFlushStopAS() |
|
943 { |
|
944 if (iActiveSchedulerStarted) |
|
945 { |
|
946 iActiveSchedulerStarted = EFalse; |
|
947 CActiveScheduler::Stop(); |
|
948 } |
|
949 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
950 iMultiPtrEventClient->iWs.SetAutoFlush(iClientFlush); |
|
951 } |
|
952 |
|
953 // Common function for all test cases |
|
954 void CTMultiPtrEventTest::RunTestsL() |
|
955 { |
|
956 // Create CTMultiPtrEventClient for each test case and call NextSetOfEventsL() |
|
957 iMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this); |
|
958 iMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber); |
|
959 iMultiPtrEventClient->ConstructL(); |
|
960 |
|
961 iEventSet=0; |
|
962 |
|
963 // Create secondary client for test case number 3 |
|
964 if (iTest->iState == 3) |
|
965 { |
|
966 iSecMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this, 1); |
|
967 iSecMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber); |
|
968 iSecMultiPtrEventClient->ConstructL(); |
|
969 } |
|
970 |
|
971 TRAPD(err, NextSetOfEventsL()); |
|
972 if (err != KErrNone) |
|
973 { |
|
974 iFailed = ETrue; |
|
975 } |
|
976 |
|
977 // Start nested activescheduler if it is not failed for the first attempt |
|
978 if (!iFailed) |
|
979 { |
|
980 iActiveSchedulerStarted = ETrue; |
|
981 CActiveScheduler::Start(); |
|
982 } |
|
983 |
|
984 // |
|
985 TInt eventsRem = iMultiPtrEventClient->EventBuffer()->EventsRemaining(); |
|
986 if (eventsRem > 0) |
|
987 { |
|
988 iFailed=ETrue; |
|
989 } |
|
990 |
|
991 // Delete secondary client for test case number 3 |
|
992 if (iTest->iState == 3) |
|
993 { |
|
994 delete iSecMultiPtrEventClient; |
|
995 iSecMultiPtrEventClient = NULL; |
|
996 } |
|
997 |
|
998 delete iMultiPtrEventClient; |
|
999 iMultiPtrEventClient = NULL; |
|
1000 } |
|
1001 |
|
1002 // Common function for all tests |
|
1003 // Important point to remember is that this function should not leave when running tests |
|
1004 void CTMultiPtrEventTest::NextSetOfEventsL() |
|
1005 { |
|
1006 // For each test case calls its respective tests |
|
1007 |
|
1008 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
1009 switch (iTest->iState) |
|
1010 { |
|
1011 case 0: |
|
1012 /** |
|
1013 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0036 |
|
1014 */ |
|
1015 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0036")); |
|
1016 MultiPointerEvents(); |
|
1017 break; |
|
1018 case 1: |
|
1019 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0014")); |
|
1020 PurgingMultiPointerEvents(); |
|
1021 break; |
|
1022 case 2: |
|
1023 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0013")); |
|
1024 MultiPointerEventsForAnimsL(); |
|
1025 break; |
|
1026 case 3: |
|
1027 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0011")); |
|
1028 GetRemainingEventsFromSecondaryClient(); // Does nothing for first time |
|
1029 MultiClientMultiPointerEvents(); |
|
1030 break; |
|
1031 case 4: |
|
1032 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0027")); |
|
1033 MultiPointerEventsForPointerClickL(); |
|
1034 break; |
|
1035 case 5: |
|
1036 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0028")); |
|
1037 MultiPointerEventsInDiffScreenModes(); |
|
1038 break; |
|
1039 case 6: |
|
1040 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0025")); |
|
1041 FilteringMultiPointerEvents(); |
|
1042 break; |
|
1043 case 7: |
|
1044 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0021")); |
|
1045 GrabbingMultiPointerEvents(); |
|
1046 break; |
|
1047 case 8: |
|
1048 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0031")); |
|
1049 VirtualKeyBoardForMultiplePointers(); |
|
1050 break; |
|
1051 case 9: |
|
1052 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0032")); |
|
1053 DoubleClickForMultiplePointers(); |
|
1054 break; |
|
1055 case 10: |
|
1056 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0015")); |
|
1057 MultiPointerOutOfRangeEvents(); |
|
1058 break; |
|
1059 case 11: |
|
1060 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0026")); |
|
1061 AutoForeGroundForMultiplePointersL(); |
|
1062 break; |
|
1063 case 12: |
|
1064 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0029")); |
|
1065 EmulationRulesForMultiplePointers(); |
|
1066 break; |
|
1067 case 13: |
|
1068 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034")); |
|
1069 CloseProximityAndHighPressureEventsL(); |
|
1070 break; |
|
1071 case 14: |
|
1072 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0017")); |
|
1073 OutOfBoundValueTesting(); |
|
1074 break; |
|
1075 case 15: |
|
1076 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0019")); |
|
1077 CapturingMultiPointerEvents(); |
|
1078 break; |
|
1079 case 16: |
|
1080 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0035")); |
|
1081 NegativeTestsForProximityPressureEventsL(); |
|
1082 break; |
|
1083 case 17: |
|
1084 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034")); |
|
1085 PointerRepeatEventForMultiplePointers(); |
|
1086 break; |
|
1087 // Any new test case should be added here. |
|
1088 // because some of the above tests use testcase number for certain checks |
|
1089 default: |
|
1090 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
1091 AutoPanic(EAutoPanicWrongTest); |
|
1092 } |
|
1093 ((CTMultiPtrEventTestStep*)iStep)->RecordTestResultL(); |
|
1094 } |
|
1095 |
|
1096 /** |
|
1097 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0033 |
|
1098 @SYMPREQ PREQ1226 |
|
1099 @SYMREQ REQ9677 |
|
1100 @SYMTestPriority High |
|
1101 @SYMTestCaseDesc To check Wserv sends Pointer Repeat Events for all pointers. |
|
1102 @SYMTestStatus Implemented |
|
1103 |
|
1104 @SYMTestActions Simulate events being passed to the client by implementing each discrete test |
|
1105 over 4 seperate test cases. |
|
1106 In the first test case simulate EButton1Down and add event to a TWsEvent buffer. |
|
1107 In the second test case call RequestPointerRepeatEvent on the base window passing |
|
1108 in a time interval, a rectangle (the 'hitbox') and pointer number. |
|
1109 Add EButtonRepeat to TWsEvent buffer. |
|
1110 In the third test case simulate EPointerMove event within the hitbox, then simulate |
|
1111 an elapsed period of time longer that specified interval. Add only a EButtonRepeat |
|
1112 to TWsEvent buffer. |
|
1113 In the final test case simulate EButton1Up and add event to TWsEvent buffer. |
|
1114 |
|
1115 Repeat steps for the second discrete test, however, in the third test case simulate |
|
1116 EPointerMove event outside the hitbox. In addition add EDrag to TWsEvent buffer |
|
1117 instead of EButtonRepeat. |
|
1118 |
|
1119 A third discrete test will be executed over two test cases and will test |
|
1120 CancelPointerRepeatEventRequest API. |
|
1121 |
|
1122 @SYMTestExpectedResults The received events must match the events added to the buffer except where EPointerMove |
|
1123 events should be filtered out. In addition, EButtonRepeat will be generated by wserv |
|
1124 after calling RequestPointerRepeatEvent and time interval specified has elapsed. |
|
1125 |
|
1126 */ |
|
1127 void CTMultiPtrEventTest::PointerRepeatEventForMultiplePointers() |
|
1128 { |
|
1129 // Test PointerRepeatEvent for Multiple Pointers |
|
1130 TLogMessageText logText; |
|
1131 _LIT(KSet, "PointerRepeatEventForMultiplePointers SetOfEvents: %d of 10"); |
|
1132 logText.AppendFormat(KSet, iEventSet); |
|
1133 LOG_MESSAGE(logText); |
|
1134 |
|
1135 if (!iEventSet) |
|
1136 { |
|
1137 SetAutoFlush(); |
|
1138 AddExpectedWsEvent(EEventFocusGained); |
|
1139 } |
|
1140 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
1141 |
|
1142 TPoint ptrPos; |
|
1143 TInt ptrNum; |
|
1144 // Ensure all pointers are on iParentWin |
|
1145 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers/3; |
|
1146 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers/3; |
|
1147 |
|
1148 switch(iEventSet++) |
|
1149 { |
|
1150 // Test cases 0 - 3 represent first discrete test for PointerRepeatEvents |
|
1151 case 0: |
|
1152 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. |
|
1153 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. |
|
1154 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); |
|
1155 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1156 { |
|
1157 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1158 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
1159 ptrPos.iX+=xInc; |
|
1160 ptrPos.iY+=yInc; |
|
1161 } |
|
1162 break; |
|
1163 case 1: |
|
1164 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. |
|
1165 INFO_PRINTF1(_L("Simulate PointerRepeatEvent request for all pointers.")); |
|
1166 ptrPos.SetXY(0,0); |
|
1167 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1168 { |
|
1169 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum); |
|
1170 User::After(200000); |
|
1171 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); |
|
1172 ptrPos.iX+=xInc; |
|
1173 ptrPos.iY+=yInc; |
|
1174 } |
|
1175 break; |
|
1176 case 2: |
|
1177 // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and pointer remaining within the 'hitbox'. |
|
1178 INFO_PRINTF1(_L("Simulate additional PointerRepeatEvent request for all pointers.")); |
|
1179 // New coordinates will be used for a simulated EPointerMove. This event will be filtered out, however, EButtonRepeat will occur at new coordinates |
|
1180 ptrPos.iX = xInc; |
|
1181 ptrPos.iY = yInc; |
|
1182 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1183 { |
|
1184 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum); |
|
1185 // EPointerMove event is filtered out by TWsPointer::PointerRepeatPurgeCheck |
|
1186 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1187 User::After(200000); |
|
1188 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); |
|
1189 ptrPos.iX+=xInc; |
|
1190 ptrPos.iY+=yInc; |
|
1191 } |
|
1192 break; |
|
1193 case 3: |
|
1194 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); |
|
1195 ptrPos.iX = xInc; |
|
1196 ptrPos.iY = yInc; |
|
1197 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1198 { |
|
1199 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1200 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
1201 ptrPos.iX+=xInc; |
|
1202 ptrPos.iY+=yInc; |
|
1203 } |
|
1204 break; |
|
1205 // Test cases 4 - 7 represent second second discrete test for PointerRepeatEvents |
|
1206 case 4: |
|
1207 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. |
|
1208 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. |
|
1209 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); |
|
1210 ptrPos.SetXY(0,0); |
|
1211 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1212 { |
|
1213 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1214 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
1215 ptrPos.iX+=xInc; |
|
1216 ptrPos.iY+=yInc; |
|
1217 } |
|
1218 break; |
|
1219 case 5: |
|
1220 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. |
|
1221 INFO_PRINTF1(_L("Call RequestPointerRepeatEvent for all pointers.")); |
|
1222 ptrPos.SetXY(0,0); |
|
1223 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1224 { |
|
1225 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); // hitbox size reduced |
|
1226 User::After(200000); |
|
1227 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); |
|
1228 ptrPos.iX+=xInc; |
|
1229 ptrPos.iY+=yInc; |
|
1230 } |
|
1231 break; |
|
1232 case 6: |
|
1233 // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and event remaining within the 'hitbox' rect. |
|
1234 // EPointerMove will take pointer out of the hitbox so should not be filtered. PointerRepeatEvent should be cancelled. |
|
1235 INFO_PRINTF1(_L("Simulate a PointerMove event for all pointers to a coordinate outside the hitbox.")); |
|
1236 // New coordinates will be used for a simulated EPointerMove outisde the hitbox. |
|
1237 ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc; |
|
1238 ptrPos.iY = 0; |
|
1239 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1240 { |
|
1241 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); |
|
1242 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1243 User::After(200000); |
|
1244 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); |
|
1245 } |
|
1246 break; |
|
1247 case 7: |
|
1248 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); |
|
1249 ptrNum = 0; |
|
1250 ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc; |
|
1251 ptrPos.iY = 0; |
|
1252 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1253 { |
|
1254 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1255 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
1256 } |
|
1257 break; |
|
1258 // Test cases 8 and 9 represent third discrete test for PointerRepeatEvents |
|
1259 case 8: |
|
1260 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. |
|
1261 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. |
|
1262 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); |
|
1263 ptrPos.SetXY(0,0); |
|
1264 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1265 { |
|
1266 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1267 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
1268 ptrPos.iX+=xInc; |
|
1269 ptrPos.iY+=yInc; |
|
1270 } |
|
1271 break; |
|
1272 case 9: |
|
1273 // No simulated events. This test case is to explicity call RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber) |
|
1274 INFO_PRINTF1(_L("Call RequestPointerRepeatEvent and CancelPointerRepeatEventRequest for all pointers.")); |
|
1275 ptrPos.SetXY(0,0); |
|
1276 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1277 { |
|
1278 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); |
|
1279 iMultiPtrEventClient->ParentWin()->BaseWin()->CancelPointerRepeatEventRequest(ptrNum); |
|
1280 ptrPos.iX+=xInc; |
|
1281 ptrPos.iY+=yInc; |
|
1282 } |
|
1283 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); |
|
1284 ptrPos.iX = xInc; |
|
1285 ptrPos.iY = yInc; |
|
1286 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1287 { |
|
1288 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1289 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
1290 ptrPos.iX+=xInc; |
|
1291 ptrPos.iY+=yInc; |
|
1292 } |
|
1293 break; |
|
1294 default: |
|
1295 ResetFlushStopAS(); |
|
1296 break; |
|
1297 } |
|
1298 LogEventsAdded(); |
|
1299 } |
|
1300 |
|
1301 void CTMultiPtrEventTest::TestErrorCodeL(TInt aExpErrCode, TInt aActualErrCode) |
|
1302 { |
|
1303 if (aExpErrCode != aActualErrCode) |
|
1304 { |
|
1305 TLogMessageText logText; |
|
1306 _LIT(KError, "Expected Error code = %d Actual Actual Error code %d"); |
|
1307 logText.AppendFormat(KError, aExpErrCode, aActualErrCode); |
|
1308 LOG_MESSAGE(logText); |
|
1309 User::Leave(ETestFailed); |
|
1310 } |
|
1311 } |
|
1312 |
|
1313 void CTMultiPtrEventTest::NegativeTestingOfProximityPressureAPIsL() |
|
1314 { |
|
1315 // First send -10 for EnterCloseProximity and -5 for ExitCLoseProximity, it should return KErrArgument |
|
1316 // Then send 20 and 10 which should return KErrNone |
|
1317 // Then sent 10 and 20 which should return KErrArgument |
|
1318 TInt retVal; |
|
1319 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-10, -5); |
|
1320 TestErrorCodeL(KErrArgument, retVal); |
|
1321 |
|
1322 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(20, 10); |
|
1323 TestErrorCodeL(KErrNone, retVal); |
|
1324 |
|
1325 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(10, 20); |
|
1326 TestErrorCodeL(KErrArgument, retVal); |
|
1327 |
|
1328 // Repeat the above for EnterHighPressure and ExitHighPressure with these values |
|
1329 // -10 and -5 it should return KErrArgument |
|
1330 // -5 and -10 it should return KErrNone |
|
1331 retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-10, -5); |
|
1332 TestErrorCodeL(KErrArgument, retVal); |
|
1333 |
|
1334 retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-5, -10); |
|
1335 TestErrorCodeL(KErrNone, retVal); |
|
1336 } |
|
1337 |
|
1338 void CTMultiPtrEventTest::SimulateProximityAndPressureEvents(TInt aCloseProxEnterValue, TInt aCloseProxExitValue, TInt aHighPresEnterValue, TInt aHighPresExitValue) |
|
1339 { |
|
1340 TPoint ptrPos(10,10); |
|
1341 // Simulate EPointerMove with proximity value > EnterCloseProximity threshold |
|
1342 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1343 { |
|
1344 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxEnterValue, ptrNum); |
|
1345 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, aCloseProxEnterValue, 0, ptrNum); |
|
1346 } |
|
1347 |
|
1348 // Simulate EPointerMove with proximity value < ExitCloseProximity threshold |
|
1349 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1350 { |
|
1351 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum); |
|
1352 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum); |
|
1353 } |
|
1354 |
|
1355 // Simulate EBUtton1Down with presure value > EnterHighPressure threshold |
|
1356 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1357 { |
|
1358 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, aHighPresEnterValue, ptrNum); |
|
1359 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, aHighPresEnterValue, 0, ptrNum); |
|
1360 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, aHighPresEnterValue, 0, ptrNum); |
|
1361 } |
|
1362 |
|
1363 // Simulate EPointerMove with presure value < ExitHighPressure threshold |
|
1364 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1365 { |
|
1366 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aHighPresExitValue, ptrNum); |
|
1367 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, aHighPresExitValue, 0, ptrNum); |
|
1368 } |
|
1369 |
|
1370 // Finally simulate Ebutton1Up with proximity value < ExitCloseProximity |
|
1371 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1372 { |
|
1373 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum); |
|
1374 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, aCloseProxExitValue, 0, ptrNum); |
|
1375 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum); |
|
1376 } |
|
1377 } |
|
1378 |
|
1379 /** |
|
1380 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0035 |
|
1381 @SYMPREQ PREQ1226 |
|
1382 @SYMREQ REQ10887, REQ10886 |
|
1383 @SYMTestPriority High |
|
1384 @SYMTestCaseDesc Negative tests for close Proximity and high Pressure events. |
|
1385 @SYMTestStatus Implemented |
|
1386 |
|
1387 @SYMTestActions Set CloseProximity and HighPressure thresholds with positive and negative values. |
|
1388 Simulate Enter/ExitCloseProximity and Enter/ExitHighPressure events. |
|
1389 @SYMTestExpectedResults The received events must match the simulated pointer events |
|
1390 */ |
|
1391 void CTMultiPtrEventTest::NegativeTestsForProximityPressureEventsL() |
|
1392 { |
|
1393 TLogMessageText logText; |
|
1394 _LIT(KSet, "Negative tests for pressure and proximity events: %d of 3"); |
|
1395 logText.AppendFormat(KSet, iEventSet); |
|
1396 LOG_MESSAGE(logText); |
|
1397 |
|
1398 if (!iEventSet) |
|
1399 { |
|
1400 SetAutoFlush(); |
|
1401 NegativeTestingOfProximityPressureAPIsL(); |
|
1402 AddExpectedWsEvent(EEventFocusGained); |
|
1403 } |
|
1404 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
1405 switch(iEventSet++) |
|
1406 { |
|
1407 case 0: |
|
1408 // This is to check close proximity threshold API can be given +ve values |
|
1409 // and high pressure threshold API can begiven -ve values |
|
1410 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20); |
|
1411 iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50); |
|
1412 SimulateProximityAndPressureEvents(60, 10, -10, -60); |
|
1413 break; |
|
1414 case 1: |
|
1415 // Repeat the above with +ve values |
|
1416 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20); |
|
1417 iMultiPtrEventClient->iWs.SetHighPressureThresholds(50, 20); |
|
1418 SimulateProximityAndPressureEvents(60, 10, 60, 10); |
|
1419 break; |
|
1420 case 2: |
|
1421 // Repeat the above -ve values |
|
1422 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-20, -50); |
|
1423 iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50); |
|
1424 SimulateProximityAndPressureEvents(-10, -60, -10, -60); |
|
1425 break; |
|
1426 default: |
|
1427 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); |
|
1428 ResetFlushStopAS(); |
|
1429 break; |
|
1430 } |
|
1431 |
|
1432 LogEventsAdded(); |
|
1433 } |
|
1434 |
|
1435 |
|
1436 void CTMultiPtrEventTest::CreateGroupWinForCapturingL() |
|
1437 { |
|
1438 iGroupWinForCapturing = new(ELeave) CTWindowGroup(iMultiPtrEventClient); |
|
1439 iGroupWinForCapturing->ConstructL(); |
|
1440 iGroupWinForCapturing->GroupWin()->AutoForeground(ETrue); |
|
1441 iGroupWinForCapturing->GroupWin()->EnableFocusChangeEvents(); |
|
1442 |
|
1443 iWinForCapturing = new(ELeave) CTBlankWindow(); |
|
1444 iWinForCapturing->ConstructL(*iGroupWinForCapturing); |
|
1445 iWinForCapturing->SetExt(TPoint(), TSize(iPhysicalScreenSize.iWidth/2, iPhysicalScreenSize.iHeight)); |
|
1446 iWinForCapturing->SetColor(KRgbBlue); |
|
1447 iWinForCapturing->BaseWin()->EnableAdvancedPointers(); |
|
1448 iWinForCapturing->Activate(); |
|
1449 } |
|
1450 |
|
1451 void CTMultiPtrEventTest::DeleteGroupWinForCapturing() |
|
1452 { |
|
1453 if (iWinForCapturing) |
|
1454 { |
|
1455 delete iWinForCapturing; |
|
1456 iWinForCapturing = NULL; |
|
1457 } |
|
1458 if (iGroupWinForCapturing) |
|
1459 { |
|
1460 delete iGroupWinForCapturing; |
|
1461 iGroupWinForCapturing = NULL; |
|
1462 } |
|
1463 } |
|
1464 |
|
1465 /** |
|
1466 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0019 |
|
1467 @SYMPREQ PREQ1226 |
|
1468 @SYMREQ REQ9677,REQ9683, |
|
1469 @SYMTestPriority High |
|
1470 @SYMTestCaseDesc Checks Wserv supports Capturing in case of multi pointer events. |
|
1471 @SYMTestStatus Implemented |
|
1472 |
|
1473 @SYMTestActions Create a window with group window as its parent. |
|
1474 Create another window with same parent and partially overlapping the first one. |
|
1475 SetPointerCapture for second window with TCaptureEnabled flag. |
|
1476 Simulate TRawEvent::EButton1Down from each pointer the device supports |
|
1477 |
|
1478 Repeat the above with TCaptureFlagAllGroups flag for SetPointerCapture |
|
1479 and creating windows from different window group |
|
1480 |
|
1481 @SYMTestExpectedResults Even if events were simulated on first window events are delivered to |
|
1482 second window as it is capturing. |
|
1483 With TCaptureFlagAllGroups flag set events are delivered to window which is |
|
1484 capturing even if events were simulated on a window from different group |
|
1485 |
|
1486 */ |
|
1487 void CTMultiPtrEventTest::CapturingMultiPointerEvents() |
|
1488 { |
|
1489 // Test Capturing of multi pointer events |
|
1490 // 1. Test Wserv supports Capturing in case of multi-pointer events |
|
1491 // 2. Test pointer events are delivered correctly when Capturing is disabled. |
|
1492 TLogMessageText logText; |
|
1493 _LIT(KSet, "CapturingMultiPtrEvents SetOfEvents: %d of 3"); |
|
1494 logText.AppendFormat(KSet, iEventSet); |
|
1495 LOG_MESSAGE(logText); |
|
1496 |
|
1497 if (!iEventSet) |
|
1498 { |
|
1499 SetAutoFlush(); |
|
1500 } |
|
1501 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
1502 |
|
1503 TPoint ptrPos; |
|
1504 TInt ptrNum; |
|
1505 |
|
1506 switch(iEventSet++) |
|
1507 { |
|
1508 case 0: |
|
1509 INFO_PRINTF1(_L("Ensure pointer state is Out of Range")); |
|
1510 AddExpectedWsEvent(EEventFocusGained); |
|
1511 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1512 { |
|
1513 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1514 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
1515 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1516 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, ptrNum); |
|
1517 } |
|
1518 break; |
|
1519 case 1: |
|
1520 INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, within window group")); |
|
1521 iMultiPtrEventClient->ChildWin()->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
1522 TestCapturingForMultiPointer(EFalse); |
|
1523 break; |
|
1524 case 2: |
|
1525 INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, from different window groups")); |
|
1526 TRAPD(err, CreateGroupWinForCapturingL()); // it cannot leave so trap and fail |
|
1527 if (err != KErrNone) |
|
1528 { |
|
1529 Failed(); |
|
1530 } |
|
1531 AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation |
|
1532 AddExpectedWsEvent(EEventFocusGained); // Second group window creation |
|
1533 |
|
1534 iWinForCapturing->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
1535 TestCapturingForMultiPointer(ETrue); |
|
1536 break; |
|
1537 default: |
|
1538 DeleteGroupWinForCapturing(); |
|
1539 ResetFlushStopAS(); |
|
1540 break; |
|
1541 } |
|
1542 LogEventsAdded(); |
|
1543 } |
|
1544 |
|
1545 /** |
|
1546 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0017 |
|
1547 @SYMPREQ PREQ1226 |
|
1548 @SYMREQ Negative Testing |
|
1549 @SYMTestPriority High |
|
1550 @SYMTestCaseDesc Out of bound value testing |
|
1551 @SYMTestStatus Implemented |
|
1552 |
|
1553 @SYMTestActions Simulate raw events of TRawEvent with pointer number greater than EPointerMaxPointers |
|
1554 |
|
1555 @SYMTestExpectedResults The received events must match the events added to the buffer and check that out of bound events are ignored. |
|
1556 |
|
1557 */ |
|
1558 void CTMultiPtrEventTest::OutOfBoundValueTesting() |
|
1559 { |
|
1560 // Test Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers. |
|
1561 TLogMessageText logText; |
|
1562 _LIT(KSet, "OutOfBoundValueTesting SetOfEvents: %d of 1"); |
|
1563 logText.AppendFormat(KSet, iEventSet); |
|
1564 LOG_MESSAGE(logText); |
|
1565 |
|
1566 if (!iEventSet) |
|
1567 { |
|
1568 SetAutoFlush(); |
|
1569 AddExpectedWsEvent(EEventFocusGained); |
|
1570 } |
|
1571 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
1572 |
|
1573 TPoint ptrPos; |
|
1574 TInt ptrNum; |
|
1575 TInt ptrNumOutOfBounds; |
|
1576 |
|
1577 switch(iEventSet++) |
|
1578 { |
|
1579 case 0: |
|
1580 INFO_PRINTF1(_L("Checks Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers.")); |
|
1581 ptrPos.SetXY(0,0); |
|
1582 ptrNum = iMaxDevPointers-1; // Max value for ptrNum |
|
1583 ptrNumOutOfBounds = iMaxDevPointers; // Invalid ptrNum as pointer numbers are zero indexed |
|
1584 |
|
1585 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1586 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNumOutOfBounds); |
|
1587 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum); |
|
1588 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds); |
|
1589 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum); |
|
1590 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds); |
|
1591 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); |
|
1592 ptrPos.iX += 10; ptrPos.iY += 10; |
|
1593 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); |
|
1594 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); |
|
1595 break; |
|
1596 default: |
|
1597 ResetFlushStopAS(); |
|
1598 break; |
|
1599 } |
|
1600 LogEventsAdded(); |
|
1601 } |
|
1602 |
|
1603 void CTMultiPtrEventTest::SetThresholdValues(TInt aEnterCloseProx, TInt aExitCloseProx, TInt aEnterHighPres, TInt aExitHighPres) |
|
1604 { |
|
1605 iEnterCloseProximityThreshold = aEnterCloseProx; |
|
1606 iExitCloseProximityThreshold = aExitCloseProx; |
|
1607 iEnterHighPressureThreshold = aEnterHighPres; |
|
1608 iExitHighPressureThreshold = aExitHighPres; |
|
1609 |
|
1610 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(iEnterCloseProximityThreshold,iExitCloseProximityThreshold); |
|
1611 iMultiPtrEventClient->iWs.SetHighPressureThresholds(iEnterHighPressureThreshold,iExitHighPressureThreshold); |
|
1612 } |
|
1613 |
|
1614 void CTMultiPtrEventTest::TestCloseProximityHighPressureAPIsL() |
|
1615 { |
|
1616 // These are some typical values which are used only for testing purposes. |
|
1617 // 20mm to screen |
|
1618 // 50mm to screen |
|
1619 // 4N of pressure |
|
1620 // 2N of pressure |
|
1621 SetThresholdValues(-20,-50,4000,2000); |
|
1622 |
|
1623 if (iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold() != iEnterCloseProximityThreshold) |
|
1624 { |
|
1625 TLogMessageText logText; |
|
1626 _LIT(KError, "Expected EnterCloseProximityThreshold = %d Actual EnterCloseProximityThreshold %d"); |
|
1627 logText.AppendFormat(KError, iEnterCloseProximityThreshold, iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold()); |
|
1628 LOG_MESSAGE(logText); |
|
1629 User::Leave(ETestFailed); |
|
1630 } |
|
1631 |
|
1632 if (iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold() != iExitCloseProximityThreshold) |
|
1633 { |
|
1634 TLogMessageText logText; |
|
1635 _LIT(KError, "Expected ExitCloseProximityThreshold = %d Actual ExitCloseProximityThreshold %d"); |
|
1636 logText.AppendFormat(KError, iExitCloseProximityThreshold, iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold()); |
|
1637 LOG_MESSAGE(logText); |
|
1638 User::Leave(ETestFailed); |
|
1639 } |
|
1640 |
|
1641 if (iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold() != iEnterHighPressureThreshold) |
|
1642 { |
|
1643 TLogMessageText logText; |
|
1644 _LIT(KError, "Expected EnterHighPressureThreshold = %d Actual EnterHighPressureThreshold %d"); |
|
1645 logText.AppendFormat(KError, iEnterHighPressureThreshold, iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold()); |
|
1646 LOG_MESSAGE(logText); |
|
1647 User::Leave(ETestFailed); |
|
1648 } |
|
1649 |
|
1650 if (iMultiPtrEventClient->iWs.GetExitHighPressureThreshold() != iExitHighPressureThreshold) |
|
1651 { |
|
1652 TLogMessageText logText; |
|
1653 _LIT(KError, "Expected ExitHighPressureThreshold = %d Actual ExitHighPressureThreshold %d"); |
|
1654 logText.AppendFormat(KError, iExitHighPressureThreshold, iMultiPtrEventClient->iWs.GetExitHighPressureThreshold()); |
|
1655 LOG_MESSAGE(logText); |
|
1656 User::Leave(ETestFailed); |
|
1657 } |
|
1658 } |
|
1659 |
|
1660 /** |
|
1661 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0034 |
|
1662 @SYMPREQ PREQ1226 |
|
1663 @SYMREQ REQ10887,REQ10886 |
|
1664 @SYMTestPriority High |
|
1665 @SYMTestCaseDesc Tests close Proximity and high Pressure event types. |
|
1666 @SYMTestStatus Implemented |
|
1667 |
|
1668 @SYMTestActions Set CloseProximity and HighPressure thresholds and simulate events with different Z values |
|
1669 @SYMTestExpectedResults The received events must match the simulated pointer events |
|
1670 */ |
|
1671 void CTMultiPtrEventTest::CloseProximityAndHighPressureEventsL() |
|
1672 { |
|
1673 TLogMessageText logText; |
|
1674 _LIT(KSet, "Close Proximity and High Pressure events: %d of 11"); |
|
1675 logText.AppendFormat(KSet, iEventSet); |
|
1676 LOG_MESSAGE(logText); |
|
1677 |
|
1678 if (!iEventSet) |
|
1679 { |
|
1680 SetAutoFlush(); |
|
1681 TestCloseProximityHighPressureAPIsL(); |
|
1682 AddExpectedWsEvent(EEventFocusGained); |
|
1683 } |
|
1684 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
1685 |
|
1686 TPoint ptrPos(10,10); |
|
1687 TInt proxValue; |
|
1688 TInt prValue; |
|
1689 TInt tempCount; |
|
1690 switch(iEventSet++) |
|
1691 { |
|
1692 case 0: |
|
1693 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
1694 // One whole cycle of events |
|
1695 // Simulate out-of-range from all pointers and don't expect out-of-range events |
|
1696 // since all the pointers are already in same state |
|
1697 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1698 { |
|
1699 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1700 } |
|
1701 |
|
1702 // Simulate moves with proximity value < EEnterCloseProximity |
|
1703 proxValue = -30; |
|
1704 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1705 { |
|
1706 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1707 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
1708 } |
|
1709 |
|
1710 // Simulate moves with proximity value > EEnterCloseProximity |
|
1711 proxValue = -10; |
|
1712 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1713 { |
|
1714 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1715 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1716 } |
|
1717 |
|
1718 // Simulate EButton1Down with pressure value < EEnterHighPressure |
|
1719 prValue = 1000; |
|
1720 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1721 { |
|
1722 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1723 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1724 } |
|
1725 |
|
1726 // Simulate moves with pressure value > EEnterHighPressure |
|
1727 prValue = 5000; |
|
1728 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1729 { |
|
1730 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1731 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); |
|
1732 } |
|
1733 |
|
1734 // Simulate moves with pressure value < EExitHighPressure |
|
1735 prValue = 1000; |
|
1736 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1737 { |
|
1738 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1739 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, prValue, 0, ptrNum); |
|
1740 } |
|
1741 |
|
1742 // Simulate EButton1Up with proximity value > EEnterCloseProximity |
|
1743 proxValue = -10; |
|
1744 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1745 { |
|
1746 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1747 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1748 } |
|
1749 |
|
1750 // Simulate moves with proximity value < EExitCloseProximity |
|
1751 proxValue = -60; |
|
1752 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1753 { |
|
1754 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1755 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1756 } |
|
1757 break; |
|
1758 case 1: |
|
1759 // Simulate events to meet all scenarios |
|
1760 // Simulate EButton1Down with pressure value < EEnterHighPressure |
|
1761 prValue = 1000; |
|
1762 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1763 { |
|
1764 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1765 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1766 } |
|
1767 |
|
1768 // Simulate EButton1Up with proximity value < EExitCloseProximity |
|
1769 proxValue = -60; |
|
1770 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1771 { |
|
1772 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1773 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1774 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1775 } |
|
1776 |
|
1777 // Simulate EButton1Down with pressure value > EEnterHighPressure |
|
1778 prValue = 5000; |
|
1779 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1780 { |
|
1781 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1782 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1783 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); |
|
1784 } |
|
1785 |
|
1786 // Simulate EButton1Up with proximity value < EExitCloseProximity |
|
1787 proxValue = -60; |
|
1788 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1789 { |
|
1790 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1791 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1792 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1793 } |
|
1794 break; |
|
1795 case 2: |
|
1796 // Simulate moves with proximity value > EEnterCloseProximity |
|
1797 proxValue = -10; |
|
1798 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1799 { |
|
1800 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1801 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1802 } |
|
1803 |
|
1804 // Simulate EButton1Down with pressure value > EEnterHighPressure |
|
1805 prValue = 5000; |
|
1806 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1807 { |
|
1808 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1809 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1810 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); |
|
1811 } |
|
1812 |
|
1813 // Simulate EButton1Up with proximity value > EExitCloseProximity |
|
1814 proxValue = -40; // When you coming up, EEnterCloseProximity is of no use |
|
1815 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1816 { |
|
1817 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1818 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1819 } |
|
1820 |
|
1821 // Simulate out-of-range events |
|
1822 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1823 { |
|
1824 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1825 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1826 } |
|
1827 break; |
|
1828 case 3: |
|
1829 // From out-of-range state to EButton1Down |
|
1830 // Simulate EButton1Down with pressure value < EEnterHighPressure |
|
1831 prValue = 1000; |
|
1832 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1833 { |
|
1834 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1835 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1836 } |
|
1837 |
|
1838 // Simulate EButton1Up with proximity value > EExitCloseProximity |
|
1839 proxValue = -40; |
|
1840 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1841 { |
|
1842 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1843 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1844 } |
|
1845 |
|
1846 // Simulate out-of-range events |
|
1847 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1848 { |
|
1849 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1850 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1851 } |
|
1852 |
|
1853 // Simulate EButton1Down with pressure value > EEnterHighPressure |
|
1854 prValue = 5000; |
|
1855 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1856 { |
|
1857 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1858 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1859 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); |
|
1860 } |
|
1861 |
|
1862 // Simulate EButton1Up with proximity value > EExitCloseProximity |
|
1863 proxValue = -40; |
|
1864 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1865 { |
|
1866 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1867 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1868 } |
|
1869 |
|
1870 // Simulate out-of-range events |
|
1871 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1872 { |
|
1873 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1874 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1875 } |
|
1876 break; |
|
1877 case 4: |
|
1878 // Simulate EButton1Dowm with pressure value < EEnterHighPressure |
|
1879 prValue = 1000; |
|
1880 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1881 { |
|
1882 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1883 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); |
|
1884 } |
|
1885 |
|
1886 // Simulate EButton1Up with proximity value < EExitCloseProximity |
|
1887 proxValue = -60; |
|
1888 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1889 { |
|
1890 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1891 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1892 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); |
|
1893 } |
|
1894 |
|
1895 // Simulate out-of-range from Up/OutOfCloseProximity |
|
1896 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1897 { |
|
1898 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1899 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1900 } |
|
1901 break; |
|
1902 case 5: |
|
1903 // Purging of proximity and pressure events |
|
1904 // Simulate EnterCloseProximity and ExitCloseProximity events which will be purged |
|
1905 // when you send Button1Up events for KMaxQueueSize |
|
1906 proxValue = -10; |
|
1907 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) |
|
1908 { |
|
1909 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1910 } |
|
1911 proxValue = -60; |
|
1912 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) |
|
1913 { |
|
1914 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1915 } |
|
1916 for (TInt count = 0; count < KMaxQueueSize; count++) |
|
1917 { |
|
1918 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
1919 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); |
|
1920 } |
|
1921 break; |
|
1922 case 6: |
|
1923 // Simulate EnterCloseProximity for 4 pointers. |
|
1924 // As we cannot create lone ExitCloseProximity events, so create just moves from next 4 pointers |
|
1925 // Simulate out-of-range for these events on thier respective pointers |
|
1926 // Then simulate EButton1Up events which will purge EnterCloseProximity and move events |
|
1927 // which checks that lone EnterCloseProximity and lone move events will be purged |
|
1928 proxValue = -10; |
|
1929 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
1930 { |
|
1931 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1932 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1933 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1934 } |
|
1935 proxValue = -60; |
|
1936 for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) |
|
1937 { |
|
1938 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1939 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1940 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1941 } |
|
1942 for (TInt count = 0; count < KMaxQueueSize-iMaxDevPointers; count++) |
|
1943 { |
|
1944 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
1945 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); |
|
1946 } |
|
1947 break; |
|
1948 case 7: |
|
1949 // Bring all other pointers to Up state, becasue of previous test |
|
1950 // Then simulate out-of-range twice for all the pointers |
|
1951 // Then simulate Button1Up which will cause purging of successive out-of-range events |
|
1952 proxValue = -60; |
|
1953 tempCount = 0; |
|
1954 for (TInt ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) |
|
1955 { |
|
1956 tempCount++; |
|
1957 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
1958 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); |
|
1959 } |
|
1960 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
1961 { |
|
1962 tempCount++; |
|
1963 // Wserv does nothing if current state is outofrange and if receives again EOutOfRange event which is practically not possible |
|
1964 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1965 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
1966 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
1967 } |
|
1968 for (TInt count = 0; count < KMaxQueueSize-tempCount; count++) |
|
1969 { |
|
1970 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
1971 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); |
|
1972 } |
|
1973 break; |
|
1974 case 8: |
|
1975 // Simulate EButton1Down with pressure value > EnterHIghPressure threshold |
|
1976 // which will cause EButton1Down and EnterHighPressure to be filled in queue |
|
1977 // Simulate ExitHighPressure and EButton1Up events for 2 pointers |
|
1978 // Then simulate EButton1Up events from pointer0 so that all of the above events are purged |
|
1979 prValue = 5000; |
|
1980 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) |
|
1981 { |
|
1982 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1983 } |
|
1984 prValue = 1000; |
|
1985 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) |
|
1986 { |
|
1987 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
1988 // Here these events are purged becasue their correpsonding down event would have been purged |
|
1989 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
1990 } |
|
1991 // All the above events get purged by this |
|
1992 for (TInt count = 0; count < KMaxQueueSize; count++) |
|
1993 { |
|
1994 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
1995 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
1996 } |
|
1997 break; |
|
1998 case 9: |
|
1999 // Simulate EButton1Down for 2 pointers, which will generate Button1Down and EnterHighPressure |
|
2000 // Simulate Ebutton1Up events for MaxQueueSize from last pointer so that all the above events are purged |
|
2001 prValue = 5000; |
|
2002 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++) |
|
2003 { |
|
2004 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
2005 } |
|
2006 |
|
2007 // This will cause above down and enterhighpressure events to be purged |
|
2008 // When pointer is in outofrange state and when EButton1Up event is sent Wserv sends EnterCloseProximity |
|
2009 // EnterCloseProximity cannot be purged unless the next event is EExitCloseProximity or EOutOfRange |
|
2010 for (TInt count = 0; count < KMaxQueueSize; count++) |
|
2011 { |
|
2012 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, iMaxDevPointers-1); |
|
2013 AddExpectedPointerEvent((count ? TPointerEvent::EButton1Up : TPointerEvent::EEnterCloseProximity), ptrPos, 0, 0, iMaxDevPointers-1); |
|
2014 } |
|
2015 |
|
2016 // As the first 2 pointers are in down state, and if we send the move events with prValue = 1000 |
|
2017 // This will generate the exithigh pressure events, which will be ignored |
|
2018 // This will also generate the Ebutton1Up event which will also be ignored |
|
2019 prValue = 1000; |
|
2020 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++) |
|
2021 { |
|
2022 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
2023 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2024 } |
|
2025 break; |
|
2026 case 10: |
|
2027 // This is to just bring all the pointers to out-of-range state |
|
2028 // to make all pointers in valid state for other test to run |
|
2029 // Wserv processes EOutOfRange events only when its current state is not in outofrange. |
|
2030 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers && ptrNum < 2; ptrNum++) |
|
2031 { |
|
2032 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2033 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); |
|
2034 } |
|
2035 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, iMaxDevPointers-1); |
|
2036 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, iMaxDevPointers-1); |
|
2037 break; |
|
2038 default: |
|
2039 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); |
|
2040 ResetFlushStopAS(); |
|
2041 break; |
|
2042 } |
|
2043 |
|
2044 LogEventsAdded(); |
|
2045 } |
|
2046 |
|
2047 void CTMultiPtrEventTest::CreateAnimDllAndAnimL() |
|
2048 { |
|
2049 iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs); |
|
2050 User::LeaveIfError(iAnimDll->Load(KAnimDLLName)); |
|
2051 iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll); |
|
2052 } |
|
2053 |
|
2054 void CTMultiPtrEventTest::DestroyAnimDllAndAnim() |
|
2055 { |
|
2056 if (iAnim) |
|
2057 { |
|
2058 iAnim->Destroy(); |
|
2059 iAnim = NULL; |
|
2060 } |
|
2061 if (iAnimDll) |
|
2062 { |
|
2063 iAnimDll->Destroy(); |
|
2064 iAnimDll = NULL; |
|
2065 } |
|
2066 } |
|
2067 |
|
2068 void CTMultiPtrEventTest::CreateGroupWinL() |
|
2069 { |
|
2070 iGroupWinForEmul = new(ELeave) CTWindowGroup(iMultiPtrEventClient); |
|
2071 iGroupWinForEmul->ConstructL(); |
|
2072 iGroupWinForEmul->GroupWin()->AutoForeground(ETrue); |
|
2073 iGroupWinForEmul->GroupWin()->EnableFocusChangeEvents(); |
|
2074 |
|
2075 iWinForEmul = new(ELeave) CTBlankWindow(); |
|
2076 iWinForEmul->ConstructL(*iGroupWinForEmul); |
|
2077 iWinForEmul->SetExt(TPoint(50,50), TSize(80,80)); |
|
2078 iWinForEmul->SetColor(KRgbDarkYellow); |
|
2079 iWinForEmul->Activate(); |
|
2080 } |
|
2081 |
|
2082 void CTMultiPtrEventTest::DeleteGroupWin() |
|
2083 { |
|
2084 if (iWinForEmul) |
|
2085 { |
|
2086 delete iWinForEmul; |
|
2087 iWinForEmul = NULL; |
|
2088 } |
|
2089 if (iGroupWinForEmul) |
|
2090 { |
|
2091 delete iGroupWinForEmul; |
|
2092 iGroupWinForEmul = NULL; |
|
2093 } |
|
2094 } |
|
2095 |
|
2096 /** |
|
2097 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0029 |
|
2098 @SYMPREQ PREQ1226 |
|
2099 @SYMREQ REQ9688 |
|
2100 @SYMTestPriority High |
|
2101 @SYMTestCaseDesc Tests the emulation rules for Apps, Anims, Autofocus and Buffered delivery |
|
2102 @SYMTestStatus Implemented |
|
2103 |
|
2104 @SYMTestActions Simulate event to make a pointer primary. EnableAdvancedPointers API is not called. And then simulate events from other pointers |
|
2105 @SYMTestExpectedResults The events from other pointer are not received |
|
2106 */ |
|
2107 void CTMultiPtrEventTest::EmulationRulesForMultiplePointers() |
|
2108 { |
|
2109 TLogMessageText logText; |
|
2110 _LIT(KSet, "Emulation rules set of events: %d of 15"); |
|
2111 logText.AppendFormat(KSet, iEventSet); |
|
2112 LOG_MESSAGE(logText); |
|
2113 |
|
2114 if (!iEventSet) |
|
2115 { |
|
2116 SetExpectNonAdvancedPointerEvents(); |
|
2117 SetAutoFlush(); |
|
2118 AddExpectedWsEvent(EEventFocusGained); |
|
2119 } |
|
2120 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
2121 |
|
2122 TPoint ptrPos(10,10); |
|
2123 TInt proxValue = -iProximityStep; |
|
2124 TInt prValue = iPressureStep; |
|
2125 TInt ptrNum = 0; |
|
2126 switch(iEventSet++) |
|
2127 { |
|
2128 case 0: |
|
2129 // This event is for simulated/primary pointer |
|
2130 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
2131 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2132 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2133 |
|
2134 // Parent window has not called EnableAdvancedPointers API |
|
2135 // So even if we simulate moves and out-of-range these are not delivered to client |
|
2136 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) |
|
2137 { |
|
2138 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2139 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2140 } |
|
2141 break; |
|
2142 case 1: |
|
2143 // Since the primary pointer is 0, simulate EButton1Down for making pointer 1 as primary |
|
2144 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2145 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2146 |
|
2147 // Simulate move or Ebutton1Down from pointer0 they are NOT sent back to client |
|
2148 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2149 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2150 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2151 |
|
2152 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2153 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2154 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2155 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2156 break; |
|
2157 case 2: |
|
2158 // Simulate EButton1Down from pointer0 to make it primary |
|
2159 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2160 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, 0); |
|
2161 |
|
2162 // Move from pointer1 |
|
2163 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2164 |
|
2165 // Take the zero pointer out-of-range, this will not result in Pointer 1 becoming primary |
|
2166 // and out-of-range event is sent to client |
|
2167 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2168 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
2169 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2170 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, 0); |
|
2171 |
|
2172 // Send moves from pointer1, but these are not sent to the Client. |
|
2173 ptrPos.iX += 10; |
|
2174 ptrPos.iY += 10; |
|
2175 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2176 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2177 |
|
2178 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2179 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2180 |
|
2181 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2182 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2183 break; |
|
2184 case 3: |
|
2185 // Simulate EButton1Down from pointer0 to make it primary |
|
2186 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2187 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2188 |
|
2189 // Simulate EButton1Down from pointer1, which is not sent to client |
|
2190 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2191 |
|
2192 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2193 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2194 |
|
2195 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2196 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2197 |
|
2198 // Drag events are not sent becasue pointer1 has NOT become primary |
|
2199 ptrPos.iX += 10; |
|
2200 ptrPos.iY += 10; |
|
2201 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2202 |
|
2203 // Simulate up from pointer1, still not primary, so event is not sent |
|
2204 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2205 |
|
2206 // Simulate out-of-range from pointer1, still not primary, so event is not sent |
|
2207 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2208 |
|
2209 // Now moves from out-of-range to move state |
|
2210 ptrPos.iX += 10; |
|
2211 ptrPos.iY += 10; |
|
2212 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2213 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2214 |
|
2215 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2216 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2217 break; |
|
2218 case 4: |
|
2219 // pointer0 sends move (becomes primary) |
|
2220 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2221 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2222 |
|
2223 // pointer0 sends down |
|
2224 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2225 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2226 |
|
2227 // pointer1 sends down, doesn't become primary |
|
2228 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2229 |
|
2230 // pointer0 sends up, stays primary |
|
2231 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2232 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2233 |
|
2234 // pointer2, pointer3 and pointer4 sends move with proximity -5, -10, -15 |
|
2235 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++, proxValue -= iProximityStep) |
|
2236 { |
|
2237 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2238 } |
|
2239 |
|
2240 // pointer0 sends out-of-range, loses primary pointer, But NO events are sent |
|
2241 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2242 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2243 |
|
2244 // Send moves for pointer2, pointer3 and pointer4. |
|
2245 // None of the evnst are sent |
|
2246 ptrPos.SetXY(0,0); |
|
2247 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++) |
|
2248 { |
|
2249 ptrPos.iX += 10; |
|
2250 ptrPos.iY += 5; |
|
2251 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2252 } |
|
2253 |
|
2254 // Drag from pointer1, NOT sent, since it is not primary |
|
2255 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, 1); |
|
2256 |
|
2257 // Send out-of-range from all pointers |
|
2258 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++) |
|
2259 { |
|
2260 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2261 } |
|
2262 |
|
2263 // As the pointer1 is down, this will not become primary even if EButton1Up is called |
|
2264 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2265 |
|
2266 // And now sending out-of-range will also not send the event to client as it is not primary |
|
2267 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2268 break; |
|
2269 case 5: |
|
2270 // Test cases 5 - 7 represent one discrete test for PointerRepeatEvents |
|
2271 // Case 5 simulates EButton1Down events only. This is to ensure the event is delivered to the client. |
|
2272 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. |
|
2273 ptrPos.SetXY(0,0); |
|
2274 |
|
2275 // pointer0 sends down (become primary) |
|
2276 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2277 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2278 |
|
2279 // pointer1 sends down, doesn't become primary |
|
2280 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2281 |
|
2282 // pointer4 sends down |
|
2283 if (4 < iMaxDevPointers) |
|
2284 { |
|
2285 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 4); |
|
2286 } |
|
2287 break; |
|
2288 case 6: |
|
2289 ptrPos.SetXY(0,0); |
|
2290 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. |
|
2291 // Legacy API called which does not specify a pointer number. EButtonRepeat should be generated for primary pointer only. |
|
2292 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(20,20))); |
|
2293 User::After(200000); |
|
2294 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2295 break; |
|
2296 case 7: |
|
2297 // pointer0 sends up |
|
2298 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2299 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2300 |
|
2301 // pointer2 sends out-of-range |
|
2302 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2303 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2304 |
|
2305 // Send up and out-of-range for pointer1 and 4 |
|
2306 SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 1); |
|
2307 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2308 |
|
2309 if (4 < iMaxDevPointers) |
|
2310 { |
|
2311 SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 4); |
|
2312 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 4); |
|
2313 } |
|
2314 break; |
|
2315 case 8: |
|
2316 // Autofocus does not work for other than primary pointers |
|
2317 // Create group window which will send focus lost and gained |
|
2318 TRAPD(err, CreateGroupWinL()); // it cannot leave so trap and fail |
|
2319 if (err != KErrNone) |
|
2320 { |
|
2321 Failed(); |
|
2322 } |
|
2323 AddExpectedWsEvent(EEventFocusLost); |
|
2324 AddExpectedWsEvent(EEventFocusGained); |
|
2325 |
|
2326 // Simulate Epointer down which will send focuslost, focusgained and focusgroupchanged events |
|
2327 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2328 AddExpectedWsEvent(EEventFocusLost); |
|
2329 AddExpectedWsEvent(EEventFocusGained); |
|
2330 AddExpectedWsEvent(EEventFocusGroupChanged); |
|
2331 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2332 |
|
2333 // Now simulate EButton1Down from first or second pointer on second group |
|
2334 // This should not reflect the autofocus |
|
2335 ptrPos.iX = 60; |
|
2336 ptrPos.iY = 60; |
|
2337 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2338 if (2 < iMaxDevPointers) |
|
2339 { |
|
2340 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 2); |
|
2341 } |
|
2342 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2343 if (2 < iMaxDevPointers) |
|
2344 { |
|
2345 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 2); |
|
2346 } |
|
2347 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2348 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2349 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2350 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2351 break; |
|
2352 case 9: |
|
2353 // First thing to do in this case is to delete the group window created |
|
2354 DeleteGroupWin(); |
|
2355 |
|
2356 TRAP(err, CreateAnimDllAndAnimL()); // it cannot leave so trap and fail |
|
2357 if (err != KErrNone) |
|
2358 { |
|
2359 Failed(); |
|
2360 } |
|
2361 |
|
2362 // This is the first event which makes first pointer as primary |
|
2363 // When the last argument is EFalse, it means that the event is not consumed by Anim |
|
2364 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, 0, 0, 0, EFalse); |
|
2365 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2366 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2367 |
|
2368 // Now simulate moves from other pointers and these events are not sent to anim |
|
2369 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) |
|
2370 { |
|
2371 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2372 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2373 } |
|
2374 |
|
2375 // This is to reset the primary pointer |
|
2376 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse); |
|
2377 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2378 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2379 |
|
2380 // Now simulate EButton1Down, which will make it as primary |
|
2381 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 1, EFalse); |
|
2382 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2383 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2384 |
|
2385 // Simulate move or Ebutton1Down from any other prointer they are not sent back to client |
|
2386 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2387 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2388 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2389 |
|
2390 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 1, EFalse); |
|
2391 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2392 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2393 |
|
2394 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 1, EFalse); |
|
2395 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2396 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2397 |
|
2398 // Set the primary pointer to Zero |
|
2399 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 0, EFalse); |
|
2400 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2401 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2402 |
|
2403 // Move from second pointer |
|
2404 // As EnableMultiPointer is not called and this is not a primary pointer so this event |
|
2405 // will cause the pointer 1 into move state |
|
2406 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2407 |
|
2408 // Take the zero pointer out-of-range |
|
2409 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 0, EFalse); |
|
2410 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2411 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2412 |
|
2413 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse); |
|
2414 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2415 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2416 |
|
2417 // These moves will not be sent |
|
2418 ptrPos.iX += 10; |
|
2419 ptrPos.iY += 10; |
|
2420 |
|
2421 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2422 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2423 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2424 |
|
2425 TestAndDisplayAnimError(); |
|
2426 |
|
2427 _LIT(KEventsChecked, "Events checked at server side = %d"); |
|
2428 logText.Format(KEventsChecked, 10); |
|
2429 LOG_MESSAGE(logText); |
|
2430 break; |
|
2431 case 10: |
|
2432 DestroyAnimDllAndAnim(); |
|
2433 |
|
2434 // Test for PointerMove buffers |
|
2435 // AllocPointerMoveBuffer, EnablePointerMoveBuffer and then simulate few moves |
|
2436 // Add these moves to another points buffer for testing |
|
2437 // Simulate moves from other pointers, these should not be delivered to clients. |
|
2438 iMultiPtrEventClient->ParentWin()->BaseWin()->AllocPointerMoveBuffer(10, 0); |
|
2439 iMultiPtrEventClient->ParentWin()->BaseWin()->EnablePointerMoveBuffer(); |
|
2440 |
|
2441 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2442 AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin()); |
|
2443 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); // If this position is above some other window then we need to consider its window postion also |
|
2444 ptrPos.iX += 10; |
|
2445 ptrPos.iY += 10; |
|
2446 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2447 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); |
|
2448 ptrPos.iX += 10; |
|
2449 ptrPos.iY += 10; |
|
2450 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2451 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); |
|
2452 |
|
2453 // These events should not be added to buffer |
|
2454 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) |
|
2455 { |
|
2456 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2457 ptrPos.iX += 10; |
|
2458 ptrPos.iY += 10; |
|
2459 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2460 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2461 } |
|
2462 break; |
|
2463 case 11: |
|
2464 // Repeat the above for drag events |
|
2465 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2466 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2467 |
|
2468 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2469 AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin()); |
|
2470 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); |
|
2471 ptrPos.iX += 10; |
|
2472 ptrPos.iY += 10; |
|
2473 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2474 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); |
|
2475 ptrPos.iX += 10; |
|
2476 ptrPos.iY += 10; |
|
2477 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2478 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); |
|
2479 |
|
2480 // These events should not be added to buffer |
|
2481 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) |
|
2482 { |
|
2483 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2484 ptrPos.iX += 10; |
|
2485 ptrPos.iY += 10; |
|
2486 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2487 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2488 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2489 } |
|
2490 |
|
2491 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2492 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2493 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2494 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2495 break; |
|
2496 case 12: |
|
2497 iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer(); |
|
2498 iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer(); |
|
2499 |
|
2500 // Pointer Cursor Position test |
|
2501 // This event is for simulating primary pointer |
|
2502 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2503 // Here I am not adding the event because this event is deleted by another move of same pointer |
|
2504 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) |
|
2505 { |
|
2506 TEST(EFalse); |
|
2507 Failed(); |
|
2508 } |
|
2509 |
|
2510 iMultiPtrEventClient->iWs.SetPointerCursorPosition(TPoint(20,20)); |
|
2511 if (TPoint(20,20) != iMultiPtrEventClient->iWs.PointerCursorPosition()) |
|
2512 { |
|
2513 TEST(EFalse); |
|
2514 Failed(); |
|
2515 } |
|
2516 |
|
2517 // Now simulate moves from other pointer, this should not have any effect on pointer cursor position |
|
2518 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2519 |
|
2520 // Now move the primary pointer, and check the pointer cursor position which should be same as position used for move |
|
2521 ptrPos.iX = 30; |
|
2522 ptrPos.iY = 30; |
|
2523 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2524 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2525 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) |
|
2526 { |
|
2527 TEST(EFalse); |
|
2528 Failed(); |
|
2529 } |
|
2530 |
|
2531 // Send out-of-range event which will not lead to pointer 1 becoming primary |
|
2532 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2533 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2534 |
|
2535 // Now check the pointer cursor position, which should be same |
|
2536 // as primary even if there is other pointer in up state, but that is not primary |
|
2537 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) |
|
2538 { |
|
2539 TEST(EFalse); |
|
2540 Failed(); |
|
2541 } |
|
2542 |
|
2543 // This is to bring the pointer1 to out-of-range state |
|
2544 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2545 |
|
2546 // then send move event and then again check the pointer cursor position |
|
2547 ptrPos.iX = 20; |
|
2548 ptrPos.iY = 20; |
|
2549 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2550 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2551 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) |
|
2552 { |
|
2553 TEST(EFalse); |
|
2554 Failed(); |
|
2555 } |
|
2556 |
|
2557 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2558 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2559 |
|
2560 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2561 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2562 break; |
|
2563 case 13: |
|
2564 { |
|
2565 // Pointer Cursor Area test-1 |
|
2566 iOrigPtrCursorArea = iMultiPtrEventClient->iWs.PointerCursorArea(); |
|
2567 TRect ptrCurArea(0,0,40,40); |
|
2568 iMultiPtrEventClient->iWs.SetPointerCursorArea(ptrCurArea); |
|
2569 |
|
2570 // Simulate move from pointer0 in PointerCursorArea |
|
2571 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2572 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2573 |
|
2574 // Simulate move from other pointer, This should have no effect |
|
2575 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2576 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2577 |
|
2578 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2579 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2580 |
|
2581 // Repeat the above with moves outside pointer cursor area |
|
2582 ptrPos.iX = 50; |
|
2583 ptrPos.iY = 50; |
|
2584 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); |
|
2585 TPoint pointInCurArea(39, 39); |
|
2586 AddExpectedPointerEvent(TPointerEvent::EMove, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2587 |
|
2588 // Simulate move from other pointer, This should have no effect |
|
2589 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); |
|
2590 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2591 |
|
2592 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2593 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2594 } |
|
2595 break; |
|
2596 case 14: |
|
2597 { |
|
2598 // Pointer Cursor Area test-2 |
|
2599 // repeat the above test with button1 down |
|
2600 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2601 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2602 |
|
2603 // Simulate move from other pointer, This should have no effect |
|
2604 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2605 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2606 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2607 |
|
2608 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2609 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2610 |
|
2611 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2612 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2613 |
|
2614 // Repeat the above with moves outside pointer cursor area |
|
2615 ptrPos.iX = 50; |
|
2616 ptrPos.iY = 50; |
|
2617 TPoint pointInCurArea(39, 39); |
|
2618 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2619 AddExpectedPointerEvent(TPointerEvent::EButton1Down, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2620 |
|
2621 // Simulate move from other pointer, This should have no effect |
|
2622 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2623 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); |
|
2624 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); |
|
2625 |
|
2626 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
2627 AddExpectedPointerEvent(TPointerEvent::EButton1Up, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2628 |
|
2629 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); |
|
2630 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); |
|
2631 } |
|
2632 break; |
|
2633 default: |
|
2634 ClearExpectNonAdvancedPointerEvents(); |
|
2635 iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea); |
|
2636 ResetFlushStopAS(); |
|
2637 break; |
|
2638 } |
|
2639 LogEventsAdded(); |
|
2640 } |
|
2641 |
|
2642 /** |
|
2643 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0026 |
|
2644 @SYMPREQ PREQ1226 |
|
2645 @SYMREQ REQ9677, REQ9683 |
|
2646 @SYMTestPriority High |
|
2647 @SYMTestCaseDesc Checks Wserv supports Autofocus for multiple pointers |
|
2648 @SYMTestStatus Implemented |
|
2649 |
|
2650 @SYMTestActions Create 2 group window and respective client windows for it. And simulate EButton1Down on each window consecutively |
|
2651 @SYMTestExpectedResults The received events must match the simulated pointer events |
|
2652 */ |
|
2653 void CTMultiPtrEventTest::AutoForeGroundForMultiplePointersL() |
|
2654 { |
|
2655 TLogMessageText logText; |
|
2656 _LIT(KSet, "Multiple pointer Auto foreground events: %d of 2"); |
|
2657 logText.AppendFormat(KSet, iEventSet); |
|
2658 LOG_MESSAGE(logText); |
|
2659 |
|
2660 if (!iEventSet) |
|
2661 { |
|
2662 SetAutoFlush(); |
|
2663 AddExpectedWsEvent(EEventFocusGained); // This if for the main groupwindow |
|
2664 iMultiPtrEventClient->ConstructGroupBlankWinL(); |
|
2665 |
|
2666 // These are for child group window creation |
|
2667 AddExpectedWsEvent(EEventFocusLost); // This if for the main groupwindow losing focus |
|
2668 AddExpectedWsEvent(EEventFocusGained); // First group window of this test creation |
|
2669 |
|
2670 AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation |
|
2671 AddExpectedWsEvent(EEventFocusGained); // Second group window creation |
|
2672 AddExpectedWsEvent(EEventFocusGroupChanged); // First group window's Enable Focus changed flag is set |
|
2673 } |
|
2674 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
2675 |
|
2676 TPoint win1PtrPos(20,20); |
|
2677 TPoint win2PtrPos(60,60); |
|
2678 TPoint ptrPos; |
|
2679 TInt autoFocusWin; |
|
2680 switch(iEventSet++) |
|
2681 { |
|
2682 case 0: |
|
2683 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
2684 { |
|
2685 if ((ptrNum & 1) == 0) |
|
2686 { |
|
2687 ptrPos = win1PtrPos; |
|
2688 autoFocusWin = 1; |
|
2689 } |
|
2690 else |
|
2691 { |
|
2692 ptrPos = win2PtrPos; |
|
2693 autoFocusWin = 0; |
|
2694 } |
|
2695 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2696 AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus |
|
2697 AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus |
|
2698 if (ptrNum == 0) |
|
2699 { // First group window has already received EEventFocusGroupChanged |
|
2700 AddExpectedWsEvent(EEventFocusGroupChanged); // Second group window's Enable Focus changed flag is set |
|
2701 } |
|
2702 // In the queue only once EEventFocusGroupChanged is sent |
|
2703 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
2704 |
|
2705 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2706 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
2707 |
|
2708 // These events are to clear out the pointer state |
|
2709 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2710 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); |
|
2711 |
|
2712 if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin)) |
|
2713 { |
|
2714 TEST(EFalse); |
|
2715 Failed(); |
|
2716 } |
|
2717 } |
|
2718 break; |
|
2719 case 1: |
|
2720 for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) |
|
2721 { |
|
2722 if ((ptrNum & 1) == 0) |
|
2723 { |
|
2724 ptrPos = win1PtrPos; |
|
2725 autoFocusWin = 1; |
|
2726 } |
|
2727 else |
|
2728 { |
|
2729 ptrPos = win2PtrPos; |
|
2730 autoFocusWin = 0; |
|
2731 } |
|
2732 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2733 AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus |
|
2734 AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus |
|
2735 if (ptrNum == iMaxDevPointers/2) // first loop |
|
2736 { |
|
2737 // When ever a group window changes focus, For all the group/client windows which have |
|
2738 // registered for receiving group window changes recive EEventFocusGroupChanged |
|
2739 // EEventFocusGroupChanged is sent only once in one queue |
|
2740 AddExpectedWsEvent(EEventFocusGroupChanged); |
|
2741 AddExpectedWsEvent(EEventFocusGroupChanged); |
|
2742 } |
|
2743 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
2744 |
|
2745 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2746 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
2747 |
|
2748 // These events are to clear out the pointer state |
|
2749 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2750 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); |
|
2751 if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin)) |
|
2752 { |
|
2753 TEST(EFalse); |
|
2754 Failed(); |
|
2755 } |
|
2756 } |
|
2757 break; |
|
2758 default: |
|
2759 iMultiPtrEventClient->DeleteGroupBlankWin(); |
|
2760 ResetFlushStopAS(); |
|
2761 break; |
|
2762 } |
|
2763 |
|
2764 LogEventsAdded(); |
|
2765 } |
|
2766 |
|
2767 /** |
|
2768 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0015 |
|
2769 @SYMPREQ PREQ1226 |
|
2770 @SYMREQ REQ9684 |
|
2771 @SYMTestPriority High |
|
2772 @SYMTestCaseDesc Checks Wserv supports out-of-range and pointer Enter/Exit events. |
|
2773 @SYMTestStatus Implemented |
|
2774 |
|
2775 @SYMTestActions Simulate moves and EPointer3DOutOfRange from different pointers |
|
2776 @SYMTestExpectedResults The received events must match the simulated pointer events |
|
2777 */ |
|
2778 void CTMultiPtrEventTest::MultiPointerOutOfRangeEvents() |
|
2779 { |
|
2780 TLogMessageText logText; |
|
2781 _LIT(KSet, "OutOfRange & Enter/Exit events: %d of 4"); |
|
2782 logText.AppendFormat(KSet, iEventSet); |
|
2783 LOG_MESSAGE(logText); |
|
2784 |
|
2785 if (!iEventSet) |
|
2786 { |
|
2787 SetAutoFlush(); |
|
2788 AddExpectedWsEvent(EEventFocusGained); |
|
2789 } |
|
2790 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
2791 |
|
2792 TPoint ptrPos(10,10); |
|
2793 TInt proxValue = -iProximityStep; |
|
2794 switch(iEventSet++) |
|
2795 { |
|
2796 case 0: |
|
2797 // Simulate moves and EPointer3DOutOfRange from all pointers |
|
2798 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
2799 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
2800 { |
|
2801 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2802 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
2803 |
|
2804 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2805 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
2806 // Here I am not enabling the enter/exit events filter so not getting those |
|
2807 } |
|
2808 break; |
|
2809 case 1: |
|
2810 // Repeat the above by enabling the enter/exit events |
|
2811 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0); |
|
2812 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) |
|
2813 { |
|
2814 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2815 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); |
|
2816 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
2817 |
|
2818 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2819 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); |
|
2820 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
2821 } |
|
2822 break; |
|
2823 case 2: |
|
2824 // Check the moves from one window to other |
|
2825 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) |
|
2826 { |
|
2827 ptrPos.iX = 10; |
|
2828 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2829 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); |
|
2830 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
2831 |
|
2832 ptrPos.iX = (iMultiPtrEventClient->ParentWin()->Size().iWidth)/2 + 10; |
|
2833 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2834 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); // move and enter of child window is filtered out |
|
2835 } |
|
2836 break; |
|
2837 case 3: |
|
2838 // Since all the pointers are now on child and when we change the pointer filter |
|
2839 // wserv sends enter event to all pointers |
|
2840 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0); |
|
2841 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) |
|
2842 { |
|
2843 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); |
|
2844 } |
|
2845 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) |
|
2846 { |
|
2847 ptrPos.iX = ptrPos.iY =10; |
|
2848 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
2849 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); |
|
2850 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); |
|
2851 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
2852 |
|
2853 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); |
|
2854 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); |
|
2855 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); |
|
2856 } |
|
2857 break; |
|
2858 default: |
|
2859 ResetFlushStopAS(); |
|
2860 break; |
|
2861 } |
|
2862 |
|
2863 LogEventsAdded(); |
|
2864 } |
|
2865 |
|
2866 /** |
|
2867 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0032 |
|
2868 @SYMPREQ PREQ1226 |
|
2869 @SYMREQ REQ9677 |
|
2870 @SYMTestPriority High |
|
2871 @SYMTestCaseDesc Checks Wserv supports Double click events for multi pointer events. |
|
2872 @SYMTestStatus Implemented |
|
2873 |
|
2874 @SYMTestActions Simulate double click events from different pointers |
|
2875 @SYMTestExpectedResults The received events must match the simulated pointer events |
|
2876 */ |
|
2877 void CTMultiPtrEventTest::DoubleClickForMultiplePointers() |
|
2878 { |
|
2879 // Logic involved, double click settings are global no need to test them |
|
2880 // Check that double click events are sent by wserv for all pointers |
|
2881 TLogMessageText logText; |
|
2882 _LIT(KSet, "Double click settings and events: %d of 1"); |
|
2883 logText.AppendFormat(KSet, iEventSet); |
|
2884 LOG_MESSAGE(logText); |
|
2885 |
|
2886 if (!iEventSet) |
|
2887 { |
|
2888 SetAutoFlush(); |
|
2889 AddExpectedWsEvent(EEventFocusGained); |
|
2890 } |
|
2891 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
2892 |
|
2893 TPoint ptrPos(10,10); |
|
2894 switch(iEventSet++) |
|
2895 { |
|
2896 case 0: |
|
2897 for (TInt ptrNum = 0; ptrNum < Min(iMaxDevPointers, 7); ptrNum++) |
|
2898 { |
|
2899 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2900 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
2901 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
2902 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, EModifierDoubleClick, ptrNum); |
|
2903 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
2904 } |
|
2905 break; |
|
2906 default: |
|
2907 ResetFlushStopAS(); |
|
2908 break; |
|
2909 } |
|
2910 |
|
2911 LogEventsAdded(); |
|
2912 } |
|
2913 |
|
2914 |
|
2915 /** |
|
2916 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0031 |
|
2917 @SYMPREQ PREQ1226 |
|
2918 @SYMREQ REQ9677 |
|
2919 @SYMTestPriority High |
|
2920 @SYMTestCaseDesc Checks Wserv supports Virtual keyboard for multi pointer events. |
|
2921 @SYMTestStatus Implemented |
|
2922 |
|
2923 @SYMTestActions Create virtual keyboard by AddKeyRect() to a window and simulate pointer events from all pointers |
|
2924 @SYMTestExpectedResults The received events must match the simulated Key events |
|
2925 */ |
|
2926 void CTMultiPtrEventTest::VirtualKeyBoardForMultiplePointers() |
|
2927 { |
|
2928 TLogMessageText logText; |
|
2929 _LIT(KSet, "VirtualKeyboard SetOfEvents: %d of 8"); |
|
2930 logText.AppendFormat(KSet, iEventSet); |
|
2931 LOG_MESSAGE(logText); |
|
2932 |
|
2933 // Create virtual keyboard for 8 keys on parent window |
|
2934 // give a 5 pixel spacing at start/end and in between keys |
|
2935 const TInt noVirtualKeys = iMaxDevPointers; |
|
2936 const TInt keySpacing = 5; |
|
2937 const TInt keyWidth = ((iPhysicalScreenSize.iWidth/2) - ((noVirtualKeys+1)*keySpacing))/noVirtualKeys; |
|
2938 const TInt keyHeight = keyWidth/2; |
|
2939 TInt startX = keySpacing; |
|
2940 const TInt baseChar ='A'; |
|
2941 |
|
2942 if (!iEventSet) |
|
2943 { |
|
2944 SetAutoFlush(); |
|
2945 for (TInt count=0; count < noVirtualKeys; count++) |
|
2946 { |
|
2947 iMultiPtrEventClient->ParentWin()->BaseWin()->AddKeyRect(TRect(startX, keySpacing, startX+keyWidth, keySpacing+keyHeight), baseChar+count,EFalse); |
|
2948 startX+=(keyWidth+keySpacing); |
|
2949 } |
|
2950 AddExpectedWsEvent(EEventFocusGained); |
|
2951 } |
|
2952 |
|
2953 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
2954 TPoint ptrPos(keySpacing+(keyWidth/2), keySpacing+(keyHeight/2)); |
|
2955 |
|
2956 TInt count = 0; |
|
2957 if (iEventSet < iMaxDevPointers) |
|
2958 { |
|
2959 for (; ptrPos.iX < (iPhysicalScreenSize.iWidth/2)-5; ptrPos.iX += (keySpacing+keyWidth), count++) |
|
2960 { |
|
2961 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, iEventSet); |
|
2962 AddExpectedKeyDownUp(baseChar+count); |
|
2963 } |
|
2964 } |
|
2965 else |
|
2966 { |
|
2967 ResetFlushStopAS(); |
|
2968 } |
|
2969 iEventSet++; |
|
2970 |
|
2971 LogEventsAdded(); |
|
2972 } |
|
2973 |
|
2974 /** |
|
2975 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0021 |
|
2976 @SYMPREQ PREQ1226 |
|
2977 @SYMREQ REQ9677,REQ9683, |
|
2978 @SYMTestPriority High |
|
2979 @SYMTestCaseDesc Checks Wserv supports Grabbing in case of multi pointer events. |
|
2980 @SYMTestStatus Implemented |
|
2981 |
|
2982 @SYMTestActions Simulate EButton1Down events on iParentWin. Simulate Drag and Button1Up events on iChildWin. |
|
2983 SetPointerGrab is called on iParentWin for first test and disabled for the second. |
|
2984 @SYMTestExpectedResults The Drag and Button1Up events contain a handle to iParentWin when Grabbing active. |
|
2985 The Drag and Button1Up events contain a handle to iChildWin when Grabbing disabled. |
|
2986 */ |
|
2987 void CTMultiPtrEventTest::GrabbingMultiPointerEvents() |
|
2988 { |
|
2989 // Test Grabbing of multi pointer events |
|
2990 // 1. Test Wserv supports Grabbing in case of multi-pointer events |
|
2991 // 2. Test pointer events are delivered correctly when Grabbing is disabled. |
|
2992 TLogMessageText logText; |
|
2993 _LIT(KSet, "GrabbingMultiPtrEvents SetOfEvents: %d of 2"); |
|
2994 logText.AppendFormat(KSet, iEventSet); |
|
2995 LOG_MESSAGE(logText); |
|
2996 |
|
2997 if (!iEventSet) |
|
2998 { |
|
2999 SetAutoFlush(); |
|
3000 } |
|
3001 |
|
3002 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3003 |
|
3004 TPoint ptrPos; |
|
3005 |
|
3006 switch(iEventSet++) |
|
3007 { |
|
3008 case 0: |
|
3009 INFO_PRINTF1(_L("Check Wserv supports Grabbing in case of multi-pointer events")); |
|
3010 // Check pointer events are delivered to the window where the EButton1Down event occured, |
|
3011 // even if subsequent events are simulated outside this window. |
|
3012 AddExpectedWsEvent(EEventFocusGained); |
|
3013 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
3014 iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(ETrue); |
|
3015 TestGrabbingForMultiPointer(ETrue); |
|
3016 break; |
|
3017 case 1: |
|
3018 INFO_PRINTF1(_L("Check pointer events are delivered correctly when Grabbing is disabled.")); |
|
3019 // Check pointer events are delivered to the window on which they occured. |
|
3020 iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(EFalse); |
|
3021 TestGrabbingForMultiPointer(EFalse); |
|
3022 break; |
|
3023 default: |
|
3024 ResetFlushStopAS(); |
|
3025 break; |
|
3026 } |
|
3027 LogEventsAdded(); |
|
3028 } |
|
3029 |
|
3030 /** |
|
3031 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0025 |
|
3032 @SYMPREQ PREQ1226 |
|
3033 @SYMREQ REQ9677,REQ9683, |
|
3034 @SYMTestPriority High |
|
3035 @SYMTestCaseDesc Checks Wserv supports Filtering in case of multi pointer events. |
|
3036 @SYMTestStatus Implemented |
|
3037 |
|
3038 @SYMTestActions Simulate Move and Drag events. Add only Button1Up and Button1Down to TWsEvent buffer. |
|
3039 Disable Filtering and repeat test with the addition of Move and Drag events to TWsEvent buffer. |
|
3040 @SYMTestExpectedResults The received events must match the expected simulated raw events |
|
3041 The received events must match the simulated raw events |
|
3042 */ |
|
3043 void CTMultiPtrEventTest::FilteringMultiPointerEvents() |
|
3044 { |
|
3045 // Test Filtering of multi pointer events |
|
3046 // 1. Test pointer move and drag events are filtered correctly by Wserv |
|
3047 // 2. Test pointer events are delivered correctly when Filtered is disabled. |
|
3048 TLogMessageText logText; |
|
3049 _LIT(KSet, "FilteringMultiPtrEvents SetOfEvents: %d of 2"); |
|
3050 logText.AppendFormat(KSet, iEventSet); |
|
3051 LOG_MESSAGE(logText); |
|
3052 |
|
3053 if (!iEventSet) |
|
3054 { |
|
3055 SetAutoFlush(); |
|
3056 } |
|
3057 |
|
3058 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3059 |
|
3060 TPoint ptrPos; |
|
3061 |
|
3062 switch(iEventSet++) |
|
3063 { |
|
3064 case 0: |
|
3065 INFO_PRINTF1(_L("Check pointer move and drag events are filtered with multi-pointer events")); |
|
3066 // Check pointer move and drag events are filtered by Wserv |
|
3067 AddExpectedWsEvent(EEventFocusGained); |
|
3068 |
|
3069 // Ensure default values are set i.e. Drag and Move events are filtered out and not delivered to the client. |
|
3070 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, |
|
3071 EPointerFilterDrag|EPointerFilterMove); |
|
3072 TestFilteringForMultiPointer(ETrue); |
|
3073 break; |
|
3074 case 1: |
|
3075 INFO_PRINTF1(_L("Check pointer move and drag events are not filtered, with multi-pointer events, when filtering is disabled")); |
|
3076 // Check move and drag events are not filtered by Wserv when filtering is disabled |
|
3077 |
|
3078 // Enable Drag and Move events |
|
3079 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, 0); |
|
3080 TestFilteringForMultiPointer(EFalse); |
|
3081 break; |
|
3082 default: |
|
3083 ResetFlushStopAS(); |
|
3084 break; |
|
3085 } |
|
3086 LogEventsAdded(); |
|
3087 } |
|
3088 |
|
3089 void CTMultiPtrEventTest::SetDefaultScreenMode() |
|
3090 { |
|
3091 iMultiPtrEventClient->iScreen->SetAppScreenMode(0); |
|
3092 TheClient->iScreen->SetAppScreenMode(0); |
|
3093 iMultiPtrEventClient->iScreen->SetScreenMode(0); |
|
3094 iMultiPtrEventClient->iScreen->SetCurrentRotations(0, CFbsBitGc::EGraphicsOrientationNormal); |
|
3095 } |
|
3096 |
|
3097 TPoint PhysicalToLogical(TPoint aPhysicalPt, TPoint aOrigin, TSize aSize) |
|
3098 { |
|
3099 return PhysicalToLogical(aPhysicalPt-aOrigin, aSize); |
|
3100 } |
|
3101 |
|
3102 TPoint CTMultiPtrEventTest::GetPointerPostionOnRotatedMode(TPoint aPointerPos, CFbsBitGc::TGraphicsOrientation aRotation) |
|
3103 { |
|
3104 if (aRotation == CFbsBitGc::EGraphicsOrientationNormal) |
|
3105 { |
|
3106 return aPointerPos; |
|
3107 } |
|
3108 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated90) |
|
3109 { |
|
3110 // here width is actually height in rotated mode |
|
3111 return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iY - 1, aPointerPos.iX); |
|
3112 } |
|
3113 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated180) |
|
3114 { |
|
3115 return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iX - 1, iPhysicalScreenSize.iHeight - aPointerPos.iY - 1); |
|
3116 } |
|
3117 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated270) |
|
3118 { |
|
3119 // here width is actually height in rotated mode |
|
3120 return TPoint(aPointerPos.iY, iPhysicalScreenSize.iHeight - aPointerPos.iX -1); |
|
3121 } |
|
3122 return TPoint(0,0); |
|
3123 } |
|
3124 |
|
3125 /** |
|
3126 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0028 |
|
3127 @SYMPREQ PREQ1226 |
|
3128 @SYMREQ REQ9677, REQ9683 |
|
3129 @SYMTestPriority High |
|
3130 @SYMTestCaseDesc To check Wserv sends multi pointer events in Different screen modes |
|
3131 @SYMTestStatus Implemented |
|
3132 |
|
3133 @SYMTestActions Simulate multi pointer events in Different screenmodes |
|
3134 @SYMTestExpectedResults The received events must match the simulated raw events |
|
3135 */ |
|
3136 void CTMultiPtrEventTest::MultiPointerEventsInDiffScreenModes() |
|
3137 { |
|
3138 // Logic inloved, For a particular screen mode check pointer down/up, moves and drags |
|
3139 // for different pointers and for different co-ordinates. |
|
3140 // For each screen mode check these events on diffferent rotation that screen mode supports |
|
3141 // During the last switch case increment the screenmode |
|
3142 TLogMessageText logText; |
|
3143 _LIT(KSet, "Multi pointer events in screenmode(%d): %d of 2"); |
|
3144 logText.AppendFormat(KSet, iCurrentScreenMode+1, iEventSet); |
|
3145 LOG_MESSAGE(logText); |
|
3146 |
|
3147 TInt numScrMode = iMultiPtrEventClient->iScreen->NumScreenModes(); |
|
3148 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3149 |
|
3150 if (!iEventSet && !iChangeScreenMode) |
|
3151 { |
|
3152 SetAutoFlush(); |
|
3153 iChangeScreenMode = ETrue; |
|
3154 AddExpectedWsEvent(EEventFocusGained); |
|
3155 } |
|
3156 else |
|
3157 { |
|
3158 if (iChangeScreenMode) |
|
3159 { |
|
3160 if (iCurrentScreenMode >= numScrMode) |
|
3161 { |
|
3162 EndFun: |
|
3163 SetDefaultScreenMode(); |
|
3164 ResetFlushStopAS(); |
|
3165 return; |
|
3166 } |
|
3167 } |
|
3168 } |
|
3169 |
|
3170 if (iChangeScreenMode) |
|
3171 { |
|
3172 iMultiPtrEventClient->iScreen->SetAppScreenMode(iCurrentScreenMode); |
|
3173 TheClient->iScreen->SetAppScreenMode(iCurrentScreenMode); |
|
3174 iMultiPtrEventClient->iScreen->SetScreenMode(iCurrentScreenMode); |
|
3175 iChangeScreenMode = EFalse; |
|
3176 } |
|
3177 |
|
3178 CArrayFixFlat<TInt>* rotations = NULL; |
|
3179 TRAPD(err, |
|
3180 rotations = new(ELeave) CArrayFixFlat<TInt>(1); |
|
3181 iMultiPtrEventClient->iScreen->GetRotationsList(iCurrentScreenMode, rotations)); |
|
3182 if (err != KErrNone) |
|
3183 { |
|
3184 if (iEventSet) |
|
3185 { |
|
3186 goto EndFun; |
|
3187 } |
|
3188 else |
|
3189 { |
|
3190 return; |
|
3191 } |
|
3192 } |
|
3193 |
|
3194 #if !defined(__WINS__) |
|
3195 TPoint ptrRotatedPos; |
|
3196 TPoint ptrNormalPos; |
|
3197 #else |
|
3198 TPoint ptrPhyPos; |
|
3199 #endif |
|
3200 TPoint ptrLogPos; |
|
3201 |
|
3202 TInt ptrNum = 0; |
|
3203 TInt proxValue = 0; |
|
3204 // Since screenmode positioning and screenmode scaling is not supported in NGA wserv2 |
|
3205 // but it is supported in Non NGA. But for NGA it will return (0,0) as origin and (1,1) as scale. |
|
3206 TPoint screenOrigin(iMultiPtrEventClient->iScreen->GetDefaultScreenModeOrigin()); |
|
3207 TPoint scaledScreenOrigin(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScaledOrigin()); |
|
3208 TSize scale(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScale()); |
|
3209 |
|
3210 switch(iEventSet++) |
|
3211 { |
|
3212 case 0: |
|
3213 // Simulate Pointer down/up for different rotations of a screenmode |
|
3214 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) |
|
3215 { |
|
3216 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]); |
|
3217 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); |
|
3218 |
|
3219 #if !defined(__WINS__) |
|
3220 ptrNormalPos = screenOrigin; |
|
3221 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3222 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3223 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3224 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3225 |
|
3226 ptrNormalPos.iX += 10; |
|
3227 ptrNormalPos.iY += 5; |
|
3228 ptrNum = iMaxDevPointers/2; |
|
3229 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3230 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3231 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3232 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3233 |
|
3234 ptrNormalPos.iX += 5; |
|
3235 ptrNormalPos.iY += 10; |
|
3236 ptrNum = iMaxDevPointers-1; |
|
3237 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3238 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3239 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3240 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3241 ptrNum = 0; |
|
3242 #else |
|
3243 // This is not needed for NGA, becasue NGA wserv does not support positioning and scaling |
|
3244 // but for early access we are deliverying for NonNGA so we need it. |
|
3245 ptrPhyPos = screenOrigin; |
|
3246 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3247 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3248 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3249 ptrPhyPos.iX += 10; |
|
3250 ptrPhyPos.iY += 5; |
|
3251 ptrNum = iMaxDevPointers/2; |
|
3252 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3253 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3254 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3255 ptrPhyPos.iX += 5; |
|
3256 ptrPhyPos.iY += 10; |
|
3257 ptrNum = iMaxDevPointers-1; |
|
3258 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3259 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3260 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3261 ptrNum = 0; |
|
3262 #endif |
|
3263 } |
|
3264 break; |
|
3265 case 1: |
|
3266 // Simulate moves for different rotations of a screenmode with different Proximity |
|
3267 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); |
|
3268 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) |
|
3269 { |
|
3270 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]); |
|
3271 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); |
|
3272 |
|
3273 #if !defined(__WINS__) |
|
3274 ptrNormalPos = screenOrigin; |
|
3275 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3276 proxValue = -iProximityStep; |
|
3277 SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum); |
|
3278 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3279 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); |
|
3280 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3281 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3282 |
|
3283 ptrNormalPos.iX += 10; |
|
3284 ptrNormalPos.iY += 5; |
|
3285 ptrNum = iMaxDevPointers/2; |
|
3286 if (proxValue-iProximityStep > iMaxProximity) |
|
3287 { |
|
3288 proxValue -= iProximityStep; |
|
3289 } |
|
3290 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3291 SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum); |
|
3292 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3293 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); |
|
3294 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3295 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3296 ptrNum = 0; |
|
3297 #else |
|
3298 ptrPhyPos = screenOrigin; |
|
3299 proxValue = -iProximityStep; |
|
3300 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3301 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum); |
|
3302 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); |
|
3303 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3304 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3305 |
|
3306 ptrPhyPos.iX += 10; |
|
3307 ptrPhyPos.iY += 5; |
|
3308 ptrNum = iMaxDevPointers/2; |
|
3309 if (proxValue-iProximityStep > iMaxProximity) |
|
3310 { |
|
3311 proxValue -= iProximityStep; |
|
3312 } |
|
3313 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3314 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum); |
|
3315 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); |
|
3316 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3317 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); |
|
3318 ptrNum = 0; |
|
3319 #endif |
|
3320 } |
|
3321 break; |
|
3322 case 2: |
|
3323 { |
|
3324 // Simulate drags for different rotations of a screenmode |
|
3325 #if !defined(__WINS__) |
|
3326 TPoint intNormalPt; |
|
3327 TPoint intRotatedPt; |
|
3328 #else |
|
3329 TPoint interPhyPt; |
|
3330 TPoint interLogPt; |
|
3331 #endif |
|
3332 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); |
|
3333 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) |
|
3334 { |
|
3335 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]); |
|
3336 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); |
|
3337 #if !defined(__WINS__) |
|
3338 ptrNormalPos = screenOrigin; |
|
3339 intNormalPt.iX = ptrNormalPos.iX+4; |
|
3340 intNormalPt.iY = ptrNormalPos.iY+5; |
|
3341 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3342 intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation); |
|
3343 SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3344 SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); |
|
3345 SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); |
|
3346 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3347 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); |
|
3348 TPoint intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale); |
|
3349 AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum); |
|
3350 AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum); |
|
3351 |
|
3352 ptrNormalPos.iX += 10; |
|
3353 ptrNormalPos.iY += 5; |
|
3354 ptrNum = iMaxDevPointers-1; |
|
3355 intNormalPt.iX = ptrNormalPos.iX+5; |
|
3356 intNormalPt.iY = ptrNormalPos.iY+4; |
|
3357 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); |
|
3358 intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation); |
|
3359 SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); |
|
3360 SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); |
|
3361 SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); |
|
3362 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); |
|
3363 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); |
|
3364 intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale); |
|
3365 AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum); |
|
3366 AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum); |
|
3367 |
|
3368 ptrNum = 0; |
|
3369 #else |
|
3370 ptrPhyPos = screenOrigin; |
|
3371 interPhyPt.iX = ptrPhyPos.iX+4; |
|
3372 interPhyPt.iY = ptrPhyPos.iY+5; |
|
3373 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3374 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); |
|
3375 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3376 SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); |
|
3377 SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); |
|
3378 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); |
|
3379 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); |
|
3380 AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum); |
|
3381 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum); |
|
3382 |
|
3383 ptrPhyPos.iX += 10; |
|
3384 ptrPhyPos.iY += 5; |
|
3385 ptrNum = iMaxDevPointers-1; |
|
3386 interPhyPt.iX = ptrPhyPos.iX+5; |
|
3387 interPhyPt.iY = ptrPhyPos.iY+4; |
|
3388 |
|
3389 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); |
|
3390 SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); |
|
3391 SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); |
|
3392 |
|
3393 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); |
|
3394 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); |
|
3395 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); |
|
3396 AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum); |
|
3397 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum); |
|
3398 ptrNum = 0; |
|
3399 #endif |
|
3400 } |
|
3401 } |
|
3402 iChangeScreenMode = ETrue; |
|
3403 iEventSet = 0; |
|
3404 iCurrentScreenMode++; |
|
3405 break; |
|
3406 default: |
|
3407 break; |
|
3408 } |
|
3409 |
|
3410 delete rotations; |
|
3411 |
|
3412 LogEventsAdded(); |
|
3413 } |
|
3414 |
|
3415 /* |
|
3416 Checks if pointer click plugin has an error when testing its events |
|
3417 If so then it gets the error deescription and displays the same |
|
3418 */ |
|
3419 void CTMultiPtrEventTest::TestAndDisplayPtrClickError() |
|
3420 { |
|
3421 TPckgBuf<TInt> intPkg; |
|
3422 TInt retErr = iClick.CommandReply(EMultiPtrClickEventError, intPkg); |
|
3423 if (retErr != KErrNone) |
|
3424 { |
|
3425 _LIT(KError, "Failed in Pointer click plugin"); |
|
3426 LOG_MESSAGE(KError); |
|
3427 // Error is ignored here, becasue this function should not leave |
|
3428 TRAPD(errMem, iErrDesc = iHeap->AllocL(KErrDescSize)); |
|
3429 if (errMem == KErrNone) |
|
3430 { |
|
3431 intPkg() = reinterpret_cast<TUint8*>(iErrDesc) - iChunk.Base() ; |
|
3432 |
|
3433 // get the error desccription, print it out and stop the tests |
|
3434 TInt retVal = iClick.CommandReply(EADllMultiPtrEventErrorDesc, intPkg); |
|
3435 if (retVal > KErrNone) |
|
3436 { |
|
3437 TPtr8 memPtr2(reinterpret_cast<TUint8*>(iErrDesc), retVal, retVal); |
|
3438 HBufC16* buf16 = NULL; |
|
3439 TRAPD(err, buf16 = HBufC16::NewL(retVal)); // Error is ignored here |
|
3440 if (err == KErrNone) |
|
3441 { |
|
3442 buf16->Des().Copy(memPtr2); |
|
3443 LOG_MESSAGE(buf16->Des()); |
|
3444 delete buf16; |
|
3445 } |
|
3446 } |
|
3447 iHeap->Free(iErrDesc); |
|
3448 } |
|
3449 Failed(); |
|
3450 } |
|
3451 iClick.CommandReply(EMultiPtrClickEventReset, intPkg); |
|
3452 } |
|
3453 |
|
3454 void CTMultiPtrEventTest::AddExpectedMultiPtrClickEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) |
|
3455 { |
|
3456 TPckgBuf<TWsEvent> evtPkg; |
|
3457 TWsEvent& event=evtPkg(); |
|
3458 event.SetType(EEventPointer); |
|
3459 iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); |
|
3460 |
|
3461 // change the parent position here as they r with respect to screen corodinates. |
|
3462 event.Pointer()->iParentPosition = aPos; |
|
3463 |
|
3464 iClick.CommandReply(EMultiPtrClickEventAdd, evtPkg); |
|
3465 AddExpectedMultiPtrClickOtherEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); |
|
3466 } |
|
3467 |
|
3468 void CTMultiPtrEventTest::AddExpectedMultiPtrClickOtherEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) |
|
3469 { |
|
3470 TWsEvent event; |
|
3471 event.SetType(EEventPointer); |
|
3472 iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); |
|
3473 |
|
3474 TPointerEventData otherEvent; |
|
3475 otherEvent.iClientHandle = event.Handle(); |
|
3476 otherEvent.iCurrentPos = aPos; |
|
3477 otherEvent.iPointerEvent = *event.Pointer(); |
|
3478 |
|
3479 TPckgBuf<TPointerEventData> evtPkg(otherEvent); |
|
3480 iClick.CommandReply(EMultiPtrOtherEventAdd, evtPkg); |
|
3481 } |
|
3482 |
|
3483 /* |
|
3484 Function of creating |
|
3485 1. Pointer click plugin |
|
3486 2. RChunk for transfering error description from pointer click plugin to current test |
|
3487 3. RHeap for allocating memory in RChunk |
|
3488 */ |
|
3489 void CTMultiPtrEventTest::CreatePointerClickPluginL() |
|
3490 { |
|
3491 // tranfer this to another function |
|
3492 iClick=RSoundPlugIn(TheClient->iWs); |
|
3493 User::LeaveIfError(iClick.Construct(TUid::Uid(MULTIPTR_CLICK_THIRD_UID))); |
|
3494 TBool ptrPluginLoadable = EFalse; |
|
3495 iClick.IsLoaded(ptrPluginLoadable); |
|
3496 if (ptrPluginLoadable) |
|
3497 { |
|
3498 User::LeaveIfError(iClick.Load(KMultiPtrPluginDll)); |
|
3499 iPtrPluginLoaded = ETrue; |
|
3500 } |
|
3501 iClick.SetPenClick(ETrue); |
|
3502 iHeap = UserHeap::ChunkHeap(&KMultiPtrClickChunk, 128, 256, 10); |
|
3503 if (iHeap == NULL) |
|
3504 { |
|
3505 User::LeaveNoMemory(); |
|
3506 } |
|
3507 User::LeaveIfError(iChunk.OpenGlobal(KMultiPtrClickChunk, ETrue)); |
|
3508 } |
|
3509 |
|
3510 /** |
|
3511 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0027 |
|
3512 @SYMPREQ PREQ1226 |
|
3513 @SYMREQ REQ9677, REQ9683 |
|
3514 @SYMTestPriority High |
|
3515 @SYMTestCaseDesc To check Wserv sends multi pointer events to PointerClickPlugin |
|
3516 @SYMTestStatus Implemented |
|
3517 |
|
3518 @SYMTestActions Simulate multi pointer events for PointerClickPlugin |
|
3519 @SYMTestExpectedResults The received events must match the simulated raw events |
|
3520 */ |
|
3521 void CTMultiPtrEventTest::MultiPointerEventsForPointerClickL() |
|
3522 { |
|
3523 TLogMessageText logText; |
|
3524 _LIT(KSet, "Multi pointer events for PointerClickPlugin: %d of 4"); |
|
3525 logText.AppendFormat(KSet, iEventSet); |
|
3526 LOG_MESSAGE(logText); |
|
3527 |
|
3528 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3529 if (!iEventSet) |
|
3530 { |
|
3531 SetAutoFlush(); |
|
3532 } |
|
3533 |
|
3534 TPoint ptrPos; |
|
3535 TInt ptrNum = 0; |
|
3536 TInt prValue = 0; |
|
3537 TInt proxValue = 0; |
|
3538 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
3539 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
3540 |
|
3541 switch(iEventSet++) |
|
3542 { |
|
3543 case 0: |
|
3544 // Creates RSoundPlugin, loads the plugin DLL, create RChunk and RHeap |
|
3545 CreatePointerClickPluginL(); |
|
3546 AddExpectedWsEvent(EEventFocusGained); |
|
3547 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
3548 { |
|
3549 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3550 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
3551 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
3552 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3553 ptrPos.iX += xInc; |
|
3554 ptrPos.iY += yInc; |
|
3555 } |
|
3556 TestAndDisplayPtrClickError(); |
|
3557 break; |
|
3558 case 1: |
|
3559 // Simulate moves from different pointer with different pressure |
|
3560 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); |
|
3561 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); |
|
3562 ptrPos.SetXY(0,0); |
|
3563 prValue = iPressureStep; |
|
3564 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
3565 { |
|
3566 AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
3567 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum); |
|
3568 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum); |
|
3569 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
3570 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
3571 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
3572 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3573 ptrPos.iX += xInc; |
|
3574 ptrPos.iY += yInc; |
|
3575 } |
|
3576 TestAndDisplayPtrClickError(); |
|
3577 break; |
|
3578 case 2: |
|
3579 // Simulate moves from different pointer with different proximity |
|
3580 ptrPos.SetXY(0,0); |
|
3581 proxValue = -iProximityStep; |
|
3582 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
3583 { |
|
3584 AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
3585 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum); |
|
3586 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum); |
|
3587 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
3588 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
3589 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
3590 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3591 ptrPos.iX += xInc; |
|
3592 ptrPos.iY += yInc; |
|
3593 } |
|
3594 TestAndDisplayPtrClickError(); |
|
3595 break; |
|
3596 case 3: |
|
3597 { |
|
3598 // Simulate drags from all pointers |
|
3599 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); |
|
3600 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); |
|
3601 ptrPos.SetXY(0,0); |
|
3602 TPoint interPt; |
|
3603 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
3604 { |
|
3605 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3606 interPt.iX = ptrPos.iX+1; |
|
3607 interPt.iY = ptrPos.iY+2; |
|
3608 AddExpectedMultiPtrClickEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
3609 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
3610 |
|
3611 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3612 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
3613 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
3614 |
|
3615 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3616 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
3617 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
3618 |
|
3619 ptrPos.iX += xInc; |
|
3620 ptrPos.iY += yInc; |
|
3621 } |
|
3622 TestAndDisplayPtrClickError(); |
|
3623 } |
|
3624 break; |
|
3625 default: |
|
3626 iClick.Unload(); |
|
3627 iClick.Close(); |
|
3628 iPtrPluginLoaded = EFalse; |
|
3629 iHeap->Close(); |
|
3630 iHeap = NULL; |
|
3631 iChunk.Close(); |
|
3632 ResetFlushStopAS(); |
|
3633 break; |
|
3634 } |
|
3635 |
|
3636 LogEventsAdded(); |
|
3637 } |
|
3638 |
|
3639 void CTMultiPtrEventTest::GetRemainingEventsFromSecondaryClient() |
|
3640 { |
|
3641 if (iSecMultiPtrEventClient->EventBuffer()->EventsRemaining() != 0) |
|
3642 { |
|
3643 iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(ETrue); |
|
3644 CActiveScheduler::Start(); |
|
3645 } |
|
3646 } |
|
3647 |
|
3648 /** |
|
3649 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0011 |
|
3650 @SYMPREQ PREQ1226 |
|
3651 @SYMREQ REQ9677,REQ9674, |
|
3652 @SYMTestPriority High |
|
3653 @SYMTestCaseDesc To check Wserv sends Multi Pointer events to correct clients |
|
3654 @SYMTestStatus Implemented |
|
3655 |
|
3656 @SYMTestActions Simulate multi pointer events on windows from different client. |
|
3657 @SYMTestExpectedResults The received events must match the simulated raw events |
|
3658 */ |
|
3659 void CTMultiPtrEventTest::MultiClientMultiPointerEvents() |
|
3660 { |
|
3661 // Logic for this test code |
|
3662 // Create a secondary client when running this test |
|
3663 // Simulate events for both main client and secondary simulataneously |
|
3664 // Get events from DoRunL() of event buffer class |
|
3665 // Before running next set of events, get all the events from secondary client |
|
3666 // If test fails on any client make sure both active scheduler are stopped |
|
3667 TLogMessageText logText; |
|
3668 _LIT(KSet, "Multi pointer events for Multi client: %d of 5"); |
|
3669 logText.AppendFormat(KSet, iEventSet); |
|
3670 LOG_MESSAGE(logText); |
|
3671 |
|
3672 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3673 iSecMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3674 if (!iEventSet) |
|
3675 { |
|
3676 SetAutoFlush(); |
|
3677 iSecClientFlush = iSecMultiPtrEventClient->iWs.SetAutoFlush(ETrue); |
|
3678 } |
|
3679 |
|
3680 TPoint ptrPos; |
|
3681 TInt ptrNum = 0; |
|
3682 TInt prValue = 0; |
|
3683 TInt proxValue = 0; |
|
3684 TInt xInc = (iPhysicalScreenSize.iWidth/2)/iMaxDevPointers; |
|
3685 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
3686 TPoint secPt(iPhysicalScreenSize.iWidth/2,0); |
|
3687 TInt ptrSecNum = iMaxDevPointers-1; |
|
3688 |
|
3689 switch(iEventSet++) |
|
3690 { |
|
3691 case 0: |
|
3692 ptrPos.SetXY(0,0); |
|
3693 |
|
3694 // These events are generated when primary client is created and its group |
|
3695 // window constructed and then when button down for primary client is called |
|
3696 AddExpectedWsEvent(EEventFocusGained); |
|
3697 AddExpectedWsEvent(EEventFocusLost); |
|
3698 AddExpectedWsEvent(EEventFocusGained); |
|
3699 |
|
3700 // Simulate pointer down/up events for primary client from 0,1,3... pointers and 6,5,4... pointers for secondary client |
|
3701 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
3702 { |
|
3703 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3704 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3705 |
|
3706 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3707 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
3708 |
|
3709 ptrPos.iX += xInc; |
|
3710 ptrPos.iY += yInc; |
|
3711 } |
|
3712 |
|
3713 ptrPos.iX = iPhysicalScreenSize.iWidth/2; |
|
3714 ptrPos.iY = 0; |
|
3715 |
|
3716 // These events are generated when secondary cleint is created and then when |
|
3717 // button down for primary client is called, then when SetOrdinalPosition is |
|
3718 // called on secondary cleint's group window |
|
3719 AddExpectedWsEvent(EEventFocusGained, ETrue); |
|
3720 AddExpectedWsEvent(EEventFocusLost, ETrue); |
|
3721 iSecMultiPtrEventClient->iGroup->GroupWin()->SetOrdinalPosition(0, 1); |
|
3722 AddExpectedWsEvent(EEventFocusGained, ETrue); |
|
3723 |
|
3724 AddExpectedWsEvent(EEventFocusLost); |
|
3725 |
|
3726 for (ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) |
|
3727 { |
|
3728 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3729 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3730 |
|
3731 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3732 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3733 |
|
3734 ptrPos.iX += xInc; |
|
3735 ptrPos.iY += yInc; |
|
3736 } |
|
3737 break; |
|
3738 case 1: |
|
3739 // Simulate move events from primary and secondary client simultaneously with pressure |
|
3740 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
3741 iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
3742 |
|
3743 ptrPos.SetXY(0,0); |
|
3744 prValue = iPressureStep; |
|
3745 |
|
3746 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3747 { |
|
3748 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
3749 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
3750 ptrPos.iX += xInc; |
|
3751 ptrPos.iY += yInc; |
|
3752 |
|
3753 SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, prValue, ptrSecNum); |
|
3754 AddExpectedPointerEvent(TPointerEvent::EMove, secPt, prValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3755 secPt.iX += xInc; |
|
3756 secPt.iY += yInc; |
|
3757 } |
|
3758 break; |
|
3759 case 2: |
|
3760 // Simulate move events from primary and secondary client simultaneously with proximity |
|
3761 ptrPos.SetXY(0,0); |
|
3762 proxValue = -iProximityStep; |
|
3763 |
|
3764 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3765 { |
|
3766 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
3767 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
3768 ptrPos.iX += xInc; |
|
3769 ptrPos.iY += yInc; |
|
3770 |
|
3771 SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, proxValue, ptrSecNum); |
|
3772 AddExpectedPointerEvent(TPointerEvent::EMove, secPt, proxValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3773 secPt.iX += xInc; |
|
3774 secPt.iY += yInc; |
|
3775 } |
|
3776 break; |
|
3777 case 3: |
|
3778 { |
|
3779 // Simulate drag events on different clients window one after the other |
|
3780 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
3781 iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
3782 |
|
3783 ptrPos.SetXY(0,0); |
|
3784 secPt.iX = iPhysicalScreenSize.iWidth/2; |
|
3785 secPt.iY = 0; |
|
3786 ptrSecNum = iMaxDevPointers-1; |
|
3787 TPoint interPt; |
|
3788 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3789 { |
|
3790 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3791 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3792 interPt.iX = ptrPos.iX+2; |
|
3793 interPt.iY = ptrPos.iY+1; |
|
3794 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
3795 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
3796 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
3797 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
3798 ptrPos.iX += xInc; |
|
3799 ptrPos.iY += yInc; |
|
3800 |
|
3801 SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum); |
|
3802 AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3803 interPt.iX = secPt.iX+2; |
|
3804 interPt.iY = secPt.iY+1; |
|
3805 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum); |
|
3806 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3807 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum); |
|
3808 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3809 secPt.iX += xInc; |
|
3810 secPt.iY += yInc; |
|
3811 } |
|
3812 } |
|
3813 break; |
|
3814 case 4: |
|
3815 { |
|
3816 // Simulate drag events on different clients, but interleaved each other |
|
3817 ptrPos.SetXY(0,0); |
|
3818 secPt.iX = iPhysicalScreenSize.iWidth/2; |
|
3819 secPt.iY = 0; |
|
3820 ptrSecNum = iMaxDevPointers-1; |
|
3821 TPoint interPt; |
|
3822 |
|
3823 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3824 { |
|
3825 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3826 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
3827 ptrPos.iX += xInc; |
|
3828 ptrPos.iY += yInc; |
|
3829 |
|
3830 SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum); |
|
3831 AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3832 secPt.iX += xInc; |
|
3833 secPt.iY += yInc; |
|
3834 } |
|
3835 |
|
3836 ptrPos.SetXY(0,0); |
|
3837 secPt.iX = iPhysicalScreenSize.iWidth/2; |
|
3838 secPt.iY = 0; |
|
3839 ptrSecNum = iMaxDevPointers-1; |
|
3840 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3841 { |
|
3842 interPt.iX = ptrPos.iX+2; |
|
3843 interPt.iY = ptrPos.iY+1; |
|
3844 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
3845 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
3846 ptrPos.iX += xInc; |
|
3847 ptrPos.iY += yInc; |
|
3848 |
|
3849 |
|
3850 interPt.iX = secPt.iX+2; |
|
3851 interPt.iY = secPt.iY+1; |
|
3852 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum); |
|
3853 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3854 secPt.iX += xInc; |
|
3855 secPt.iY += yInc; |
|
3856 } |
|
3857 |
|
3858 ptrPos.SetXY(0,0); |
|
3859 secPt.iX = iPhysicalScreenSize.iWidth/2; |
|
3860 secPt.iY = 0; |
|
3861 ptrSecNum = iMaxDevPointers-1; |
|
3862 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) |
|
3863 { |
|
3864 interPt.iX = ptrPos.iX+2; |
|
3865 interPt.iY = ptrPos.iY+1; |
|
3866 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
3867 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
3868 ptrPos.iX += xInc; |
|
3869 ptrPos.iY += yInc; |
|
3870 |
|
3871 interPt.iX = secPt.iX+2; |
|
3872 interPt.iY = secPt.iY+1; |
|
3873 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum); |
|
3874 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); |
|
3875 secPt.iX += xInc; |
|
3876 secPt.iY += yInc; |
|
3877 } |
|
3878 } |
|
3879 break; |
|
3880 default: |
|
3881 ResetFlushStopAS(); |
|
3882 iSecMultiPtrEventClient->iWs.SetAutoFlush(iSecClientFlush); |
|
3883 break; |
|
3884 } |
|
3885 |
|
3886 _LIT(KEventsAdded, "Events added to Primary client's buffer = %d"); |
|
3887 logText.Format(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); |
|
3888 LOG_MESSAGE(logText); |
|
3889 _LIT(KEventsAdded1, "Events added to Secondary client's buffer = %d"); |
|
3890 logText.Format(KEventsAdded1, iSecMultiPtrEventClient->EventBuffer()->EventsRemaining()); |
|
3891 LOG_MESSAGE(logText); |
|
3892 } |
|
3893 |
|
3894 |
|
3895 // RMultiPointerAnim |
|
3896 RMultiPointerAnim* RMultiPointerAnim::NewL(RWindowBase* aWin, RAnimDll* aDll) |
|
3897 { |
|
3898 RMultiPointerAnim* self=new(ELeave) RMultiPointerAnim(aDll); |
|
3899 CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); |
|
3900 User::LeaveIfError(self->Construct(*aWin, EAnimTypeMultiPointer, TPtrC8())); |
|
3901 CleanupStack::Pop(self); |
|
3902 return self; |
|
3903 } |
|
3904 |
|
3905 TInt RMultiPointerAnim::AddExpectedAnimPointerEvent(TRawEvent::TType aType, TPoint aPos, TInt aZ, TUint /*aModifier*/, TUint8 aPointerNumber, TBool aEat /*= ETrue*/) |
|
3906 { |
|
3907 TRawEvent rawEvent; |
|
3908 rawEvent.Set(aType, aPos.iX, aPos.iY, aZ, aPointerNumber); |
|
3909 TAnimRawEvent animEvent; |
|
3910 animEvent.iRawEvent = rawEvent; |
|
3911 animEvent.iEat = aEat; |
|
3912 TPckgBuf<TAnimRawEvent> param; |
|
3913 param()=animEvent; |
|
3914 return CommandReply(EADllAddExpectedMultiPtrEvent, param); |
|
3915 } |
|
3916 |
|
3917 void CTMultiPtrEventTest::TestAndDisplayAnimError() |
|
3918 { |
|
3919 TInt err = iAnim->CommandReply(EADllMultiPtrEventError); |
|
3920 if (err != KErrNone) |
|
3921 { |
|
3922 _LIT(KError, "Failed in Anim dll"); |
|
3923 LOG_MESSAGE(KError); |
|
3924 TBuf<255> errDesc; |
|
3925 errDesc.SetMax(); |
|
3926 TIpcArgs ipcArgs; |
|
3927 ipcArgs.Set(KIpcSlot,&errDesc); |
|
3928 // get the error desccription, print it out and stop the tests |
|
3929 TInt retVal = iAnim->CommandReply(EADllMultiPtrEventErrorDesc, KNullDesC8, ipcArgs); |
|
3930 if (retVal == KErrNone) |
|
3931 { |
|
3932 LOG_MESSAGE(errDesc); |
|
3933 } |
|
3934 Failed(); |
|
3935 } |
|
3936 iAnim->CommandReply(EADllMultiPtrEventReset); |
|
3937 } |
|
3938 |
|
3939 /** |
|
3940 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0013 |
|
3941 @SYMPREQ PREQ1226 |
|
3942 @SYMREQ REQ9677,REQ9683, |
|
3943 @SYMTestPriority High |
|
3944 @SYMTestCaseDesc To check Wserv sends Multi Pointer events to Anims |
|
3945 @SYMTestStatus Implemented |
|
3946 |
|
3947 @SYMTestActions Simulate multi pointer events for anims |
|
3948 @SYMTestExpectedResults The received events must match the simulated raw events |
|
3949 */ |
|
3950 void CTMultiPtrEventTest::MultiPointerEventsForAnimsL() |
|
3951 { |
|
3952 // The logic behind these tests is |
|
3953 // Create an anim, which creates animation at server side(which swicthes raw event handling on) |
|
3954 // Add the required events to the animtaion at server side buffer |
|
3955 // Simulate those events and check simulated events are same as required at server side |
|
3956 // If any test fail, error description is got from server and displayed in the log file |
|
3957 TLogMessageText logText; |
|
3958 _LIT(KSet, "Multi pointer events for Anims: %d of 3"); |
|
3959 logText.AppendFormat(KSet, iEventSet); |
|
3960 LOG_MESSAGE(logText); |
|
3961 _LIT(KEventsChecked, "Events checked at server side = %d"); |
|
3962 |
|
3963 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
3964 if (!iEventSet) |
|
3965 { |
|
3966 SetAutoFlush(); |
|
3967 iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs); |
|
3968 User::LeaveIfError(iAnimDll->Load(KAnimDLLName)); |
|
3969 } |
|
3970 |
|
3971 TPoint ptrPos; |
|
3972 TInt ptrNum = 0; |
|
3973 TInt prValue = 0; |
|
3974 TInt proxValue = 0; |
|
3975 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
3976 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
3977 |
|
3978 switch(iEventSet++) |
|
3979 { |
|
3980 case 0: |
|
3981 // Simulate downup events for all pointers |
|
3982 iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll); |
|
3983 AddExpectedWsEvent(EEventFocusGained); |
|
3984 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
3985 { |
|
3986 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); |
|
3987 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); |
|
3988 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
3989 ptrPos.iX += xInc; |
|
3990 ptrPos.iY += yInc; |
|
3991 } |
|
3992 TestAndDisplayAnimError(); |
|
3993 logText.Format(KEventsChecked, iMaxDevPointers*2); |
|
3994 LOG_MESSAGE(logText); |
|
3995 break; |
|
3996 case 1: |
|
3997 // Simulate moves from different pointer with different pressure |
|
3998 // Here there is no need for events to be exaclty on the anim window. |
|
3999 // becasue when the animtaions ask for events it will be delivered all the events |
|
4000 // irrespective of where they occured. |
|
4001 ptrPos.SetXY(0,0); |
|
4002 prValue = iPressureStep; |
|
4003 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4004 { |
|
4005 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, prValue, 0, ptrNum); |
|
4006 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); |
|
4007 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); |
|
4008 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4009 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4010 ptrPos.iX += xInc; |
|
4011 ptrPos.iY += yInc; |
|
4012 } |
|
4013 TestAndDisplayAnimError(); |
|
4014 |
|
4015 // This is for just to add run the next test |
|
4016 SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0); |
|
4017 |
|
4018 logText.Format(KEventsChecked, iMaxDevPointers*3); |
|
4019 LOG_MESSAGE(logText); |
|
4020 break; |
|
4021 case 2: |
|
4022 // Simulate moves from different pointer with different proximity |
|
4023 ptrPos.SetXY(0,0); |
|
4024 proxValue = -iProximityStep; |
|
4025 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4026 { |
|
4027 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, proxValue, 0, ptrNum); |
|
4028 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); |
|
4029 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); |
|
4030 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
4031 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4032 ptrPos.iX += xInc; |
|
4033 ptrPos.iY += yInc; |
|
4034 } |
|
4035 TestAndDisplayAnimError(); |
|
4036 |
|
4037 // This is for just to add run the next test |
|
4038 SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0); |
|
4039 |
|
4040 logText.Format(KEventsChecked, iMaxDevPointers*3); |
|
4041 LOG_MESSAGE(logText); |
|
4042 break; |
|
4043 default: |
|
4044 DestroyAnimDllAndAnim(); |
|
4045 ResetFlushStopAS(); |
|
4046 break; |
|
4047 } |
|
4048 |
|
4049 LogEventsAdded(); |
|
4050 } |
|
4051 |
|
4052 |
|
4053 /** |
|
4054 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0014 |
|
4055 @SYMPREQ PREQ1226 |
|
4056 @SYMREQ REQ9677,REQ9683, |
|
4057 @SYMTestPriority High |
|
4058 @SYMTestCaseDesc To check Wserv purges multi pointer events with standard rules |
|
4059 @SYMTestStatus Implemented |
|
4060 |
|
4061 @SYMTestActions Simulate raw events to be purged |
|
4062 @SYMTestExpectedResults The purged events should not be delivered to client |
|
4063 */ |
|
4064 void CTMultiPtrEventTest::PurgingMultiPointerEvents() |
|
4065 { |
|
4066 // Test purging of multi pointer events |
|
4067 // 1. Test down/up pairs are purged |
|
4068 // 2. Test moves events are purged |
|
4069 // 3. Test drag events are purged |
|
4070 // 4. Test lone down events are purged |
|
4071 // 5. And finally test lone up events are also purged |
|
4072 TLogMessageText logText; |
|
4073 _LIT(KSet, "Purging of multi pointer events: %d of 6"); |
|
4074 logText.AppendFormat(KSet, iEventSet); |
|
4075 LOG_MESSAGE(logText); |
|
4076 |
|
4077 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
4078 TInt xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize; |
|
4079 TInt yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize; |
|
4080 TPoint ptrPos(xInc,yInc); |
|
4081 TInt ptrNum = 0; |
|
4082 TInt prValue = 0; |
|
4083 TInt proxValue = 0; |
|
4084 |
|
4085 if (!iEventSet) |
|
4086 { |
|
4087 SetAutoFlush(); |
|
4088 } |
|
4089 |
|
4090 // Point to note is that Kernel has an event queue size of 40 |
|
4091 // So make sure that you don't send more than 40 events |
|
4092 switch(iEventSet++) |
|
4093 { |
|
4094 case 0: |
|
4095 // Simulate pointer down/up events for all pointers |
|
4096 // Simulate many up events from any pointer which will purge down/up events |
|
4097 AddExpectedWsEvent(EEventFocusGained); |
|
4098 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) |
|
4099 { |
|
4100 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4101 } |
|
4102 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize-1, ptrPos); |
|
4103 break; |
|
4104 case 1: |
|
4105 // Repeat the same for Move events |
|
4106 // Simulate moves for all pointers with different pressure and proximity value |
|
4107 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
4108 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
4109 prValue = iPressureStep; |
|
4110 for (ptrNum = 0; (ptrNum < iMaxDevPointers && prValue < iMaxPressure && ptrNum < 4); ptrNum++,prValue+=iPressureStep) |
|
4111 { |
|
4112 ptrPos.iX += xInc/2; |
|
4113 ptrPos.iY += yInc/2; |
|
4114 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4115 } |
|
4116 ptrPos.iX = xInc; |
|
4117 ptrPos.iY = yInc; |
|
4118 proxValue = -iProximityStep; |
|
4119 for (ptrNum = 0; (ptrNum < iMaxDevPointers && proxValue > iMaxProximity && ptrNum < 4); ptrNum++,proxValue-=iProximityStep) |
|
4120 { |
|
4121 ptrPos.iX += xInc/2; |
|
4122 ptrPos.iY += yInc/2; |
|
4123 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
4124 } |
|
4125 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos); |
|
4126 break; |
|
4127 case 2: |
|
4128 { |
|
4129 // Repeat the same for drag events |
|
4130 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
4131 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
4132 ptrPos.iX = xInc; |
|
4133 ptrPos.iY = yInc; |
|
4134 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) |
|
4135 { |
|
4136 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4137 ptrPos.iX += xInc/2; |
|
4138 ptrPos.iY += yInc/2; |
|
4139 } |
|
4140 ptrPos.iX = xInc; |
|
4141 ptrPos.iY = yInc; |
|
4142 TPoint interPt = ptrPos; |
|
4143 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) |
|
4144 { |
|
4145 interPt.iX += 2; |
|
4146 interPt.iY += 1; |
|
4147 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
4148 ptrPos.iX += xInc/2; |
|
4149 ptrPos.iY += yInc/2; |
|
4150 interPt = ptrPos; |
|
4151 } |
|
4152 ptrPos.iX = xInc; |
|
4153 ptrPos.iY = yInc; |
|
4154 interPt = ptrPos; |
|
4155 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) |
|
4156 { |
|
4157 interPt.iX += 2; |
|
4158 interPt.iY += 1; |
|
4159 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
4160 ptrPos.iX += xInc/2; |
|
4161 ptrPos.iY += yInc/2; |
|
4162 interPt = ptrPos; |
|
4163 } |
|
4164 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos); |
|
4165 } |
|
4166 break; |
|
4167 case 3: |
|
4168 // Repeat the same for lone down events |
|
4169 ptrPos.iX = xInc; |
|
4170 ptrPos.iY = yInc; |
|
4171 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++) |
|
4172 { |
|
4173 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4174 ptrPos.iX += xInc/2; |
|
4175 ptrPos.iY += yInc/2; |
|
4176 } |
|
4177 SimulateAndAddLoneUpEvents(KMaxQueueSize+1, KMaxQueueSize, ptrPos); |
|
4178 |
|
4179 // Before this we had to send dummy 7 EButton1Up events from 1 to 7 pointers so that iLastUnmatchedDown1 |
|
4180 // variable to be reset and that consecutive events was not sent to client. But now EPointer3DOutOfRange |
|
4181 // resets all the variables. |
|
4182 for (ptrNum = 1; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++) |
|
4183 { |
|
4184 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4185 } |
|
4186 break; |
|
4187 case 4: |
|
4188 // Finally for even lone up events, check that when you send events more then the queuesize |
|
4189 // the events are not sent back and they are ignored in wserv |
|
4190 ptrPos.iX = xInc; |
|
4191 ptrPos.iY = yInc; |
|
4192 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) |
|
4193 { |
|
4194 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4195 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
4196 ptrPos.iX += xInc/2; |
|
4197 ptrPos.iY += yInc/2; |
|
4198 } |
|
4199 ptrPos.iX = xInc; |
|
4200 ptrPos.iY = yInc; |
|
4201 for (TInt count = 0; count < KMaxQueueSize; count++) |
|
4202 { |
|
4203 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
4204 // For all up events more then KMaxQueueSize, wserv igoners then as the queue if full |
|
4205 if (count < (KMaxQueueSize - iMaxDevPointers)) |
|
4206 { |
|
4207 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
4208 } |
|
4209 } |
|
4210 break; |
|
4211 case 5: |
|
4212 // Check PurgePointerEvents works with multi pointer events |
|
4213 ptrPos.iX = xInc; |
|
4214 ptrPos.iY = yInc; |
|
4215 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4216 { |
|
4217 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4218 ptrPos.iX += xInc/2; |
|
4219 ptrPos.iY += yInc/2; |
|
4220 } |
|
4221 ptrPos.iX = xInc; |
|
4222 ptrPos.iY = yInc; |
|
4223 iMultiPtrEventClient->iWs.PurgePointerEvents(); |
|
4224 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
4225 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
4226 break; |
|
4227 default: |
|
4228 ResetFlushStopAS(); |
|
4229 break; |
|
4230 } |
|
4231 LogEventsAdded(); |
|
4232 } |
|
4233 |
|
4234 void CTMultiPtrEventTest::MultiPointerEvents() |
|
4235 { |
|
4236 TLogMessageText logText; |
|
4237 _LIT(KSet, "MultiPtrEvents SetOfEvents: %d of 9"); |
|
4238 logText.AppendFormat(KSet, iEventSet); |
|
4239 LOG_MESSAGE(logText); |
|
4240 |
|
4241 if (!iEventSet) |
|
4242 { |
|
4243 SetAutoFlush(); |
|
4244 } |
|
4245 iMultiPtrEventClient->EventBuffer()->SetEventCount(0); |
|
4246 |
|
4247 TPoint ptrPos; |
|
4248 TInt ptrNum = 0; |
|
4249 TInt prValue = 0; |
|
4250 TInt proxValue = 0; |
|
4251 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; |
|
4252 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; |
|
4253 |
|
4254 switch(iEventSet++) |
|
4255 { |
|
4256 case 0: |
|
4257 /** |
|
4258 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0001 |
|
4259 @SYMPREQ PREQ1226 |
|
4260 @SYMREQ REQ9674,REQ9687, |
|
4261 @SYMTestPriority High |
|
4262 @SYMTestCaseDesc Checks Wserv sends multi touch pointer events received by it |
|
4263 @SYMTestStatus Implemented |
|
4264 |
|
4265 @SYMTestActions Simulate raw events from different pointers |
|
4266 @SYMTestExpectedResults The received events must match the simulated raw events |
|
4267 */ |
|
4268 INFO_PRINTF1(_L("Simulate pointer events from all pointers")); |
|
4269 INFO_PRINTF1(_L("Test pattern is PointerDown0/PointerUp0, PointerDown1/PointerUp1, PointerDown2/PointerUp2...")); |
|
4270 // Test pattern is down0/up0, down1/up1, down2/up2, down3/up3.... |
|
4271 AddExpectedWsEvent(EEventFocusGained); |
|
4272 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4273 { |
|
4274 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4275 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
4276 ptrPos.iX += xInc; |
|
4277 ptrPos.iY += yInc; |
|
4278 } |
|
4279 break; |
|
4280 case 1: |
|
4281 /** |
|
4282 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0003 |
|
4283 @SYMPREQ PREQ1226 |
|
4284 @SYMREQ REQ9674,REQ9687, |
|
4285 @SYMTestPriority High |
|
4286 @SYMTestCaseDesc To check Wserv sends simultaneous multi touch pointer events |
|
4287 @SYMTestStatus Implemented |
|
4288 |
|
4289 @SYMTestActions Simulate simultaneous raw events from different pointers |
|
4290 @SYMTestExpectedResults The received events must match the simulated raw events |
|
4291 */ |
|
4292 INFO_PRINTF1(_L("Test pattern PointerDown0/PointerDown1/PointerDown2/... PointerUp0/PointerUp1/PointerUp2...")); |
|
4293 // Test pattern is pointer0Down/pointer1Down/pointer2Down/pointer3Down.... pointer0Up/pointer1Up/pointer2Up/pointer3Up.... |
|
4294 ptrPos.SetXY(0,0); |
|
4295 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4296 { |
|
4297 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4298 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
4299 ptrPos.iX += xInc; |
|
4300 ptrPos.iY += yInc; |
|
4301 } |
|
4302 |
|
4303 ptrPos.SetXY(0,0); |
|
4304 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4305 { |
|
4306 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4307 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
4308 ptrPos.iX += xInc; |
|
4309 ptrPos.iY += yInc; |
|
4310 } |
|
4311 break; |
|
4312 case 2: |
|
4313 /** |
|
4314 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0005 |
|
4315 @SYMPREQ PREQ1226 |
|
4316 @SYMREQ REQ9676 |
|
4317 @SYMTestPriority High |
|
4318 @SYMTestCaseDesc To check Wserv sends the multi touch pointer events received |
|
4319 by it along with the Pressure or Proximity |
|
4320 @SYMTestStatus Implemented |
|
4321 |
|
4322 @SYMTestActions Simulate raw events with pressure and proximity from different pointers |
|
4323 @SYMTestExpectedResults The received events must match the simulated raw events |
|
4324 */ |
|
4325 // Simulate Button1Down with differet pressure |
|
4326 // Simulate Button1Up with zero pressure |
|
4327 INFO_PRINTF1(_L("Simulate pointer events with different pressure values")); |
|
4328 ptrPos.SetXY(0,0); |
|
4329 prValue = iPressureStep; |
|
4330 for (; (prValue <= iMaxPressure && ptrPos.iX < iPhysicalScreenSize.iWidth && ptrPos.iY < iPhysicalScreenSize.iHeight); prValue+=iPressureStep) |
|
4331 { |
|
4332 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0); |
|
4333 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
4334 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0); |
|
4335 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
4336 ptrPos.iX += xInc; |
|
4337 ptrPos.iY += yInc; |
|
4338 } |
|
4339 |
|
4340 // Test with max pressure it might be that the width may cross the physical screen size |
|
4341 ptrPos.SetXY(0,0); |
|
4342 prValue = iMaxPressure; |
|
4343 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0); |
|
4344 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); |
|
4345 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0); |
|
4346 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); |
|
4347 break; |
|
4348 case 3: |
|
4349 // Simulate EPointerMove with different pressure values and for differernt pointers |
|
4350 INFO_PRINTF1(_L("Simulate pointer events with different pressure values and from different pointers")); |
|
4351 ptrPos.SetXY(0,0); |
|
4352 prValue = iPressureStep; |
|
4353 |
|
4354 // Enable move events |
|
4355 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
4356 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); |
|
4357 |
|
4358 // Right now when 2 or more moves occur, wserv deletes all the moves except the last one. |
|
4359 // So test only one move per Pointer and then one set of button down and button up |
|
4360 // Then repeat the same for different pressure values |
|
4361 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4362 { |
|
4363 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4364 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
4365 ptrPos.iX += xInc; |
|
4366 ptrPos.iY += yInc; |
|
4367 } |
|
4368 |
|
4369 ptrPos.SetXY(0,0); |
|
4370 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4371 { |
|
4372 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4373 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
4374 ptrPos.iX += xInc; |
|
4375 ptrPos.iY += yInc; |
|
4376 } |
|
4377 |
|
4378 // Test moves with different pressure |
|
4379 ptrPos.SetXY(0,0); |
|
4380 if ((prValue+iPressureStep) <= iMaxPressure) |
|
4381 { |
|
4382 prValue += iPressureStep; |
|
4383 } |
|
4384 ptrNum = 0; |
|
4385 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4386 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
4387 break; |
|
4388 case 4: |
|
4389 INFO_PRINTF1(_L("Simulate pointer events with different proximity values")); |
|
4390 // Repeat the same test of case 3 for different proximity values |
|
4391 ptrPos.SetXY(0,0); |
|
4392 |
|
4393 proxValue = -iProximityStep; |
|
4394 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4395 { |
|
4396 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
4397 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
4398 ptrPos.iX += xInc; |
|
4399 ptrPos.iY += yInc; |
|
4400 } |
|
4401 |
|
4402 ptrPos.SetXY(0,0); |
|
4403 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4404 { |
|
4405 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4406 AddExpectedPointerDownUp(ptrPos, 0, ptrNum); |
|
4407 ptrPos.iX += xInc; |
|
4408 ptrPos.iY += yInc; |
|
4409 } |
|
4410 |
|
4411 ptrPos.SetXY(0,0); |
|
4412 if ((proxValue-iProximityStep) > iMaxProximity) |
|
4413 { |
|
4414 proxValue -= iProximityStep; |
|
4415 } |
|
4416 ptrNum = 0; |
|
4417 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
4418 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
4419 break; |
|
4420 case 5: |
|
4421 /** |
|
4422 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0007 |
|
4423 @SYMPREQ PREQ1226 |
|
4424 @SYMREQ REQ9677 |
|
4425 @SYMTestPriority High |
|
4426 @SYMTestCaseDesc To check Wserv sends move/drags of different pointers |
|
4427 @SYMTestStatus Implemented |
|
4428 |
|
4429 @SYMTestActions Simulate raw move and drag events from different pointers |
|
4430 @SYMTestExpectedResults The received events must match the simulated raw events |
|
4431 */ |
|
4432 INFO_PRINTF1(_L("Simulate pointer drag events")); |
|
4433 ptrPos.SetXY(0,0); |
|
4434 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); |
|
4435 |
|
4436 // Simulate EButton1Down and then one move and then EButton1Up event |
|
4437 // which will lead to corresponding drag, do it for all the pointers |
|
4438 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4439 { |
|
4440 TestDragForMultiPointer(ptrPos, 0, ptrNum); |
|
4441 ptrPos.iX += xInc/2; |
|
4442 ptrPos.iY += yInc/2; |
|
4443 } |
|
4444 |
|
4445 // Check the drag with different pressure value with different pointer |
|
4446 prValue = iPressureStep; |
|
4447 ptrPos.iX = xInc; |
|
4448 ptrPos.iY = yInc; |
|
4449 if ((prValue+iPressureStep) <= iMaxPressure) |
|
4450 { |
|
4451 prValue += iPressureStep; |
|
4452 } |
|
4453 ptrNum = 0; |
|
4454 TestDragForMultiPointer(ptrPos, prValue, ptrNum); |
|
4455 break; |
|
4456 case 6: |
|
4457 { |
|
4458 /** |
|
4459 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0009 |
|
4460 @SYMPREQ PREQ1226 |
|
4461 @SYMREQ REQ9677, REQ9674 |
|
4462 @SYMTestPriority High |
|
4463 @SYMTestCaseDesc To check Wserv sends simultaneous move/drags of different pointers |
|
4464 @SYMTestStatus Implemented |
|
4465 |
|
4466 @SYMTestActions Simulate simulatneous raw move and drag events from different pointers |
|
4467 @SYMTestExpectedResults The received events must match the simulated raw events |
|
4468 */ |
|
4469 INFO_PRINTF1(_L("Simulate pointer drag events in different pattern")); |
|
4470 // Dragging done in this pattern |
|
4471 // pointer0Down/pointer1Down/pointer2Down/pointer3Down... pointer0Up/pointer1Up/pointer2Up/pointer3Up.... |
|
4472 |
|
4473 ptrPos.SetXY(0,0); |
|
4474 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4475 { |
|
4476 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4477 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
4478 ptrPos.iX += xInc/2; |
|
4479 ptrPos.iY += yInc/2; |
|
4480 } |
|
4481 |
|
4482 ptrPos.SetXY(0,0); |
|
4483 TPoint interPt = ptrPos; |
|
4484 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4485 { |
|
4486 interPt.iX += 2; |
|
4487 interPt.iY += 1; |
|
4488 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
4489 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
4490 ptrPos.iX += xInc/2; |
|
4491 ptrPos.iY += yInc/2; |
|
4492 interPt = ptrPos; |
|
4493 } |
|
4494 |
|
4495 ptrPos.SetXY(0,0); |
|
4496 interPt = ptrPos; |
|
4497 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) |
|
4498 { |
|
4499 interPt.iX += 2; |
|
4500 interPt.iY += 1; |
|
4501 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
4502 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
4503 ptrPos.iX += xInc/2; |
|
4504 ptrPos.iY += yInc/2; |
|
4505 interPt = ptrPos; |
|
4506 } |
|
4507 break; |
|
4508 } |
|
4509 case 7: |
|
4510 { |
|
4511 // Mixing of drag and moves of different pointers |
|
4512 ptrPos.SetXY(0,0); |
|
4513 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4514 { |
|
4515 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4516 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
4517 ptrPos.iX += xInc/2; |
|
4518 ptrPos.iY += yInc/2; |
|
4519 } |
|
4520 ptrPos.SetXY(0,0); |
|
4521 TPoint interPt = ptrPos; |
|
4522 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4523 { |
|
4524 interPt.iX += 2; |
|
4525 interPt.iY += 1; |
|
4526 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); |
|
4527 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); |
|
4528 ptrPos.iX += xInc/2; |
|
4529 ptrPos.iY += yInc/2; |
|
4530 interPt = ptrPos; |
|
4531 } |
|
4532 |
|
4533 ptrPos.SetXY(0,0); |
|
4534 interPt = ptrPos; |
|
4535 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4536 { |
|
4537 interPt.iX += 2; |
|
4538 interPt.iY += 1; |
|
4539 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); |
|
4540 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); |
|
4541 ptrPos.iX += xInc/2; |
|
4542 ptrPos.iY += yInc/2; |
|
4543 interPt = ptrPos; |
|
4544 } |
|
4545 |
|
4546 ptrPos.SetXY(0,0); |
|
4547 prValue = iPressureStep; |
|
4548 for (ptrNum = 0; ptrNum < iMaxDevPointers/2 && prValue < iMaxPressure; ptrNum++, prValue+=iPressureStep) |
|
4549 { |
|
4550 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4551 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); |
|
4552 ptrPos.iX += xInc; |
|
4553 ptrPos.iY += yInc; |
|
4554 } |
|
4555 } |
|
4556 break; |
|
4557 case 8: |
|
4558 { |
|
4559 INFO_PRINTF1(_L("Check intermediate Moves and Drags are deleted except last event")); |
|
4560 // Check if intermediate move and drag events are deleted |
|
4561 // The deletion is done with respect to same pointer and same window |
|
4562 xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize; |
|
4563 yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize; |
|
4564 ptrPos.iX = xInc; |
|
4565 ptrPos.iY = yInc; |
|
4566 TInt count = 0; |
|
4567 |
|
4568 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4569 { |
|
4570 // Make sure that ptrPos does not go out of screen area, i,e the loop count should not exceed 4 |
|
4571 for (count = proxValue = 0; proxValue > iMaxProximity && count < 4; proxValue=proxValue-(4*iProximityStep), count++) |
|
4572 { |
|
4573 ptrPos.iX += xInc/2; |
|
4574 ptrPos.iY += yInc/2; |
|
4575 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); |
|
4576 } |
|
4577 // Since the for loop increments the variables at the end |
|
4578 proxValue = proxValue + (4*iProximityStep); |
|
4579 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); |
|
4580 } |
|
4581 |
|
4582 ptrPos.iX = xInc; |
|
4583 ptrPos.iY = yInc; |
|
4584 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4585 { |
|
4586 ptrPos.iX += xInc/2; |
|
4587 ptrPos.iY += yInc/2; |
|
4588 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4589 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); |
|
4590 } |
|
4591 |
|
4592 ptrPos.iX = xInc; |
|
4593 ptrPos.iY = yInc; |
|
4594 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4595 { |
|
4596 // Make sure that ptrPos does not go out of screen area, i,e the loop count shuld not exceed 4 |
|
4597 for (count = prValue = 0; prValue < iMaxPressure && count < 4; prValue=prValue+(4*iPressureStep), count++) |
|
4598 { |
|
4599 ptrPos.iX += xInc/2; |
|
4600 ptrPos.iY += yInc/2; |
|
4601 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); |
|
4602 } |
|
4603 prValue = prValue-(4*iPressureStep); |
|
4604 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, prValue, 0, ptrNum); |
|
4605 } |
|
4606 |
|
4607 ptrPos.iX = xInc; |
|
4608 ptrPos.iY = yInc; |
|
4609 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) |
|
4610 { |
|
4611 ptrPos.iX += xInc/2; |
|
4612 ptrPos.iY += yInc/2; |
|
4613 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); |
|
4614 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); |
|
4615 } |
|
4616 } |
|
4617 break; |
|
4618 default: |
|
4619 ResetFlushStopAS(); |
|
4620 break; |
|
4621 } |
|
4622 |
|
4623 LogEventsAdded(); |
|
4624 } |
|
4625 |
|
4626 // Logs number of events added to test buffer for comaparison |
|
4627 void CTMultiPtrEventTest::LogEventsAdded() |
|
4628 { |
|
4629 TLogMessageText logText1; |
|
4630 _LIT(KEventsAdded, "Events added to buffer = %d"); |
|
4631 logText1.AppendFormat(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); |
|
4632 LOG_MESSAGE(logText1); |
|
4633 } |
|
4634 |
|
4635 // If any of the Tests fails, bring the wserv in a consistent state for other test to run, |
|
4636 // stop ActiveScheduler and display some logs where the fail occured. |
|
4637 void CTMultiPtrEventTest::Failed() |
|
4638 { |
|
4639 switch (iTest->iState) |
|
4640 { |
|
4641 case 2: // Anim tests |
|
4642 DestroyAnimDllAndAnim(); |
|
4643 break; |
|
4644 case 3: // MultiClient tests |
|
4645 if (iMultiPtrEventClient->EventBuffer()->NestedLoopState()) |
|
4646 { |
|
4647 iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(EFalse); |
|
4648 CActiveScheduler::Stop(); |
|
4649 } |
|
4650 break; |
|
4651 case 4: //PtrClick tests |
|
4652 if (iPtrPluginLoaded) |
|
4653 { |
|
4654 iPtrPluginLoaded = EFalse; |
|
4655 iClick.Unload(); |
|
4656 iClick.Close(); |
|
4657 } |
|
4658 if (iHeap) |
|
4659 { |
|
4660 iHeap->Close(); |
|
4661 iHeap = NULL; |
|
4662 iChunk.Close(); |
|
4663 } |
|
4664 break; |
|
4665 case 5: //Screen mode tests |
|
4666 SetDefaultScreenMode(); |
|
4667 break; |
|
4668 case 11: |
|
4669 iMultiPtrEventClient->DeleteGroupBlankWin(); |
|
4670 break; |
|
4671 case 12: //Emulation tests, iEventSet is incremented in main switch case. |
|
4672 switch (iEventSet) |
|
4673 { |
|
4674 case 9: |
|
4675 DeleteGroupWin(); |
|
4676 break; |
|
4677 case 10: |
|
4678 DestroyAnimDllAndAnim(); |
|
4679 break; |
|
4680 case 11: |
|
4681 case 12: |
|
4682 iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer(); |
|
4683 iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer(); |
|
4684 break; |
|
4685 case 14: |
|
4686 case 15: |
|
4687 iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea); |
|
4688 break; |
|
4689 default: |
|
4690 break; |
|
4691 } |
|
4692 break; |
|
4693 case 15: |
|
4694 if (iEventSet > 1) |
|
4695 { |
|
4696 DeleteGroupWinForCapturing(); |
|
4697 } |
|
4698 break; |
|
4699 case 13: |
|
4700 case 16: |
|
4701 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); |
|
4702 break; |
|
4703 default: |
|
4704 break; |
|
4705 } |
|
4706 |
|
4707 if (iActiveSchedulerStarted) |
|
4708 { |
|
4709 iActiveSchedulerStarted = EFalse; |
|
4710 CActiveScheduler::Stop(); |
|
4711 } |
|
4712 |
|
4713 // Display the test case number, subtest case number and number of events left in the buffer which can be used to |
|
4714 // find out which event actually caused the failure when any test fails |
|
4715 TLogMessageText logText1; |
|
4716 _LIT(KEventsAdded, "Test case number %d Sub test case number %d Events remaining in the buffer %d \n"); |
|
4717 logText1.AppendFormat(KEventsAdded, iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); |
|
4718 LOG_MESSAGE(logText1); |
|
4719 RDebug::Printf("Test case number %d Sub test case number %d Events remaining in the buffer %d \n", iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); |
|
4720 |
|
4721 iFailed=ETrue; |
|
4722 } |
|
4723 |
|
4724 // This function is called by TestExecute Framework, through which all the testcases are run |
|
4725 void CTMultiPtrEventTest::RunTestCaseL(TInt /*aCurTestCase*/) |
|
4726 { |
|
4727 _LIT(KTest0, "MultiPointerEvents with Pressure and Proximity"); |
|
4728 _LIT(KTest1, "Purging Of MultiPointerEvents"); |
|
4729 _LIT(KTest2, "MultiPointerEvents for Anims"); |
|
4730 _LIT(KTest3, "MultiPointerEvents from multi client"); |
|
4731 _LIT(KTest4, "MultiPointerEvents for pointer click plugin"); |
|
4732 _LIT(KTest5, "MultiPointerEvents In Different ScreenModes"); |
|
4733 _LIT(KTest6, "Filtering Of MultiPointerEvents"); |
|
4734 _LIT(KTest7, "Grabbing Of MultiPointerEvents"); |
|
4735 _LIT(KTest8, "VirtualKeyboard for Multiple Pointers"); |
|
4736 _LIT(KTest9, "DoubleClick events for Multiple Pointer"); |
|
4737 _LIT(KTest10, "OutOfRange & EnterExit for Multiple Pointer"); |
|
4738 _LIT(KTest11, "Auto foreground for Multiple Pointer"); |
|
4739 _LIT(KTest12, "Emulation rules for Mulitple Pointers"); |
|
4740 _LIT(KTest13, "Close proximity and High Pressure events"); |
|
4741 _LIT(KTest14, "Out of bound value testing"); |
|
4742 _LIT(KTest15, "Capturing Of MultiPointerEvents"); |
|
4743 _LIT(KTest16, "Negative testing for Proximity and Pressure events"); |
|
4744 _LIT(KTest17, "PointerRepeatEvent for Multiple Pointers"); |
|
4745 |
|
4746 if (!TestBase()->ConfigurationSupportsPointerEventTesting()) |
|
4747 { |
|
4748 INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); |
|
4749 TestComplete(); |
|
4750 return; |
|
4751 } |
|
4752 |
|
4753 switch(iTest->iState) |
|
4754 { |
|
4755 case 0: |
|
4756 iTest->LogSubTest(KTest0); |
|
4757 RunTestsL(); |
|
4758 break; |
|
4759 case 1: |
|
4760 iTest->LogSubTest(KTest1); |
|
4761 RunTestsL(); |
|
4762 break; |
|
4763 case 2: |
|
4764 iTest->LogSubTest(KTest2); |
|
4765 RunTestsL(); |
|
4766 break; |
|
4767 case 3: |
|
4768 iTest->LogSubTest(KTest3); |
|
4769 RunTestsL(); |
|
4770 break; |
|
4771 case 4: |
|
4772 iTest->LogSubTest(KTest4); |
|
4773 RunTestsL(); |
|
4774 break; |
|
4775 case 5: |
|
4776 iTest->LogSubTest(KTest5); |
|
4777 RunTestsL(); |
|
4778 break; |
|
4779 case 6: |
|
4780 iTest->LogSubTest(KTest6); |
|
4781 RunTestsL(); |
|
4782 break; |
|
4783 case 7: |
|
4784 iTest->LogSubTest(KTest7); |
|
4785 RunTestsL(); |
|
4786 break; |
|
4787 case 8: |
|
4788 iTest->LogSubTest(KTest8); |
|
4789 RunTestsL(); |
|
4790 break; |
|
4791 case 9: |
|
4792 iTest->LogSubTest(KTest9); |
|
4793 RunTestsL(); |
|
4794 break; |
|
4795 case 10: |
|
4796 iTest->LogSubTest(KTest10); |
|
4797 RunTestsL(); |
|
4798 break; |
|
4799 case 11: |
|
4800 iTest->LogSubTest(KTest11); |
|
4801 RunTestsL(); |
|
4802 break; |
|
4803 case 12: |
|
4804 iTest->LogSubTest(KTest12); |
|
4805 RunTestsL(); |
|
4806 break; |
|
4807 case 13: |
|
4808 iTest->LogSubTest(KTest13); |
|
4809 RunTestsL(); |
|
4810 break; |
|
4811 case 14: |
|
4812 iTest->LogSubTest(KTest14); |
|
4813 RunTestsL(); |
|
4814 break; |
|
4815 case 15: |
|
4816 iTest->LogSubTest(KTest15); |
|
4817 RunTestsL(); |
|
4818 break; |
|
4819 case 16: |
|
4820 iTest->LogSubTest(KTest16); |
|
4821 RunTestsL(); |
|
4822 break; |
|
4823 case 17: |
|
4824 iTest->LogSubTest(KTest17); |
|
4825 RunTestsL(); |
|
4826 break; |
|
4827 case 18: |
|
4828 // Keep this code in last case statement for main test completion |
|
4829 TestComplete(); |
|
4830 break; |
|
4831 default: |
|
4832 AutoPanic(EAutoPanicWrongTest); |
|
4833 } |
|
4834 |
|
4835 // |
|
4836 if (iFailed) |
|
4837 { |
|
4838 TEST(EFalse); |
|
4839 iFailed=EFalse; |
|
4840 } |
|
4841 ++iTest->iState; |
|
4842 } |
|
4843 |
|
4844 // Macro which is used for construction of CTMultiPtrEventTestStep object |
|
4845 // and also used to call CreateTestL() which creates CTMultiPtrEventTest and CTestBase objects |
|
4846 __WS_CONSTRUCT_STEP__(MultiPtrEventTest) |