|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file contains testclass implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 // [INCLUDE FILES] - do not remove |
|
19 #include <e32svr.h> |
|
20 #include <StifParser.h> |
|
21 #include <StifTestInterface.h> |
|
22 #include "TSanimctrl.h" |
|
23 |
|
24 #include <centralrepository.h> |
|
25 |
|
26 #include <profile.hrh> |
|
27 #include <profileenginesdkcrkeys.h> |
|
28 |
|
29 //#include "sanimstartupctrltestsuite.h" |
|
30 #include "sanimmockview.h" |
|
31 #include "testwaiter.h" |
|
32 |
|
33 |
|
34 #include "sanimctrl.h" |
|
35 //#include "sanimctrltestsuite.h" |
|
36 |
|
37 |
|
38 //#pragma tagging OFF // To disable CodeTest tagging |
|
39 |
|
40 _LIT( KDummyImageFile, "C:\\temp\\test.ti2" ); // There is a plug-in for this type |
|
41 _LIT( KDummyToneFile, "C:\\temp\\test.tt2" ); // There is a plug-in for this type |
|
42 //#pragma tagging OFF // To disable CodeTest tagging |
|
43 |
|
44 const TInt KTestRepository( 0x0AA0151E ); // Repository to use for testing |
|
45 |
|
46 _LIT( KUnknownFile, "C:\\temp\\unknown.unk" ); |
|
47 _LIT( KProtectedFile, "Z:\\sys\\bin\\sysap.exe" ); |
|
48 //_LIT( KDummyImageFile, "C:\\temp\\test.ti2" ); // There is a plug-in for this type |
|
49 //_LIT( KDummyToneFile, "C:\\temp\\test.tt2" ); // There is a plug-in for this type |
|
50 |
|
51 // ============================= LOCAL FUNCTIONS =============================== |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // ?function_name ?description. |
|
55 // ?description |
|
56 // Returns: ?value_1: ?description |
|
57 // ?value_n: ?description_line1 |
|
58 // ?description_line2 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 /* |
|
62 ?type ?function_name( |
|
63 ?arg_type arg, // ?description |
|
64 ?arg_type arg) // ?description |
|
65 { |
|
66 |
|
67 ?code // ?comment |
|
68 |
|
69 // ?comment |
|
70 ?code |
|
71 } |
|
72 */ |
|
73 |
|
74 // ============================ MEMBER FUNCTIONS =============================== |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CTSanimctrl::Delete |
|
78 // Delete here all resources allocated and opened from test methods. |
|
79 // Called from destructor. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CTSanimctrl::Delete() |
|
83 { |
|
84 |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CTSanimctrl::RunMethodL |
|
89 // Run specified method. Contains also table of test mothods and their names. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 TInt CTSanimctrl::RunMethodL( |
|
93 CStifItemParser& aItem ) |
|
94 { |
|
95 |
|
96 static TStifFunctionInfo const KFunctions[] = |
|
97 { |
|
98 // Copy this line for every implemented function. |
|
99 // First string is the function name used in TestScripter script file. |
|
100 // Second is the actual implementation member function. |
|
101 ENTRY("Example", CTSanimctrl::ExampleL), |
|
102 ENTRY("InitObj", CTSanimctrl::InitObjL), |
|
103 ENTRY("SetupEmpty", CTSanimctrl::SetupEmptyL), |
|
104 ENTRY("SetupEmptyValues", CTSanimctrl::SetupEmptyValuesL), |
|
105 ENTRY("SetupUnknownFile", CTSanimctrl::SetupUnknownFileL), |
|
106 ENTRY("SetupProtectedFile", CTSanimctrl::SetupProtectedFileL), |
|
107 ENTRY("SetupExistingImageFile", CTSanimctrl::SetupExistingImageFileL), |
|
108 ENTRY("SetupExistingToneFileSilent", CTSanimctrl::SetupExistingToneFileSilentL), |
|
109 ENTRY("SetupExistingToneFileVeryLowVolume", CTSanimctrl::SetupExistingToneFileVeryLowVolumeL), |
|
110 ENTRY("SetupExistingToneFileLowVolume", CTSanimctrl::SetupExistingToneFileLowVolumeL), |
|
111 ENTRY("SetupExistingToneFileNormalVolume", CTSanimctrl::SetupExistingToneFileNormalVolumeL), |
|
112 ENTRY("SetupExistingToneFileTooLowVolume", CTSanimctrl::SetupExistingToneFileTooLowVolumeL), |
|
113 ENTRY("SetupExistingToneFileTooHighVolume", CTSanimctrl::SetupExistingToneFileTooHighVolumeL), |
|
114 ENTRY("SetupUnknownToneFileNormalVolume", CTSanimctrl::SetupUnknownToneFileNormalVolumeL), |
|
115 ENTRY("SetupObj", CTSanimctrl::SetupObjL), |
|
116 ENTRY("SetupEmptyShow", CTSanimctrl::SetupEmptyShowL), |
|
117 ENTRY("SetupShow", CTSanimctrl::SetupShowL), |
|
118 ENTRY("Teardown", CTSanimctrl::Teardown), |
|
119 ENTRY("TestConstructor", CTSanimctrl::TestConstructorL), |
|
120 ENTRY("TestConstructorNoMemory", CTSanimctrl::TestConstructorNoMemoryL), |
|
121 ENTRY( "TestLoadNoContent", CTSanimctrl::TestLoadNoContentL), |
|
122 ENTRY("TestLoadHasContent", CTSanimctrl::TestLoadHasContentL), |
|
123 ENTRY("TestLoadNoMemory", CTSanimctrl::TestLoadNoMemoryL), |
|
124 ENTRY("TestCancelLoad", CTSanimctrl::TestCancelLoadL), |
|
125 ENTRY("TestLoadWhenActive", CTSanimctrl::TestLoadWhenActiveL), |
|
126 ENTRY("TestStart", CTSanimctrl::TestStartL), |
|
127 ENTRY("TestCancelStart", CTSanimctrl::TestCancelStartL), |
|
128 ENTRY("TestStartWhenActive", CTSanimctrl::TestStartWhenActiveL), |
|
129 |
|
130 ENTRY("SetupEmptyCtr", CTSanimctrl::SetupEmptyCtrL), |
|
131 ENTRY("SetupObjCtr", CTSanimctrl::SetupObjCtrL), |
|
132 ENTRY("SetupObjLoadedCtr", CTSanimctrl::SetupObjLoadedCtrL), |
|
133 ENTRY("TeardownCtr", CTSanimctrl::TeardownCtr), |
|
134 ENTRY("TestConstructorCtr", CTSanimctrl::TestConstructorCtrL), |
|
135 ENTRY("TestConstructorNoMemoryCtr", CTSanimctrl::TestConstructorNoMemoryCtrL), |
|
136 ENTRY("TestLoadEmptyCtr", CTSanimctrl::TestLoadEmptyCtrL), |
|
137 ENTRY("TestLoadImageCtr", CTSanimctrl::TestLoadImageCtrL), |
|
138 ENTRY("TestLoadToneCtr", CTSanimctrl::TestLoadToneCtrL), |
|
139 ENTRY("TestLoadBothCtr", CTSanimctrl::TestLoadBothCtrL), |
|
140 ENTRY("TestLoadWhenActiveCtr", CTSanimctrl::TestLoadWhenActiveCtrL), |
|
141 ENTRY("TestCancelLoadCtr", CTSanimctrl::TestCancelLoadCtrL), |
|
142 ENTRY("TestStartCtr", CTSanimctrl::TestStartCtrL), |
|
143 ENTRY("TestCancelStartCtr", CTSanimctrl::TestCancelStartCtrL), |
|
144 ENTRY("TestStartNoMemoryCtr",CTSanimctrl::TestStartNoMemoryCtrL), |
|
145 ENTRY("TestStartWhenActiveCtr",CTSanimctrl::TestStartWhenActiveCtrL) |
|
146 //ADD NEW ENTRY HERE |
|
147 // [test cases entries] - Do not remove |
|
148 |
|
149 }; |
|
150 |
|
151 const TInt count = sizeof( KFunctions ) / |
|
152 sizeof( TStifFunctionInfo ); |
|
153 |
|
154 return RunInternalL( KFunctions, count, aItem ); |
|
155 |
|
156 } |
|
157 |
|
158 // Praveen-2 |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // CSAnimCtrlTestSuite::SetupEmptyL |
|
162 // |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 TInt CTSanimctrl::SetupEmptyCtrL() |
|
166 { |
|
167 iTestObj2 = NULL; |
|
168 iWaiter = CTestWaiter::NewL(); |
|
169 iWaiter2 = CTestWaiter::NewL(); |
|
170 iView.SetComponent( *iTestObj2 ); |
|
171 return KErrNone; |
|
172 } |
|
173 |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CSAnimCtrlTestSuite::SetupObjL |
|
177 // |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 TInt CTSanimctrl::SetupObjCtrL() |
|
181 { |
|
182 SetupEmptyCtrL(); |
|
183 //CSAnimMockView& view = *iView; |
|
184 iTestObj2 = CSAnimCtrl::NewL( iView.Rect(), iView ); |
|
185 iView.SetComponent( *iTestObj2 ); |
|
186 return KErrNone; |
|
187 } |
|
188 |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CSAnimCtrlTestSuite::SetupObjLoadedL |
|
192 // |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 TInt CTSanimctrl::SetupObjLoadedCtrL() |
|
196 { |
|
197 SetupObjCtrL(); |
|
198 iTestObj2->Load( |
|
199 KDummyImageFile, 1000, ETrue, 1, |
|
200 KDummyToneFile, 4, 0, 1, |
|
201 iWaiter->iStatus ); |
|
202 iWaiter->Activate(); |
|
203 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
204 // User::LeaveIfError( iWaiter->iStatus.Int() ); |
|
205 return KErrNone; |
|
206 } |
|
207 |
|
208 |
|
209 // --------------------------------------------------------------------------- |
|
210 // CSAnimCtrlTestSuite::Teardown |
|
211 // |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 TInt CTSanimctrl::TeardownCtr() |
|
215 { |
|
216 delete iWaiter; |
|
217 iWaiter = NULL; |
|
218 delete iWaiter2; |
|
219 iWaiter2 = NULL; |
|
220 delete iTestObj; |
|
221 iTestObj2 = NULL; |
|
222 |
|
223 REComSession::FinalClose(); |
|
224 return KErrNone; |
|
225 } |
|
226 |
|
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // CSAnimCtrlTestSuite::TestConstructorL |
|
230 // |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 TInt CTSanimctrl::TestConstructorCtrL() |
|
234 { |
|
235 //CSAnimMockView& view = *iView; |
|
236 iTestObj2 = CSAnimCtrl::NewL( iView.Rect(), iView ); |
|
237 //STIF_ASSERT_EQUALS( iTestObj,KErrNone ); |
|
238 delete iTestObj; |
|
239 iTestObj = NULL; |
|
240 return KErrNone; |
|
241 } |
|
242 |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // CSAnimCtrlTestSuite::TestConstructorNoMemoryL |
|
246 // |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 TInt CTSanimctrl::TestConstructorNoMemoryCtrL() |
|
250 { |
|
251 //CSAnimMockView& view = *iView; |
|
252 iTestObj2 = CSAnimCtrl::NewL( iView.Rect(), iView ); |
|
253 //STIF_ASSERT_EQUALS( !iTestObj , KErrNone); |
|
254 return KErrNone; |
|
255 } |
|
256 |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CSAnimCtrlTestSuite::TestLoadEmptyL |
|
260 // |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 TInt CTSanimctrl::TestLoadEmptyCtrL() |
|
264 { |
|
265 /* |
|
266 * Returns panic.. valid condition |
|
267 [Test] |
|
268 title TestLoadEmptyCtr |
|
269 create TSanimctrl CSAnimStartupCtrl |
|
270 CSAnimStartupCtrl SetupEmptyCtr |
|
271 CSAnimStartupCtrl TestLoadEmptyCtr |
|
272 CSAnimStartupCtrl TeardownCtr |
|
273 delete CSAnimStartupCtrl |
|
274 [Endtest] |
|
275 |
|
276 iTestObj2->Load( |
|
277 KNullDesC, 1000, ETrue, 1, |
|
278 KNullDesC, 4, 0, 1, |
|
279 iWaiter->iStatus ); |
|
280 iWaiter->Activate(); |
|
281 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
282 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
283 * |
|
284 */ |
|
285 return KErrNone; |
|
286 } |
|
287 |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // CSAnimCtrlTestSuite::TestLoadImageL |
|
291 // |
|
292 // --------------------------------------------------------------------------- |
|
293 // |
|
294 TInt CTSanimctrl::TestLoadImageCtrL() |
|
295 { |
|
296 iTestObj2->Load( |
|
297 KDummyImageFile, 1000, ETrue, 1, |
|
298 KNullDesC, 4, 0, 1, |
|
299 iWaiter->iStatus ); |
|
300 iWaiter->Activate(); |
|
301 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
302 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
303 return KErrNone; |
|
304 } |
|
305 |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // CSAnimCtrlTestSuite::TestLoadToneL |
|
309 // |
|
310 // --------------------------------------------------------------------------- |
|
311 // |
|
312 TInt CTSanimctrl::TestLoadToneCtrL() |
|
313 { |
|
314 iTestObj2->Load( |
|
315 KNullDesC, 1000, ETrue, 1, |
|
316 KDummyToneFile, 4, 0, 1, |
|
317 iWaiter->iStatus ); |
|
318 iWaiter->Activate(); |
|
319 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
320 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
321 return KErrNone; |
|
322 } |
|
323 |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CSAnimCtrlTestSuite::TestLoadBothL |
|
327 // |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 TInt CTSanimctrl::TestLoadBothCtrL() |
|
331 { |
|
332 iTestObj2->Load( |
|
333 KDummyImageFile, 1000, ETrue, 1, |
|
334 KDummyToneFile, 4, 0, 1, |
|
335 iWaiter->iStatus ); |
|
336 iWaiter->Activate(); |
|
337 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
338 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
339 return KErrNone; |
|
340 } |
|
341 |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // CSAnimCtrlTestSuite::TestLoadWhenActiveL |
|
345 // |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 TInt CTSanimctrl::TestLoadWhenActiveCtrL() |
|
349 { |
|
350 iTestObj2->Load( |
|
351 KDummyImageFile, 1000, ETrue, 1, |
|
352 KNullDesC, 4, 0, 1, |
|
353 iWaiter->iStatus ); |
|
354 iWaiter->Activate(); |
|
355 iTestObj2->Load( |
|
356 KNullDesC, 1000, ETrue, 1, |
|
357 KDummyToneFile, 4, 0, 1, |
|
358 iWaiter2->iStatus ); |
|
359 iWaiter2->Activate(); |
|
360 CActiveScheduler::Start(); // Waiter2 stops it when request completes. |
|
361 // STIF_ASSERT_EQUALS( iWaiter2->iStatus.Int(), KErrNotReady ); |
|
362 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
363 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
364 return KErrNone; |
|
365 } |
|
366 |
|
367 |
|
368 // --------------------------------------------------------------------------- |
|
369 // CSAnimCtrlTestSuite::TestCancelLoadL |
|
370 // |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 TInt CTSanimctrl::TestCancelLoadCtrL() |
|
374 { |
|
375 iTestObj2->Load( |
|
376 KDummyImageFile, 1000, ETrue, 1, |
|
377 KDummyToneFile, 4, 0, 1, |
|
378 iWaiter->iStatus ); |
|
379 iWaiter->Activate(); |
|
380 iTestObj2->Cancel(); |
|
381 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
382 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCancel ); |
|
383 return KErrNone; |
|
384 } |
|
385 |
|
386 |
|
387 // --------------------------------------------------------------------------- |
|
388 // CSAnimCtrlTestSuite::TestStartL |
|
389 // |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 TInt CTSanimctrl::TestStartCtrL() |
|
393 { |
|
394 iTestObj2->Start( iWaiter->iStatus ); |
|
395 iWaiter->Activate(); |
|
396 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
397 //STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
398 return KErrNone; |
|
399 } |
|
400 |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CSAnimCtrlTestSuite::TestCancelStartL |
|
404 // |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 TInt CTSanimctrl::TestCancelStartCtrL() |
|
408 { |
|
409 /* |
|
410 [Test] |
|
411 title TestCancelStartCtr |
|
412 create TSanimctrl CSAnimStartupCtrl |
|
413 CSAnimStartupCtrl SetupObjLoadedCtr |
|
414 CSAnimStartupCtrl TestCancelStartCtr |
|
415 CSAnimStartupCtrl TeardownCtr |
|
416 delete CSAnimStartupCtrl |
|
417 [Endtest] |
|
418 |
|
419 iTestObj2->Start( iWaiter->iStatus ); |
|
420 iWaiter->Activate(); |
|
421 iTestObj2->Cancel(); |
|
422 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
423 // if ( iWaiter->iStatus.Int() == KErrCancel ) |
|
424 * |
|
425 */ |
|
426 return KErrNone; |
|
427 |
|
428 } |
|
429 |
|
430 |
|
431 // --------------------------------------------------------------------------- |
|
432 // CSAnimCtrlTestSuite::TestStartNoMemoryL |
|
433 // |
|
434 // --------------------------------------------------------------------------- |
|
435 // |
|
436 TInt CTSanimctrl::TestStartNoMemoryCtrL() |
|
437 { |
|
438 iTestObj2->Start( iWaiter->iStatus ); |
|
439 iWaiter->Activate(); |
|
440 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
441 //STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); // Mock plug-in does not reserve memory in Load |
|
442 return KErrNone; |
|
443 } |
|
444 |
|
445 |
|
446 |
|
447 // --------------------------------------------------------------------------- |
|
448 // CSAnimCtrlTestSuite::TestStartWhenActiveL |
|
449 // |
|
450 // --------------------------------------------------------------------------- |
|
451 // |
|
452 TInt CTSanimctrl::TestStartWhenActiveCtrL() |
|
453 { |
|
454 iTestObj2->Start( iWaiter->iStatus ); |
|
455 iWaiter->Activate(); |
|
456 iTestObj2->Start( iWaiter2->iStatus ); |
|
457 iWaiter2->Activate(); |
|
458 CActiveScheduler::Start(); // Waiter2 stops it when request completes. |
|
459 // STIF_ASSERT_EQUALS( iWaiter2->iStatus.Int(), KErrNotReady ); |
|
460 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
461 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
462 return KErrNone; |
|
463 } |
|
464 |
|
465 |
|
466 //Praveen-2 |
|
467 |
|
468 // ======== MEMBER FUNCTIONS ======== |
|
469 |
|
470 |
|
471 // --------------------------------------------------------------------------- |
|
472 // CSAnimStartupCtrlTestSuite::SetupParamsL |
|
473 // |
|
474 // --------------------------------------------------------------------------- |
|
475 // |
|
476 void CTSanimctrl::SetupParamsL( |
|
477 const TDesC& aImageFileName, |
|
478 const TDesC& aToneFileName, |
|
479 const TInt aFrameDelay, |
|
480 const TInt aVolume, |
|
481 const TInt /*aVolumeRamp*/ ) |
|
482 { |
|
483 CRepository* repository = CRepository::NewLC( TUid::Uid( KTestRepository ) ); |
|
484 User::LeaveIfError( repository->Set( iParams.iAnimationPathKey, aImageFileName ) ); |
|
485 User::LeaveIfError( repository->Set( iParams.iTonePathKey, aToneFileName ) ); |
|
486 User::LeaveIfError( repository->Set( iParams.iFrameDelayKey, aFrameDelay ) ); |
|
487 User::LeaveIfError( repository->Set( iParams.iVolumeKey, aVolume ) ); |
|
488 CleanupStack::PopAndDestroy( repository ); |
|
489 } |
|
490 |
|
491 |
|
492 // --------------------------------------------------------------------------- |
|
493 // CSAnimStartupCtrlTestSuite::SetupProfileL |
|
494 // |
|
495 // --------------------------------------------------------------------------- |
|
496 // |
|
497 TInt CTSanimctrl::SetupProfileL( const TInt aRingingType, const TInt aRingingVolume ) |
|
498 { |
|
499 CRepository* repository = CRepository::NewLC( KCRUidProfileEngine ); |
|
500 User::LeaveIfError( repository->Set( KProEngActiveRingingType, aRingingType ) ); |
|
501 User::LeaveIfError( repository->Set( KProEngActiveRingingVolume, aRingingVolume ) ); |
|
502 CleanupStack::PopAndDestroy( repository ); |
|
503 return KErrNone; |
|
504 } |
|
505 |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // CSAnimStartupCtrlTestSuite::InitObjL |
|
509 // |
|
510 // --------------------------------------------------------------------------- |
|
511 // |
|
512 TInt CTSanimctrl::InitObjL() |
|
513 { |
|
514 // iView = CSAnimMockView::NewL(); |
|
515 //CSAnimMockView& view = *iView; |
|
516 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
517 iView.SetComponent( *iTestObj ); |
|
518 iTestObj->Load (iParams,ETrue,0,iWaiter->iStatus ); |
|
519 iWaiter->Activate(); |
|
520 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
521 return KErrNone; |
|
522 } |
|
523 |
|
524 |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // CSAnimStartupCtrlTestSuite::SetupEmptyL |
|
528 // |
|
529 // --------------------------------------------------------------------------- |
|
530 // |
|
531 TInt CTSanimctrl::SetupEmptyL() |
|
532 { |
|
533 SetupParamsL( KNullDesC, KNullDesC, 0, 0, 0 ); |
|
534 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
535 iTestObj = NULL; |
|
536 iWaiter = CTestWaiter::NewL(); |
|
537 iWaiter2 = CTestWaiter::NewL(); |
|
538 return KErrNone; |
|
539 } |
|
540 |
|
541 |
|
542 // --------------------------------------------------------------------------- |
|
543 // CSAnimStartupCtrlTestSuite::SetupEmptyValuesL |
|
544 // |
|
545 // --------------------------------------------------------------------------- |
|
546 // |
|
547 TInt CTSanimctrl::SetupEmptyValuesL() |
|
548 { |
|
549 SetupEmptyL(); |
|
550 SetupParamsL( KNullDesC, KNullDesC, 0, 0, 0 ); |
|
551 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
552 |
|
553 // iView = CSAnimMockView::NewL(); |
|
554 //CSAnimMockView& view = *iView; |
|
555 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
556 iView.SetComponent( *iTestObj ); |
|
557 return KErrNone; |
|
558 } |
|
559 |
|
560 |
|
561 // --------------------------------------------------------------------------- |
|
562 // CSAnimStartupCtrlTestSuite::SetupUnknownFileL |
|
563 // |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 TInt CTSanimctrl::SetupUnknownFileL() |
|
567 { |
|
568 SetupEmptyL(); |
|
569 SetupParamsL( KUnknownFile, KNullDesC, 0, 0, 0 ); |
|
570 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
571 //iView = CSAnimMockView::NewL(); |
|
572 //CSAnimMockView& view = *iView; |
|
573 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
574 iView.SetComponent( *iTestObj ); |
|
575 return KErrNone; |
|
576 } |
|
577 |
|
578 |
|
579 // --------------------------------------------------------------------------- |
|
580 // CSAnimStartupCtrlTestSuite::SetupProtectedFileL |
|
581 // |
|
582 // --------------------------------------------------------------------------- |
|
583 // |
|
584 TInt CTSanimctrl::SetupProtectedFileL() |
|
585 { |
|
586 SetupEmptyL(); |
|
587 SetupParamsL( KProtectedFile, KNullDesC, 0, 0, 0 ); |
|
588 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
589 // iView = CSAnimMockView::NewL(); |
|
590 // CSAnimMockView& view = *iView; |
|
591 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
592 iView.SetComponent( *iTestObj ); |
|
593 return KErrNone; |
|
594 } |
|
595 |
|
596 |
|
597 // --------------------------------------------------------------------------- |
|
598 // CSAnimStartupCtrlTestSuite::SetupExistingImageFileL |
|
599 // |
|
600 // --------------------------------------------------------------------------- |
|
601 // |
|
602 TInt CTSanimctrl::SetupExistingImageFileL() |
|
603 { |
|
604 SetupEmptyL(); |
|
605 SetupParamsL( KDummyImageFile, KNullDesC, 0, 0, 0 ); |
|
606 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
607 // iView = CSAnimMockView::NewL(); |
|
608 //CSAnimMockView& view = *iView; |
|
609 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
610 iView.SetComponent( *iTestObj ); |
|
611 return KErrNone; |
|
612 } |
|
613 |
|
614 |
|
615 // --------------------------------------------------------------------------- |
|
616 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileSilentL |
|
617 // |
|
618 // --------------------------------------------------------------------------- |
|
619 // |
|
620 TInt CTSanimctrl::SetupExistingToneFileSilentL() |
|
621 { |
|
622 SetupEmptyL(); |
|
623 SetupParamsL( KNullDesC, KDummyToneFile, 0, 2, 0 ); |
|
624 SetupProfileL( EProfileRingingTypeSilent, 4 ); |
|
625 // iView = CSAnimMockView::NewL(); |
|
626 //CSAnimMockView& view = *iView; |
|
627 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
628 iView.SetComponent( *iTestObj ); |
|
629 return KErrNone; |
|
630 } |
|
631 |
|
632 |
|
633 // --------------------------------------------------------------------------- |
|
634 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileVeryLowVolumeL |
|
635 // |
|
636 // --------------------------------------------------------------------------- |
|
637 // |
|
638 TInt CTSanimctrl::SetupExistingToneFileVeryLowVolumeL() |
|
639 { |
|
640 SetupEmptyL(); |
|
641 SetupParamsL( KNullDesC, KDummyToneFile, 0, 2, 0 ); |
|
642 SetupProfileL( EProfileRingingTypeRinging, 0 ); |
|
643 // iView = CSAnimMockView::NewL(); |
|
644 //CSAnimMockView& view = *iView; |
|
645 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
646 iView.SetComponent( *iTestObj ); |
|
647 return KErrNone; |
|
648 } |
|
649 |
|
650 |
|
651 // --------------------------------------------------------------------------- |
|
652 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileLowVolumeL |
|
653 // |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 TInt CTSanimctrl::SetupExistingToneFileLowVolumeL() |
|
657 { |
|
658 SetupEmptyL(); |
|
659 SetupParamsL( KNullDesC, KDummyToneFile, 0, 2, 0 ); |
|
660 SetupProfileL( EProfileRingingTypeRinging, 1 ); |
|
661 // iView = CSAnimMockView::NewL(); |
|
662 // CSAnimMockView& view = *iView; |
|
663 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
664 iView.SetComponent( *iTestObj ); |
|
665 return KErrNone; |
|
666 } |
|
667 |
|
668 |
|
669 // --------------------------------------------------------------------------- |
|
670 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileNormalVolumeL |
|
671 // |
|
672 // --------------------------------------------------------------------------- |
|
673 // |
|
674 TInt CTSanimctrl::SetupExistingToneFileNormalVolumeL() |
|
675 { |
|
676 SetupEmptyL(); |
|
677 SetupParamsL( KNullDesC, KDummyToneFile, 0, 2, 0 ); |
|
678 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
679 // iView = CSAnimMockView::NewL(); |
|
680 //CSAnimMockView& view = *iView; |
|
681 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
682 iView.SetComponent( *iTestObj ); |
|
683 return KErrNone; |
|
684 } |
|
685 |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileTooLowVolumeL |
|
689 // |
|
690 // --------------------------------------------------------------------------- |
|
691 // |
|
692 TInt CTSanimctrl::SetupExistingToneFileTooLowVolumeL() |
|
693 { |
|
694 SetupEmptyL(); |
|
695 SetupParamsL( KNullDesC, KDummyToneFile, 0, -1, 0 ); |
|
696 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
697 // iView = CSAnimMockView::NewL(); |
|
698 //CSAnimMockView& view = *iView; |
|
699 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
700 iView.SetComponent( *iTestObj ); |
|
701 return KErrNone; |
|
702 } |
|
703 |
|
704 |
|
705 // --------------------------------------------------------------------------- |
|
706 // CSAnimStartupCtrlTestSuite::SetupExistingToneFileTooHighVolumeL |
|
707 // |
|
708 // --------------------------------------------------------------------------- |
|
709 // |
|
710 TInt CTSanimctrl::SetupExistingToneFileTooHighVolumeL() |
|
711 { |
|
712 SetupEmptyL(); |
|
713 SetupParamsL( KNullDesC, KDummyToneFile, 0, 11, 0 ); |
|
714 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
715 // iView = CSAnimMockView::NewL(); |
|
716 //CSAnimMockView& view = *iView; |
|
717 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
718 iView.SetComponent( *iTestObj ); |
|
719 return KErrNone; |
|
720 } |
|
721 |
|
722 |
|
723 // --------------------------------------------------------------------------- |
|
724 // CSAnimStartupCtrlTestSuite::SetupUnknownToneFileNormalVolumeL |
|
725 // |
|
726 // --------------------------------------------------------------------------- |
|
727 // |
|
728 TInt CTSanimctrl::SetupUnknownToneFileNormalVolumeL() |
|
729 { |
|
730 SetupEmptyL(); |
|
731 SetupParamsL( KNullDesC, KUnknownFile, 0, 2, 0 ); |
|
732 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
733 // iView = CSAnimMockView::NewL(); |
|
734 // CSAnimMockView& view = *iView; |
|
735 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
736 iView.SetComponent( *iTestObj ); |
|
737 return KErrNone; |
|
738 } |
|
739 |
|
740 |
|
741 // --------------------------------------------------------------------------- |
|
742 // CSAnimStartupCtrlTestSuite::SetupObjL |
|
743 // |
|
744 // --------------------------------------------------------------------------- |
|
745 // |
|
746 TInt CTSanimctrl::SetupObjL() |
|
747 { |
|
748 SetupEmptyL(); |
|
749 SetupParamsL( KDummyImageFile, KDummyToneFile, 0, 4, 0 ); |
|
750 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
751 //iView = CSAnimMockView::NewL(); |
|
752 //CSAnimMockView& view = *iView; |
|
753 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
754 iView.SetComponent( *iTestObj ); |
|
755 return KErrNone; |
|
756 } |
|
757 |
|
758 |
|
759 // --------------------------------------------------------------------------- |
|
760 // CSAnimStartupCtrlTestSuite::SetupEmptyShowL |
|
761 // |
|
762 // --------------------------------------------------------------------------- |
|
763 // |
|
764 TInt CTSanimctrl::SetupEmptyShowL() |
|
765 { |
|
766 SetupEmptyL(); |
|
767 SetupParamsL( KNullDesC, KNullDesC, 0, 0, 0 ); |
|
768 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
769 InitObjL(); |
|
770 return KErrNone; |
|
771 } |
|
772 |
|
773 |
|
774 // --------------------------------------------------------------------------- |
|
775 // CSAnimStartupCtrlTestSuite::SetupShowL |
|
776 // |
|
777 // --------------------------------------------------------------------------- |
|
778 // |
|
779 TInt CTSanimctrl::SetupShowL() |
|
780 { |
|
781 SetupEmptyL(); |
|
782 SetupParamsL( KDummyImageFile, KDummyToneFile, 0, 4, 0 ); |
|
783 SetupProfileL( EProfileRingingTypeRinging, 4 ); |
|
784 InitObjL(); |
|
785 return KErrNone; |
|
786 } |
|
787 |
|
788 |
|
789 // --------------------------------------------------------------------------- |
|
790 // CSAnimStartupCtrlTestSuite::Teardown |
|
791 // |
|
792 // --------------------------------------------------------------------------- |
|
793 // |
|
794 TInt CTSanimctrl::Teardown() |
|
795 { |
|
796 delete iWaiter; |
|
797 iWaiter = NULL; |
|
798 delete iWaiter2; |
|
799 iWaiter2 = NULL; |
|
800 delete iTestObj; |
|
801 iTestObj = NULL; |
|
802 |
|
803 REComSession::FinalClose(); |
|
804 return KErrNone; |
|
805 } |
|
806 |
|
807 |
|
808 // --------------------------------------------------------------------------- |
|
809 // CSAnimStartupCtrlTestSuite::TestConstructorL |
|
810 // |
|
811 // --------------------------------------------------------------------------- |
|
812 // |
|
813 TInt CTSanimctrl::TestConstructorL() |
|
814 { |
|
815 iView.SetComponent( *iTestObj ); |
|
816 // iView = CSAnimMockView::NewL(); |
|
817 //CSAnimMockView& view = *iView; |
|
818 iTestObj =CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
819 //STIF_ASSERT_EQUALS( iTestObj,1 ); |
|
820 delete iTestObj; |
|
821 iTestObj = NULL; |
|
822 return KErrNone; |
|
823 } |
|
824 |
|
825 |
|
826 // --------------------------------------------------------------------------- |
|
827 // CSAnimStartupCtrlTestSuite::TestConstructorNoMemoryL |
|
828 // |
|
829 // --------------------------------------------------------------------------- |
|
830 // |
|
831 TInt CTSanimctrl::TestConstructorNoMemoryL() |
|
832 { |
|
833 //iView = CSAnimMockView::NewL(); |
|
834 //CSAnimMockView& view = *iView; |
|
835 iTestObj = CSAnimStartupCtrl::NewL( iView.Rect(), iView ); |
|
836 // STIF_ASSERT_EQUALS( !iTestObj,0 ); |
|
837 return KErrNone; |
|
838 } |
|
839 |
|
840 |
|
841 // --------------------------------------------------------------------------- |
|
842 // CSAnimStartupCtrlTestSuite::TestLoadNoContentL |
|
843 // |
|
844 // --------------------------------------------------------------------------- |
|
845 // |
|
846 TInt CTSanimctrl::TestLoadNoContentL() |
|
847 { |
|
848 iTestObj->Load( iParams, EFalse, 0, iWaiter->iStatus ); |
|
849 iWaiter->Activate(); |
|
850 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
851 //STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
852 // STIF_ASSERT_EQUALS( iTestObj->HasContent(), EFalse ); |
|
853 return KErrNone; |
|
854 } |
|
855 |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // CSAnimStartupCtrlTestSuite::TestLoadHasContentL |
|
859 // |
|
860 // --------------------------------------------------------------------------- |
|
861 // |
|
862 TInt CTSanimctrl::TestLoadHasContentL() |
|
863 { |
|
864 iTestObj->Load( iParams, ETrue, 1, iWaiter->iStatus ); |
|
865 iWaiter->Activate(); |
|
866 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
867 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
868 // STIF_ASSERT_EQUALS( iTestObj->HasContent(), ETrue ); |
|
869 return KErrNone; |
|
870 } |
|
871 |
|
872 |
|
873 // --------------------------------------------------------------------------- |
|
874 // CSAnimStartupCtrlTestSuite::TestLoadNoMemoryL |
|
875 // |
|
876 // --------------------------------------------------------------------------- |
|
877 // |
|
878 TInt CTSanimctrl::TestLoadNoMemoryL() |
|
879 { |
|
880 iTestObj->Load( iParams, EFalse, 1, iWaiter->iStatus ); |
|
881 iWaiter->Activate(); |
|
882 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
883 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNoMemory ); |
|
884 return KErrNone; |
|
885 } |
|
886 |
|
887 |
|
888 // --------------------------------------------------------------------------- |
|
889 // CSAnimStartupCtrlTestSuite::TestCancelLoadL |
|
890 // |
|
891 // --------------------------------------------------------------------------- |
|
892 // |
|
893 TInt CTSanimctrl::TestCancelLoadL() |
|
894 { |
|
895 iTestObj->Load( iParams, ETrue, 0, iWaiter->iStatus ); |
|
896 iWaiter->Activate(); |
|
897 iTestObj->Cancel(); |
|
898 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
899 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCancel ); |
|
900 return KErrNone; |
|
901 } |
|
902 |
|
903 |
|
904 // --------------------------------------------------------------------------- |
|
905 // CSAnimStartupCtrlTestSuite::TestLoadWhenActiveL |
|
906 // |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 TInt CTSanimctrl::TestLoadWhenActiveL() |
|
910 { |
|
911 iTestObj->Load( iParams, ETrue, 0, iWaiter->iStatus ); |
|
912 iWaiter->Activate(); |
|
913 iTestObj->Load( iParams, ETrue, 0, iWaiter2->iStatus ); |
|
914 iWaiter2->Activate(); |
|
915 CActiveScheduler::Start(); // Waiter2 stops it when request completes. |
|
916 // STIF_ASSERT_EQUALS( iWaiter2->iStatus.Int(), KErrNotReady ); |
|
917 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
918 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
919 return KErrNone; |
|
920 } |
|
921 |
|
922 |
|
923 // --------------------------------------------------------------------------- |
|
924 // CSAnimStartupCtrlTestSuite::TestStartL |
|
925 // |
|
926 // --------------------------------------------------------------------------- |
|
927 // |
|
928 TInt CTSanimctrl::TestStartL() |
|
929 { |
|
930 iTestObj->Start( iWaiter->iStatus ); |
|
931 iWaiter->Activate(); |
|
932 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
933 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
934 return KErrNone; |
|
935 } |
|
936 |
|
937 |
|
938 // --------------------------------------------------------------------------- |
|
939 // CSAnimStartupCtrlTestSuite::TestCancelStartL |
|
940 // |
|
941 // --------------------------------------------------------------------------- |
|
942 // |
|
943 TInt CTSanimctrl::TestCancelStartL() |
|
944 { |
|
945 iTestObj->Start( iWaiter->iStatus ); |
|
946 iWaiter->Activate(); |
|
947 iTestObj->Cancel(); |
|
948 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
949 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCancel ); |
|
950 return KErrNone; |
|
951 } |
|
952 |
|
953 |
|
954 // --------------------------------------------------------------------------- |
|
955 // CSAnimStartupCtrlTestSuite::TestStartWhenActiveL |
|
956 // |
|
957 // --------------------------------------------------------------------------- |
|
958 // |
|
959 TInt CTSanimctrl::TestStartWhenActiveL() |
|
960 { |
|
961 iTestObj->Start( iWaiter->iStatus ); |
|
962 iWaiter->Activate(); |
|
963 iTestObj->Start( iWaiter2->iStatus ); |
|
964 iWaiter2->Activate(); |
|
965 CActiveScheduler::Start(); // Waiter2 stops it when request completes. |
|
966 // STIF_ASSERT_EQUALS( iWaiter2->iStatus.Int(), KErrNotReady ); |
|
967 CActiveScheduler::Start(); // Waiter stops it when request completes. |
|
968 // STIF_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); |
|
969 return KErrNone; |
|
970 } |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CTSanimctrl::ExampleL |
|
977 // Example test method function. |
|
978 // (other items were commented in a header). |
|
979 // ----------------------------------------------------------------------------- |
|
980 // |
|
981 TInt CTSanimctrl::ExampleL( CStifItemParser& aItem ) |
|
982 { |
|
983 |
|
984 // Print to UI |
|
985 _LIT( KTSanimctrl, "TSanimctrl" ); |
|
986 _LIT( KExample, "In Example" ); |
|
987 TestModuleIf().Printf( 0, KTSanimctrl, KExample ); |
|
988 // Print to log file |
|
989 iLog->Log( KExample ); |
|
990 |
|
991 TInt i = 0; |
|
992 TPtrC string; |
|
993 _LIT( KParam, "Param[%i]: %S" ); |
|
994 while ( aItem.GetNextString ( string ) == KErrNone ) |
|
995 { |
|
996 TestModuleIf().Printf( i, KTSanimctrl, |
|
997 KParam, i, &string ); |
|
998 i++; |
|
999 } |
|
1000 |
|
1001 return KErrNone; |
|
1002 |
|
1003 } |
|
1004 |
|
1005 // ----------------------------------------------------------------------------- |
|
1006 // CTSanimctrl::?member_function |
|
1007 // ?implementation_description |
|
1008 // (other items were commented in a header). |
|
1009 // ----------------------------------------------------------------------------- |
|
1010 // |
|
1011 /* |
|
1012 TInt CTSanimctrl::?member_function( |
|
1013 CItemParser& aItem ) |
|
1014 { |
|
1015 |
|
1016 ?code |
|
1017 |
|
1018 } |
|
1019 */ |
|
1020 |
|
1021 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1022 // None |
|
1023 |
|
1024 // [End of File] - Do not remove |
|
1025 |
|
1026 // End of File |