|
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 // |
|
15 |
|
16 #include "TConeMultiPtrStep.h" |
|
17 #include "tconemultiptrtestappui.h" |
|
18 #include "tconemultiptrconst.h" |
|
19 #include <hal.h> |
|
20 |
|
21 // Global function for panic |
|
22 void ConeTestPanic(TConeTestPanic aPanic) |
|
23 { |
|
24 User::Panic(_L("MultiPointerConeTest Panic"),aPanic); |
|
25 } |
|
26 |
|
27 |
|
28 |
|
29 /** |
|
30 CTestStep derived class which implements RunTestStepL. It creates CoEnv & AppUi objects. |
|
31 Logic involved, RunTestStepL will call RunTestsL() which will create new control/s for each |
|
32 test case and calls NextSetOfEventsL() which does testing of all different use cases |
|
33 i,e by simulating the events and adding the events to a buffer. |
|
34 Then RunTestStepL() starts the active scheduler, which will result in a call to |
|
35 control's HandlePointerEventL, which will test expected event in buffer with actual event. |
|
36 */ |
|
37 CConeMultiPtrTestAppUi::CConeMultiPtrTestAppUi(CTmsTestStep* aStep) |
|
38 : CTestCoeAppUi(aStep) |
|
39 { |
|
40 } |
|
41 |
|
42 |
|
43 void CConeMultiPtrTestAppUi::ConstructL() |
|
44 { |
|
45 RDebug::Print( _L(">CConeMultiPtrTestAppUi::ConstructL") ); |
|
46 |
|
47 CTestCoeAppUi::ConstructL(); |
|
48 iNormalPointerCursorArea = iCoeEnv->WsSession().PointerCursorArea(); |
|
49 User::LeaveIfError( HAL::Get(HALData::EPointerMaxPointers, iMaxPointers) ); |
|
50 User::LeaveIfError( HAL::Get(HALData::EPointerNumberOfPointers, iNumberOfPointers) ); |
|
51 User::LeaveIfError( HAL::Get(HALData::EPointer3DMaxPressure, iMaxPressure) ); |
|
52 User::LeaveIfError( HAL::Get(HALData::EPointer3DPressureStep, iPressureStep) ); |
|
53 User::LeaveIfError( HAL::Get(HALData::EPointer3DMaxProximity, iMaxProximity) ); |
|
54 User::LeaveIfError( HAL::Get(HALData::EPointer3DProximityStep, iProximityStep) ); |
|
55 |
|
56 RDebug::Print( _L("CConeMultiPtrTestAppUi::ConstructL 1") ); |
|
57 |
|
58 iPressureNominal = iPressureStep * (iMaxPressure / (iPressureStep * 2) ); // Somewhere in the middle |
|
59 iProximityNominal = iProximityStep * (iMaxProximity / (iProximityStep * 2) ); // Somewhere in the middle |
|
60 |
|
61 // Certain tests (MultiPointerGrab) can induce anomalous double-click key-modifiers. |
|
62 // Therefore, disable by setting the double-click max interval to zero. |
|
63 // This is restored in doTestStepPostambleL(). |
|
64 RWsSession wsSession; |
|
65 TTimeIntervalMicroSeconds32 interval; |
|
66 TInt distance; |
|
67 |
|
68 User::LeaveIfError( wsSession.Connect() ); |
|
69 wsSession.GetDoubleClickSettings( interval, distance); |
|
70 wsSession.SetDoubleClick( 0, distance); |
|
71 wsSession.Close(); |
|
72 |
|
73 |
|
74 AutoTestManager().StartAutoTest(); |
|
75 |
|
76 RDebug::Print( _L("CConeMultiPtrTestAppUi::ConstructL>") ); |
|
77 } |
|
78 |
|
79 |
|
80 CConeMultiPtrTestAppUi::~CConeMultiPtrTestAppUi() |
|
81 { |
|
82 delete iControl; |
|
83 } |
|
84 |
|
85 |
|
86 // Function called for each new test case from CTestManager active object. |
|
87 void CConeMultiPtrTestAppUi::RunTestStepL(TInt /*aStepNum*/) |
|
88 { |
|
89 if (!ConfigurationSupportsPointerEventTesting()) |
|
90 { |
|
91 INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); |
|
92 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
93 return; |
|
94 } |
|
95 |
|
96 switch(iTestCase) |
|
97 { |
|
98 case 0: |
|
99 case 1: |
|
100 case 2: |
|
101 case 3: |
|
102 case 4: |
|
103 case 5: |
|
104 case 6: |
|
105 RunTestsL(); |
|
106 break; |
|
107 |
|
108 default: |
|
109 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
110 break; |
|
111 } |
|
112 |
|
113 if (iFailed) |
|
114 { |
|
115 TEST(EFalse); |
|
116 iFailed=EFalse; |
|
117 } |
|
118 ++iTestCase; |
|
119 } |
|
120 |
|
121 |
|
122 /** |
|
123 Function called for each new test case from RunTestStepL. |
|
124 This creates control/s calls NextSetOfEventsL and starts activescheduler |
|
125 */ |
|
126 void CConeMultiPtrTestAppUi::RunTestsL() |
|
127 { |
|
128 iEventSet = 0; |
|
129 iCoeEnv->WsSession().SetAutoFlush(ETrue); |
|
130 |
|
131 iControl = CMultiPtrTestControl::NewL( KMultiPtrTestControlParentPosition, TSize(300,200) ); |
|
132 AddToStackL(iControl); |
|
133 |
|
134 iEventCount = 0; |
|
135 TRAPD(err, NextSetOfEventsL()); |
|
136 if (err != KErrNone) |
|
137 { |
|
138 INFO_PRINTF1( _L("ERROR INFO LOGGED IN epocwind.out") ); |
|
139 |
|
140 iFailed = ETrue; |
|
141 return; |
|
142 } |
|
143 |
|
144 // Start nested activescheduler |
|
145 CActiveScheduler::Start(); |
|
146 |
|
147 TInt eventsLeft = iControl->EventsLeft(); |
|
148 if (eventsLeft > 0) |
|
149 { |
|
150 INFO_PRINTF1( _L("ERROR INFO LOGGED IN epocwind.out") ); |
|
151 |
|
152 iFailed=ETrue; |
|
153 } |
|
154 |
|
155 RemoveFromStack(iControl); |
|
156 delete iControl; |
|
157 iControl = NULL; |
|
158 } |
|
159 |
|
160 /** |
|
161 * Determine if the configuration supports pointer event testing. |
|
162 * |
|
163 * There are certain circumstances where we want to skip pointer event |
|
164 * testing because we are simulating pointer events, and don't want to |
|
165 * simulate a pointer event from an impossible co-ordinate. We'd rather |
|
166 * just identify that there is no point in doing the test and skip over |
|
167 * to the next test case. |
|
168 * |
|
169 * In particular, when a ROM configured with a digitiser is deployed on a |
|
170 * Naviengine, with hardware configuration DIP switches which say that there |
|
171 * is an external screen connected, then no touch pad is active. |
|
172 * The base port under these conditions returns a digitiser area (0,0,0,0) |
|
173 * |
|
174 * @return ETrue if the configuration supports pointer event testing, otherwise |
|
175 * return EFalse. |
|
176 */ |
|
177 TBool CConeMultiPtrTestAppUi::ConfigurationSupportsPointerEventTesting() const |
|
178 { |
|
179 if (iNormalPointerCursorArea.IsEmpty()) |
|
180 { |
|
181 return EFalse; |
|
182 } |
|
183 return ETrue; |
|
184 } |
|
185 |
|
186 |
|
187 /** |
|
188 Simulates pointer event, by making use of UserSvr::AddEvent. Also takes a Z parameter. |
|
189 */ |
|
190 void CConeMultiPtrTestAppUi::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) |
|
191 { |
|
192 __ASSERT_DEBUG(ConfigurationSupportsPointerEventTesting(), ConeTestPanic(EConePanicNoDigitiser)); |
|
193 |
|
194 TRawEvent rawEvent; |
|
195 |
|
196 rawEvent.Set(aType, aX, aY, aZ, aPointerNumber); |
|
197 UserSvr::AddEvent(rawEvent); |
|
198 } |
|
199 |
|
200 void CConeMultiPtrTestAppUi::SimulatePointerDownUp(TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) |
|
201 { |
|
202 SimulatePointer(TRawEvent::EButton1Down, aX, aY, aZ, aPointerNumber); |
|
203 SimulatePointer(TRawEvent::EButton1Up, aX, aY, aZ, aPointerNumber); |
|
204 } |
|
205 |
|
206 |
|
207 void CConeMultiPtrTestAppUi::AddExpectedPointer( TAdvancedPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint8 aPointerNumber, TInt /*Handle*/ ) |
|
208 { |
|
209 TWsEvent event; |
|
210 TPoint3D point3D; |
|
211 |
|
212 point3D.iX = aPos.iX; |
|
213 point3D.iY = aPos.iY; |
|
214 point3D.iZ = aZ; |
|
215 |
|
216 // Note: this setter does not initialise the parent-position parameter. |
|
217 // Note: The modifier value is or'd in, as it is a bit-field. The TAdvancedPointerEvent Init()function |
|
218 // should initialise it to EModifierAdvancedPointerEvent. |
|
219 event.InitAdvancedPointerEvent( aType, 0, point3D, aPointerNumber ); |
|
220 event.Pointer()->iParentPosition.SetXY( KMultiPtrTestControlParentPosition.iX, KMultiPtrTestControlParentPosition.iY ); |
|
221 |
|
222 iControl->AddExpectedEvent( *event.Pointer() ); |
|
223 } |
|
224 |
|
225 |
|
226 void CConeMultiPtrTestAppUi::AddExpectedPointerDownUp(TPoint aPos, TInt aZ, TUint8 aPointerNumber) |
|
227 { |
|
228 // Pointer position is with respect to the window's Top Left position |
|
229 // Here we may want to write a function which will set sent position with respect to control/window |
|
230 // on which we are simulating the events. |
|
231 aPos -= iControl->Position(); |
|
232 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, aPos, aZ, aPointerNumber ); |
|
233 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, aPos, aZ, aPointerNumber ); |
|
234 } |
|
235 |
|
236 |
|
237 /** |
|
238 once all the events for a given sub test are tested. So that next subtest case can proceed with it. |
|
239 */ |
|
240 void CConeMultiPtrTestAppUi::NextSetOfEventsL() |
|
241 { |
|
242 |
|
243 switch(iTestCase) |
|
244 { |
|
245 |
|
246 case 0: |
|
247 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0002")); |
|
248 MultiPointerEventsL(); |
|
249 RecordTestResultL(); |
|
250 break; |
|
251 |
|
252 case 1: |
|
253 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0006")); |
|
254 PressureAndProximityL(); |
|
255 RecordTestResultL(); |
|
256 break; |
|
257 |
|
258 case 2: |
|
259 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0008")); |
|
260 MoveAndDragL(); |
|
261 RecordTestResultL(); |
|
262 break; |
|
263 |
|
264 case 3: |
|
265 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0016")); |
|
266 MoveAndOutOfRangeL(); |
|
267 RecordTestResultL(); |
|
268 break; |
|
269 |
|
270 case 4: |
|
271 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0018")); |
|
272 PointerNumberOutOfRangeL(); |
|
273 RecordTestResultL(); |
|
274 break; |
|
275 |
|
276 case 5: |
|
277 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0020")); |
|
278 MultiPointerCaptureL(); |
|
279 RecordTestResultL(); |
|
280 break; |
|
281 |
|
282 case 6: |
|
283 SetTestStepID(_L("UIF-WSERV-ADVANCEDPOINTER-0022")); |
|
284 MultiPointerGrabL(); |
|
285 RecordTestResultL(); |
|
286 CloseTMSGraphicsStep(); |
|
287 break; |
|
288 |
|
289 default: |
|
290 ConeTestPanic(EConeTestPanicWrongTest); |
|
291 break; |
|
292 } |
|
293 |
|
294 } |
|
295 |
|
296 |
|
297 /** |
|
298 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0002 |
|
299 @SYMPREQ PREQ1226 |
|
300 @SYMTestType UT |
|
301 @SYMTestPriority Critical |
|
302 @SYMTestStatus Implemented |
|
303 @SYMTestCaseDesc Multi-touch pointer events in Cone. |
|
304 @SYMTestActions |
|
305 @SYMTestExpectedResults The received events should match the simulated raw events. |
|
306 */ |
|
307 void CConeMultiPtrTestAppUi::MultiPointerEventsL() |
|
308 { |
|
309 INFO_PRINTF1( _L(">MultiPointerEventsL") ); |
|
310 RDebug::Print( _L(">MultiPointerEventsL") ); |
|
311 |
|
312 if( iNumberOfPointers <= 1 ) |
|
313 { |
|
314 User::Leave( KErrNotSupported ); |
|
315 } |
|
316 |
|
317 switch( iEventSet++ ) |
|
318 { |
|
319 case 0: |
|
320 { |
|
321 INFO_PRINTF1( _L("MultiPointerEventsL case 0") ); |
|
322 |
|
323 TPoint ptrPos( 60, 60 ); |
|
324 TInt z = iPressureNominal; |
|
325 TInt i = 0; |
|
326 |
|
327 for(; i < iNumberOfPointers; i++ ) |
|
328 { |
|
329 ptrPos.iX += KMultiPtrTestCoOrdinateIncrement; |
|
330 ptrPos.iY += KMultiPtrTestCoOrdinateIncrement; |
|
331 |
|
332 SimulatePointerDownUp( ptrPos.iX, ptrPos.iY, z, i ); |
|
333 AddExpectedPointerDownUp( ptrPos, z, i ); |
|
334 } |
|
335 |
|
336 } |
|
337 break; |
|
338 |
|
339 default: |
|
340 { |
|
341 CActiveScheduler::Stop(); |
|
342 iEventSet = 0; |
|
343 INFO_PRINTF1( _L("MultiPointerEventsL STOP\n") ); |
|
344 RDebug::Print( _L("MultiPointerEventsL STOP") ); |
|
345 RDebug::Print( _L("") ); |
|
346 } |
|
347 break; |
|
348 } |
|
349 |
|
350 } |
|
351 |
|
352 |
|
353 /** |
|
354 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0006 |
|
355 @SYMPREQ PREQ1226 |
|
356 @SYMTestType UT |
|
357 @SYMTestPriority Critical |
|
358 @SYMTestStatus Implemented |
|
359 @SYMTestCaseDesc To check events received by the control (from different pointers) |
|
360 have pressure and proximity and move events in them. |
|
361 @SYMTestActions |
|
362 @SYMTestExpectedResults Simulated events are correctly conveyed. |
|
363 */ |
|
364 void CConeMultiPtrTestAppUi::PressureAndProximityL() |
|
365 { |
|
366 INFO_PRINTF1( _L(">PressureAndProximityL") ); |
|
367 RDebug::Print( _L(">PressureAndProximityL") ); |
|
368 |
|
369 if( iNumberOfPointers <= 1 ) |
|
370 { |
|
371 User::Leave( KErrNotSupported ); |
|
372 } |
|
373 |
|
374 const TInt KPressureProximityInitialX = 60; |
|
375 const TInt KPressureProximityInitialY = 60; |
|
376 TPoint ptrPos( KPressureProximityInitialX, KPressureProximityInitialY ); |
|
377 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
378 |
|
379 iControl->SetDrags(); |
|
380 |
|
381 switch( iEventSet++ ) |
|
382 { |
|
383 case 0: |
|
384 { |
|
385 INFO_PRINTF1( _L("PressureAndProximityL case 0") ); |
|
386 RDebug::Print( _L("PressureAndProximityL case 0") ); |
|
387 // Two pointers. Some pressure. Position is wrt the screen |
|
388 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, iPressureNominal, KMultiPtrTestPointerNumberLowest ); |
|
389 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, (iPressureNominal + iPressureStep), KMultiPtrTestPointerNumberLowest + 1 ); |
|
390 // Reported position is wrt the control. |
|
391 ptrPos -= iControl->Position(); |
|
392 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptrPos, iPressureNominal, KMultiPtrTestPointerNumberLowest ); |
|
393 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptrPos, (iPressureNominal + iPressureStep), KMultiPtrTestPointerNumberLowest + 1 ); |
|
394 } |
|
395 break; |
|
396 |
|
397 case 1: |
|
398 { |
|
399 INFO_PRINTF1( _L("PressureAndProximityL case 1") ); |
|
400 RDebug::Print( _L("PressureAndProximityL case 1") ); |
|
401 // Two pointers. Max pressure. Position is wrt the screen |
|
402 ptrPos += incPoint; |
|
403 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, iMaxPressure, KMultiPtrTestPointerNumberLowest ); |
|
404 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, iMaxPressure, KMultiPtrTestPointerNumberLowest + 1 ); |
|
405 // Reported position is wrt the control. |
|
406 ptrPos -= iControl->Position(); |
|
407 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptrPos, iMaxPressure, KMultiPtrTestPointerNumberLowest ); |
|
408 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptrPos, iMaxPressure, KMultiPtrTestPointerNumberLowest + 1 ); |
|
409 } |
|
410 break; |
|
411 |
|
412 case 2: |
|
413 { |
|
414 INFO_PRINTF1( _L("PressureAndProximityL case 2") ); |
|
415 RDebug::Print( _L("PressureAndProximityL case 2") ); |
|
416 // Two pointers. Some proximity plus pointer-move events. |
|
417 //Differentiate ptr no's so WServe does not translate to EDrag because of the above button-down events. |
|
418 ptrPos += incPoint; |
|
419 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest + 2 ); |
|
420 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest + 3 ); |
|
421 |
|
422 ptrPos -= iControl->Position(); |
|
423 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptrPos, iProximityNominal, KMultiPtrTestPointerNumberLowest + 2 ); |
|
424 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptrPos, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest + 3 ); |
|
425 } |
|
426 break; |
|
427 |
|
428 case 3: |
|
429 { |
|
430 INFO_PRINTF1( _L("PressureAndProximityL case 3") ); |
|
431 RDebug::Print( _L("PressureAndProximityL case 3") ); |
|
432 // Two pointers. Max proximity plus pointer-move events. |
|
433 ptrPos += incPoint; |
|
434 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, iMaxProximity, KMultiPtrTestPointerNumberLowest + 2 ); |
|
435 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, iMaxProximity, KMultiPtrTestPointerNumberLowest + 3 ); |
|
436 |
|
437 ptrPos -= iControl->Position(); |
|
438 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptrPos, iMaxProximity, KMultiPtrTestPointerNumberLowest + 2 ); |
|
439 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptrPos, iMaxProximity, KMultiPtrTestPointerNumberLowest + 3 ); |
|
440 } |
|
441 break; |
|
442 |
|
443 default: |
|
444 { |
|
445 INFO_PRINTF1( _L("PressureAndProximityL STOP\n") ); |
|
446 RDebug::Print( _L("PressureAndProximityL STOP") ); |
|
447 RDebug::Print( _L("") ); |
|
448 |
|
449 CActiveScheduler::Stop(); |
|
450 iEventSet = 0; |
|
451 } |
|
452 break; |
|
453 } |
|
454 |
|
455 } |
|
456 |
|
457 |
|
458 /** |
|
459 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0008 |
|
460 @SYMPREQ PREQ1226 |
|
461 @SYMTestType UT |
|
462 @SYMTestPriority Critical |
|
463 @SYMTestStatus Implemented |
|
464 @SYMTestCaseDesc To check the Control receives move and drags from different pointers |
|
465 and that moves are delivered as moves, or translated to drags |
|
466 dependent upon whether the pointer is up or down. |
|
467 @SYMTestActions |
|
468 @SYMTestExpectedResults The received events must match the simulated raw events. Moves being |
|
469 translated to drags in the button-down state. |
|
470 */ |
|
471 void CConeMultiPtrTestAppUi::MoveAndDragL() |
|
472 { |
|
473 INFO_PRINTF1( _L(">MoveAndDragL") ); |
|
474 RDebug::Print( _L(">MoveAndDragL") ); |
|
475 |
|
476 if( iNumberOfPointers <= 1 ) |
|
477 { |
|
478 User::Leave( KErrNotSupported ); |
|
479 } |
|
480 |
|
481 const TInt KMoveAndDragInitialX = 100; |
|
482 const TInt KMoveAndDragInitialY = 100; |
|
483 TPoint ptrPos( KMoveAndDragInitialX, KMoveAndDragInitialY ); |
|
484 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
485 TPoint exPos( ptrPos - iControl->Position() ); // The initial expected position adjusted for the control's offset |
|
486 |
|
487 iControl->SetDrags(); |
|
488 |
|
489 switch( iEventSet++ ) |
|
490 { |
|
491 case 0: |
|
492 { |
|
493 INFO_PRINTF1( _L("MoveAndDragL case 0") ); |
|
494 RDebug::Print( _L("MoveAndDragL case 0") ); |
|
495 |
|
496 // Anomalous: Send button-up so that EPointerMove -> EMove |
|
497 SimulatePointer( TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
498 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, exPos, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
499 |
|
500 ptrPos += incPoint; |
|
501 exPos +=incPoint; |
|
502 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
503 AddExpectedPointer( TAdvancedPointerEvent::EMove, exPos, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
504 // Send button-down so that EPointerMove -> EDrag |
|
505 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
506 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, exPos, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
507 |
|
508 ptrPos += incPoint; |
|
509 exPos +=incPoint; |
|
510 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + (2 * iProximityStep)), KMultiPtrTestPointerNumberLowest ); |
|
511 AddExpectedPointer( TAdvancedPointerEvent::EDrag, exPos, (iProximityNominal + (2 * iProximityStep)), KMultiPtrTestPointerNumberLowest ); |
|
512 // Anomalous: Send button-up so that EPointerMove -> EMove |
|
513 SimulatePointer( TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
514 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, exPos, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
515 |
|
516 ptrPos += incPoint; |
|
517 exPos +=incPoint; |
|
518 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
519 AddExpectedPointer( TAdvancedPointerEvent::EMove, exPos, (iProximityNominal + iProximityStep), KMultiPtrTestPointerNumberLowest ); |
|
520 } |
|
521 break; |
|
522 case 1: |
|
523 { |
|
524 INFO_PRINTF1( _L("MoveAndDragL case 1") ); |
|
525 RDebug::Print( _L("MoveAndDragL case 1") ); |
|
526 // Replicate case 0 for another pointer number. |
|
527 const TInt pointerNumber = KMultiPtrTestPointerNumberLowest + 1; |
|
528 |
|
529 // Anomalous: Send button-up so that EPointerMove -> EMove |
|
530 SimulatePointer( TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, iProximityNominal, pointerNumber ); |
|
531 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, exPos, iProximityNominal, pointerNumber ); |
|
532 |
|
533 ptrPos += incPoint; |
|
534 exPos +=incPoint; |
|
535 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), pointerNumber ); |
|
536 AddExpectedPointer( TAdvancedPointerEvent::EMove, exPos, (iProximityNominal + iProximityStep), pointerNumber ); |
|
537 // Send button-down so that EPointerMove -> EDrag |
|
538 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), pointerNumber ); |
|
539 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, exPos, (iProximityNominal + iProximityStep), pointerNumber ); |
|
540 |
|
541 ptrPos += incPoint; |
|
542 exPos +=incPoint; |
|
543 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + (2 * iProximityStep)), pointerNumber ); |
|
544 AddExpectedPointer( TAdvancedPointerEvent::EDrag, exPos, (iProximityNominal + (2 * iProximityStep)), pointerNumber ); |
|
545 // Anomalous: Send button-up so that EPointerMove -> EMove |
|
546 SimulatePointer( TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, iProximityNominal, pointerNumber ); |
|
547 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, exPos, iProximityNominal, pointerNumber ); |
|
548 |
|
549 ptrPos += incPoint; |
|
550 exPos +=incPoint; |
|
551 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, (iProximityNominal + iProximityStep), pointerNumber ); |
|
552 AddExpectedPointer( TAdvancedPointerEvent::EMove, exPos, (iProximityNominal + iProximityStep), pointerNumber ); |
|
553 } |
|
554 break; |
|
555 |
|
556 case 2: |
|
557 { |
|
558 INFO_PRINTF1( _L("MoveAndDragL case 2") ); |
|
559 RDebug::Print( _L("MoveAndDragL case 2") ); |
|
560 // Discriminate the pointers' attributes by position and prox/press. |
|
561 TPoint ptr0Pos( ptrPos ); |
|
562 TPoint ptr0ExpectedPos( ptrPos - iControl->Position() ); |
|
563 TPoint ptr1Pos( ptrPos += incPoint ); |
|
564 TPoint ptr1ExpectedPos( ptr1Pos - iControl->Position() ); |
|
565 TInt pointer0Proximity = iProximityNominal; |
|
566 TInt pointer1Proximity = iProximityNominal + iProximityStep; |
|
567 TInt pointer0Pressure = iPressureNominal; |
|
568 TInt pointer1Pressure = iPressureNominal + iPressureStep; |
|
569 |
|
570 const TInt pointerZero = KMultiPtrTestPointerNumberLowest; |
|
571 const TInt pointerOne = KMultiPtrTestPointerNumberLowest + 1; |
|
572 |
|
573 // Anomalous: Send button-up so that EPointerMove -> EMove |
|
574 SimulatePointer( TRawEvent::EButton1Up, ptr0Pos.iX, ptr0Pos.iY, pointer0Proximity, pointerZero ); |
|
575 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, ptr0ExpectedPos, pointer0Proximity, pointerZero ); |
|
576 |
|
577 SimulatePointer( TRawEvent::EButton1Up, ptr1Pos.iX, ptr1Pos.iY, pointer1Proximity, pointerOne ); |
|
578 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, ptr1ExpectedPos, pointer1Proximity, pointerOne ); |
|
579 |
|
580 |
|
581 ptr0Pos += incPoint; |
|
582 ptr1Pos +=incPoint; |
|
583 ptr0ExpectedPos +=incPoint; |
|
584 ptr1ExpectedPos +=incPoint; |
|
585 pointer0Proximity += iProximityStep; |
|
586 pointer1Proximity += iProximityStep; |
|
587 |
|
588 SimulatePointer( TRawEvent::EPointerMove, ptr0Pos.iX, ptr0Pos.iY, pointer0Proximity, pointerZero ); |
|
589 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptr0ExpectedPos, pointer0Proximity, pointerZero ); |
|
590 |
|
591 SimulatePointer( TRawEvent::EPointerMove, ptr1Pos.iX, ptr1Pos.iY, pointer1Proximity, pointerOne ); |
|
592 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptr1ExpectedPos, pointer1Proximity, pointerOne ); |
|
593 |
|
594 RDebug::Print( _L("Button down") ); |
|
595 // Send button-down so that EPointerMove -> EDrag |
|
596 SimulatePointer( TRawEvent::EButton1Down, ptr1Pos.iX, ptr1Pos.iY, pointer0Pressure, pointerZero ); |
|
597 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptr1ExpectedPos, pointer0Pressure, pointerZero ); |
|
598 |
|
599 SimulatePointer( TRawEvent::EButton1Down, ptr1Pos.iX, ptr1Pos.iY, pointer1Pressure, pointerOne ); |
|
600 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, ptr1ExpectedPos, pointer1Pressure, pointerOne ); |
|
601 |
|
602 |
|
603 ptr0Pos += incPoint; |
|
604 ptr1Pos +=incPoint; |
|
605 ptr0ExpectedPos +=incPoint; |
|
606 ptr1ExpectedPos +=incPoint; |
|
607 pointer0Pressure += iPressureStep; |
|
608 pointer1Pressure += iPressureStep; |
|
609 |
|
610 // Perform moves in anticipation of drags. |
|
611 SimulatePointer( TRawEvent::EPointerMove, ptr0Pos.iX, ptr0Pos.iY, pointer0Pressure, pointerZero ); |
|
612 AddExpectedPointer( TAdvancedPointerEvent::EDrag, ptr0ExpectedPos, pointer0Pressure, pointerZero ); |
|
613 |
|
614 SimulatePointer( TRawEvent::EPointerMove, ptr1Pos.iX, ptr1Pos.iY, pointer1Pressure, pointerOne ); |
|
615 AddExpectedPointer( TAdvancedPointerEvent::EDrag, ptr1ExpectedPos, pointer1Pressure, pointerOne ); |
|
616 |
|
617 |
|
618 ptr0Pos += incPoint; |
|
619 ptr1Pos +=incPoint; |
|
620 ptr0ExpectedPos +=incPoint; |
|
621 ptr1ExpectedPos +=incPoint; |
|
622 pointer0Proximity += iProximityStep; |
|
623 pointer1Proximity += iProximityStep; |
|
624 |
|
625 // Send button-up so that EPointerMove -> EMove |
|
626 SimulatePointer( TRawEvent::EButton1Up, ptr0Pos.iX, ptr0Pos.iY, pointer0Proximity, pointerZero ); |
|
627 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, ptr0ExpectedPos, pointer0Proximity, pointerZero ); |
|
628 |
|
629 SimulatePointer( TRawEvent::EButton1Up, ptr1Pos.iX, ptr1Pos.iY, pointer1Proximity, pointerOne ); |
|
630 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, ptr1ExpectedPos, pointer1Proximity, pointerOne ); |
|
631 |
|
632 |
|
633 ptr0Pos += incPoint; |
|
634 ptr1Pos +=incPoint; |
|
635 ptr0ExpectedPos +=incPoint; |
|
636 ptr1ExpectedPos +=incPoint; |
|
637 |
|
638 SimulatePointer( TRawEvent::EPointerMove, ptr0Pos.iX, ptr0Pos.iY, pointer0Proximity, pointerZero ); |
|
639 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptr0ExpectedPos, pointer0Proximity, pointerZero ); |
|
640 |
|
641 SimulatePointer( TRawEvent::EPointerMove, ptr1Pos.iX, ptr1Pos.iY, pointer1Proximity, pointerOne ); |
|
642 AddExpectedPointer( TAdvancedPointerEvent::EMove, ptr1ExpectedPos, pointer1Proximity, pointerOne ); |
|
643 } |
|
644 break; |
|
645 default: |
|
646 { |
|
647 INFO_PRINTF1( _L("MoveAndDragL STOP\n") ); |
|
648 RDebug::Print( _L("MoveAndDragL STOP") ); |
|
649 RDebug::Print( _L("") ); |
|
650 |
|
651 CActiveScheduler::Stop(); |
|
652 iEventSet = 0; |
|
653 } |
|
654 break; |
|
655 } |
|
656 |
|
657 } |
|
658 |
|
659 |
|
660 /** |
|
661 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0016 |
|
662 @SYMPREQ PREQ1226 |
|
663 @SYMTestType UT |
|
664 @SYMTestPriority Critical |
|
665 @SYMTestStatus Implemented |
|
666 @SYMTestCaseDesc Out of range and move events in Cone. |
|
667 @SYMTestActions Simulate TRawEvent::EMove from 2 pointers. |
|
668 Simulate TRawEvent::EPointer3DOutOfRange from 2 pointers. |
|
669 cf GRAPHICS-WSERV-ADVANCEDPOINTER-0042 |
|
670 @SYMTestExpectedResults The received events must match the events added to buffer. |
|
671 */ |
|
672 void CConeMultiPtrTestAppUi::MoveAndOutOfRangeL() |
|
673 { |
|
674 INFO_PRINTF1( _L(">MoveAndOutOfRangeL") ); |
|
675 RDebug::Print( _L(">MoveAndOutOfRangeL") ); |
|
676 |
|
677 if( iNumberOfPointers <= 1 ) |
|
678 { |
|
679 User::Leave( KErrNotSupported ); |
|
680 } |
|
681 |
|
682 iControl->SetDrags(); |
|
683 |
|
684 switch( iEventSet++ ) |
|
685 { |
|
686 case 0: |
|
687 { |
|
688 INFO_PRINTF1( _L("MoveAndOutOfRangeL case 0") ); |
|
689 RDebug::Print( _L("MoveAndOutOfRangeL STOP\n") ); |
|
690 const TInt KPressureProximityInitialX = 60; |
|
691 const TInt KPressureProximityInitialY = 60; |
|
692 TPoint ptrPos( KPressureProximityInitialX, KPressureProximityInitialY ); |
|
693 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
694 |
|
695 // Two pointers. Move events |
|
696 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
697 SimulatePointer( TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest + 1 ); |
|
698 ptrPos -= iControl->Position(); |
|
699 AddExpectedPointer( TAdvancedPointerEvent::EMove, TPoint(ptrPos.iX, ptrPos.iY), iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
700 AddExpectedPointer( TAdvancedPointerEvent::EMove, TPoint(ptrPos.iX, ptrPos.iY), iProximityNominal, KMultiPtrTestPointerNumberLowest + 1 ); |
|
701 |
|
702 // Reset the position. |
|
703 ptrPos.SetXY( KPressureProximityInitialX, KPressureProximityInitialY ); |
|
704 SimulatePointer( TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
705 SimulatePointer( TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, iProximityNominal, KMultiPtrTestPointerNumberLowest + 1 ); |
|
706 ptrPos -= iControl->Position(); |
|
707 AddExpectedPointer( TAdvancedPointerEvent::EOutOfRange, TPoint(ptrPos.iX, ptrPos.iY), iProximityNominal, KMultiPtrTestPointerNumberLowest ); |
|
708 AddExpectedPointer( TAdvancedPointerEvent::EOutOfRange, TPoint(ptrPos.iX, ptrPos.iY), iProximityNominal, KMultiPtrTestPointerNumberLowest + 1 ); |
|
709 |
|
710 } |
|
711 break; |
|
712 |
|
713 default: |
|
714 { |
|
715 INFO_PRINTF1( _L("MoveAndOutOfRangeL STOP\n") ); |
|
716 RDebug::Print( _L("MoveAndOutOfRangeL STOP\n") ); |
|
717 RDebug::Print( _L("") ); |
|
718 |
|
719 CActiveScheduler::Stop(); |
|
720 iEventSet = 0; |
|
721 } |
|
722 break; |
|
723 } |
|
724 |
|
725 } |
|
726 |
|
727 |
|
728 /** |
|
729 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0018 |
|
730 @SYMPREQ PREQ1226 |
|
731 @SYMTestType UT |
|
732 @SYMTestPriority Critical |
|
733 @SYMTestStatus Implemented |
|
734 @SYMTestCaseDesc Check cone ignores pointer numbers greater than EPointerNumberOfPointers but less than EPointerMaxPointers. |
|
735 @SYMTestActions |
|
736 @SYMTestExpectedResults The first reported event should be the first legal one. The illegally-numbered-pointer event should be ignored. |
|
737 */ |
|
738 void CConeMultiPtrTestAppUi::PointerNumberOutOfRangeL() |
|
739 { |
|
740 INFO_PRINTF1( _L(">PointerNumberOutOfRange") ); |
|
741 RDebug::Print( _L(">PointerNumberOutOfRange") ); |
|
742 |
|
743 // Compose an illegitimately numbered pointer. (Pointers are numbered from 0) |
|
744 const TInt illegitimatePointerNumber = iNumberOfPointers; // One more than the maximally-numbered pointer |
|
745 const TInt nominalPressureOne = iPressureNominal; |
|
746 const TInt nominalPressureTwo = iPressureNominal + iPressureStep; |
|
747 |
|
748 if( (iNumberOfPointers <= 1) |
|
749 || (illegitimatePointerNumber >= iMaxPointers) ) |
|
750 { |
|
751 User::Leave( KErrNotSupported ); |
|
752 } |
|
753 |
|
754 switch( iEventSet++ ) |
|
755 { |
|
756 case 0: |
|
757 { |
|
758 INFO_PRINTF1( _L("PointerNumberOutOfRange case 0") ); |
|
759 RDebug::Print( _L("PointerNumberOutOfRange case 0") ); |
|
760 |
|
761 const TInt KPointerNumberOutOfRangeInitialX = 60; |
|
762 const TInt KPointerNumberOutOfRangeInitialY = 60; |
|
763 TPoint ptrPos( KPointerNumberOutOfRangeInitialX, KPointerNumberOutOfRangeInitialY ); |
|
764 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
765 // Generate a button-down event from an illegally numbered pointer |
|
766 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, nominalPressureOne, illegitimatePointerNumber ); |
|
767 // Generate a legal event. Differentiate the event in terms of position and pressure also. |
|
768 ptrPos += incPoint; |
|
769 SimulatePointer( TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, nominalPressureTwo, (iNumberOfPointers - 1) ); |
|
770 ptrPos -= iControl->Position(); // Compensate for co-ordinate-within-control. |
|
771 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, TPoint(ptrPos.iX, ptrPos.iY), nominalPressureTwo, (iNumberOfPointers - 1) ); |
|
772 } |
|
773 break; |
|
774 |
|
775 default: |
|
776 { |
|
777 INFO_PRINTF1( _L("PointerNumberOutOfRange STOP\n") ); |
|
778 RDebug::Print( _L("PointerNumberOutOfRange STOP") ); |
|
779 RDebug::Print( _L("") ); |
|
780 |
|
781 CActiveScheduler::Stop(); |
|
782 iEventSet = 0; |
|
783 } |
|
784 break; |
|
785 } |
|
786 |
|
787 } |
|
788 |
|
789 |
|
790 /** |
|
791 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0020 |
|
792 @SYMPREQ PREQ1226 |
|
793 @SYMTestType UT |
|
794 @SYMTestPriority Critical |
|
795 @SYMTestStatus Implemented |
|
796 @SYMTestCaseDesc Check that Cone supports 'capture' in the case of multi-pointer events. |
|
797 @SYMTestActions Set the test-control to be capturing. Simulate EButton1Down from 2 pointers outside the control area. |
|
798 Then simulate EButton1Down from a third pointer inside the control. |
|
799 cf GRAPHICS-WSERV-ADVANCEDPOINTER-0040 |
|
800 @SYMTestExpectedResults Pointer events inside and outside the control are delivered to the control. |
|
801 */ |
|
802 void CConeMultiPtrTestAppUi::MultiPointerCaptureL() |
|
803 { |
|
804 INFO_PRINTF1( _L(">MultiPointerCaptureL") ); |
|
805 RDebug::Print( _L(">MultiPointerCaptureL") ); |
|
806 |
|
807 if( iNumberOfPointers <= 1 ) |
|
808 { |
|
809 User::Leave( KErrNotSupported ); |
|
810 } |
|
811 |
|
812 switch( iEventSet++ ) |
|
813 { |
|
814 case 0: |
|
815 { |
|
816 INFO_PRINTF1( _L("MultiPointerCaptureL case 0") ); |
|
817 RDebug::Print( _L("MultiPointerCaptureL case 0") ); |
|
818 |
|
819 TPoint decPoint( KMultiPtrTestCoOrdinateDecrementSmall, KMultiPtrTestCoOrdinateDecrementSmall ); |
|
820 TPoint incPoint( KMultiPtrTestCoOrdinateIncrementSmall, KMultiPtrTestCoOrdinateIncrementSmall ); |
|
821 |
|
822 TPoint outsidePoint_1( iControl->Position() ); |
|
823 outsidePoint_1 -= decPoint; |
|
824 // The negative co-ordinates supplied to the control |
|
825 TPoint outsideResult_1( outsidePoint_1 - iControl->Position() ); |
|
826 |
|
827 TPoint outsidePoint_2( outsidePoint_1 ); |
|
828 outsidePoint_2 -= decPoint; |
|
829 // The negative co-ordinates supplied to the control |
|
830 TPoint outsideResult_2( outsidePoint_2 - iControl->Position() ); |
|
831 |
|
832 TPoint insidePoint_1( iControl->Position() ); |
|
833 insidePoint_1 += incPoint; |
|
834 TPoint insideResult_1( insidePoint_1 - iControl->Position() ); |
|
835 |
|
836 const TInt nominalPressureOne = iPressureNominal; |
|
837 const TInt nominalPressureTwo = iPressureNominal + iPressureStep; |
|
838 |
|
839 iControl->SetGloballyCapturing( ETrue ); |
|
840 iControl->SetPointerCapture( ETrue ); |
|
841 |
|
842 TInt i = 2; |
|
843 TInt first = 0; |
|
844 TInt second = 0; |
|
845 TInt third = 0; |
|
846 |
|
847 for(; i < iNumberOfPointers; i++ ) |
|
848 { |
|
849 first = i - 2; |
|
850 second = i - 1; |
|
851 third = i; |
|
852 |
|
853 // First pointer. Outside the control. |
|
854 SimulatePointer( TRawEvent::EButton1Down, outsidePoint_1.iX, outsidePoint_1.iY, nominalPressureOne, first ); |
|
855 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, outsideResult_1, nominalPressureOne, first ); |
|
856 // Next pointer. Outside the control. |
|
857 SimulatePointer( TRawEvent::EButton1Down, outsidePoint_2.iX, outsidePoint_2.iY, nominalPressureOne, second ); |
|
858 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, outsideResult_2, nominalPressureOne, second ); |
|
859 // Next pointer. Inside the control. |
|
860 SimulatePointer( TRawEvent::EButton1Down, insidePoint_1.iX, insidePoint_1.iY, nominalPressureTwo, third ); |
|
861 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, insideResult_1, nominalPressureTwo, third ); |
|
862 |
|
863 // Discriminate the next suite of events by co-ordinate |
|
864 outsidePoint_1 -= decPoint; |
|
865 outsideResult_1 -= decPoint; |
|
866 |
|
867 outsidePoint_2 -= decPoint; |
|
868 outsideResult_2 -= decPoint; |
|
869 |
|
870 insidePoint_1 += incPoint; |
|
871 insideResult_1 += incPoint; |
|
872 } |
|
873 |
|
874 } |
|
875 break; |
|
876 |
|
877 default: |
|
878 { |
|
879 INFO_PRINTF1( _L("MultiPointerCaptureL STOP\n") ); |
|
880 RDebug::Print( _L("MultiPointerCaptureL STOP") ); |
|
881 RDebug::Print( _L("") ); |
|
882 |
|
883 CActiveScheduler::Stop(); |
|
884 iEventSet = 0; |
|
885 } |
|
886 break; |
|
887 } |
|
888 |
|
889 } |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 /** |
|
895 @SYMTestCaseID UIF-WSERV-ADVANCEDPOINTER-0022 |
|
896 @SYMPREQ PREQ1226 |
|
897 @SYMTestType UT |
|
898 @SYMTestPriority Critical |
|
899 @SYMTestStatus Implemented |
|
900 @SYMTestCaseDesc Check that Cone supports 'grabbing' in the case of multi-pointer events. |
|
901 Ensure that events outside the control are not grabbed if grabbing has not been enabled. |
|
902 @SYMTestActions |
|
903 @SYMTestExpectedResults Events outside the control are supplied to the control only when grabbing has been enabled. |
|
904 */ |
|
905 void CConeMultiPtrTestAppUi::MultiPointerGrabL() |
|
906 { |
|
907 INFO_PRINTF1( _L(">MultiPointerGrabL") ); |
|
908 RDebug::Print( _L(">MultiPointerGrabL") ); |
|
909 |
|
910 if( iNumberOfPointers <= 1 ) |
|
911 { |
|
912 User::Leave( KErrNotSupported ); |
|
913 } |
|
914 |
|
915 |
|
916 switch( iEventSet++ ) |
|
917 { |
|
918 case 0: |
|
919 { |
|
920 // Events outside the control are not reported when grabbing has not been enabled |
|
921 INFO_PRINTF1( _L("MultiPointerGrabL case 0") ); |
|
922 RDebug::Print( _L("MultiPointerGrabL case 0") ); |
|
923 |
|
924 TPoint decPoint( KMultiPtrTestCoOrdinateDecrement, KMultiPtrTestCoOrdinateDecrement ); |
|
925 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
926 |
|
927 TPoint outsidePoint_1( iControl->Position() ); |
|
928 outsidePoint_1 -= decPoint; |
|
929 TPoint reportedOutsidePoint_1( outsidePoint_1 ); |
|
930 reportedOutsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
931 |
|
932 TPoint outsidePoint_2( outsidePoint_1 ); |
|
933 outsidePoint_2 -= decPoint; |
|
934 TPoint reportedOutsidePoint_2( outsidePoint_2 ); |
|
935 reportedOutsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
936 |
|
937 TPoint insidePoint_1( iControl->Position() ); |
|
938 insidePoint_1 += incPoint; // Place the co-ordinates within the control. |
|
939 TPoint reportedInsidePoint_1( insidePoint_1 ); |
|
940 reportedInsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
941 |
|
942 TPoint insidePoint_2( insidePoint_1 ); |
|
943 insidePoint_2 += incPoint; // differentiate from insidePoint_1. |
|
944 TPoint reportedInsidePoint_2( insidePoint_2 ); |
|
945 reportedInsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
946 |
|
947 const TInt nominalPressureOne = iPressureNominal; |
|
948 const TInt nominalPressureTwo = iPressureNominal + iPressureStep; |
|
949 const TInt nominalProximityOne = iProximityNominal; |
|
950 const TInt nominalProximityTwo = iProximityNominal + iProximityStep; |
|
951 |
|
952 // ****** Grabbing not enabled |
|
953 iControl->SetDrags(); |
|
954 TInt i = 1; |
|
955 |
|
956 for(; i < iNumberOfPointers; i++ ) |
|
957 { |
|
958 // Only events within the control should be reported. |
|
959 |
|
960 // First pointer down. |
|
961 SimulatePointer( TRawEvent::EButton1Down, insidePoint_1.iX, insidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
962 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_1, nominalPressureOne, i - 1 ); |
|
963 // First button move outside. |
|
964 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_1.iX, outsidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
965 // First button up |
|
966 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_1.iX, outsidePoint_1.iY, nominalProximityOne, i - 1 ); |
|
967 |
|
968 // Second pointer down. |
|
969 SimulatePointer( TRawEvent::EButton1Down, insidePoint_2.iX, insidePoint_2.iY, nominalPressureTwo, i ); |
|
970 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_2, nominalPressureTwo, i ); |
|
971 // Second button move outside. |
|
972 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_2.iX, outsidePoint_2.iY, nominalPressureTwo, i ); |
|
973 // Second button up |
|
974 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_2.iX, outsidePoint_2.iY, nominalProximityTwo, i ); |
|
975 } |
|
976 |
|
977 } |
|
978 break; |
|
979 |
|
980 case 1: |
|
981 { |
|
982 // Events outside the control should be reported to the control. |
|
983 |
|
984 // Pointer down, drag outside control, pointer up. Next pointer down... |
|
985 INFO_PRINTF1( _L("MultiPointerGrabL case 1") ); |
|
986 RDebug::Print( _L("MultiPointerGrabL case 1") ); |
|
987 |
|
988 TPoint decPoint( KMultiPtrTestCoOrdinateDecrement, KMultiPtrTestCoOrdinateDecrement ); |
|
989 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
990 |
|
991 TPoint outsidePoint_1( iControl->Position() ); |
|
992 outsidePoint_1 -= decPoint; |
|
993 TPoint reportedOutsidePoint_1( outsidePoint_1 ); |
|
994 reportedOutsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
995 |
|
996 TPoint outsidePoint_2( outsidePoint_1 ); |
|
997 outsidePoint_2 -= decPoint; |
|
998 TPoint reportedOutsidePoint_2( outsidePoint_2 ); |
|
999 reportedOutsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1000 |
|
1001 TPoint insidePoint_1( iControl->Position() ); |
|
1002 insidePoint_1 += incPoint; // Place the co-ordinates within the control. |
|
1003 TPoint reportedInsidePoint_1( insidePoint_1 ); |
|
1004 reportedInsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1005 |
|
1006 TPoint insidePoint_2( insidePoint_1 ); |
|
1007 insidePoint_2 += incPoint; // differentiate from insidePoint_1. |
|
1008 TPoint reportedInsidePoint_2( insidePoint_2 ); |
|
1009 reportedInsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1010 |
|
1011 const TInt nominalPressureOne = iPressureNominal; |
|
1012 const TInt nominalPressureTwo = iPressureNominal + iPressureStep; |
|
1013 const TInt nominalProximityOne = iProximityNominal; |
|
1014 const TInt nominalProximityTwo = iProximityNominal + iProximityStep; |
|
1015 |
|
1016 iControl->SetGrabs(); |
|
1017 iControl->SetDrags(); |
|
1018 TInt i = 1; |
|
1019 |
|
1020 for(; i < iNumberOfPointers; i++ ) |
|
1021 { |
|
1022 // First pointer down. |
|
1023 SimulatePointer( TRawEvent::EButton1Down, insidePoint_1.iX, insidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
1024 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_1, nominalPressureOne, i - 1 ); |
|
1025 // First button move outside. |
|
1026 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_1.iX, outsidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
1027 AddExpectedPointer( TAdvancedPointerEvent::EDrag, reportedOutsidePoint_1, nominalPressureOne, i - 1 ); |
|
1028 // First button up |
|
1029 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_1.iX, outsidePoint_1.iY, nominalProximityOne, i - 1 ); |
|
1030 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, reportedOutsidePoint_1, nominalProximityOne, i - 1 ); |
|
1031 |
|
1032 // Second pointer down. |
|
1033 SimulatePointer( TRawEvent::EButton1Down, insidePoint_2.iX, insidePoint_2.iY, nominalPressureTwo, i ); |
|
1034 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_2, nominalPressureTwo, i ); |
|
1035 // Second button move outside. |
|
1036 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_2.iX, outsidePoint_2.iY, nominalPressureTwo, i ); |
|
1037 AddExpectedPointer( TAdvancedPointerEvent::EDrag, reportedOutsidePoint_2, nominalPressureTwo, i ); |
|
1038 // Second button up |
|
1039 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_2.iX, outsidePoint_2.iY, nominalProximityTwo, i ); |
|
1040 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, reportedOutsidePoint_2, nominalProximityTwo, i ); |
|
1041 } |
|
1042 |
|
1043 } |
|
1044 break; |
|
1045 |
|
1046 case 2: |
|
1047 { |
|
1048 // Events outside the control should be reported to the control. Interdigitate the events to ensure |
|
1049 // that the pointer numbers are discriminated correctly |
|
1050 |
|
1051 // Ptr dn, next ptr dn, 1st ptr drag outside , next ptr drag outside, 1st ptr up, next ptr up |
|
1052 INFO_PRINTF1( _L("MultiPointerGrabL case 2") ); |
|
1053 RDebug::Print( _L("MultiPointerGrabL case 2") ); |
|
1054 |
|
1055 TPoint decPoint( KMultiPtrTestCoOrdinateDecrement, KMultiPtrTestCoOrdinateDecrement ); |
|
1056 TPoint incPoint( KMultiPtrTestCoOrdinateIncrement, KMultiPtrTestCoOrdinateIncrement ); |
|
1057 |
|
1058 TPoint outsidePoint_1( iControl->Position() ); |
|
1059 outsidePoint_1 -= decPoint; |
|
1060 TPoint reportedOutsidePoint_1( outsidePoint_1 ); |
|
1061 reportedOutsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1062 |
|
1063 TPoint outsidePoint_2( outsidePoint_1 ); |
|
1064 outsidePoint_2 -= decPoint; |
|
1065 TPoint reportedOutsidePoint_2( outsidePoint_2 ); |
|
1066 reportedOutsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1067 |
|
1068 TPoint insidePoint_1( iControl->Position() ); |
|
1069 insidePoint_1 += incPoint; // Place the co-ordinates within the control. |
|
1070 TPoint reportedInsidePoint_1( insidePoint_1 ); |
|
1071 reportedInsidePoint_1 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1072 |
|
1073 TPoint insidePoint_2( insidePoint_1 ); |
|
1074 insidePoint_2 += incPoint; // differentiate from insidePoint_1. |
|
1075 TPoint reportedInsidePoint_2( insidePoint_2 ); |
|
1076 reportedInsidePoint_2 -= iControl->Position(); // Compensate for the reported position within the control. |
|
1077 |
|
1078 const TInt nominalPressureOne = iPressureNominal; |
|
1079 const TInt nominalPressureTwo = iPressureNominal + iPressureStep; |
|
1080 const TInt nominalProximityOne = iProximityNominal; |
|
1081 const TInt nominalProximityTwo = iProximityNominal + iProximityStep; |
|
1082 |
|
1083 iControl->SetGrabs(); |
|
1084 iControl->SetDrags(); |
|
1085 TInt i = 1; |
|
1086 |
|
1087 for(; i < iNumberOfPointers; i++ ) |
|
1088 { |
|
1089 // First pointer down. |
|
1090 SimulatePointer( TRawEvent::EButton1Down, insidePoint_1.iX, insidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
1091 // Second pointer down. |
|
1092 SimulatePointer( TRawEvent::EButton1Down, insidePoint_2.iX, insidePoint_2.iY, nominalPressureTwo, i ); |
|
1093 // First button move outside. |
|
1094 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_1.iX, outsidePoint_1.iY, nominalPressureOne, i - 1 ); |
|
1095 // Second button move outside. |
|
1096 SimulatePointer( TRawEvent::EPointerMove, outsidePoint_2.iX, outsidePoint_2.iY, nominalPressureTwo, i ); |
|
1097 // First button up |
|
1098 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_1.iX, outsidePoint_1.iY, nominalProximityOne, i - 1 ); |
|
1099 // Second button up |
|
1100 SimulatePointer( TRawEvent::EButton1Up, outsidePoint_2.iX, outsidePoint_2.iY, nominalProximityTwo, i ); |
|
1101 |
|
1102 // The corresponding anticipated events. |
|
1103 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_1, nominalPressureOne, i - 1 ); |
|
1104 AddExpectedPointer( TAdvancedPointerEvent::EButton1Down, reportedInsidePoint_2, nominalPressureTwo, i ); |
|
1105 |
|
1106 AddExpectedPointer( TAdvancedPointerEvent::EDrag, reportedOutsidePoint_1, nominalPressureOne, i - 1 ); |
|
1107 AddExpectedPointer( TAdvancedPointerEvent::EDrag, reportedOutsidePoint_2, nominalPressureTwo, i ); |
|
1108 |
|
1109 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, reportedOutsidePoint_1, nominalProximityOne, i - 1 ); |
|
1110 AddExpectedPointer( TAdvancedPointerEvent::EButton1Up, reportedOutsidePoint_2, nominalProximityTwo, i ); |
|
1111 } |
|
1112 |
|
1113 } |
|
1114 break; |
|
1115 default: |
|
1116 { |
|
1117 INFO_PRINTF1( _L("MultiPointerGrabL STOP\n") ); |
|
1118 RDebug::Print( _L("MultiPointerGrabL STOP") ); |
|
1119 RDebug::Print( _L("") ); |
|
1120 |
|
1121 CActiveScheduler::Stop(); |
|
1122 iEventSet = 0; |
|
1123 } |
|
1124 break; |
|
1125 |
|
1126 } |
|
1127 |
|
1128 } |
|
1129 |
|
1130 |
|
1131 // Stops the active scheduler and sets the flag to ETrue |
|
1132 void CConeMultiPtrTestAppUi::Failed() |
|
1133 { |
|
1134 CActiveScheduler::Stop(); |
|
1135 iFailed=ETrue; |
|
1136 } |
|
1137 |
|
1138 |
|
1139 /** |
|
1140 CTestStep derived class. It creates the control environment and App Ui class objects |
|
1141 */ |
|
1142 void CTConeMultiPtrStep::ConstructConeMultiPtrAppL(CCoeEnv* aCoe) |
|
1143 { // runs inside a TRAP harness |
|
1144 aCoe->ConstructL(); |
|
1145 CConeMultiPtrTestAppUi* appUi=new(ELeave) CConeMultiPtrTestAppUi(this); |
|
1146 aCoe->SetAppUi(appUi); |
|
1147 aCoe->WsSession().SetDoubleClick(1000000,4); |
|
1148 appUi->ConstructL(); |
|
1149 } |
|
1150 |
|
1151 |
|
1152 CTConeMultiPtrStep::CTConeMultiPtrStep() |
|
1153 { |
|
1154 SetTestStepName(KTConeMultiPtrStep); |
|
1155 } |
|
1156 |
|
1157 |
|
1158 CTConeMultiPtrStep::~CTConeMultiPtrStep() |
|
1159 { |
|
1160 |
|
1161 } |
|
1162 |
|
1163 |
|
1164 /** |
|
1165 Testexecute loads testserver and creates CTConeMultiPtrStep object and calls |
|
1166 this function for each step in script file. |
|
1167 */ |
|
1168 TVerdict CTConeMultiPtrStep::doTestStepL() |
|
1169 { |
|
1170 INFO_PRINTF1(_L("Test Started")); |
|
1171 |
|
1172 // Need to check if wserv is NGA or Non-NGA |
|
1173 // If NGA continue or else just return |
|
1174 RWsSession wsSession; |
|
1175 User::LeaveIfError(wsSession.Connect()); |
|
1176 if (wsSession.PreferredSurfaceConfigurationSize() == KErrNotSupported) |
|
1177 { |
|
1178 wsSession.Close(); |
|
1179 INFO_PRINTF1(_L("Tests should run only on NGA configuration. \n")); |
|
1180 SetTestStepResult(EPass); |
|
1181 return TestStepResult(); |
|
1182 } |
|
1183 wsSession.Close(); |
|
1184 |
|
1185 // Here check if the HAL configuration are correct if not then finish the test case |
|
1186 TInt maxPtr=-1; |
|
1187 TInt ret = HAL::Get(HALData::EPointerMaxPointers, maxPtr); |
|
1188 if (ret != KErrNone || maxPtr < 2 || maxPtr > 8) |
|
1189 { |
|
1190 INFO_PRINTF2(_L("Incorrect HAL configuration (MaxPointers=%d). \n"),maxPtr); |
|
1191 SetTestStepResult(EFail); |
|
1192 return TestStepResult(); |
|
1193 } |
|
1194 |
|
1195 PreallocateHALBuffer(); |
|
1196 |
|
1197 __UHEAP_MARK; |
|
1198 |
|
1199 CCoeEnv* coe = new(ELeave) CCoeEnv; |
|
1200 TRAPD(err, ConstructConeMultiPtrAppL(coe)); |
|
1201 |
|
1202 if (!err) |
|
1203 { |
|
1204 coe->ExecuteD(); |
|
1205 } |
|
1206 else |
|
1207 { |
|
1208 INFO_PRINTF1(_L("Failed to contruct ControlEnvironment")); |
|
1209 SetTestStepResult(EFail); |
|
1210 if (coe) |
|
1211 coe->DestroyEnvironment(); |
|
1212 } |
|
1213 REComSession::FinalClose(); |
|
1214 |
|
1215 __UHEAP_MARKEND; |
|
1216 |
|
1217 INFO_PRINTF1(_L("Test Finished")); |
|
1218 return TestStepResult(); |
|
1219 } |
|
1220 |
|
1221 |
|
1222 TVerdict CTConeMultiPtrStep::doTestStepPreambleL() |
|
1223 { |
|
1224 // Remember the double-click settings. |
|
1225 // Tests (may) adjust these values. |
|
1226 RWsSession wsSession; |
|
1227 User::LeaveIfError( wsSession.Connect() ); |
|
1228 |
|
1229 wsSession.GetDoubleClickSettings( iDoubleClickMaxInterval, iDoubleClickMaxDistance ); |
|
1230 wsSession.Close(); |
|
1231 |
|
1232 return CTestStep::doTestStepPreambleL(); |
|
1233 } |
|
1234 |
|
1235 |
|
1236 TVerdict CTConeMultiPtrStep::doTestStepPostambleL() |
|
1237 { |
|
1238 // Restore the original system-wide double-click settings. |
|
1239 RWsSession wsSession; |
|
1240 User::LeaveIfError( wsSession.Connect() ); |
|
1241 |
|
1242 wsSession.SetDoubleClick( iDoubleClickMaxInterval, iDoubleClickMaxDistance); |
|
1243 wsSession.Close(); |
|
1244 |
|
1245 return CTestStep::doTestStepPostambleL(); |
|
1246 } |