|
1 // Copyright (c) 2006-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 // Tests 100% of the public API of the Cone view architecture support. |
|
15 // The tests performed are server start, coe env and app ui creation, addition of views, |
|
16 // activation of views, activation message passing, queuing of view events, |
|
17 // removal of views, view control stacking, key event simulation, control stack flag changing, |
|
18 // addition of default view, activation of default view, addition of view deactivation observers |
|
19 // removal of view deactivation observers. |
|
20 // Also tests the ordering of key event passing for controls on the control stack of the appUi and |
|
21 // the active view. Low priority controls in the appUi should get key events after higher priority |
|
22 // controls in the active view. |
|
23 // |
|
24 // |
|
25 |
|
26 /** |
|
27 @file |
|
28 @test |
|
29 @internalComponent - Internal Symbian test code |
|
30 */ |
|
31 |
|
32 #include <e32cons.h> |
|
33 #include <vwsappst.h> |
|
34 #include <coeaui.h> |
|
35 #include <coemain.h> |
|
36 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
37 #include <viewclipartner.h> |
|
38 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
39 |
|
40 #include "coepriv.h" |
|
41 #include "COEVWMAN.H" |
|
42 |
|
43 #include <test/appfwk_test.h> |
|
44 #include "TVWASTEP.H" |
|
45 |
|
46 |
|
47 /************************************************************* |
|
48 ** |
|
49 ** Global constants |
|
50 ** |
|
51 *************************************************************/ |
|
52 |
|
53 _LIT(KCustomDes,"Custom Message"); |
|
54 _LIT(KNullDes,""); |
|
55 |
|
56 #define KUidTViewAppOneValue 0xA |
|
57 const TUid KUidTViewAppOne={KUidTViewAppOneValue}; |
|
58 |
|
59 #define KUidTViewOneValue 0x1 |
|
60 const TUid KUidTViewOne={KUidTViewOneValue}; |
|
61 |
|
62 #define KUidTViewTwoValue 0x2 |
|
63 const TUid KUidTViewTwo={KUidTViewTwoValue}; |
|
64 |
|
65 #define KUidTViewFiveValue 0x5 |
|
66 const TUid KUidTViewFive={KUidTViewFiveValue}; |
|
67 |
|
68 #define VIEW_ONE TVwsViewId(KUidTViewAppOne,KUidTViewOne) |
|
69 #define VIEW_TWO TVwsViewId(KUidTViewAppOne,KUidTViewTwo) |
|
70 #define VIEW_FIVE TVwsViewId(KUidTViewAppOne,KUidTViewFive) |
|
71 |
|
72 #define KUidTViewAppTwoValue 0xB |
|
73 const TUid KUidTViewAppTwo={KUidTViewAppTwoValue}; |
|
74 |
|
75 #define KUidTViewThreeValue 0x3 |
|
76 const TUid KUidTViewThree={KUidTViewThreeValue}; |
|
77 |
|
78 #define KUidTViewFourValue 0x4 |
|
79 const TUid KUidTViewFour={KUidTViewFourValue}; |
|
80 |
|
81 #define VIEW_THREE TVwsViewId(KUidTViewAppTwo,KUidTViewThree) |
|
82 #define VIEW_FOUR TVwsViewId(KUidTViewAppTwo,KUidTViewFour) |
|
83 |
|
84 const TUid KUidTws0CustomMesssageId={0x1}; |
|
85 |
|
86 const TInt KTopControlId=1; |
|
87 const TInt KBottomControlId=2; |
|
88 |
|
89 const TInt KViewDeactivationObserverOneId=1; |
|
90 const TInt KViewDeactivationObserverTwoId=2; |
|
91 const TInt KViewActivationObserverOneId=1; |
|
92 const TInt KViewActivationObserverTwoId=2; |
|
93 const TInt KViewActivationObserverThreeId=3; |
|
94 |
|
95 // Global variables to check activations & deactivations notifications... |
|
96 TInt gViewActivationObserverOne; |
|
97 TInt gViewDeactivationObserverOne; |
|
98 TInt gViewActivationObserverTwo; |
|
99 TInt gViewDeactivationObserverTwo; |
|
100 TInt gViewActivationObserverNotify; |
|
101 TInt gViewDeactivationObserverNotify; |
|
102 |
|
103 // Global variables to check controls event consumptions... |
|
104 TInt gTopControl; |
|
105 TInt gBottomControl; |
|
106 TInt gAppUiControl; |
|
107 |
|
108 enum TTestFrameworkPanic |
|
109 { |
|
110 ETestFailure = 1 |
|
111 }; |
|
112 |
|
113 static void PanicWithCondAndInfo(TTestFrameworkPanic aPanic, const TDesC& aCondition, const TDesC& aFileName, const TDesC& aPanicName, TInt aLine) |
|
114 { |
|
115 TBuf<256> buf; |
|
116 _LIT(KPanicDesc1,"Testframework Panic %S, in file %S @ line %i"); |
|
117 buf.Format(KPanicDesc1, &aPanicName, &aFileName, aLine); |
|
118 RDebug::Print(buf); |
|
119 _LIT(KPanicDesc2,"Assert condition = \"%S\""); |
|
120 buf.Format(KPanicDesc2, &aCondition); |
|
121 RDebug::Print(buf); |
|
122 _LIT(KPanicCategory,"CTestDriver"); |
|
123 User::Panic(KPanicCategory,aPanic); |
|
124 } |
|
125 |
|
126 #define _ASSERT_FILENAME(f) _LIT(KPanicFileName, f); |
|
127 #define _ASSERT_PANICNAME(p) _LIT(KPanicEnum ## p, # p); |
|
128 #define _ASSERT_CONDITION(c) _LIT(KPanicCondition, c); |
|
129 |
|
130 #define TEST_ASSERT(c, p) \ |
|
131 do { \ |
|
132 if (!(c)) \ |
|
133 { \ |
|
134 _ASSERT_FILENAME(__FILE__); \ |
|
135 _ASSERT_PANICNAME(p); \ |
|
136 _ASSERT_CONDITION(#c); \ |
|
137 PanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \ |
|
138 } \ |
|
139 } while (0) |
|
140 |
|
141 // Use this method as a way to test when usage of TEST macro is not possible |
|
142 //inline void TEST_ASSERT(TBool aCondition){ TEST_ASSERT(aCondition, ETestFailure); } |
|
143 |
|
144 /************************************************************* |
|
145 ** |
|
146 ** CViewActivationObserver - implements the MCoeViewActivationObserver interface |
|
147 ** |
|
148 *************************************************************/ |
|
149 |
|
150 CViewActivationObserver* CViewActivationObserver::NewL(TInt aObserverId) |
|
151 { |
|
152 CViewActivationObserver* self=new(ELeave) CViewActivationObserver(aObserverId); |
|
153 return self; |
|
154 } |
|
155 |
|
156 CViewActivationObserver::CViewActivationObserver(TInt aObserverId) : iObserverId(aObserverId) |
|
157 { |
|
158 } |
|
159 |
|
160 CViewActivationObserver::~CViewActivationObserver() |
|
161 { |
|
162 } |
|
163 |
|
164 void CViewActivationObserver::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,const TVwsViewId& aViewIdToBeDeactivated) |
|
165 { |
|
166 RDebug::Print(_L("CViewActivationObserver::HandleViewActivation: Observer 0x%x - Newly Active View: 0x%x - Deactivate 0x%x"), iObserverId, aNewlyActivatedViewId.iViewUid.iUid, aViewIdToBeDeactivated.iViewUid.iUid); |
|
167 // for testing purposes |
|
168 if (iObserverId == KViewActivationObserverOneId) |
|
169 gViewActivationObserverOne++; |
|
170 else if (iObserverId == KViewActivationObserverTwoId) |
|
171 gViewActivationObserverTwo++; |
|
172 } |
|
173 |
|
174 |
|
175 |
|
176 /************************************************************* |
|
177 ** |
|
178 ** CViewDeactivationObserver - implements the MCoeViewDeactivationObserver interface |
|
179 ** |
|
180 *************************************************************/ |
|
181 |
|
182 CViewDeactivationObserver* CViewDeactivationObserver::NewL(TInt aObserverId) |
|
183 { |
|
184 CViewDeactivationObserver* self=new(ELeave) CViewDeactivationObserver(aObserverId); |
|
185 return self; |
|
186 } |
|
187 |
|
188 CViewDeactivationObserver::CViewDeactivationObserver(TInt aObserverId) : iObserverId(aObserverId) |
|
189 { |
|
190 } |
|
191 |
|
192 CViewDeactivationObserver::~CViewDeactivationObserver() |
|
193 { |
|
194 } |
|
195 |
|
196 void CViewDeactivationObserver::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,const TVwsViewId& aNewlyActivatedViewId) |
|
197 { |
|
198 RDebug::Print(_L("CViewDeactivationObserver::HandleViewDeactivation: Observer 0x%x - Deactivate 0x%x - Newly Active View: 0x%x"), iObserverId, aViewIdToBeDeactivated.iViewUid.iUid, aNewlyActivatedViewId.iViewUid.iUid); |
|
199 // for testing purposes |
|
200 if (iObserverId == KViewDeactivationObserverOneId) |
|
201 gViewDeactivationObserverOne++; |
|
202 else if (iObserverId == KViewDeactivationObserverTwoId) |
|
203 gViewDeactivationObserverTwo++; |
|
204 } |
|
205 |
|
206 |
|
207 |
|
208 /************************************************************* |
|
209 ** |
|
210 ** CViewActivationObserver_Notify - implements the MCoeViewActivationObserver interface for notifications only |
|
211 ** |
|
212 *************************************************************/ |
|
213 |
|
214 CViewActivationObserver_Notify* CViewActivationObserver_Notify::NewL() |
|
215 { |
|
216 CViewActivationObserver_Notify* self=new(ELeave) CViewActivationObserver_Notify(); |
|
217 return self; |
|
218 } |
|
219 |
|
220 CViewActivationObserver_Notify::CViewActivationObserver_Notify() |
|
221 { |
|
222 } |
|
223 |
|
224 CViewActivationObserver_Notify::~CViewActivationObserver_Notify() |
|
225 { |
|
226 } |
|
227 |
|
228 void CViewActivationObserver_Notify::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,const TVwsViewId& aViewIdToBeDeactivated) |
|
229 { |
|
230 RDebug::Print(_L("Notified CViewActivationObserver_Notify::HandleViewActivation: Newly Active View: 0x%x - Deactivate 0x%x"), aNewlyActivatedViewId.iViewUid.iUid, aViewIdToBeDeactivated.iViewUid.iUid); |
|
231 // for testing purposes |
|
232 gViewActivationObserverNotify++; |
|
233 } |
|
234 |
|
235 |
|
236 |
|
237 /************************************************************* |
|
238 ** |
|
239 ** CViewDeactivationObserver_Notify - implements the MCoeViewDeactivationObserver interface for notifications only |
|
240 ** |
|
241 *************************************************************/ |
|
242 |
|
243 CViewDeactivationObserver_Notify* CViewDeactivationObserver_Notify::NewL() |
|
244 { |
|
245 CViewDeactivationObserver_Notify* self=new(ELeave) CViewDeactivationObserver_Notify(); |
|
246 return self; |
|
247 } |
|
248 |
|
249 CViewDeactivationObserver_Notify::CViewDeactivationObserver_Notify() |
|
250 { |
|
251 } |
|
252 |
|
253 CViewDeactivationObserver_Notify::~CViewDeactivationObserver_Notify() |
|
254 { |
|
255 } |
|
256 |
|
257 void CViewDeactivationObserver_Notify::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,const TVwsViewId& aNewlyActivatedViewId) |
|
258 { |
|
259 RDebug::Print(_L("Notified CViewDeactivationObserver_Notify::HandleViewDeactivation: Deactivate 0x%x - Newly Active View: 0x%x"), aViewIdToBeDeactivated.iViewUid.iUid, aNewlyActivatedViewId.iViewUid.iUid); |
|
260 // for testing purposes |
|
261 gViewDeactivationObserverNotify++; |
|
262 } |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 /************************************************************* |
|
268 ** |
|
269 ** CTVwaTestControl |
|
270 ** |
|
271 *************************************************************/ |
|
272 |
|
273 CTVwaTestControl::CTVwaTestControl(TVwsViewId& aViewId, TInt aControlId) : iViewId(aViewId), iControlId(aControlId) |
|
274 { |
|
275 } |
|
276 |
|
277 void CTVwaTestControl::ConstructL() |
|
278 { |
|
279 CreateWindowL(); |
|
280 SetExtent(TPoint(0,0),TSize(0,0)); |
|
281 ActivateL(); |
|
282 } |
|
283 |
|
284 CTVwaTestControl::~CTVwaTestControl() |
|
285 { |
|
286 } |
|
287 |
|
288 TKeyResponse CTVwaTestControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
289 { |
|
290 if (aType!=EEventKey) |
|
291 return(EKeyWasConsumed); |
|
292 |
|
293 RDebug::Print(_L("Key Event: View: 0x%x - Control: 0x%x - Key 0x%x"), iViewId.iViewUid.iUid, iControlId, aKeyEvent.iCode); |
|
294 |
|
295 // for testing purposes |
|
296 if (iControlId == KTopControlId) |
|
297 gTopControl++; |
|
298 else if (iControlId == KBottomControlId) |
|
299 gBottomControl++; |
|
300 |
|
301 // For testing purposes, if the control receives a 'C', let's consume it. |
|
302 if (aKeyEvent.iCode == 'C') |
|
303 return(EKeyWasConsumed); |
|
304 else |
|
305 return(EKeyWasNotConsumed); |
|
306 |
|
307 } |
|
308 |
|
309 |
|
310 |
|
311 /************************************************************* |
|
312 ** |
|
313 ** CAppUiTestControl |
|
314 ** |
|
315 *************************************************************/ |
|
316 |
|
317 CAppUiTestControl::CAppUiTestControl() |
|
318 { |
|
319 } |
|
320 |
|
321 void CAppUiTestControl::ConstructL() |
|
322 { |
|
323 CreateWindowL(); |
|
324 SetExtent(TPoint(0,0),TSize(0,0)); |
|
325 ActivateL(); |
|
326 } |
|
327 |
|
328 CAppUiTestControl::~CAppUiTestControl() |
|
329 { |
|
330 } |
|
331 |
|
332 TKeyResponse CAppUiTestControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
333 { |
|
334 if (aType!=EEventKey) |
|
335 return(EKeyWasConsumed); |
|
336 |
|
337 RDebug::Print(_L("AppUi Control Key Event: Key 0x%x"), aKeyEvent.iCode); |
|
338 |
|
339 // for testing purposes |
|
340 gAppUiControl++; |
|
341 |
|
342 // For testing purposes, if the control receives a 'U', let's consume it. |
|
343 if (aKeyEvent.iCode == 'C') |
|
344 return(EKeyWasConsumed); |
|
345 else |
|
346 return(EKeyWasNotConsumed); |
|
347 } |
|
348 |
|
349 |
|
350 |
|
351 /************************************************************* |
|
352 ** |
|
353 ** CTestView |
|
354 ** |
|
355 *************************************************************/ |
|
356 |
|
357 CTestView::~CTestView() |
|
358 { |
|
359 RemoveFromStack(iTopControl); |
|
360 delete iTopControl; |
|
361 RemoveFromStack(iBottomControl); |
|
362 delete iBottomControl; |
|
363 } |
|
364 |
|
365 CTestView::CTestView(const TVwsViewId& aViewId,CCoeAppUi& aAppUi) |
|
366 :iAppUi(aAppUi),iViewId(aViewId) |
|
367 { |
|
368 } |
|
369 |
|
370 void CTestView::ConstructL() |
|
371 { |
|
372 iTopControl=new(ELeave) CTVwaTestControl(iViewId,KTopControlId); |
|
373 iTopControl->ConstructL(); |
|
374 iBottomControl=new(ELeave) CTVwaTestControl(iViewId,KBottomControlId); |
|
375 iBottomControl->ConstructL(); |
|
376 AddToStackL(iBottomControl); |
|
377 AddToStackL(iTopControl); |
|
378 } |
|
379 |
|
380 /** |
|
381 Getter of view id.\n |
|
382 */ |
|
383 TVwsViewId CTestView::ViewId() const |
|
384 { |
|
385 return iViewId; |
|
386 } |
|
387 |
|
388 /** |
|
389 Activates the supplied view id.\n |
|
390 */ |
|
391 void CTestView::ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage) |
|
392 { |
|
393 DoActivateNarrowL(aPrevViewId,aCustomMessageId,aCustomMessage); |
|
394 |
|
395 if (aPrevViewId.iAppUid.iUid == KUidTViewAppOneValue && iViewId.iAppUid.iUid == KUidTViewAppOneValue) |
|
396 { |
|
397 TSecureId processId = aPrevViewId.iAppUid; |
|
398 const TSecurityPolicy policy(processId); |
|
399 TInt previousAppInitiatedViewSwitch = 0; |
|
400 RDebug::Print(_L("Calling CheckSourceOfViewSwitchL where appUid and processID are same ...")); |
|
401 TRAPD(err, previousAppInitiatedViewSwitch = iAppUi.CheckSourceOfViewSwitchL(policy, KSuppressPlatSecDiagnostic)); |
|
402 TEST_ASSERT(err == KErrNone, ETestFailure); |
|
403 TEST_ASSERT(!previousAppInitiatedViewSwitch, ETestFailure); |
|
404 RDebug::Print(_L("Test for CheckSourceOfViewSwitchL complete ...")); |
|
405 } |
|
406 |
|
407 // CheckSourceOfViewSwitchL leaves with KErrUnknown if called outside of an implementation of MCoeView's ViewConstructL or ViewActivatedL |
|
408 // Do that if and only if we're switching between iAppUi (i.e. KTVwaStandardAppUiId, not KTVwaEmbeddedAppUiId) |
|
409 if (aPrevViewId.iAppUid.iUid == KUidTViewAppOneValue && iViewId.iAppUid.iUid == KUidTViewAppOneValue) |
|
410 { |
|
411 TInt r = 0; |
|
412 RDebug::Print(_L("Calling CheckSourceOfViewSwitchL with a valid TVendorId...")); |
|
413 TRAPD(err, r = iAppUi.CheckSourceOfViewSwitchL(TSecurityPolicy(TVendorId(0x70000001)))); |
|
414 TEST_ASSERT(err == KErrNone, ETestFailure); |
|
415 TEST_ASSERT(r, ETestFailure); |
|
416 |
|
417 |
|
418 RDebug::Print(_L("Calling CheckSourceOfViewSwitchL with an invalid TVendorId...")); |
|
419 APPFWK_NEGATIVE_PLATSEC_START; |
|
420 TRAP(err, r = iAppUi.CheckSourceOfViewSwitchL(TSecurityPolicy(TVendorId(0x70000002)), __PLATSEC_DIAGNOSTIC_STRING("z:/conetest/menutest_t_vwa.script negative testing"))); |
|
421 APPFWK_NEGATIVE_PLATSEC_FINISH; |
|
422 TEST_ASSERT(err == KErrNone, ETestFailure); |
|
423 TEST_ASSERT(!r, ETestFailure); |
|
424 } |
|
425 } |
|
426 |
|
427 |
|
428 /** |
|
429 Activates the supplied view id but narrows down the supplied message from 16-bit unicode to 8 bit ASCII. |
|
430 */ |
|
431 void CTestView::DoActivateNarrowL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage) |
|
432 { |
|
433 HBufC16* wideCustomMessage=HBufC16::NewLC(aCustomMessage.Length()/2); |
|
434 TPtr16 ptr=wideCustomMessage->Des(); |
|
435 ptr.Copy((TUint16*)aCustomMessage.Ptr(),aCustomMessage.Length()/2); |
|
436 DoActivateL(aPrevViewId,aCustomMessageId,ptr); |
|
437 CleanupStack::PopAndDestroy(wideCustomMessage); |
|
438 } |
|
439 |
|
440 /** |
|
441 Activates the supplied view id.\n |
|
442 */ |
|
443 void CTestView::DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage) |
|
444 { |
|
445 RDebug::Print(_L("CTestView::ViewActivatedL:: 0x%x - Previous View: 0x%x"), iViewId.iViewUid.iUid, aPrevViewId.iViewUid.iUid); |
|
446 RDebug::Print(_L("Message - Id: 0x%x - Text: %S"),aCustomMessageId.iUid, &aCustomMessage); |
|
447 } |
|
448 |
|
449 /** |
|
450 Handles a change to the screen device returning the value of the TVwsViewIdAndMessage |
|
451 object that describes what the view architecture should do next.\n |
|
452 */ |
|
453 TVwsViewIdAndMessage CTestView::ViewScreenDeviceChangedL() |
|
454 { |
|
455 RDebug::Print(_L("CTestView::ViewScreenDeviceChangedL: 0x%x"), iViewId.iViewUid.iUid); |
|
456 return TVwsViewIdAndMessage(); |
|
457 } |
|
458 |
|
459 /** |
|
460 Prints a message which view has been deactivated.\n |
|
461 */ |
|
462 void CTestView::ViewDeactivated() |
|
463 { |
|
464 RDebug::Print(_L("CTestView::ViewDeactivated: 0x%x "), iViewId.iViewUid.iUid); |
|
465 } |
|
466 |
|
467 /** |
|
468 Debug print of the uid of the top control.\n |
|
469 */ |
|
470 void CTestView::ViewConstructL() |
|
471 { |
|
472 if(!iTopControl && !iBottomControl) |
|
473 { |
|
474 ConstructL(); |
|
475 } |
|
476 |
|
477 RDebug::Print(_L("CTestView::ViewConstructL: 0x%x "), iViewId.iViewUid.iUid); |
|
478 } |
|
479 |
|
480 /** |
|
481 Activates view with id aViewId.\n |
|
482 */ |
|
483 void CTestView::ActivateViewL(const TVwsViewId& aViewId) |
|
484 { |
|
485 iAppUi.ActivateViewL(aViewId); |
|
486 } |
|
487 |
|
488 /** |
|
489 Activates view with id aViewId and send a message.\n |
|
490 */ |
|
491 void CTestView::ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage) |
|
492 { |
|
493 HBufC8* narrowMessage=HBufC8::NewLC(aCustomMessage.Size()); |
|
494 TPtr8 ptr=narrowMessage->Des(); |
|
495 ptr.Copy((TUint8*)aCustomMessage.Ptr(),aCustomMessage.Size()); |
|
496 iAppUi.ActivateViewL(aViewId,aCustomMessageId,narrowMessage->Des()); |
|
497 CleanupStack::PopAndDestroy(narrowMessage); |
|
498 } |
|
499 |
|
500 /** |
|
501 Add aControl to Cone's control stack with priority aPriority and behaviour aStackingFlags.\n |
|
502 */ |
|
503 void CTestView::AddToStackL(CCoeControl* aControl,TInt aPriority,TInt aStackingFlags) |
|
504 { |
|
505 iAppUi.AddToStackL(*this, aControl,aPriority,aStackingFlags); |
|
506 } |
|
507 |
|
508 /** |
|
509 Remove aControl from Cone's control stack.\n |
|
510 */ |
|
511 void CTestView::RemoveFromStack(CCoeControl* aControl) |
|
512 { |
|
513 iAppUi.RemoveFromStack(aControl); |
|
514 } |
|
515 |
|
516 /** |
|
517 Updates the value of the flags for aControl on the control stack. |
|
518 The mask aMask defines which flags are modified, while aFlags defines the values they are set to.\n |
|
519 */ |
|
520 void CTestView::UpdateStackedControlFlags(CCoeControl* aControl,TInt aFlags,TInt aMask) |
|
521 { |
|
522 iAppUi.UpdateStackedControlFlags(aControl,aFlags,aMask); |
|
523 } |
|
524 |
|
525 /** |
|
526 Set the top control to refuse all key events.\n |
|
527 */ |
|
528 void CTestView::UpdateControlStackingFlags() |
|
529 { |
|
530 UpdateStackedControlFlags(iTopControl,ECoeStackFlagRefusesAllKeys,0xffff); |
|
531 } |
|
532 |
|
533 /** |
|
534 Lower the priority of the bottom control with 20.\n |
|
535 */ |
|
536 void CTestView::UpdateControlPriorityL() |
|
537 { |
|
538 RemoveFromStack(iBottomControl); |
|
539 AddToStackL(iBottomControl,ECoeStackPriorityDefault-20); |
|
540 } |
|
541 |
|
542 |
|
543 /************************************************************* |
|
544 ** |
|
545 ** CTestDriver |
|
546 ** |
|
547 *************************************************************/ |
|
548 |
|
549 CTestDriver::CTestDriver(CCoeAppUi& aAppUi, CTmsTestStep* aStep) : iAppUi(aAppUi) ,iStep(aStep) |
|
550 { |
|
551 } |
|
552 |
|
553 void CTestDriver::ConstructL() |
|
554 { |
|
555 iUpdateTimer=CPeriodic::NewL(0); |
|
556 iUpdateTimer->Start(KUpdateInterval,KUpdateInterval,TCallBack(UpdateTimerCallBackL,this)); |
|
557 |
|
558 iViewActivationObserverOne=CViewActivationObserver::NewL(KViewActivationObserverOneId); |
|
559 iViewDeactivationObserverOne=CViewDeactivationObserver::NewL(KViewDeactivationObserverOneId); |
|
560 |
|
561 iViewActivationObserverTwo=CViewActivationObserver::NewL(KViewActivationObserverTwoId); |
|
562 iViewDeactivationObserverTwo=CViewDeactivationObserver::NewL(KViewDeactivationObserverTwoId); |
|
563 |
|
564 iViewActivationObserver_Notify=CViewActivationObserver_Notify::NewL(); |
|
565 iViewDeactivationObserver_Notify=CViewDeactivationObserver_Notify::NewL(); |
|
566 } |
|
567 |
|
568 CTestDriver::~CTestDriver() |
|
569 { |
|
570 delete iUpdateTimer; |
|
571 delete iViewActivationObserverOne; |
|
572 delete iViewDeactivationObserverOne; |
|
573 delete iViewActivationObserverTwo; |
|
574 delete iViewDeactivationObserverTwo; |
|
575 delete iViewActivationObserver_Notify; |
|
576 delete iViewDeactivationObserver_Notify; |
|
577 } |
|
578 |
|
579 void CTestDriver::Exit() |
|
580 { |
|
581 CBaActiveScheduler::Exit(); |
|
582 } |
|
583 |
|
584 void CTestDriver::RunTestL() |
|
585 { |
|
586 TInt ret=EInvalid; |
|
587 TRAPD(err,ret=DoTestL()); |
|
588 if (err!=KErrNone) |
|
589 { |
|
590 User::Leave(err); |
|
591 } |
|
592 else if (ret==EFinished) |
|
593 { |
|
594 iTestNum=KExitTestNum; |
|
595 } |
|
596 } |
|
597 |
|
598 |
|
599 TInt CTestDriver::UpdateTimerCallBackL(TAny* aThis) |
|
600 { |
|
601 CTestDriver* driver=((CTestDriver*)aThis); |
|
602 driver->RunTestL(); |
|
603 return 0; |
|
604 } |
|
605 |
|
606 |
|
607 TestState CTestDriver::DoTestL() |
|
608 { |
|
609 switch(iTestNum++) |
|
610 { |
|
611 |
|
612 |
|
613 //---------------------------------------------------------------------------------------------- |
|
614 |
|
615 /** |
|
616 @SYMTestCaseID UIF-CONE-VIEW-0014 |
|
617 @SYMPREQ Codebase |
|
618 @SYMTestCaseDesc Addition and activation of views using Cone view architecture support |
|
619 @SYMTestPriority High |
|
620 @SYMTestStatus Implemented |
|
621 @SYMTestActions The tests performed are addition of views to an application. Views 1, 2 & 5 |
|
622 are added, and activation of these views is tested (both with and without |
|
623 a custom message associated to the activation). |
|
624 In addition, the getter and setter functionality of application default |
|
625 view, and system default views are tested. |
|
626 @SYMTestType CIT |
|
627 @SYMTestExpectedResults Views are added and activated as expected with no error returned. Getter |
|
628 & setter funtions get & set accordingly too. |
|
629 */ |
|
630 |
|
631 //---------------------------------------------------------------------------------------------- |
|
632 |
|
633 case 0: |
|
634 { |
|
635 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0014")); |
|
636 INFO_PRINTF1(_L("Add views 1, 5 and 2 for client 1")); |
|
637 TEST_ASSERT(AddView(VIEW_ONE) == KErrNone, ETestFailure); |
|
638 TEST_ASSERT(AddView(VIEW_FIVE) == KErrNone, ETestFailure); |
|
639 TEST_ASSERT(AddView(VIEW_TWO) == KErrNone, ETestFailure); |
|
640 } |
|
641 break; |
|
642 |
|
643 case 1: |
|
644 { |
|
645 INFO_PRINTF1(_L("Set default view for client 1 to view 5")); |
|
646 TEST_ASSERT(SetDefaultView(VIEW_FIVE) == KErrNone, ETestFailure); |
|
647 |
|
648 TVwsViewId viewId=KNullViewId; |
|
649 INFO_PRINTF1(_L("Set default view for client 1 to view 2 and check it changed")); |
|
650 TEST_ASSERT(GetDefaultView(viewId) == KErrNone, ETestFailure); |
|
651 TEST_ASSERT(viewId == VIEW_FIVE, ETestFailure); |
|
652 |
|
653 TEST_ASSERT(SetDefaultView(VIEW_TWO) == KErrNone, ETestFailure); |
|
654 TEST_ASSERT(GetDefaultView(viewId) == KErrNone, ETestFailure); |
|
655 TEST_ASSERT(viewId == VIEW_TWO, ETestFailure); |
|
656 } |
|
657 break; |
|
658 |
|
659 case 2: |
|
660 { |
|
661 INFO_PRINTF1(_L("Set system default view for client 1 to view 1")); |
|
662 AppUi().SetSystemDefaultViewL(VIEW_ONE); |
|
663 |
|
664 TVwsViewId viewId=KNullViewId; |
|
665 INFO_PRINTF1(_L("Set system default view for client 1 to view 2 and check it changed")); |
|
666 AppUi().GetSystemDefaultViewL(viewId); |
|
667 TEST_ASSERT(viewId == VIEW_ONE, ETestFailure); |
|
668 |
|
669 AppUi().SetSystemDefaultViewL(VIEW_TWO); |
|
670 AppUi().GetSystemDefaultViewL(viewId); |
|
671 TEST_ASSERT(viewId == VIEW_TWO, ETestFailure); |
|
672 } |
|
673 break; |
|
674 |
|
675 case 3: |
|
676 { |
|
677 INFO_PRINTF1(_L("Set system default view for different modes")); |
|
678 AppUi().SetSystemDefaultViewL(VIEW_TWO); |
|
679 AppUi().SetSystemDefaultViewL(VIEW_ONE, 1); |
|
680 AppUi().SetSystemDefaultViewL(VIEW_FIVE, 2); |
|
681 |
|
682 TVwsViewId viewId=KNullViewId; |
|
683 AppUi().GetSystemDefaultViewL(viewId); |
|
684 TEST_ASSERT(viewId == VIEW_TWO, ETestFailure); // It's 2 for the current one (current = default) |
|
685 } |
|
686 break; |
|
687 |
|
688 case 5: |
|
689 { |
|
690 INFO_PRINTF1(_L("Activate view 2 with message")); |
|
691 TEST_ASSERT(ActivateView(VIEW_TWO,KUidTws0CustomMesssageId,KCustomDes) == KErrNone, ETestFailure); |
|
692 TVwsViewId activeViewId=KNullViewId; |
|
693 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
694 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
695 } |
|
696 break; |
|
697 |
|
698 case 6: |
|
699 { |
|
700 INFO_PRINTF1(_L("Remove view 5")); |
|
701 TEST_ASSERT(RemoveView(VIEW_FIVE) == KErrNone, ETestFailure); |
|
702 TVwsViewId activeViewId=KNullViewId; |
|
703 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
704 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
705 } |
|
706 break; |
|
707 |
|
708 case 7: |
|
709 { |
|
710 INFO_PRINTF1(_L("Activate top view for client 1 (expected to be view 2)")); |
|
711 TEST_ASSERT(ActivateTopView() == KErrNone, ETestFailure); |
|
712 TVwsViewId activeViewId=KNullViewId; |
|
713 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
714 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
715 } |
|
716 break; |
|
717 |
|
718 case 8: |
|
719 { |
|
720 INFO_PRINTF1(_L("Activate view 1 with message")); |
|
721 TEST_ASSERT(ActivateView(VIEW_ONE,KUidTws0CustomMesssageId,KCustomDes) == KErrNone, ETestFailure); |
|
722 TVwsViewId activeViewId=KNullViewId; |
|
723 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
724 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
725 iStep->RecordTestResultL(); |
|
726 break; |
|
727 } |
|
728 |
|
729 |
|
730 //---------------------------------------------------------------------------------------------- |
|
731 |
|
732 /** |
|
733 @SYMTestCaseID UIF-CONE-VIEW-0015 |
|
734 @SYMPREQ Codebase |
|
735 @SYMTestCaseDesc Control notification in views using Cone view architecture support |
|
736 @SYMTestPriority High |
|
737 @SYMTestStatus Implemented |
|
738 @SYMTestActions The tests performs a simulation of EKeyEvents sent to the application to check |
|
739 how both test controls (Top & Bottom) receive them, as well as the AppUi control. |
|
740 A counter is increased everytime the key is processed, and usually the key |
|
741 is never consumed, hence it goes to the next control in the loop. Just some specific |
|
742 EKeyEvents are consumed to check that the next control do not receive it. |
|
743 In addition, priorities and flags are updated to test the notifications are |
|
744 still correctly received. |
|
745 Change of active view is also tested. |
|
746 @SYMTestType CIT |
|
747 @SYMTestExpectedResults Controls receive notifications as expected depending of their flags and / or |
|
748 priorities. |
|
749 */ |
|
750 |
|
751 //---------------------------------------------------------------------------------------------- |
|
752 |
|
753 case 20: |
|
754 { |
|
755 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0015")); |
|
756 INFO_PRINTF1(_L("Simulate normal key event 'A'")); |
|
757 TEST_ASSERT(SimulateKeyEvent('A') == KErrNone, ETestFailure); |
|
758 } |
|
759 break; |
|
760 |
|
761 case 21: |
|
762 { |
|
763 INFO_PRINTF1(_L("All controls must have received the notification, as none consumed it")); |
|
764 TEST_ASSERT(gTopControl == 1, ETestFailure); |
|
765 TEST_ASSERT(gBottomControl == 1, ETestFailure); |
|
766 TEST_ASSERT(gAppUiControl == 1, ETestFailure); |
|
767 } |
|
768 break; |
|
769 |
|
770 case 22: |
|
771 { |
|
772 INFO_PRINTF1(_L("Lower BottomControl priority for active view")); |
|
773 TEST_ASSERT(UpdateActiveViewPriorities() == KErrNone, ETestFailure); |
|
774 } |
|
775 break; |
|
776 |
|
777 case 23: |
|
778 { |
|
779 INFO_PRINTF1(_L("Simulate normal key event 'B'")); |
|
780 TEST_ASSERT(SimulateKeyEvent('B') == KErrNone, ETestFailure); |
|
781 } |
|
782 break; |
|
783 |
|
784 case 24: |
|
785 { |
|
786 INFO_PRINTF1(_L("All controls must have received the notification, as none consumed it")); |
|
787 TEST_ASSERT(gTopControl == 2, ETestFailure); |
|
788 TEST_ASSERT(gBottomControl == 2, ETestFailure); |
|
789 TEST_ASSERT(gAppUiControl == 2, ETestFailure); |
|
790 } |
|
791 break; |
|
792 |
|
793 case 25: |
|
794 { |
|
795 INFO_PRINTF1(_L("Simulate normal key event 'C' (consumed by one of the controls!)")); |
|
796 TEST_ASSERT(SimulateKeyEvent('C') == KErrNone, ETestFailure); |
|
797 } |
|
798 break; |
|
799 |
|
800 case 26: |
|
801 { |
|
802 INFO_PRINTF1(_L("BottomControl does not receive the key, as it's consumed by TopControl which has higher priority")); |
|
803 TEST_ASSERT(gTopControl == 3, ETestFailure); |
|
804 TEST_ASSERT(gBottomControl == 2, ETestFailure); |
|
805 TEST_ASSERT(gAppUiControl == 2, ETestFailure); |
|
806 } |
|
807 break; |
|
808 |
|
809 case 27: |
|
810 { |
|
811 INFO_PRINTF1(_L("Simulate normal key event 'U' (consumed by AppUi control!)")); |
|
812 TEST_ASSERT(SimulateKeyEvent('U') == KErrNone, ETestFailure); |
|
813 } |
|
814 break; |
|
815 |
|
816 case 28: |
|
817 { |
|
818 INFO_PRINTF1(_L("AppUi consumes the key, but other Bottom and Top still receive it")); |
|
819 TEST_ASSERT(gTopControl == 4, ETestFailure); |
|
820 TEST_ASSERT(gBottomControl == 3, ETestFailure); |
|
821 TEST_ASSERT(gAppUiControl == 3, ETestFailure); |
|
822 } |
|
823 break; |
|
824 |
|
825 case 29: |
|
826 { |
|
827 INFO_PRINTF1(_L("Activate view 2")); |
|
828 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
829 TVwsViewId activeViewId=KNullViewId; |
|
830 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
831 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
832 } |
|
833 break; |
|
834 |
|
835 case 30: |
|
836 { |
|
837 INFO_PRINTF1(_L("Simulate normal key event 'D'")); |
|
838 TEST_ASSERT(SimulateKeyEvent('D') == KErrNone, ETestFailure); |
|
839 } |
|
840 break; |
|
841 |
|
842 case 31: |
|
843 { |
|
844 INFO_PRINTF1(_L("All controls must have received the notification, as none consumed it")); |
|
845 TEST_ASSERT(gTopControl == 5, ETestFailure); |
|
846 TEST_ASSERT(gBottomControl == 4, ETestFailure); |
|
847 TEST_ASSERT(gAppUiControl == 4, ETestFailure); |
|
848 } |
|
849 break; |
|
850 |
|
851 case 32: |
|
852 { |
|
853 INFO_PRINTF1(_L("Update stacking flags for active view. TopControl refuses all key events")); |
|
854 TEST_ASSERT(UpdateActiveViewStackingFlags() == KErrNone, ETestFailure); |
|
855 } |
|
856 break; |
|
857 |
|
858 case 33: |
|
859 { |
|
860 INFO_PRINTF1(_L("Simulate normal key event 'E'")); |
|
861 TEST_ASSERT(SimulateKeyEvent('E') == KErrNone, ETestFailure); |
|
862 } |
|
863 break; |
|
864 |
|
865 case 34: |
|
866 { |
|
867 INFO_PRINTF1(_L("TopControl refuses all key event, others receive it")); |
|
868 TEST_ASSERT(gTopControl == 5, ETestFailure); |
|
869 TEST_ASSERT(gBottomControl == 5, ETestFailure); |
|
870 TEST_ASSERT(gAppUiControl == 5, ETestFailure); |
|
871 } |
|
872 break; |
|
873 |
|
874 case 35: |
|
875 { |
|
876 INFO_PRINTF1(_L("Simulate normal key event 'C' (consumed by one of the controls!)")); |
|
877 TEST_ASSERT(SimulateKeyEvent('C') == KErrNone, ETestFailure); |
|
878 } |
|
879 break; |
|
880 |
|
881 case 36: |
|
882 { |
|
883 INFO_PRINTF1(_L("BottomControl receives the key, as it's refused by TopControl although it has higher priority")); |
|
884 TEST_ASSERT(gTopControl == 5, ETestFailure); |
|
885 TEST_ASSERT(gBottomControl == 6, ETestFailure); |
|
886 TEST_ASSERT(gAppUiControl == 5, ETestFailure); |
|
887 iStep->RecordTestResultL(); |
|
888 } |
|
889 break; |
|
890 |
|
891 |
|
892 //---------------------------------------------------------------------------------------------- |
|
893 |
|
894 /** |
|
895 @SYMTestCaseID UIF-CONE-VIEW-0016 |
|
896 @SYMPREQ Codebase |
|
897 @SYMTestCaseDesc Negative testing using Cone view architecture support |
|
898 @SYMTestPriority High |
|
899 @SYMTestStatus Implemented |
|
900 @SYMTestActions Negative testing is implenented in this test case, with the following being done: |
|
901 - Activation of a non existing view, |
|
902 - Activation of a non existing app |
|
903 - CheckSourceOfViewSwitchL leaves with KErrUnknown if called outside of |
|
904 an implementation of MCoeView's ViewConstructL or ViewActivatedL |
|
905 - OOM testing. |
|
906 @SYMTestType CIT |
|
907 @SYMTestExpectedResults The framework behaves as expected returning the appropiate error return value. |
|
908 */ |
|
909 |
|
910 //---------------------------------------------------------------------------------------------- |
|
911 |
|
912 case 40: |
|
913 { |
|
914 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0016")); |
|
915 INFO_PRINTF1(_L("Activate view 5...ooops, it was removed (expecting to return KErrNotFound)")); |
|
916 TEST_ASSERT(ActivateView(VIEW_FIVE, TUid::Null(), KNullDes) == KErrNotFound, ETestFailure); |
|
917 TVwsViewId activeViewId=KNullViewId; |
|
918 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
919 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); // it doesn't change, so still view 2 |
|
920 } |
|
921 break; |
|
922 |
|
923 case 41: |
|
924 { |
|
925 INFO_PRINTF1(_L("Activate missing app (expecting to return KErrNotFound)")); |
|
926 const TUid KUidPasswordMode={268435755}; // This UID defined in Uikon. Not an app. |
|
927 TEST_ASSERT(ActivateView(TVwsViewId(KUidPasswordMode, KUidTViewOne), TUid::Null(), KNullDes) == KErrNotFound, ETestFailure); |
|
928 TVwsViewId activeViewId=KNullViewId; |
|
929 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
930 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); // it doesn't change, so still view 2 |
|
931 } |
|
932 break; |
|
933 |
|
934 case 42: |
|
935 { |
|
936 INFO_PRINTF1(_L("Activate view 1")); |
|
937 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
938 |
|
939 TVwsViewId activeViewId=KNullViewId; |
|
940 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
941 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
942 |
|
943 TVwsViewId viewId=KNullViewId; |
|
944 AppUi().GetSystemDefaultViewL(viewId); |
|
945 TEST_ASSERT(viewId == VIEW_TWO, ETestFailure); |
|
946 } |
|
947 break; |
|
948 |
|
949 case 43: |
|
950 { |
|
951 /* |
|
952 PLEASE NOTE: |
|
953 This test case is related to DEF092434: Removing a view (which is active & system default) results in some confussion, |
|
954 which was rejectes as "Not Going To Fix", as it was thought to be too complicated to solve without a Break Request |
|
955 |
|
956 Include it whenever/if it is fixed later on |
|
957 |
|
958 INFO_PRINTF1(_L("Remove view 1 (normally it should panic, but it doesn't as it is the default system view too...(although for another mode!)")); |
|
959 TEST_ASSERT(RemoveView(VIEW_ONE) == KErrNone); |
|
960 |
|
961 TVwsViewId activeViewId=KNullViewId; |
|
962 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone); |
|
963 TEST_ASSERT(activeViewId.iViewUid.iUid != KUidTViewOneValue); |
|
964 INFO_PRINTF2(_L("activeViewId.iViewUid.iUid = %d"), activeViewId.iViewUid.iUid); |
|
965 |
|
966 TVwsViewId viewId=KNullViewId; |
|
967 AppUi().GetSystemDefaultViewL(viewId); |
|
968 TEST_ASSERT(viewId == VIEW_TWO); // view one was systemdefault view for aMode=1... */ |
|
969 } |
|
970 break; |
|
971 |
|
972 case 44: |
|
973 { |
|
974 INFO_PRINTF1(_L("Add view 2 for client 1 (which already has this view 2!)")); |
|
975 TEST_ASSERT(AddView(VIEW_TWO) == KErrNone, ETestFailure); |
|
976 } |
|
977 break; |
|
978 |
|
979 case 45: |
|
980 { |
|
981 INFO_PRINTF1(_L("Perform OOM testing over ActivateViewL")); |
|
982 TEST_ASSERT(TestActivateViewOOM(VIEW_TWO,KUidTws0CustomMesssageId,KCustomDes) == KErrNone, ETestFailure); |
|
983 } |
|
984 break; |
|
985 |
|
986 case 46: |
|
987 { |
|
988 INFO_PRINTF1(_L("Perform OOM testing over AddViewL")); |
|
989 TEST_ASSERT(TestAddViewOOML(VIEW_FIVE) == KErrNone, ETestFailure); |
|
990 } |
|
991 break; |
|
992 |
|
993 case 47: |
|
994 { |
|
995 TInt r = 0; |
|
996 INFO_PRINTF1(_L("Calling CheckSourceOfViewSwitchL with a valid TVendorId...")); |
|
997 TRAPD(err, r = AppUi().CheckSourceOfViewSwitchL(TSecurityPolicy(TVendorId(0x70000001)))); |
|
998 INFO_PRINTF3(_L("...leave error value ='%d', expected one ='%d'"), err, KErrUnknown); |
|
999 TEST_ASSERT(err == KErrUnknown, ETestFailure); |
|
1000 INFO_PRINTF2(_L("...return value ='%d'"), r); |
|
1001 TEST_ASSERT(!r, ETestFailure); |
|
1002 |
|
1003 INFO_PRINTF1(_L("Calling CheckSourceOfViewSwitchL with an invalid TVendorId...")); |
|
1004 TRAP(err, r = AppUi().CheckSourceOfViewSwitchL(TSecurityPolicy(TVendorId(0x70000002)))); |
|
1005 INFO_PRINTF3(_L("...leave error value ='%d', expected one ='%d'"), err, KErrUnknown); |
|
1006 TEST_ASSERT(err == KErrUnknown, ETestFailure); |
|
1007 INFO_PRINTF2(_L("...return value ='%d'"), r); |
|
1008 TEST_ASSERT(!r, ETestFailure); |
|
1009 iStep->RecordTestResultL(); |
|
1010 } |
|
1011 break; |
|
1012 |
|
1013 |
|
1014 //---------------------------------------------------------------------------------------------- |
|
1015 |
|
1016 /** |
|
1017 @SYMTestCaseID UIF-CONE-VIEW-0017 |
|
1018 @SYMPREQ Codebase |
|
1019 @SYMTestCaseDesc Add view activation and deactivation observers using Cone view architecture support |
|
1020 @SYMTestPriority High |
|
1021 @SYMTestStatus Implemented |
|
1022 @SYMTestActions Observers are added to the application to check the correct observers are notified. |
|
1023 A counter is increased everytime the observer is notified, so the test performs |
|
1024 several view activations and deactivations to check that they are hit correctly. |
|
1025 Also observers that call NotifyNextActivation are used, which should only be hit |
|
1026 once. |
|
1027 In addition, several consecutive activations (with and without message) are tested |
|
1028 to test multiple activations |
|
1029 @SYMTestType CIT |
|
1030 @SYMTestExpectedResults For each view activation and deactivation the correct observers are notified and |
|
1031 the counter associated to them corresponds with the expected value. |
|
1032 */ |
|
1033 |
|
1034 //---------------------------------------------------------------------------------------------- |
|
1035 |
|
1036 case 50: |
|
1037 { |
|
1038 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0017")); |
|
1039 INFO_PRINTF1(_L("Activate view 2")); |
|
1040 TEST_ASSERT(ActivateView(VIEW_TWO, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1041 TVwsViewId activeViewId=KNullViewId; |
|
1042 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1043 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1044 } |
|
1045 break; |
|
1046 |
|
1047 case 51: |
|
1048 { |
|
1049 INFO_PRINTF1(_L("Add view activation / deactivation observers")); |
|
1050 TEST_ASSERT(AddViewActivationObserverOne() == KErrNone, ETestFailure); |
|
1051 TEST_ASSERT(AddViewActivationObserverTwo() == KErrNone, ETestFailure); |
|
1052 TEST_ASSERT(AddViewDeactivationObserverOne() == KErrNone, ETestFailure); |
|
1053 TEST_ASSERT(AddViewDeactivationObserverTwo() == KErrNone, ETestFailure); |
|
1054 } |
|
1055 break; |
|
1056 |
|
1057 case 52: |
|
1058 { |
|
1059 INFO_PRINTF1(_L("Add view 1 again for client 1 as it was previously removed")); |
|
1060 TEST_ASSERT(AddView(VIEW_ONE) == KErrNone, ETestFailure); |
|
1061 } |
|
1062 break; |
|
1063 |
|
1064 case 53: |
|
1065 { |
|
1066 INFO_PRINTF1(_L("No activations / deactivations have been notified")); |
|
1067 TEST_ASSERT(gViewActivationObserverOne == 0, ETestFailure); |
|
1068 TEST_ASSERT(gViewDeactivationObserverOne == 0, ETestFailure); |
|
1069 TEST_ASSERT(gViewActivationObserverTwo == 0, ETestFailure); |
|
1070 TEST_ASSERT(gViewDeactivationObserverTwo == 0, ETestFailure); |
|
1071 TEST_ASSERT(gViewActivationObserverNotify == 0, ETestFailure); |
|
1072 TEST_ASSERT(gViewDeactivationObserverNotify == 0, ETestFailure); |
|
1073 } |
|
1074 break; |
|
1075 |
|
1076 case 54: |
|
1077 { |
|
1078 INFO_PRINTF1(_L("Activate view 1")); |
|
1079 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1080 TVwsViewId activeViewId=KNullViewId; |
|
1081 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1082 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1083 } |
|
1084 break; |
|
1085 |
|
1086 case 55: |
|
1087 { |
|
1088 INFO_PRINTF1(_L("Both observer 1 & 2 have been notified of activation / deactivation")); |
|
1089 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1090 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1091 TEST_ASSERT(gViewActivationObserverTwo == 1, ETestFailure); |
|
1092 TEST_ASSERT(gViewDeactivationObserverTwo == 1, ETestFailure); |
|
1093 TEST_ASSERT(gViewActivationObserverNotify == 0, ETestFailure); |
|
1094 TEST_ASSERT(gViewDeactivationObserverNotify == 0, ETestFailure); |
|
1095 } |
|
1096 break; |
|
1097 |
|
1098 case 56: |
|
1099 { |
|
1100 INFO_PRINTF1(_L("Remove view activation / deactivation observer one")); |
|
1101 TEST_ASSERT(RemoveViewDeactivationObserverOne() == KErrNone, ETestFailure); |
|
1102 TEST_ASSERT(RemoveViewActivationObserverOne() == KErrNone, ETestFailure); |
|
1103 } |
|
1104 break; |
|
1105 |
|
1106 case 57: |
|
1107 { |
|
1108 INFO_PRINTF1(_L("Activate view 2")); |
|
1109 TEST_ASSERT(ActivateView(VIEW_TWO, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1110 TVwsViewId activeViewId=KNullViewId; |
|
1111 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1112 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1113 } |
|
1114 break; |
|
1115 |
|
1116 case 58: |
|
1117 { |
|
1118 INFO_PRINTF1(_L("Check activations / deactivations have been notified for observer two")); |
|
1119 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1120 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1121 TEST_ASSERT(gViewActivationObserverTwo == 2, ETestFailure); |
|
1122 TEST_ASSERT(gViewDeactivationObserverTwo == 2, ETestFailure); |
|
1123 TEST_ASSERT(gViewActivationObserverNotify == 0, ETestFailure); |
|
1124 TEST_ASSERT(gViewDeactivationObserverNotify == 0, ETestFailure); |
|
1125 } |
|
1126 break; |
|
1127 |
|
1128 case 59: |
|
1129 { |
|
1130 INFO_PRINTF1(_L("Notify next activation")); |
|
1131 TEST_ASSERT(NotifyActivation() == KErrNone, ETestFailure); |
|
1132 } |
|
1133 break; |
|
1134 |
|
1135 case 60: |
|
1136 { |
|
1137 INFO_PRINTF1(_L("Activate view 1")); |
|
1138 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1139 TVwsViewId activeViewId=KNullViewId; |
|
1140 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1141 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1142 } |
|
1143 break; |
|
1144 |
|
1145 case 61: |
|
1146 { |
|
1147 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1148 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1149 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1150 TEST_ASSERT(gViewActivationObserverTwo == 3, ETestFailure); |
|
1151 TEST_ASSERT(gViewDeactivationObserverTwo == 3, ETestFailure); |
|
1152 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1153 TEST_ASSERT(gViewDeactivationObserverNotify == 0, ETestFailure); |
|
1154 } |
|
1155 break; |
|
1156 |
|
1157 case 62: |
|
1158 { |
|
1159 INFO_PRINTF1(_L("Notify next deactivation")); |
|
1160 TEST_ASSERT(NotifyDeactivation() == KErrNone, ETestFailure); |
|
1161 } |
|
1162 break; |
|
1163 |
|
1164 case 63: |
|
1165 { |
|
1166 INFO_PRINTF1(_L("Activate view 2")); |
|
1167 TEST_ASSERT(ActivateView(VIEW_TWO, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1168 TVwsViewId activeViewId=KNullViewId; |
|
1169 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1170 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1171 } |
|
1172 break; |
|
1173 |
|
1174 case 64: |
|
1175 { |
|
1176 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1177 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1178 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1179 TEST_ASSERT(gViewActivationObserverTwo == 4, ETestFailure); |
|
1180 TEST_ASSERT(gViewDeactivationObserverTwo == 4, ETestFailure); |
|
1181 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1182 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1183 } |
|
1184 break; |
|
1185 |
|
1186 case 65: |
|
1187 { |
|
1188 INFO_PRINTF1(_L("Activate view 1, 2, 1, 2 ... test multiple activations")); |
|
1189 TEST_ASSERT(ActivateView(VIEW_ONE,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1190 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1191 TEST_ASSERT(ActivateView(VIEW_ONE,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1192 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1193 TEST_ASSERT(ActivateView(VIEW_ONE,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1194 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1195 TEST_ASSERT(ActivateView(VIEW_ONE,KUidTws0CustomMesssageId,KNullDes) == KErrNone, ETestFailure); |
|
1196 TEST_ASSERT(ActivateView(VIEW_TWO,KUidTws0CustomMesssageId,KNullDes) == KErrNone, ETestFailure); |
|
1197 TEST_ASSERT(ActivateView(VIEW_ONE,KUidTws0CustomMesssageId,KNullDes) == KErrNone, ETestFailure); |
|
1198 TEST_ASSERT(ActivateView(VIEW_TWO,KUidTws0CustomMesssageId,KNullDes) == KErrNone, ETestFailure); |
|
1199 TEST_ASSERT(ActivateView(VIEW_ONE,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1200 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1201 TEST_ASSERT(ActivateView(VIEW_ONE,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1202 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1203 } |
|
1204 break; |
|
1205 |
|
1206 case 66: |
|
1207 { |
|
1208 INFO_PRINTF1(_L("Check activations / deactivations have been notified for observer two")); |
|
1209 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1210 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1211 TEST_ASSERT(gViewActivationObserverTwo == 18, ETestFailure); |
|
1212 TEST_ASSERT(gViewDeactivationObserverTwo == 18, ETestFailure); |
|
1213 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1214 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1215 iStep->RecordTestResultL(); |
|
1216 } |
|
1217 break; |
|
1218 |
|
1219 |
|
1220 //---------------------------------------------------------------------------------------------- |
|
1221 |
|
1222 /** |
|
1223 @SYMTestCaseID UIF-CONE-VIEW-0018 |
|
1224 @SYMPREQ Codebase |
|
1225 @SYMTestCaseDesc Registers a pseudo-view for the application using Cone view architecture support |
|
1226 @SYMTestPriority High |
|
1227 @SYMTestStatus Implemented |
|
1228 @SYMTestActions The test implements the registration of a pseudo-view after removing view 1. Once |
|
1229 this pseudo-view is in place, check that activating and deactivating it works as |
|
1230 expected. |
|
1231 EKeyEvents are sent and controls are check to make sure the correct ones have been hit, |
|
1232 while the pseudo-view is active and while not. |
|
1233 In addition, the number of observers notifications is checked. |
|
1234 @SYMTestType CIT |
|
1235 @SYMTestExpectedResults The pseudo-view is correctly added and activated. Also the correct observers and controls |
|
1236 are notified and the counter associated to them corresponds with the expected value. |
|
1237 */ |
|
1238 |
|
1239 //---------------------------------------------------------------------------------------------- |
|
1240 |
|
1241 case 80: |
|
1242 { |
|
1243 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0018")); |
|
1244 INFO_PRINTF1(_L("Remove view 1 (should be OK as it's not the active one)")); |
|
1245 TEST_ASSERT(RemoveView(VIEW_ONE) == KErrNone, ETestFailure); |
|
1246 |
|
1247 TVwsViewId activeViewId=KNullViewId; |
|
1248 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1249 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1250 } |
|
1251 break; |
|
1252 |
|
1253 case 81: |
|
1254 { |
|
1255 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1256 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1257 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1258 TEST_ASSERT(gViewActivationObserverTwo == 18, ETestFailure); |
|
1259 TEST_ASSERT(gViewDeactivationObserverTwo == 18, ETestFailure); |
|
1260 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1261 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1262 } |
|
1263 break; |
|
1264 |
|
1265 case 82: |
|
1266 { |
|
1267 INFO_PRINTF1(_L("Simulate normal key event 'Z'")); |
|
1268 TEST_ASSERT(SimulateKeyEvent('Z') == KErrNone, ETestFailure); |
|
1269 } |
|
1270 break; |
|
1271 |
|
1272 case 83: |
|
1273 { |
|
1274 INFO_PRINTF1(_L("TopControl refuses all key event, others receive it")); |
|
1275 TEST_ASSERT(gTopControl == 5, ETestFailure); |
|
1276 TEST_ASSERT(gBottomControl == 7, ETestFailure); |
|
1277 TEST_ASSERT(gAppUiControl == 6, ETestFailure); |
|
1278 } |
|
1279 break; |
|
1280 |
|
1281 case 84: |
|
1282 { |
|
1283 INFO_PRINTF1(_L("Add application view ('pseudo' view)")); |
|
1284 TEST_ASSERT(AddApplicationView() == KErrNone, ETestFailure); |
|
1285 } |
|
1286 break; |
|
1287 |
|
1288 case 85: |
|
1289 { |
|
1290 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1291 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1292 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1293 TEST_ASSERT(gViewActivationObserverTwo == 18, ETestFailure); |
|
1294 TEST_ASSERT(gViewDeactivationObserverTwo == 18, ETestFailure); |
|
1295 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1296 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1297 } |
|
1298 break; |
|
1299 |
|
1300 case 86: |
|
1301 { |
|
1302 INFO_PRINTF1(_L("Activate application view")); |
|
1303 TEST_ASSERT(ActivateApplicationView() == KErrNone, ETestFailure); |
|
1304 |
|
1305 TVwsViewId activeViewId=KNullViewId; |
|
1306 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1307 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewAppOneValue, ETestFailure); |
|
1308 TEST_ASSERT(activeViewId.iAppUid.iUid == KUidTViewAppOneValue, ETestFailure); |
|
1309 } |
|
1310 break; |
|
1311 |
|
1312 case 87: |
|
1313 { |
|
1314 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1315 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1316 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1317 TEST_ASSERT(gViewActivationObserverTwo == 19, ETestFailure); |
|
1318 TEST_ASSERT(gViewDeactivationObserverTwo == 19, ETestFailure); |
|
1319 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1320 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1321 } |
|
1322 break; |
|
1323 |
|
1324 case 88: |
|
1325 { |
|
1326 INFO_PRINTF1(_L("Simulate normal key event 'Y'")); |
|
1327 TEST_ASSERT(SimulateKeyEvent('Y') == KErrNone, ETestFailure); |
|
1328 } |
|
1329 break; |
|
1330 |
|
1331 case 89: |
|
1332 { |
|
1333 INFO_PRINTF1(_L("Just AppUi receives the key event")); |
|
1334 TEST_ASSERT(gTopControl == 5, ETestFailure); |
|
1335 TEST_ASSERT(gBottomControl == 7, ETestFailure); |
|
1336 TEST_ASSERT(gAppUiControl == 7, ETestFailure); |
|
1337 } |
|
1338 break; |
|
1339 |
|
1340 case 90: |
|
1341 { |
|
1342 INFO_PRINTF1(_L("Activate view 2")); |
|
1343 TEST_ASSERT(ActivateView(VIEW_TWO,TUid::Null(),KNullDes) == KErrNone, ETestFailure); |
|
1344 TVwsViewId activeViewId=KNullViewId; |
|
1345 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1346 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1347 } |
|
1348 break; |
|
1349 |
|
1350 case 91: |
|
1351 { |
|
1352 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1353 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1354 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1355 TEST_ASSERT(gViewActivationObserverTwo == 20, ETestFailure); |
|
1356 TEST_ASSERT(gViewDeactivationObserverTwo == 20, ETestFailure); |
|
1357 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1358 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1359 } |
|
1360 break; |
|
1361 |
|
1362 case 92: |
|
1363 { |
|
1364 INFO_PRINTF1(_L("Remove application view")); |
|
1365 TEST_ASSERT(RemoveApplicationView() == KErrNone, ETestFailure); |
|
1366 TVwsViewId activeViewId=KNullViewId; |
|
1367 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1368 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1369 iStep->RecordTestResultL(); |
|
1370 } |
|
1371 break; |
|
1372 |
|
1373 |
|
1374 //---------------------------------------------------------------------------------------------- |
|
1375 |
|
1376 /** |
|
1377 @SYMTestCaseID UIF-CONE-VIEW-0019 |
|
1378 @SYMPREQ Codebase |
|
1379 @SYMTestCaseDesc Create an embedded appUi using Cone view architecture support |
|
1380 @SYMTestPriority High |
|
1381 @SYMTestStatus Implemented |
|
1382 @SYMTestActions The test implements the creation of an embedded appUi. Once this app is in place |
|
1383 views 3 and 4 are added to it. Check the activation and deactivation of these |
|
1384 views works as expected. |
|
1385 In addition, the number of observers notifications is checked. |
|
1386 It has to be noted here that when activating embedded appUi views, the current |
|
1387 active view for the normal appUi is not fully deactivated, hence no observers |
|
1388 receive notifications. |
|
1389 Note: The implementation of this test does not fully comform with the actual |
|
1390 concept of what a standard embedded appUi is. For a fully meaningful test, it |
|
1391 should be changed to be a complete embedded app. |
|
1392 have any relationship with other windows or views. |
|
1393 @SYMTestType CIT |
|
1394 @SYMTestExpectedResults The embedded is correctly created and activated. Also the correct observers |
|
1395 are notified and the counter associated to them corresponds with the expected value. |
|
1396 */ |
|
1397 |
|
1398 //---------------------------------------------------------------------------------------------- |
|
1399 |
|
1400 case 100: |
|
1401 { |
|
1402 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0019")); |
|
1403 INFO_PRINTF1(_L("Create 'embedded' appUi (not a proper embedded appUi though...)")); |
|
1404 RDebug::Print(_L("CTestDriver case100: Create 'embedded' appUi (not a proper embedded appUi though...)")); |
|
1405 TEST_ASSERT(ConstructEmbeddedAppUi() == KErrNone, ETestFailure); |
|
1406 } |
|
1407 break; |
|
1408 |
|
1409 case 101: |
|
1410 { |
|
1411 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1412 RDebug::Print(_L("CTestDriver case101: Check no activations / deactivations have been notified")); |
|
1413 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1414 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1415 TEST_ASSERT(gViewActivationObserverTwo == 20, ETestFailure); |
|
1416 TEST_ASSERT(gViewDeactivationObserverTwo == 20, ETestFailure); |
|
1417 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1418 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1419 } |
|
1420 break; |
|
1421 |
|
1422 case 102: |
|
1423 { |
|
1424 INFO_PRINTF1(_L("Add views 3 and 4 for embedded appUi")); |
|
1425 RDebug::Print(_L("CTestDriver case102: Add views 3 and 4 for embedded appUi")); |
|
1426 TEST_ASSERT(AddView(VIEW_THREE,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1427 TEST_ASSERT(AddView(VIEW_FOUR,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1428 } |
|
1429 break; |
|
1430 |
|
1431 case 103: |
|
1432 { |
|
1433 INFO_PRINTF1(_L("Set default view for embedded appUi to view 3")); |
|
1434 RDebug::Print(_L("CTestDriver case103: Set default view for embedded appUi to view 3")); |
|
1435 TEST_ASSERT(SetDefaultView(VIEW_THREE,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1436 TVwsViewId viewId=KNullViewId; |
|
1437 TEST_ASSERT(GetDefaultView(viewId,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1438 TEST_ASSERT(viewId == VIEW_THREE, ETestFailure); |
|
1439 } |
|
1440 break; |
|
1441 |
|
1442 case 104: |
|
1443 { |
|
1444 INFO_PRINTF1(_L("Check there's no activate view for embedded appUi until we activate top view (must be view 3)")); |
|
1445 RDebug::Print(_L("CTestDriver case104: Check there's no activate view for embedded appUi until we activate top view (must be view 3)")); |
|
1446 TVwsViewId activeViewId=KNullViewId; |
|
1447 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNotFound, ETestFailure); |
|
1448 TEST_ASSERT(activeViewId == KNullViewId, ETestFailure); |
|
1449 |
|
1450 TEST_ASSERT(ActivateTopView(KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1451 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1452 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewThreeValue, ETestFailure); |
|
1453 |
|
1454 INFO_PRINTF1(_L("view 2 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1455 RDebug::Print(_L("CTestDriver: view 2 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1456 activeViewId=KNullViewId; |
|
1457 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1458 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1459 } |
|
1460 break; |
|
1461 |
|
1462 case 105: |
|
1463 { |
|
1464 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1465 RDebug::Print(_L("CTestDriver case105: Check no activations / deactivations have been notified")); |
|
1466 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1467 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1468 TEST_ASSERT(gViewActivationObserverTwo == 20, ETestFailure); |
|
1469 TEST_ASSERT(gViewDeactivationObserverTwo == 20, ETestFailure); |
|
1470 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1471 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1472 } |
|
1473 break; |
|
1474 |
|
1475 case 106: |
|
1476 { |
|
1477 INFO_PRINTF1(_L("Activate view 4")); |
|
1478 RDebug::Print(_L("CTestDriver case106: Activate view 4")); |
|
1479 TEST_ASSERT(ActivateView(VIEW_FOUR,TUid::Null(),KNullDes,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1480 TVwsViewId activeViewId=KNullViewId; |
|
1481 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1482 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewFourValue, ETestFailure); |
|
1483 |
|
1484 INFO_PRINTF1(_L("view 2 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1485 RDebug::Print(_L("CTestDriver: view 2 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1486 activeViewId=KNullViewId; |
|
1487 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1488 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1489 } |
|
1490 break; |
|
1491 |
|
1492 case 107: |
|
1493 { |
|
1494 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1495 RDebug::Print(_L("CTestDriver case107: Check no activations / deactivations have been notified")); |
|
1496 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1497 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1498 TEST_ASSERT(gViewActivationObserverTwo == 20, ETestFailure); |
|
1499 TEST_ASSERT(gViewDeactivationObserverTwo == 20, ETestFailure); |
|
1500 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1501 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1502 } |
|
1503 break; |
|
1504 |
|
1505 case 108: |
|
1506 { |
|
1507 INFO_PRINTF1(_L("Add view 1 again for client 1 as it was previously removed")); |
|
1508 RDebug::Print(_L("CTestDriver case108: Add view 1 again for client 1 as it was previously removed")); |
|
1509 TEST_ASSERT(AddView(VIEW_ONE) == KErrNone, ETestFailure); |
|
1510 } |
|
1511 break; |
|
1512 |
|
1513 case 109: |
|
1514 { |
|
1515 INFO_PRINTF1(_L("Activate view 1")); |
|
1516 RDebug::Print(_L("CTestDriver case109: Activate view 1")); |
|
1517 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1518 TVwsViewId activeViewId=KNullViewId; |
|
1519 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1520 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1521 |
|
1522 INFO_PRINTF1(_L("embedded appUi views are not active")); |
|
1523 RDebug::Print(_L("CTestDriver: embedded appUi views are not active")); |
|
1524 activeViewId=KNullViewId; |
|
1525 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNotFound, ETestFailure); |
|
1526 TEST_ASSERT(activeViewId == KNullViewId, ETestFailure); |
|
1527 } |
|
1528 break; |
|
1529 |
|
1530 case 110: |
|
1531 { |
|
1532 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1533 RDebug::Print(_L("CTestDriver case110: Check correct activations / deactivations have been notified")); |
|
1534 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1535 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1536 TEST_ASSERT(gViewActivationObserverTwo == 21, ETestFailure); |
|
1537 TEST_ASSERT(gViewDeactivationObserverTwo == 21, ETestFailure); |
|
1538 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1539 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1540 } |
|
1541 break; |
|
1542 |
|
1543 case 111: |
|
1544 { |
|
1545 INFO_PRINTF1(_L("Activate view 2")); |
|
1546 RDebug::Print(_L("CTestDriver case111: Activate view 2")); |
|
1547 TEST_ASSERT(ActivateView(VIEW_TWO, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1548 TVwsViewId activeViewId=KNullViewId; |
|
1549 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1550 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1551 |
|
1552 INFO_PRINTF1(_L("embedded appUi views are not active")); |
|
1553 RDebug::Print(_L("CTestDriver: embedded appUi views are not active")); |
|
1554 activeViewId=KNullViewId; |
|
1555 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNotFound, ETestFailure); |
|
1556 TEST_ASSERT(activeViewId == KNullViewId, ETestFailure); |
|
1557 } |
|
1558 break; |
|
1559 |
|
1560 case 112: |
|
1561 { |
|
1562 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1563 RDebug::Print(_L("CTestDriver case112: Check correct activations / deactivations have been notified")); |
|
1564 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1565 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1566 TEST_ASSERT(gViewActivationObserverTwo == 22, ETestFailure); |
|
1567 TEST_ASSERT(gViewDeactivationObserverTwo == 22, ETestFailure); |
|
1568 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1569 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1570 } |
|
1571 break; |
|
1572 |
|
1573 case 113: |
|
1574 { |
|
1575 INFO_PRINTF1(_L("Activate view 1")); |
|
1576 RDebug::Print(_L("CTestDriver case113: Activate view 1")); |
|
1577 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1578 TVwsViewId activeViewId=KNullViewId; |
|
1579 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1580 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1581 |
|
1582 INFO_PRINTF1(_L("embedded appUi views are not active")); |
|
1583 RDebug::Print(_L("CTestDriver: embedded appUi views are not active")); |
|
1584 activeViewId=KNullViewId; |
|
1585 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNotFound, ETestFailure); |
|
1586 TEST_ASSERT(activeViewId == KNullViewId, ETestFailure); |
|
1587 } |
|
1588 break; |
|
1589 |
|
1590 case 114: |
|
1591 { |
|
1592 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1593 RDebug::Print(_L("CTestDriver case114: Check correct activations / deactivations have been notified")); |
|
1594 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1595 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1596 TEST_ASSERT(gViewActivationObserverTwo == 23, ETestFailure); |
|
1597 TEST_ASSERT(gViewDeactivationObserverTwo == 23, ETestFailure); |
|
1598 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1599 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1600 } |
|
1601 break; |
|
1602 |
|
1603 case 115: |
|
1604 { |
|
1605 INFO_PRINTF1(_L("Activate view 3")); |
|
1606 RDebug::Print(_L("CTestDriver case115: Activate view 3")); |
|
1607 TEST_ASSERT(ActivateView(VIEW_THREE,TUid::Null(),KNullDes,KTVwaEmbeddedAppUiId) == KErrNone, ETestFailure); |
|
1608 TVwsViewId activeViewId=KNullViewId; |
|
1609 TEST_ASSERT(AppUi(KTVwaEmbeddedAppUiId).GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1610 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewThreeValue, ETestFailure); |
|
1611 |
|
1612 INFO_PRINTF1(_L("view 1 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1613 RDebug::Print(_L("CTestDriver: view 1 still must be active for appUi (embedded view does not fully deactive view 2)")); |
|
1614 activeViewId=KNullViewId; |
|
1615 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1616 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1617 } |
|
1618 break; |
|
1619 |
|
1620 case 116: |
|
1621 { |
|
1622 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1623 RDebug::Print(_L("CTestDriver case116: Check no activations / deactivations have been notified")); |
|
1624 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1625 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1626 TEST_ASSERT(gViewActivationObserverTwo == 23, ETestFailure); |
|
1627 TEST_ASSERT(gViewDeactivationObserverTwo == 23, ETestFailure); |
|
1628 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1629 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1630 } |
|
1631 break; |
|
1632 |
|
1633 case 117: |
|
1634 { |
|
1635 INFO_PRINTF1(_L("Destroy emdedded appUi")); |
|
1636 RDebug::Print(_L("CTestDriver case117: Destroy emdedded appUi")); |
|
1637 TEST_ASSERT(DestroyEmbeddedAppUi() == KErrNone, ETestFailure); |
|
1638 } |
|
1639 break; |
|
1640 |
|
1641 case 118: |
|
1642 { |
|
1643 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1644 RDebug::Print(_L("CTestDriver case118: Check no activations / deactivations have been notified")); |
|
1645 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1646 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1647 TEST_ASSERT(gViewActivationObserverTwo == 23, ETestFailure); |
|
1648 TEST_ASSERT(gViewDeactivationObserverTwo == 23, ETestFailure); |
|
1649 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1650 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1651 iStep->RecordTestResultL(); |
|
1652 } |
|
1653 break; |
|
1654 |
|
1655 |
|
1656 //---------------------------------------------------------------------------------------------- |
|
1657 |
|
1658 /** |
|
1659 @SYMTestCaseID UIF-CONE-VIEW-0020 |
|
1660 @SYMPREQ Codebase |
|
1661 @SYMTestCaseDesc Notify next activation with viewId using Cone view architecture support |
|
1662 @SYMTestPriority High |
|
1663 @SYMTestStatus Implemented |
|
1664 @SYMTestActions The test implements the activation and deactivation of a view while registering an observer |
|
1665 to be notified for the next activation and deactivation, but with the difference |
|
1666 that now we only want to be notified for a certain viewId, not any of them. |
|
1667 @SYMTestType CIT |
|
1668 @SYMTestExpectedResults The appropiate observer is notified and the counter associated to them corresponds with the expected value |
|
1669 after the view with viewId is activated and / or deactivated. |
|
1670 */ |
|
1671 |
|
1672 //---------------------------------------------------------------------------------------------- |
|
1673 |
|
1674 case 130: |
|
1675 { |
|
1676 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0020")); |
|
1677 INFO_PRINTF1(_L("Activate top view for client 1 (should be a no-op)")); |
|
1678 RDebug::Print(_L("CTestDriver case130: Activate top view for client 1 (should be a no-op)")); |
|
1679 TEST_ASSERT(ActivateTopView() == KErrNone, ETestFailure); |
|
1680 TVwsViewId activeViewId=KNullViewId; |
|
1681 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1682 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1683 } |
|
1684 break; |
|
1685 |
|
1686 case 131: |
|
1687 { |
|
1688 INFO_PRINTF1(_L("Check no activations / deactivations have been notified")); |
|
1689 RDebug::Print(_L("CTestDriver case131: Check no activations / deactivations have been notified")); |
|
1690 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1691 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1692 TEST_ASSERT(gViewActivationObserverTwo == 23, ETestFailure); |
|
1693 TEST_ASSERT(gViewDeactivationObserverTwo == 23, ETestFailure); |
|
1694 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1695 TEST_ASSERT(gViewDeactivationObserverNotify == 1, ETestFailure); |
|
1696 } |
|
1697 break; |
|
1698 |
|
1699 case 132: |
|
1700 { |
|
1701 INFO_PRINTF1(_L("Notify next activation & deactivation with view id (view 1)")); |
|
1702 RDebug::Print(_L("CTestDriver case132: Notify next activation & deactivation with view id (view 1)")); |
|
1703 TEST_ASSERT(NotifyActivationWithViewId(VIEW_ONE) == KErrNone, ETestFailure); |
|
1704 TEST_ASSERT(NotifyDeactivationWithViewId(VIEW_ONE) == KErrNone, ETestFailure); |
|
1705 } |
|
1706 break; |
|
1707 |
|
1708 case 133: |
|
1709 { |
|
1710 INFO_PRINTF1(_L("Activate view 2")); |
|
1711 RDebug::Print(_L("CTestDriver case133: Activate view 2")); |
|
1712 TEST_ASSERT(ActivateView(VIEW_TWO, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1713 TVwsViewId activeViewId=KNullViewId; |
|
1714 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1715 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewTwoValue, ETestFailure); |
|
1716 } |
|
1717 break; |
|
1718 |
|
1719 case 134: |
|
1720 { |
|
1721 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified (also deactivation notifier")); |
|
1722 RDebug::Print(_L("CTestDriver case134: Check correct activations / deactivations have been notified (also deactivation notifier")); |
|
1723 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1724 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1725 TEST_ASSERT(gViewActivationObserverTwo == 24, ETestFailure); |
|
1726 TEST_ASSERT(gViewDeactivationObserverTwo == 24, ETestFailure); |
|
1727 TEST_ASSERT(gViewActivationObserverNotify == 1, ETestFailure); |
|
1728 TEST_ASSERT(gViewDeactivationObserverNotify == 2, ETestFailure); |
|
1729 } |
|
1730 break; |
|
1731 |
|
1732 case 135: |
|
1733 { |
|
1734 INFO_PRINTF1(_L("Activate view 1")); |
|
1735 RDebug::Print(_L("CTestDriver case135: Activate view 1")); |
|
1736 TEST_ASSERT(ActivateView(VIEW_ONE, TUid::Null(), KNullDes) == KErrNone, ETestFailure); |
|
1737 TVwsViewId activeViewId=KNullViewId; |
|
1738 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNone, ETestFailure); |
|
1739 TEST_ASSERT(activeViewId.iViewUid.iUid == KUidTViewOneValue, ETestFailure); |
|
1740 } |
|
1741 break; |
|
1742 |
|
1743 case 137: |
|
1744 { |
|
1745 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified (also activation notifier")); |
|
1746 RDebug::Print(_L("CTestDriver case137: Check correct activations / deactivations have been notified (also activation notifier")); |
|
1747 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1748 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1749 TEST_ASSERT(gViewActivationObserverTwo == 25, ETestFailure); |
|
1750 TEST_ASSERT(gViewDeactivationObserverTwo == 25, ETestFailure); |
|
1751 TEST_ASSERT(gViewActivationObserverNotify == 2, ETestFailure); |
|
1752 TEST_ASSERT(gViewDeactivationObserverNotify == 2, ETestFailure); |
|
1753 } |
|
1754 break; |
|
1755 |
|
1756 case 138: |
|
1757 { |
|
1758 INFO_PRINTF1(_L("Deactivate active view (results in none being active)")); |
|
1759 RDebug::Print(_L("CTestDriver case138: Deactivate active view (results in none being active)")); |
|
1760 TEST_ASSERT(DeactivateActiveView() == KErrNone, ETestFailure); |
|
1761 TVwsViewId activeViewId=KNullViewId; |
|
1762 TEST_ASSERT(AppUi().GetActiveViewId(activeViewId) == KErrNotFound, ETestFailure); |
|
1763 TEST_ASSERT(activeViewId == KNullViewId, ETestFailure); |
|
1764 } |
|
1765 break; |
|
1766 |
|
1767 case 139: |
|
1768 { |
|
1769 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1770 RDebug::Print(_L("CTestDriver case139: Check correct activations / deactivations have been notified")); |
|
1771 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1772 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1773 TEST_ASSERT(gViewActivationObserverTwo == 25, ETestFailure); |
|
1774 TEST_ASSERT(gViewDeactivationObserverTwo == 26, ETestFailure); |
|
1775 TEST_ASSERT(gViewActivationObserverNotify == 2, ETestFailure); |
|
1776 TEST_ASSERT(gViewDeactivationObserverNotify == 2, ETestFailure); |
|
1777 } |
|
1778 break; |
|
1779 |
|
1780 case 140: |
|
1781 { |
|
1782 INFO_PRINTF1(_L("Remove view 1 & 2 (should be ok as none of them is active)")); |
|
1783 RDebug::Print(_L("CTestDriver case140: Remove view 1 & 2 (should be ok as none of them is active)")); |
|
1784 TEST_ASSERT(RemoveView(VIEW_ONE) == KErrNone, ETestFailure); |
|
1785 TEST_ASSERT(RemoveView(VIEW_TWO) == KErrNone, ETestFailure); |
|
1786 } |
|
1787 break; |
|
1788 |
|
1789 case 141: |
|
1790 { |
|
1791 INFO_PRINTF1(_L("Register and Deregister view 1")); |
|
1792 RDebug::Print(_L("CTestDriver case141: Register and Deregister view 1")); |
|
1793 TEST_ASSERT(RegisterAndDeregisterView() == KErrNone, ETestFailure); |
|
1794 } |
|
1795 break; |
|
1796 |
|
1797 case 142: |
|
1798 { |
|
1799 INFO_PRINTF1(_L("Check correct activations / deactivations have been notified")); |
|
1800 RDebug::Print(_L("CTestDriver case142: Check correct activations / deactivations have been notified")); |
|
1801 TEST_ASSERT(gViewActivationObserverOne == 1, ETestFailure); |
|
1802 TEST_ASSERT(gViewDeactivationObserverOne == 1, ETestFailure); |
|
1803 TEST_ASSERT(gViewActivationObserverTwo == 25, ETestFailure); |
|
1804 TEST_ASSERT(gViewDeactivationObserverTwo == 26, ETestFailure); |
|
1805 TEST_ASSERT(gViewActivationObserverNotify == 2, ETestFailure); |
|
1806 TEST_ASSERT(gViewDeactivationObserverNotify == 2, ETestFailure); |
|
1807 iStep->RecordTestResultL(); |
|
1808 } |
|
1809 break; |
|
1810 |
|
1811 //---------------------------------------------------------------------------------------------- |
|
1812 |
|
1813 /** |
|
1814 @SYMTestCaseID UIF-CONE-VIEW-0032 |
|
1815 @SYMTestCaseDesc Check that calling RemoveViewActivationObserver with an invalid pointer does not panic |
|
1816 @SYMTestPriority High |
|
1817 @SYMTestStatus Implemented |
|
1818 @SYMTestActions Create a CViewActivationObserver object and then call |
|
1819 AppUi().RemoveViewActivationObserver with the object. Do not activate beforehand. |
|
1820 @SYMTestType CIT |
|
1821 @SYMTestExpectedResults In debug more there is a log put in the log output. |
|
1822 */ |
|
1823 case 143: |
|
1824 { |
|
1825 iStep->SetTestStepID(_L("UIF-CONE-VIEW-0032")); |
|
1826 INFO_PRINTF1(_L("Calling RemoveViewActivationObserver with invalid data")); |
|
1827 RDebug::Print(_L("CTestDriver case143: Calling RemoveViewActivationObserver with invalid data")); |
|
1828 TEST_ASSERT(TestRemoveViewActivationObserverL()==KErrNone, ETestFailure); |
|
1829 iStep->RecordTestResultL(); |
|
1830 iStep->CloseTMSGraphicsStep(); |
|
1831 } |
|
1832 break; |
|
1833 |
|
1834 //---------------------------------------------------------------------------------------------- |
|
1835 // |
|
1836 // FINISHING TEST CASES... |
|
1837 // |
|
1838 //---------------------------------------------------------------------------------------------- |
|
1839 |
|
1840 case 150: |
|
1841 INFO_PRINTF1(_L("End of valid tests cases...")); |
|
1842 RDebug::Print(_L("CTestDriver case150: End of valid tests cases...")); |
|
1843 return(EFinished); |
|
1844 //break; |
|
1845 |
|
1846 case KExitTestNum: |
|
1847 Exit(); |
|
1848 break; |
|
1849 |
|
1850 default: |
|
1851 break; |
|
1852 } |
|
1853 return(ENext); |
|
1854 } |
|
1855 |
|
1856 |
|
1857 TInt CTestDriver::SimulateKeyEvent(const TInt aCode) |
|
1858 { |
|
1859 TKeyEvent event; |
|
1860 event.iCode=aCode; |
|
1861 event.iScanCode=aCode; |
|
1862 event.iModifiers=1; |
|
1863 event.iRepeats=0; |
|
1864 |
|
1865 TRAPD(err,CCoeEnv::Static()->SimulateKeyEventL(event,EEventKey)); |
|
1866 return err; |
|
1867 } |
|
1868 |
|
1869 TInt CTestDriver::NotifyActivation() |
|
1870 { |
|
1871 AppUi().NotifyNextActivation(*iViewActivationObserver_Notify); |
|
1872 return KErrNone; |
|
1873 } |
|
1874 |
|
1875 TInt CTestDriver::NotifyDeactivation() |
|
1876 { |
|
1877 AppUi().NotifyNextDeactivation(*iViewDeactivationObserver_Notify); |
|
1878 return KErrNone; |
|
1879 } |
|
1880 |
|
1881 TInt CTestDriver::NotifyActivationWithViewId(const TVwsViewId& aViewId) |
|
1882 { |
|
1883 AppUi().NotifyNextActivation(aViewId, *iViewActivationObserver_Notify); |
|
1884 return KErrNone; |
|
1885 } |
|
1886 |
|
1887 TInt CTestDriver::NotifyDeactivationWithViewId(const TVwsViewId& aViewId) |
|
1888 { |
|
1889 AppUi().NotifyNextDeactivation(aViewId, *iViewDeactivationObserver_Notify); |
|
1890 return KErrNone; |
|
1891 } |
|
1892 |
|
1893 TInt CTestDriver::RegisterAndDeregisterView() |
|
1894 { |
|
1895 TRAPD(err, |
|
1896 CTVwaTestAppUi& appUi=AppUi(KTVwaStandardAppUiId); |
|
1897 CTestView* view=new(ELeave) CTestView(VIEW_ONE,appUi); |
|
1898 CleanupStack::PushL(view); |
|
1899 appUi.RegisterViewL(*view); |
|
1900 appUi.DeregisterView(*view); |
|
1901 CleanupStack::PopAndDestroy(view); |
|
1902 ); |
|
1903 return err; |
|
1904 } |
|
1905 |
|
1906 TInt CTestDriver::AddView(const TVwsViewId& aViewId,TInt aAppUiId) |
|
1907 { |
|
1908 TRAPD(err, |
|
1909 CTVwaTestAppUi& appUi=AppUi(aAppUiId); |
|
1910 CTestView* view=new(ELeave) CTestView(aViewId,appUi); |
|
1911 appUi.AddViewL(view); // transfers ownership at start |
|
1912 ); |
|
1913 return err; |
|
1914 } |
|
1915 |
|
1916 TInt CTestDriver::AddApplicationView() |
|
1917 { |
|
1918 TRAPD(err,AppUi().RegisterApplicationViewL(KUidTViewAppOne)); |
|
1919 return err; |
|
1920 } |
|
1921 |
|
1922 TInt CTestDriver::ActivateApplicationView() |
|
1923 { |
|
1924 TRAPD(err,iAppUi.ActivateViewL(TVwsViewId(KUidTViewAppOne,KUidTViewAppOne))); |
|
1925 return err; |
|
1926 } |
|
1927 |
|
1928 TInt CTestDriver::RemoveApplicationView() |
|
1929 { |
|
1930 TRAPD(err,AppUi().DeregisterApplicationView()); |
|
1931 return err; |
|
1932 } |
|
1933 |
|
1934 TInt CTestDriver::DeactivateActiveView() |
|
1935 { |
|
1936 TRAPD(err,iAppUi.iViewManager->iVwsSession->DeactivateActiveView()); |
|
1937 return err; |
|
1938 } |
|
1939 |
|
1940 TInt CTestDriver::ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage,TInt aAppUiId) |
|
1941 { |
|
1942 TRAPD(err,AppUi(aAppUiId).ActivateViewL(aViewId,aCustomMessageId,aCustomMessage)); |
|
1943 return err; |
|
1944 } |
|
1945 |
|
1946 TInt CTestDriver::ActivateTopView(TInt aAppUiId) |
|
1947 { |
|
1948 TRAPD(err,AppUi(aAppUiId).ActivateTopViewL()); |
|
1949 return err; |
|
1950 } |
|
1951 |
|
1952 TInt CTestDriver::SetDefaultView(const TVwsViewId& aViewId,TInt aAppUiId) |
|
1953 { |
|
1954 TRAPD(err,AppUi(aAppUiId).SetDefaultViewL(*(AppUi(aAppUiId).ViewById(aViewId)))); |
|
1955 return err; |
|
1956 } |
|
1957 |
|
1958 TInt CTestDriver::GetDefaultView(TVwsViewId& aViewId,TInt aAppUiId) |
|
1959 { |
|
1960 return AppUi(aAppUiId).GetDefaultViewId(aViewId); |
|
1961 } |
|
1962 |
|
1963 TInt CTestDriver::RemoveView(const TVwsViewId& aViewId,TInt aAppUiId) |
|
1964 { |
|
1965 TRAPD(err, |
|
1966 CTVwaTestAppUi& appUi=AppUi(aAppUiId); |
|
1967 CTestView* view=appUi.ViewById(aViewId); |
|
1968 AppUi().RemoveView(*view) |
|
1969 ); |
|
1970 return err; |
|
1971 } |
|
1972 |
|
1973 TInt CTestDriver::UpdateActiveViewStackingFlags() |
|
1974 { |
|
1975 TRAPD(err,AppUi().ActiveView()->UpdateControlStackingFlags()); |
|
1976 return err; |
|
1977 } |
|
1978 |
|
1979 TInt CTestDriver::UpdateActiveViewPriorities() |
|
1980 { |
|
1981 TRAPD(err,AppUi().ActiveView()->UpdateControlPriorityL()); |
|
1982 return err; |
|
1983 } |
|
1984 |
|
1985 TInt CTestDriver::AddViewActivationObserverOne() |
|
1986 { |
|
1987 TRAPD(err,AppUi().AddViewActivationObserverL(iViewActivationObserverOne)); |
|
1988 return err; |
|
1989 } |
|
1990 |
|
1991 TInt CTestDriver::RemoveViewActivationObserverOne() |
|
1992 { |
|
1993 TRAPD(err,AppUi().RemoveViewActivationObserver(iViewActivationObserverOne)); |
|
1994 return err; |
|
1995 } |
|
1996 |
|
1997 TInt CTestDriver::AddViewDeactivationObserverOne() |
|
1998 { |
|
1999 TRAPD(err,AppUi().AddViewDeactivationObserverL(iViewDeactivationObserverOne)); |
|
2000 return err; |
|
2001 } |
|
2002 |
|
2003 TInt CTestDriver::RemoveViewDeactivationObserverOne() |
|
2004 { |
|
2005 TRAPD(err,AppUi().RemoveViewDeactivationObserver(iViewDeactivationObserverOne)); |
|
2006 return err; |
|
2007 } |
|
2008 |
|
2009 TInt CTestDriver::AddViewActivationObserverTwo() |
|
2010 { |
|
2011 TRAPD(err,AppUi().AddViewActivationObserverL(iViewActivationObserverTwo)); |
|
2012 return err; |
|
2013 } |
|
2014 |
|
2015 TInt CTestDriver::AddViewDeactivationObserverTwo() |
|
2016 { |
|
2017 TRAPD(err,AppUi().AddViewDeactivationObserverL(iViewDeactivationObserverTwo)); |
|
2018 return err; |
|
2019 } |
|
2020 |
|
2021 /* |
|
2022 The term embedded appUi here is a missuse of the concept of embedded app. This is not a fully |
|
2023 embedded app, which means that the resulting app will not have the same behaviour as a proper |
|
2024 embedded one (for exaple, appUi and embedded appUi are sharing hte same CCoeEnv, ....). |
|
2025 */ |
|
2026 TInt CTestDriver::ConstructEmbeddedAppUi() |
|
2027 { |
|
2028 TRAPD(err, |
|
2029 iAppUiEmbedded=new(ELeave) CTVwaTestAppUi(); |
|
2030 CCoeEnv::Static()->SetAppUi(iAppUiEmbedded); |
|
2031 iAppUiEmbedded->ConstructL(&iAppUi); |
|
2032 ); |
|
2033 return err; |
|
2034 } |
|
2035 |
|
2036 TInt CTestDriver::DestroyEmbeddedAppUi() |
|
2037 { |
|
2038 TRAPD(err, |
|
2039 CCoeEnv::Static()->SetAppUi(&iAppUi); |
|
2040 delete iAppUiEmbedded; |
|
2041 ); |
|
2042 return err; |
|
2043 } |
|
2044 |
|
2045 TInt CTestDriver::TestActivateViewOOM(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage,TInt aAppUiId) |
|
2046 { |
|
2047 TInt err=KErrNoMemory; |
|
2048 TInt failRate=0; |
|
2049 for(failRate=1; err==KErrNoMemory; failRate++) |
|
2050 { |
|
2051 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
2052 __UHEAP_MARK; |
|
2053 TRAP(err, AppUi(aAppUiId).ActivateViewL(aViewId,aCustomMessageId,aCustomMessage)); |
|
2054 __UHEAP_MARKEND; |
|
2055 __UHEAP_RESET; |
|
2056 TEST_ASSERT(err==KErrNoMemory || err==KErrNone, ETestFailure); |
|
2057 } |
|
2058 INFO_PRINTF2(_L("ActivateViewL succeded after %d attempts."), failRate - 1); |
|
2059 return err; |
|
2060 } |
|
2061 |
|
2062 TInt CTestDriver::TestAddViewOOML(const TVwsViewId& aViewId,TInt aAppUiId) |
|
2063 { |
|
2064 CTVwaTestAppUi& appUi=AppUi(aAppUiId); |
|
2065 CTestView* view=new(ELeave) CTestView(aViewId,appUi); |
|
2066 CleanupStack::PushL(view); |
|
2067 |
|
2068 TInt err=KErrNoMemory; |
|
2069 TInt failRate=1; |
|
2070 for(failRate=1; err==KErrNoMemory; failRate++) |
|
2071 { |
|
2072 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
2073 __UHEAP_MARK; |
|
2074 TRAP(err, appUi.RegisterViewL(*view)); |
|
2075 TEST_ASSERT(err==KErrNoMemory || err==KErrNone, ETestFailure); |
|
2076 if (err == KErrNone) |
|
2077 { |
|
2078 appUi.DeregisterView(*view); |
|
2079 } |
|
2080 __UHEAP_MARKEND; |
|
2081 __UHEAP_RESET; |
|
2082 } |
|
2083 |
|
2084 CleanupStack::PopAndDestroy(view); |
|
2085 |
|
2086 INFO_PRINTF2(_L("AddViewL succeded after %d attempts."), failRate - 1); |
|
2087 return err; |
|
2088 } |
|
2089 |
|
2090 TInt CTestDriver::TestRemoveViewActivationObserverL() |
|
2091 { |
|
2092 CViewActivationObserver* observer; |
|
2093 observer=CViewActivationObserver::NewL(KViewActivationObserverThreeId); |
|
2094 AppUi().RemoveViewActivationObserver(observer); |
|
2095 delete observer; |
|
2096 return KErrNone; |
|
2097 } |
|
2098 |
|
2099 /************************************************************* |
|
2100 ** |
|
2101 ** CTVwaTestAppUi |
|
2102 ** |
|
2103 *************************************************************/ |
|
2104 |
|
2105 const TInt KAppViewArrayGranularity=5; |
|
2106 |
|
2107 CTVwaTestAppUi::CTVwaTestAppUi() |
|
2108 :iAppViewArray(KAppViewArrayGranularity) |
|
2109 { |
|
2110 } |
|
2111 |
|
2112 |
|
2113 TKeyResponse CTVwaTestAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) |
|
2114 { |
|
2115 return EKeyWasConsumed; |
|
2116 } |
|
2117 |
|
2118 |
|
2119 void CTVwaTestAppUi::ConstructL(CTmsTestStep* aStep, CCoeAppUi* aPrevious) |
|
2120 { |
|
2121 CCoeAppUi::ConstructL(aPrevious); |
|
2122 |
|
2123 iDriver=new (ELeave) CTestDriver(*this, aStep); |
|
2124 iDriver->ConstructL(); |
|
2125 |
|
2126 iControl=new (ELeave) CAppUiTestControl(); |
|
2127 iControl->ConstructL(); |
|
2128 AddToStackL(iControl,ECoeStackPriorityDefault-10); |
|
2129 } |
|
2130 |
|
2131 |
|
2132 void CTVwaTestAppUi::AddViewL(CTestView* aView) |
|
2133 { |
|
2134 iAppViewArray.AppendL(aView); |
|
2135 TRAPD(err,RegisterViewL(*aView)); |
|
2136 if (err) |
|
2137 { |
|
2138 iAppViewArray.Delete(TestAppUiViewIndex(*aView)); |
|
2139 User::Leave(err); |
|
2140 } |
|
2141 } |
|
2142 |
|
2143 |
|
2144 CTestView* CTVwaTestAppUi::ViewById(const TVwsViewId& aViewId) const |
|
2145 { |
|
2146 return iAppViewArray[TestAppUiViewIndex(aViewId)]; |
|
2147 } |
|
2148 |
|
2149 |
|
2150 TInt CTVwaTestAppUi::TestAppUiViewIndex(CTestView& aView) const |
|
2151 { |
|
2152 TInt pos; |
|
2153 TKeyArrayFix key(0,ECmpTInt); |
|
2154 if (iAppViewArray.Find(&aView,key,pos)==KErrNone) |
|
2155 { |
|
2156 return pos; |
|
2157 } |
|
2158 return KErrNotFound; |
|
2159 } |
|
2160 |
|
2161 |
|
2162 void CTVwaTestAppUi::ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage) |
|
2163 { |
|
2164 HBufC8* narrowMessage=HBufC8::NewLC(aCustomMessage.Size()); |
|
2165 TPtr8 ptr=narrowMessage->Des(); |
|
2166 ptr.Copy((TUint8*)aCustomMessage.Ptr(),aCustomMessage.Size()); |
|
2167 CCoeAppUi::ActivateViewL(aViewId,aCustomMessageId,narrowMessage->Des()); |
|
2168 CleanupStack::PopAndDestroy(narrowMessage); |
|
2169 } |
|
2170 |
|
2171 |
|
2172 CTVwaTestAppUi::~CTVwaTestAppUi() |
|
2173 { |
|
2174 delete iDriver; |
|
2175 const TInt numViews=iAppViewArray.Count(); |
|
2176 for (TInt ii=numViews-1;ii>=0;--ii) |
|
2177 { |
|
2178 CTestView* thisView=iAppViewArray[ii]; |
|
2179 DeregisterView(*thisView); |
|
2180 iAppViewArray.Delete(ii); |
|
2181 delete thisView; |
|
2182 } |
|
2183 RemoveFromStack(iControl); |
|
2184 delete iControl; |
|
2185 } |
|
2186 |
|
2187 |
|
2188 TInt CTVwaTestAppUi::TestAppUiViewIndex(const TVwsViewId& aViewId) const |
|
2189 { |
|
2190 const TInt numAppViews=iAppViewArray.Count(); |
|
2191 for (TInt ii=0;ii<numAppViews;ii++) |
|
2192 { |
|
2193 if (iAppViewArray[ii]->ViewId()==aViewId) |
|
2194 return ii; |
|
2195 } |
|
2196 return KErrNotFound; |
|
2197 } |
|
2198 |
|
2199 |
|
2200 void CTVwaTestAppUi::RemoveView(CTestView& aView) |
|
2201 { |
|
2202 const TInt viewIndex=TestAppUiViewIndex(aView); |
|
2203 TEST_ASSERT(viewIndex!=KErrNotFound, ETestFailure); |
|
2204 DeregisterView(aView); |
|
2205 delete iAppViewArray[viewIndex]; |
|
2206 iAppViewArray.Delete(viewIndex); |
|
2207 } |
|
2208 |
|
2209 |
|
2210 CTestView* CTVwaTestAppUi::ActiveView() const |
|
2211 { |
|
2212 TVwsViewId activeViewId=KNullViewId; |
|
2213 if (GetActiveViewId(activeViewId)==KErrNone) |
|
2214 { |
|
2215 return iAppViewArray[TestAppUiViewIndex(activeViewId)]; |
|
2216 } |
|
2217 return NULL; |
|
2218 } |
|
2219 |
|
2220 |
|
2221 /************************************************************* |
|
2222 ** |
|
2223 ** CTVwaStep |
|
2224 ** |
|
2225 *************************************************************/ |
|
2226 |
|
2227 void CTVwaStep::ConstructAppL(CCoeEnv* aCoe) |
|
2228 { // runs inside a TRAP harness |
|
2229 aCoe->ConstructL(); |
|
2230 CTVwaTestAppUi* appUi=new(ELeave) CTVwaTestAppUi(); |
|
2231 aCoe->SetAppUi(appUi); |
|
2232 appUi->ConstructL(this); |
|
2233 } |
|
2234 |
|
2235 CTVwaStep::~CTVwaStep() |
|
2236 { |
|
2237 } |
|
2238 |
|
2239 CTVwaStep::CTVwaStep() |
|
2240 { |
|
2241 SetTestStepName(KTVwaStep); |
|
2242 } |
|
2243 |
|
2244 TVerdict CTVwaStep::doTestStepL() |
|
2245 { |
|
2246 INFO_PRINTF1(_L("Test Started")); |
|
2247 PreallocateHALBuffer(); |
|
2248 |
|
2249 // initialise notification checkers |
|
2250 gViewActivationObserverOne = 0; |
|
2251 gViewDeactivationObserverOne = 0; |
|
2252 gViewActivationObserverTwo = 0; |
|
2253 gViewDeactivationObserverTwo = 0; |
|
2254 gViewActivationObserverNotify = 0; |
|
2255 gViewDeactivationObserverNotify = 0; |
|
2256 // initialise control checkers |
|
2257 gTopControl = 0; |
|
2258 gBottomControl = 0; |
|
2259 gAppUiControl = 0; |
|
2260 |
|
2261 __UHEAP_MARK; |
|
2262 |
|
2263 CCoeEnv* coe=new CCoeEnv; |
|
2264 TRAPD(err,ConstructAppL(coe)); |
|
2265 TEST(err==KErrNone); |
|
2266 if (!err) |
|
2267 coe->ExecuteD(); |
|
2268 |
|
2269 __UHEAP_MARKEND; |
|
2270 |
|
2271 INFO_PRINTF1(_L("Test Finished")); |
|
2272 return TestStepResult(); |
|
2273 } |
|
2274 |
|
2275 |
|
2276 |