|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "testvideoplayer.h" |
|
17 |
|
18 #include <e32math.h> |
|
19 #include <mmf/common/mmfvideo.h> |
|
20 #include "u32hal.h" |
|
21 |
|
22 #ifdef SYMBIAN_BUILD_GCE |
|
23 #include <gceavailable.h> |
|
24 #endif |
|
25 |
|
26 const TInt KFrameWidth = 100; |
|
27 const TInt KFrameHeight = 50; |
|
28 |
|
29 const TInt KCropRegionRectTop = 1; |
|
30 const TInt KCropRegionRectLeft = 3; |
|
31 const TInt KCropRegionRectRight = 5; |
|
32 const TInt KCropRegionRectBottom = 7; |
|
33 const TUint KCacheSize = 1000000; //1MB |
|
34 const TUint KMaxCacheSize = 30000000; //30MB |
|
35 |
|
36 // |
|
37 // RTestVclntPlayAviFile |
|
38 // |
|
39 |
|
40 /** |
|
41 * RTestVclntPlayAviFile::Constructor |
|
42 */ |
|
43 RTestVclntPlayAviFile::RTestVclntPlayAviFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay) |
|
44 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
45 { |
|
46 iHeapSize = 2000000; //-2MB |
|
47 } |
|
48 |
|
49 /** |
|
50 * RTestVclntPlayAviFile::NewL |
|
51 */ |
|
52 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
53 { |
|
54 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
55 return self; |
|
56 } |
|
57 |
|
58 /** |
|
59 * RTestVclntPlayAviFile::NewLC |
|
60 */ |
|
61 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
62 { |
|
63 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
64 CleanupStack::PushL(self); |
|
65 return self; |
|
66 } |
|
67 |
|
68 /** |
|
69 * RTestVclntPlayAviFile::DoTestStepL |
|
70 */ |
|
71 TVerdict RTestVclntPlayAviFile::DoTestStepL() |
|
72 { |
|
73 // WDP:We are going to start the test now |
|
74 // Ensure we set paging memory to appropriate cache size for tests which need it |
|
75 //ignore other tests |
|
76 TVerdict verdict=SetCacheSize(); |
|
77 if(verdict!=EPass) |
|
78 { |
|
79 return verdict; |
|
80 } |
|
81 |
|
82 // Call the state handler from IDLE state |
|
83 FsmL(EVPIdle); |
|
84 User::LeaveIfError(iError); |
|
85 // Start the scheduler - Done only once ! |
|
86 CActiveScheduler::Start(); |
|
87 |
|
88 return iTestStepResult; |
|
89 } |
|
90 |
|
91 //Default SetCache size |
|
92 TVerdict RTestVclntPlayAviFile::SetCacheSize() |
|
93 { |
|
94 //Do not try to increase cache size for tests which dont need it |
|
95 return EPass; |
|
96 |
|
97 } |
|
98 |
|
99 /** |
|
100 * RTestVclntPlayAviFile::FsmL |
|
101 */ |
|
102 void RTestVclntPlayAviFile::FsmL(TVclntTestPlayEvents aEventCode) |
|
103 { |
|
104 if (FsmCheck(aEventCode)) |
|
105 { |
|
106 //TInt err = KErrNone; |
|
107 switch (aEventCode) |
|
108 { |
|
109 case EVPIdle: |
|
110 // Open iVideoPlayer |
|
111 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
112 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
113 PrepareState(EVPOpenComplete, KErrNone); |
|
114 break; |
|
115 case EVPOpenComplete: |
|
116 // Prepare iVideoPlayer |
|
117 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
118 iVideoPlayer->Prepare(); |
|
119 PrepareState(EVPPrepareComplete, KErrNone); |
|
120 break; |
|
121 case EVPPrepareComplete: |
|
122 iTestStepResult = DoTestL(iVideoPlayer); |
|
123 break; |
|
124 case EVPPlayComplete: |
|
125 iTestStepResult = EPass; |
|
126 CActiveScheduler::Stop(); |
|
127 break; |
|
128 } |
|
129 } |
|
130 } |
|
131 |
|
132 /** |
|
133 * RTestVclntPlayAviFile::DoTestL |
|
134 */ |
|
135 TVerdict RTestVclntPlayAviFile::DoTestL(CVideoPlayerUtility* /*aPlayer*/) |
|
136 { |
|
137 TVerdict ret = EFail; |
|
138 |
|
139 if(iPlay) |
|
140 { |
|
141 iError = KErrTimedOut; |
|
142 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
143 PrepareState(EVPPlayComplete, KErrNone); |
|
144 iVideoPlayer->Play(); |
|
145 } |
|
146 else |
|
147 { |
|
148 CActiveScheduler::Stop(); |
|
149 ret = EPass; |
|
150 } |
|
151 |
|
152 return ret; |
|
153 } |
|
154 |
|
155 // |
|
156 // RTestVclntPlayAviDes |
|
157 // |
|
158 |
|
159 /** |
|
160 * RTestVclntPlayAviDes::Constructor |
|
161 */ |
|
162 RTestVclntPlayAviDes::RTestVclntPlayAviDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay) |
|
163 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
164 { |
|
165 iHeapSize = 500000; |
|
166 } |
|
167 |
|
168 /** |
|
169 * RTestVclntPlayAviDes::NewL |
|
170 */ |
|
171 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
172 { |
|
173 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
174 return self; |
|
175 } |
|
176 |
|
177 /** |
|
178 * RTestVclntPlayAviDes::NewLC |
|
179 */ |
|
180 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
181 { |
|
182 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
183 CleanupStack::PushL(self); |
|
184 return self; |
|
185 } |
|
186 |
|
187 /** |
|
188 * RTestVclntPlayAviDes::DoTestStepPreambleL |
|
189 */ |
|
190 TVerdict RTestVclntPlayAviDes::DoTestStepPreambleL() |
|
191 { |
|
192 TVerdict preamRes; |
|
193 preamRes = EPass; |
|
194 |
|
195 // Base DoTestStepPreambleL |
|
196 preamRes = RTestVclntAviPlayerStep::DoTestStepPreambleL(); |
|
197 if (preamRes != EPass) |
|
198 { |
|
199 return preamRes; |
|
200 } |
|
201 |
|
202 RFs fs; |
|
203 RFile file; |
|
204 TInt size = 0; |
|
205 |
|
206 // connect to file system and open file |
|
207 User::LeaveIfError(fs.Connect()); |
|
208 CleanupClosePushL(fs); |
|
209 User::LeaveIfError(file.Open(fs,iFilename,EFileRead)); |
|
210 CleanupClosePushL(file); |
|
211 |
|
212 // Set HBuf size |
|
213 User::LeaveIfError(file.Size(size)); |
|
214 INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143 |
|
215 |
|
216 iVideo = HBufC8::NewMaxL(size); |
|
217 |
|
218 // read data into Hbuf |
|
219 TPtr8 bufferDes(iVideo->Des()); |
|
220 User::LeaveIfError(file.Read(bufferDes)); |
|
221 |
|
222 CleanupStack::PopAndDestroy(2); //fs, file |
|
223 |
|
224 return preamRes; |
|
225 } |
|
226 |
|
227 /** |
|
228 * RTestVclntPlayAviDes::DoTestStepPostambleL |
|
229 */ |
|
230 TVerdict RTestVclntPlayAviDes::DoTestStepPostambleL() |
|
231 { |
|
232 delete iVideo; |
|
233 iVideo = NULL; |
|
234 return RTestVclntAviPlayerStep::DoTestStepPostambleL(); |
|
235 } |
|
236 |
|
237 /** |
|
238 * Load and initialise an video descriptor. |
|
239 */ |
|
240 TVerdict RTestVclntPlayAviDes::DoTestStepL() |
|
241 { |
|
242 iTestStepResult = EFail; |
|
243 // Call the state handler from IDLE state |
|
244 TRAPD(err, FsmL(EVPIdle)); |
|
245 if (err == KErrNone) |
|
246 { |
|
247 CActiveScheduler::Start(); |
|
248 } |
|
249 // Start the scheduler - Done only once ! |
|
250 return iTestStepResult; |
|
251 } |
|
252 |
|
253 /** |
|
254 * RTestVclntPlayAviDes::FsmL |
|
255 */ |
|
256 void RTestVclntPlayAviDes::FsmL(TVclntTestPlayEvents aEventCode) |
|
257 { |
|
258 if (FsmCheck(aEventCode)) |
|
259 { |
|
260 //TInt err = KErrNone; |
|
261 switch (aEventCode) |
|
262 { |
|
263 case EVPIdle: |
|
264 // Open iVideoPlayer |
|
265 INFO_PRINTF2(_L("iVideoPlayer->OpenDesL() %S"), &iFilename); |
|
266 TRAP(iError, iVideoPlayer->OpenDesL(iVideo->Des(), ControllerUid())); |
|
267 PrepareState(EVPOpenComplete, KErrNone); |
|
268 break; |
|
269 case EVPOpenComplete: |
|
270 // Prepare iVideoPlayer |
|
271 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
272 iVideoPlayer->Prepare(); |
|
273 PrepareState(EVPPrepareComplete, KErrNone); |
|
274 break; |
|
275 case EVPPrepareComplete: |
|
276 iTestStepResult = DoTestL(iVideoPlayer); |
|
277 break; |
|
278 case EVPPlayComplete: |
|
279 iTestStepResult = EPass; |
|
280 CActiveScheduler::Stop(); |
|
281 break; |
|
282 } |
|
283 } |
|
284 } |
|
285 |
|
286 /** |
|
287 * RTestVclntPlayAviDes::DoTestL |
|
288 */ |
|
289 TVerdict RTestVclntPlayAviDes::DoTestL(CVideoPlayerUtility* aPlayer) |
|
290 { |
|
291 TVerdict ret = EFail; |
|
292 |
|
293 if(iPlay) |
|
294 { |
|
295 iError = KErrTimedOut; |
|
296 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
297 PrepareState(EVPPlayComplete, KErrNone); |
|
298 aPlayer->Play(); |
|
299 } |
|
300 else |
|
301 { |
|
302 CActiveScheduler::Stop(); |
|
303 ret = EPass; |
|
304 } |
|
305 |
|
306 return ret; |
|
307 } |
|
308 |
|
309 |
|
310 // |
|
311 // RTestVclntPlayAviUrl |
|
312 // |
|
313 |
|
314 /** |
|
315 * RTestVclntPlayAviUrl::Constructor |
|
316 */ |
|
317 |
|
318 RTestVclntPlayAviUrl::RTestVclntPlayAviUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
319 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
320 { |
|
321 } |
|
322 |
|
323 /** |
|
324 * RTestVclntPlayAviUrl::NewL |
|
325 */ |
|
326 |
|
327 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
328 { |
|
329 RTestVclntPlayAviUrl* self = RTestVclntPlayAviUrl::NewLC(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
330 CleanupStack::Pop(); |
|
331 return self; |
|
332 } |
|
333 |
|
334 /** |
|
335 * RTestVclntPlayAviUrl::NewLC |
|
336 */ |
|
337 |
|
338 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
339 { |
|
340 RTestVclntPlayAviUrl* self = new (ELeave) RTestVclntPlayAviUrl(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
341 CleanupStack::PushL(self); |
|
342 return self; |
|
343 } |
|
344 |
|
345 /** |
|
346 * RTestVclntPlayAviUrl::Constructor |
|
347 */ |
|
348 |
|
349 TVerdict RTestVclntPlayAviUrl::DoTestStepL() |
|
350 { |
|
351 // Call the state handler from IDLE state |
|
352 FsmL(EVPIdle); |
|
353 |
|
354 // Start the scheduler - Done only once ! |
|
355 CActiveScheduler::Start(); |
|
356 |
|
357 return iTestStepResult; |
|
358 } |
|
359 |
|
360 /** |
|
361 * RTestVclntPlayAviUrl::FsmL |
|
362 */ |
|
363 |
|
364 void RTestVclntPlayAviUrl::FsmL(TVclntTestPlayEvents aEventCode) |
|
365 { |
|
366 if (FsmCheck(aEventCode)) |
|
367 { |
|
368 switch (aEventCode) |
|
369 { |
|
370 case EVPIdle: |
|
371 // Open iVideoPlayer |
|
372 |
|
373 INFO_PRINTF2(_L("iVideoPlayer->OpenUrlL() %S"), &iFilename); |
|
374 TRAP(iError,iVideoPlayer->OpenUrlL(iFilename, KUseDefaultIap, KNullDesC8, ControllerUid())); |
|
375 PrepareState(EVPOpenComplete, KErrNone); |
|
376 break; |
|
377 case EVPOpenComplete: |
|
378 // Prepare iVideoPlayer |
|
379 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
380 iVideoPlayer->Prepare(); |
|
381 PrepareState(EVPPrepareComplete, KErrNone); |
|
382 break; |
|
383 case EVPPrepareComplete: |
|
384 iTestStepResult = DoTestL(iVideoPlayer); |
|
385 break; |
|
386 case EVPPlayComplete: |
|
387 CActiveScheduler::Stop(); |
|
388 iTestStepResult = EPass; |
|
389 break; |
|
390 } |
|
391 } |
|
392 } |
|
393 |
|
394 /** |
|
395 * RTestVclntPlayAviUrl::Constructor |
|
396 */ |
|
397 |
|
398 TVerdict RTestVclntPlayAviUrl::DoTestL(CVideoPlayerUtility* aPlayer) |
|
399 { |
|
400 TVerdict ret = EFail; |
|
401 |
|
402 if(iPlay) |
|
403 { |
|
404 iError = KErrTimedOut; |
|
405 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
406 PrepareState(EVPPlayComplete, KErrNone); |
|
407 aPlayer->Play(); |
|
408 } |
|
409 else |
|
410 { |
|
411 CActiveScheduler::Stop(); |
|
412 ret = EPass; |
|
413 } |
|
414 |
|
415 return ret; |
|
416 } |
|
417 |
|
418 |
|
419 // |
|
420 // RTestVclntEnqFrameRate |
|
421 // |
|
422 |
|
423 /** |
|
424 * RTestVclntEnqFrameRate::Constructor |
|
425 */ |
|
426 RTestVclntEnqFrameRate::RTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate) |
|
427 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
428 { |
|
429 iFrameRate = aFrameRate; |
|
430 } |
|
431 |
|
432 /** |
|
433 * RTestVclntEnqFrameRate::Constructor |
|
434 */ |
|
435 RTestVclntEnqFrameRate* RTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate) |
|
436 { |
|
437 RTestVclntEnqFrameRate* self = new (ELeave) RTestVclntEnqFrameRate(aTestName, aSectName, aKeyName, aExpectedError, aFrameRate); |
|
438 return self; |
|
439 } |
|
440 |
|
441 /** |
|
442 * RTestVclntEnqFrameRate::Constructor |
|
443 */ |
|
444 TVerdict RTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer) |
|
445 { |
|
446 INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate")); |
|
447 |
|
448 TVerdict ret = EFail; |
|
449 |
|
450 TReal32 theFrameRate = 0.0; |
|
451 TRAPD(err, theFrameRate = aPlayer->VideoFrameRateL()); |
|
452 INFO_PRINTF3(_L("iVideoPlayer->VideoFrameRateL() = %d...error =%d"), TInt(theFrameRate), err); |
|
453 |
|
454 // if we get here, we pass. The iVideoPlayer does not have a SetVideoFrameRate() |
|
455 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
456 PrepareState(EVPPlayComplete, KErrNone); |
|
457 aPlayer->Play(); |
|
458 |
|
459 return ret; |
|
460 } |
|
461 |
|
462 |
|
463 // |
|
464 // RTestVclntPosition |
|
465 // |
|
466 |
|
467 /** |
|
468 * RTestVclntPosition::Constructor |
|
469 */ |
|
470 RTestVclntPosition::RTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition) |
|
471 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
472 { |
|
473 iPosition = aPosition; |
|
474 } |
|
475 |
|
476 /** |
|
477 * RTestVclntPosition::NewL |
|
478 */ |
|
479 RTestVclntPosition* RTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition) |
|
480 { |
|
481 RTestVclntPosition* self = new (ELeave) RTestVclntPosition(aTestName, aSectName, aKeyName, aExpectedError, aPosition); |
|
482 return self; |
|
483 } |
|
484 |
|
485 /** |
|
486 * RTestVclntPosition::DoTestL |
|
487 */ |
|
488 TVerdict RTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer) |
|
489 { |
|
490 // NB test video controller is stubbing certain functions. May have to rewrite this |
|
491 // for AVI Controller |
|
492 |
|
493 TVerdict ret = EFail; |
|
494 TInt err = KErrNone; |
|
495 TTimeIntervalMicroSeconds pos; |
|
496 |
|
497 INFO_PRINTF1(_L("Test : Video Player - Position")); |
|
498 INFO_PRINTF3(_L("Set Position = %d, Duration = %d"), I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64())); |
|
499 |
|
500 // Set position: middle of clip. |
|
501 if (I64INT(iPosition.Int64()) == 0) |
|
502 { |
|
503 iPosition = I64INT(aPlayer->DurationL().Int64()) / 2; |
|
504 } |
|
505 |
|
506 // Set position: end of clip. |
|
507 if (I64INT(iPosition.Int64()) == -1) |
|
508 { |
|
509 iPosition = aPlayer->DurationL(); |
|
510 } |
|
511 |
|
512 // Position is beyond the end of the clips duration, so check that the value is clipped. |
|
513 if(aPlayer->DurationL() < iPosition) |
|
514 { |
|
515 INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64())); |
|
516 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
517 if (err == KErrNotSupported) |
|
518 { |
|
519 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
520 } |
|
521 TRAP(err, pos = aPlayer->PositionL()); |
|
522 if (err == KErrNotReady) |
|
523 { |
|
524 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
525 } |
|
526 INFO_PRINTF3(_L("Set Position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(aPlayer->DurationL().Int64())); |
|
527 } |
|
528 |
|
529 // Position is negative, so check that the value is clipped. |
|
530 else if (I64INT(iPosition.Int64()) < 0) |
|
531 { |
|
532 INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64())); |
|
533 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
534 if (err == KErrNotSupported) |
|
535 { |
|
536 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
537 } |
|
538 TRAP(err, pos = aPlayer->PositionL()); |
|
539 if (err == KErrNotReady) |
|
540 { |
|
541 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
542 } |
|
543 INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(pos.Int64())); |
|
544 } |
|
545 else |
|
546 { |
|
547 INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64())); |
|
548 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
549 if (err == KErrNotSupported) |
|
550 { |
|
551 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
552 } |
|
553 TRAP(err, pos = aPlayer->PositionL()); |
|
554 if (err == KErrNotReady) |
|
555 { |
|
556 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
557 } |
|
558 INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(iPosition.Int64())); |
|
559 } |
|
560 |
|
561 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
562 PrepareState(EVPPlayComplete, KErrNone); |
|
563 aPlayer->Play(); |
|
564 |
|
565 |
|
566 TRAP(err, pos = aPlayer->PositionL()); |
|
567 if (err != KErrNone) |
|
568 { |
|
569 INFO_PRINTF2(_L("PositionL() left with Error - %d"), err); |
|
570 ret = EFail; |
|
571 } |
|
572 |
|
573 return ret; |
|
574 } |
|
575 |
|
576 |
|
577 // |
|
578 // RTestVclntPriority |
|
579 // |
|
580 |
|
581 /** |
|
582 * RTestVclntPriority::Constructor |
|
583 */ |
|
584 RTestVclntPriority::RTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority) |
|
585 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
586 { |
|
587 iPriority = aPriority; |
|
588 } |
|
589 |
|
590 /** |
|
591 * RTestVclntRecordAviFile::Constructor |
|
592 */ |
|
593 RTestVclntPriority* RTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority) |
|
594 { |
|
595 RTestVclntPriority* self = new (ELeave) RTestVclntPriority(aTestName, aSectName, aKeyName, aExpectedError, aPriority); |
|
596 return self; |
|
597 } |
|
598 |
|
599 /** |
|
600 * RTestVclntRecordAviFile::Constructor |
|
601 */ |
|
602 TVerdict RTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer) |
|
603 { |
|
604 TVerdict ret = EFail; |
|
605 |
|
606 INFO_PRINTF1(_L("Test : Video Player - Priority")); |
|
607 |
|
608 aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone); |
|
609 TInt thePriority = 0; |
|
610 TMdaPriorityPreference thePref; |
|
611 aPlayer->PriorityL(thePriority, thePref); |
|
612 INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority); |
|
613 INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone); |
|
614 |
|
615 if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) ) |
|
616 { |
|
617 ret = EPass; |
|
618 } |
|
619 |
|
620 CActiveScheduler::Stop(); |
|
621 |
|
622 return ret; |
|
623 } |
|
624 |
|
625 |
|
626 // |
|
627 // RTestVclntDuration |
|
628 // |
|
629 |
|
630 /** |
|
631 * RTestVclntDuration::Constructor |
|
632 */ |
|
633 RTestVclntDuration::RTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration) |
|
634 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
635 { |
|
636 iDuration = aDuration; |
|
637 } |
|
638 |
|
639 /** |
|
640 * RTestVclntDuration::Constructor |
|
641 */ |
|
642 RTestVclntDuration* RTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration) |
|
643 { |
|
644 RTestVclntDuration* self = new (ELeave) RTestVclntDuration(aTestName, aSectName, aKeyName, aExpectedError, aDuration); |
|
645 return self; |
|
646 } |
|
647 |
|
648 /** |
|
649 * RTestVclntDuration::Constructor |
|
650 */ |
|
651 TVerdict RTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer) |
|
652 { |
|
653 TVerdict ret = EFail; |
|
654 |
|
655 INFO_PRINTF1(_L("Test : Video Player - Duration")); |
|
656 |
|
657 if (I64INT(iDuration.Int64()) == 0) |
|
658 { |
|
659 TInt duration = I64INT(aPlayer->DurationL().Int64()); |
|
660 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
661 PrepareState(EVPPlayComplete, KErrNone); |
|
662 aPlayer->Play(); |
|
663 TTime start; |
|
664 start.HomeTime(); |
|
665 CActiveScheduler::Start(); |
|
666 TTime stop; |
|
667 stop.HomeTime(); |
|
668 |
|
669 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
670 |
|
671 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"), |
|
672 iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration); |
|
673 if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation))) |
|
674 { |
|
675 ret = EPass; |
|
676 } |
|
677 } |
|
678 else |
|
679 { |
|
680 if(aPlayer->DurationL() == iDuration) |
|
681 { |
|
682 ret = EPass; |
|
683 } |
|
684 } |
|
685 |
|
686 CActiveScheduler::Stop(); |
|
687 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)iCurrentCacheSize.iMinSize,(TAny*)iCurrentCacheSize.iMaxSize); |
|
688 if(CheckCacheError(error)==EInconclusive) |
|
689 { |
|
690 return EInconclusive; |
|
691 } |
|
692 INFO_PRINTF3(_L("Setting Cache Min Size to %d,Setting Cache Max Size is %d"),iCurrentCacheSize.iMinSize,iCurrentCacheSize.iMaxSize); |
|
693 return ret; |
|
694 } |
|
695 |
|
696 TVerdict RTestVclntDuration::SetCacheSize() |
|
697 { |
|
698 TVerdict ret=EPass; |
|
699 //save the default cache sizes, set the cache size back these values after the test |
|
700 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalGetCacheSize,&iCurrentCacheSize,0); |
|
701 ret=CheckCacheError(error); |
|
702 if(ret==EPass) |
|
703 { |
|
704 error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize); |
|
705 ret=CheckCacheError(error); |
|
706 } |
|
707 return ret; |
|
708 } |
|
709 |
|
710 TVerdict RTestVclntDuration::CheckCacheError(TInt aError) |
|
711 { |
|
712 TVerdict verdict=EPass; |
|
713 #ifdef __WINSCW__ |
|
714 //Winscw does not support getting cache size. Ignoring -5 error |
|
715 if(aError!=KErrNone) |
|
716 { |
|
717 if(aError!=KErrNotSupported) |
|
718 { |
|
719 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
720 return EInconclusive; |
|
721 } |
|
722 } |
|
723 #else |
|
724 if(aError!=KErrNone) |
|
725 {//For ARMV5 we stop for all errors |
|
726 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
727 return EInconclusive; |
|
728 } |
|
729 #endif |
|
730 return verdict; |
|
731 } |
|
732 |
|
733 // |
|
734 // RTestVclntVolume |
|
735 // |
|
736 |
|
737 /** |
|
738 * RTestVclntVolume::Constructor |
|
739 */ |
|
740 RTestVclntVolume::RTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume) |
|
741 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
742 { |
|
743 iVolume = aVolume; |
|
744 } |
|
745 |
|
746 /** |
|
747 * RTestVclntVolume::Constructor |
|
748 */ |
|
749 RTestVclntVolume* RTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume) |
|
750 { |
|
751 RTestVclntVolume* self = new (ELeave) RTestVclntVolume(aTestName, aSectName, aKeyName, aExpectedError, aVolume); |
|
752 return self; |
|
753 } |
|
754 |
|
755 /** |
|
756 * RTestVclntVolume::Constructor |
|
757 */ |
|
758 TVerdict RTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer) |
|
759 { |
|
760 TVerdict ret = EFail; |
|
761 TInt err; |
|
762 |
|
763 INFO_PRINTF1(_L("Test : Video Player - Volume")); |
|
764 |
|
765 // see if audio is enabled |
|
766 if (aPlayer->AudioEnabledL()) |
|
767 { |
|
768 INFO_PRINTF1(_L("AudioEnabledL() returned True")); |
|
769 } |
|
770 else |
|
771 { |
|
772 INFO_PRINTF1(_L("AudioEnabledL() returned False")); |
|
773 } |
|
774 |
|
775 // Check maxvolume function |
|
776 if(iVolume == -1) |
|
777 { |
|
778 iVolume = aPlayer->MaxVolume(); |
|
779 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
780 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err); |
|
781 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), aPlayer->MaxVolume()); |
|
782 if(aPlayer->Volume() == aPlayer->MaxVolume()) |
|
783 { |
|
784 ret = EPass; |
|
785 } |
|
786 } |
|
787 // Volume should truncated to maxvolume |
|
788 else if(iVolume > aPlayer->MaxVolume()) |
|
789 { |
|
790 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
791 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err); |
|
792 INFO_PRINTF3(_L("Volume = %d, MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume()); |
|
793 if(aPlayer->Volume() == aPlayer->MaxVolume()) |
|
794 { |
|
795 ret = EPass; |
|
796 } |
|
797 } |
|
798 // Volume is truncated to 0 |
|
799 else if(iVolume < 0) |
|
800 { |
|
801 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
802 INFO_PRINTF2(_L("Volume should be set to Min Volume.Returned with %d"), err); |
|
803 INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume()); |
|
804 if(aPlayer->Volume() == 0) |
|
805 { |
|
806 ret = EPass; |
|
807 } |
|
808 } |
|
809 // Set volume and check |
|
810 else |
|
811 { |
|
812 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
813 INFO_PRINTF2(_L("Volume should be set to the desired value. Retuned with %d"), err); |
|
814 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume); |
|
815 if(aPlayer->Volume() == iVolume) |
|
816 { |
|
817 ret = EPass; |
|
818 } |
|
819 } |
|
820 |
|
821 CActiveScheduler::Stop(); |
|
822 |
|
823 return ret; |
|
824 } |
|
825 |
|
826 // |
|
827 // RTestVclntCloseOpen |
|
828 // |
|
829 |
|
830 /** |
|
831 * RTestVclntCloseOpen::Constructor |
|
832 */ |
|
833 RTestVclntCloseOpen::RTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
834 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
835 { |
|
836 iOpenCount = 1; |
|
837 } |
|
838 |
|
839 /** |
|
840 * RTestVclntCloseOpen::Constructor |
|
841 */ |
|
842 RTestVclntCloseOpen* RTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
843 { |
|
844 RTestVclntCloseOpen* self = new (ELeave) RTestVclntCloseOpen(aTestName, aSectName, aKeyName, aExpectedError); |
|
845 return self; |
|
846 } |
|
847 |
|
848 /** |
|
849 * RTestVclntCloseOpen::DoTestStepL |
|
850 */ |
|
851 TVerdict RTestVclntCloseOpen::DoTestStepL() |
|
852 { |
|
853 // Call the state handler from IDLE state |
|
854 FsmL(EVPIdle); |
|
855 |
|
856 // Start the scheduler - Done only once ! |
|
857 CActiveScheduler::Start(); |
|
858 |
|
859 return iTestStepResult; |
|
860 } |
|
861 |
|
862 /** |
|
863 * RTestVclntCloseOpen::FsmL |
|
864 */ |
|
865 void RTestVclntCloseOpen::FsmL(TVclntTestPlayEvents aEventCode) |
|
866 { |
|
867 if (FsmCheck(aEventCode)) |
|
868 { |
|
869 switch (aEventCode) |
|
870 { |
|
871 case EVPIdle: |
|
872 // Open iVideoPlayer First time |
|
873 iOpenCount = 1; |
|
874 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
875 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
876 PrepareState(EVPOpenComplete, KErrNone); |
|
877 break; |
|
878 case EVPOpenComplete: |
|
879 if (iOpenCount == 1) |
|
880 { |
|
881 // Prepare iVideoPlayer |
|
882 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
883 iVideoPlayer->Prepare(); |
|
884 PrepareState(EVPPrepareComplete, KErrNone); |
|
885 } |
|
886 else |
|
887 { |
|
888 CActiveScheduler::Stop(); |
|
889 iTestStepResult = EPass; |
|
890 break; |
|
891 } |
|
892 break; |
|
893 case EVPPrepareComplete: |
|
894 // Close iVideoPlayer |
|
895 CActiveScheduler::Stop(); |
|
896 INFO_PRINTF1(_L("iVideoPlayer->Close()")); |
|
897 iVideoPlayer->Close(); |
|
898 User::After(KOneSecond); |
|
899 // Open iVideoPlayer Second time |
|
900 iOpenCount = 2; |
|
901 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
902 iVideoPlayer->OpenFileL(iFilename, ControllerUid()); |
|
903 PrepareState(EVPOpenComplete, KErrNone); |
|
904 CActiveScheduler::Start(); |
|
905 break; |
|
906 } |
|
907 } |
|
908 } |
|
909 |
|
910 // |
|
911 // RTestVclntPause |
|
912 // |
|
913 |
|
914 /** |
|
915 * RTestVclntPause::Constructor |
|
916 */ |
|
917 RTestVclntPause::RTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
918 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
919 {} |
|
920 |
|
921 /** |
|
922 * RTestVclntPause::NewL |
|
923 */ |
|
924 RTestVclntPause* RTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
925 { |
|
926 RTestVclntPause* self = new (ELeave) RTestVclntPause(aTestName, aSectName, aKeyName, aExpectedError); |
|
927 return self; |
|
928 } |
|
929 |
|
930 /** |
|
931 * RTestVclntPause::DoTestStepL |
|
932 */ |
|
933 TVerdict RTestVclntPause::DoTestStepL() |
|
934 { |
|
935 // Call the state handler from IDLE state |
|
936 FsmL(EVPIdle); |
|
937 |
|
938 // Start the scheduler - Done only once ! |
|
939 CActiveScheduler::Start(); |
|
940 |
|
941 return iTestStepResult; |
|
942 } |
|
943 |
|
944 /** |
|
945 * RTestVclntPause::FsmL |
|
946 */ |
|
947 void RTestVclntPause::FsmL(TVclntTestPlayEvents aEventCode) |
|
948 { |
|
949 TTime stop; |
|
950 TTime start = NULL; |
|
951 |
|
952 if (FsmCheck(aEventCode)) |
|
953 { |
|
954 switch (aEventCode) |
|
955 { |
|
956 case EVPIdle: |
|
957 // Open iVideoPlayer |
|
958 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
959 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
960 PrepareState(EVPOpenComplete, KErrNone); |
|
961 break; |
|
962 case EVPOpenComplete: |
|
963 // Prepare iVideoPlayer |
|
964 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
965 iVideoPlayer->Prepare(); |
|
966 PrepareState(EVPPrepareComplete, KErrNone); |
|
967 break; |
|
968 case EVPPrepareComplete: |
|
969 // Play iVideoPlayer |
|
970 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
971 PrepareState(EVPPlayComplete, KErrNone); |
|
972 iVideoPlayer->Play(); |
|
973 // Pause iVideoPlayer |
|
974 INFO_PRINTF1(_L("iVideoPlayer->Pause()")); |
|
975 TRAPD(err,iVideoPlayer->PauseL()); |
|
976 if (err == KErrNotSupported) |
|
977 { |
|
978 INFO_PRINTF1(_L("Pause not supported presently")); |
|
979 } |
|
980 else |
|
981 { |
|
982 INFO_PRINTF2(_L("Pause() returns with error : %d"),err); |
|
983 iTestStepResult = EFail; |
|
984 CActiveScheduler::Stop(); |
|
985 break; |
|
986 } |
|
987 // Stop iVideoPlayer |
|
988 INFO_PRINTF1(_L("iVideoPlayer->Stop()")); |
|
989 iVideoPlayer->Stop(); |
|
990 // Get the duration of the file. |
|
991 iPlayerDuration = I64INT(iVideoPlayer->DurationL().Int64()); |
|
992 // Resume play iVideoPlayer |
|
993 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
994 iVideoPlayer->Play(); |
|
995 // Note the start time |
|
996 start.HomeTime(); |
|
997 break; |
|
998 case EVPPlayComplete: |
|
999 // Note the stop time |
|
1000 stop.HomeTime(); |
|
1001 // Get the actual duration |
|
1002 iActualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1003 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d PlayerDuration = %d ActualDuration = %d"), |
|
1004 iError, I64INT(start.Int64()), I64INT(stop.Int64()), iPlayerDuration, iActualDuration); |
|
1005 // Check the results |
|
1006 if((iError == KErrNone) && (TimeComparison(iActualDuration, iPlayerDuration, KExpectedDeviation))) |
|
1007 { |
|
1008 iTestStepResult = EPass; |
|
1009 } |
|
1010 CActiveScheduler::Stop(); |
|
1011 break; |
|
1012 } |
|
1013 } |
|
1014 } |
|
1015 |
|
1016 // |
|
1017 // RTestVclntBalance |
|
1018 // |
|
1019 |
|
1020 /** |
|
1021 * RTestVclntBalance::Constructor |
|
1022 */ |
|
1023 RTestVclntBalance::RTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance) |
|
1024 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1025 { |
|
1026 iBalance = aBalance; |
|
1027 } |
|
1028 |
|
1029 /** |
|
1030 * RTestVclntBalance::NewL |
|
1031 */ |
|
1032 RTestVclntBalance* RTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance) |
|
1033 { |
|
1034 RTestVclntBalance* self = new (ELeave) RTestVclntBalance(aTestName, aSectName, aKeyName, aExpectedError, aBalance); |
|
1035 return self; |
|
1036 } |
|
1037 |
|
1038 /** |
|
1039 * RTestVclntBalance::DoTestL |
|
1040 */ |
|
1041 TVerdict RTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1042 { |
|
1043 TVerdict ret = EFail; |
|
1044 TInt err = KErrNone; |
|
1045 |
|
1046 INFO_PRINTF1(_L("Test : Video Player - Balance")); |
|
1047 |
|
1048 // see if audio is enabled |
|
1049 if (aPlayer->AudioEnabledL()) |
|
1050 { |
|
1051 INFO_PRINTF1(_L("AudioEnabledL() returned True")); |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 INFO_PRINTF1(_L("AudioEnabledL() returned False")); |
|
1056 } |
|
1057 |
|
1058 // set the balance |
|
1059 TRAP(err, aPlayer->SetBalanceL(iBalance)); |
|
1060 INFO_PRINTF2(_L("SetBalanceL() left with Error - %d"), err); |
|
1061 |
|
1062 // check for the valid balance |
|
1063 if (iBalance < KMinBalance) |
|
1064 { |
|
1065 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance); |
|
1066 if(aPlayer->Balance() == KMinBalance) |
|
1067 { |
|
1068 ret = EPass; |
|
1069 } |
|
1070 } |
|
1071 else if (iBalance > KMaxBalance) |
|
1072 { |
|
1073 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance); |
|
1074 if(aPlayer->Balance() == KMaxBalance) |
|
1075 { |
|
1076 ret = EPass; |
|
1077 } |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance); |
|
1082 if(aPlayer->Balance() == iBalance) |
|
1083 { |
|
1084 ret = EPass; |
|
1085 } |
|
1086 } |
|
1087 |
|
1088 CActiveScheduler::Stop(); |
|
1089 |
|
1090 return ret; |
|
1091 } |
|
1092 |
|
1093 |
|
1094 // |
|
1095 // RTestVclntPlayWindow |
|
1096 // |
|
1097 |
|
1098 /** |
|
1099 * RTestVclntPlayWindow::Constructor |
|
1100 */ |
|
1101 RTestVclntPlayWindow::RTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd) |
|
1102 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1103 { |
|
1104 iStart = aStart; |
|
1105 iEnd = aEnd; |
|
1106 } |
|
1107 |
|
1108 /** |
|
1109 * RTestVclntPlayWindow::Constructor |
|
1110 */ |
|
1111 RTestVclntPlayWindow* RTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd) |
|
1112 { |
|
1113 RTestVclntPlayWindow* self = new (ELeave) RTestVclntPlayWindow(aTestName, aSectName, aKeyName, aExpectedError, aStart, aEnd); |
|
1114 return self; |
|
1115 } |
|
1116 |
|
1117 /** |
|
1118 * RTestVclntPlayWindow::Constructor |
|
1119 */ |
|
1120 TVerdict RTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1121 { |
|
1122 TVerdict ret = EFail; |
|
1123 |
|
1124 INFO_PRINTF1(_L("Test : Video Player - Window")); |
|
1125 |
|
1126 TPoint rectOrigin(10, 10); |
|
1127 TSize rectSize(176, 144); |
|
1128 TRect rect(rectOrigin, rectSize); |
|
1129 |
|
1130 TPoint clipOrigin(10, 10); |
|
1131 TSize clipSize(176, 144); |
|
1132 TRect clipRect(clipOrigin, clipSize); |
|
1133 |
|
1134 TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect)); |
|
1135 if(err) |
|
1136 { |
|
1137 ERR_PRINTF2(_L("SetDisplayWindowL() failed, error %d"), err); |
|
1138 ret = EFail; |
|
1139 } |
|
1140 else |
|
1141 { |
|
1142 ret = EPass; |
|
1143 } |
|
1144 |
|
1145 CActiveScheduler::Stop(); |
|
1146 |
|
1147 return ret; |
|
1148 } |
|
1149 |
|
1150 |
|
1151 // |
|
1152 // RTestVclntMeta |
|
1153 // |
|
1154 |
|
1155 /** |
|
1156 * RTestVclntMeta::Constructor |
|
1157 */ |
|
1158 RTestVclntMeta::RTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1159 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1160 {} |
|
1161 |
|
1162 /** |
|
1163 * RTestVclntMeta::Constructor |
|
1164 */ |
|
1165 RTestVclntMeta* RTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1166 { |
|
1167 RTestVclntMeta* self = new (ELeave) RTestVclntMeta(aTestName, aSectName, aKeyName, aExpectedError); |
|
1168 return self; |
|
1169 } |
|
1170 |
|
1171 /** |
|
1172 * RTestVclntMeta::Constructor |
|
1173 */ |
|
1174 TVerdict RTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1175 { |
|
1176 INFO_PRINTF1(_L("Test : Video Player - Metadata")); |
|
1177 |
|
1178 CActiveScheduler::Stop(); |
|
1179 |
|
1180 // there are zero meta entries now. |
|
1181 TInt numOfMeta = -1; |
|
1182 TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() ); |
|
1183 INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta); |
|
1184 if (err != KErrNotSupported || numOfMeta != -1) |
|
1185 { |
|
1186 return EFail; |
|
1187 } |
|
1188 |
|
1189 // attempt to get an entry when no entry exists. |
|
1190 CMMFMetaDataEntry* theEntry=NULL; |
|
1191 TRAP(err, theEntry = aPlayer->MetaDataEntryL(1)); |
|
1192 INFO_PRINTF2(_L("Error : %d"), err); |
|
1193 if (err != KErrNotSupported) |
|
1194 { |
|
1195 return EFail; |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 delete theEntry; |
|
1200 return EPass; |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 |
|
1205 // |
|
1206 // RTestVclntFrameSize |
|
1207 // |
|
1208 |
|
1209 /** |
|
1210 * RTestVclntFrameSize::Constructor |
|
1211 */ |
|
1212 RTestVclntFrameSize::RTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1213 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1214 { |
|
1215 iFrameSize.iWidth = 0; |
|
1216 iFrameSize.iHeight = 0; |
|
1217 } |
|
1218 |
|
1219 /** |
|
1220 * RTestVclntFrameSize::NewL |
|
1221 */ |
|
1222 RTestVclntFrameSize* RTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1223 { |
|
1224 RTestVclntFrameSize* self = new (ELeave) RTestVclntFrameSize(aTestName, aSectName, aKeyName, aExpectedError); |
|
1225 return self; |
|
1226 } |
|
1227 |
|
1228 /** |
|
1229 * RTestVclntFrameSize::DoTestL |
|
1230 */ |
|
1231 TVerdict RTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1232 { |
|
1233 TVerdict ret = EFail; |
|
1234 |
|
1235 INFO_PRINTF1(_L("Test : Video Player - Get Frame Size")); |
|
1236 TInt err; |
|
1237 TRAP(err, aPlayer->VideoFrameSizeL(iFrameSize)); |
|
1238 |
|
1239 INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, iFrameSize.iWidth, iFrameSize.iHeight); |
|
1240 if (err == KErrNone && iFrameSize.iWidth >= 0 && iFrameSize.iHeight >= 0 ) |
|
1241 { |
|
1242 ret = EPass; |
|
1243 } |
|
1244 |
|
1245 CActiveScheduler::Stop(); |
|
1246 |
|
1247 return ret; |
|
1248 } |
|
1249 |
|
1250 // |
|
1251 // RTestVclntMimeType |
|
1252 // |
|
1253 |
|
1254 /** |
|
1255 * RTestVclntMimeType::Constructor |
|
1256 */ |
|
1257 RTestVclntMimeType::RTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1258 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1259 { |
|
1260 } |
|
1261 |
|
1262 /** |
|
1263 * RTestVclntMimeType::Constructor |
|
1264 */ |
|
1265 RTestVclntMimeType* RTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1266 { |
|
1267 RTestVclntMimeType* self = new (ELeave) RTestVclntMimeType(aTestName, aSectName, aKeyName, aExpectedError); |
|
1268 return self; |
|
1269 } |
|
1270 |
|
1271 /** |
|
1272 * RTestVclntMimeType::Constructor |
|
1273 */ |
|
1274 TVerdict RTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1275 { |
|
1276 |
|
1277 TVerdict ret = EFail; |
|
1278 |
|
1279 INFO_PRINTF1(_L("Test : Video Player - MimeType")); |
|
1280 |
|
1281 // Get the Video Mime type |
|
1282 TPtrC8 mimeType = aPlayer->VideoFormatMimeType(); |
|
1283 |
|
1284 // take it to a 16-bit string |
|
1285 TBuf<64> mimeType16; |
|
1286 mimeType16.Copy(mimeType); |
|
1287 INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16); |
|
1288 |
|
1289 // Check if its valid |
|
1290 if (mimeType16.Compare(_L("XVID")) == 0) |
|
1291 { |
|
1292 INFO_PRINTF1(_L("MIME Types match")); |
|
1293 ret = EPass; |
|
1294 } |
|
1295 |
|
1296 CActiveScheduler::Stop(); |
|
1297 |
|
1298 return ret; |
|
1299 } |
|
1300 |
|
1301 // |
|
1302 // RTestVclntScale |
|
1303 // |
|
1304 |
|
1305 /** |
|
1306 * RTestVclntScale::Constructor |
|
1307 */ |
|
1308 RTestVclntScale::RTestVclntScale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1309 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1310 { |
|
1311 } |
|
1312 |
|
1313 /** |
|
1314 * RTestVclntScale::Constructor |
|
1315 */ |
|
1316 RTestVclntScale* RTestVclntScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1317 { |
|
1318 RTestVclntScale* self = new (ELeave) RTestVclntScale(aTestName, aSectName, aKeyName, aExpectedError); |
|
1319 return self; |
|
1320 } |
|
1321 |
|
1322 /** |
|
1323 * RTestVclntScale::Constructor |
|
1324 */ |
|
1325 TVerdict RTestVclntScale::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1326 { |
|
1327 INFO_PRINTF1(_L("Test : Video Player - Scale Values test")); |
|
1328 |
|
1329 CActiveScheduler::Stop(); |
|
1330 |
|
1331 // Set the scale factor using values set #1 |
|
1332 INFO_PRINTF1(_L("iVideoPlayer->SetScaleFactorL() #1")); |
|
1333 TRAPD(err, aPlayer->SetScaleFactorL(100, 100, ETrue)); |
|
1334 |
|
1335 #ifdef SYMBIAN_BUILD_GCE |
|
1336 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone; |
|
1337 #else |
|
1338 TInt expected = KErrNotSupported; |
|
1339 #endif |
|
1340 |
|
1341 if (err != expected) |
|
1342 { |
|
1343 ERR_PRINTF2(_L("iVideoPlayer->SetScaleFactorL() encountered error : %d"), err); |
|
1344 return EFail; |
|
1345 } |
|
1346 |
|
1347 return EPass; |
|
1348 } |
|
1349 |
|
1350 // |
|
1351 // RTestVclntCrop |
|
1352 // |
|
1353 |
|
1354 /** |
|
1355 * RTestVclntCrop::Constructor |
|
1356 */ |
|
1357 RTestVclntCrop::RTestVclntCrop(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1358 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1359 { |
|
1360 } |
|
1361 |
|
1362 /** |
|
1363 * RTestVclntCrop::Constructor |
|
1364 */ |
|
1365 RTestVclntCrop* RTestVclntCrop::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1366 { |
|
1367 RTestVclntCrop* self = new (ELeave) RTestVclntCrop(aTestName, aSectName, aKeyName, aExpectedError); |
|
1368 return self; |
|
1369 } |
|
1370 |
|
1371 /** |
|
1372 * RTestVclntCrop::Constructor |
|
1373 */ |
|
1374 TVerdict RTestVclntCrop::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1375 { |
|
1376 TRect cropRegion(KCropRegionRectLeft, KCropRegionRectTop, KCropRegionRectRight, KCropRegionRectBottom); |
|
1377 TRect region; |
|
1378 |
|
1379 INFO_PRINTF1(_L("Test : Video Player - Crop Values")); |
|
1380 |
|
1381 CActiveScheduler::Stop(); |
|
1382 |
|
1383 // Set the Crop Region |
|
1384 INFO_PRINTF1(_L("iVideoPlayer->SetCropRegionL()")); |
|
1385 TRAPD(err, aPlayer->SetCropRegionL(cropRegion)); |
|
1386 |
|
1387 #ifdef SYMBIAN_BUILD_GCE |
|
1388 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone; |
|
1389 #else |
|
1390 TInt expected = KErrNotSupported; |
|
1391 #endif |
|
1392 |
|
1393 if (err != expected) |
|
1394 { |
|
1395 ERR_PRINTF2(_L("iVideoPlayer->SetCropRegionL() encountered error : %d"), err); |
|
1396 return EFail; |
|
1397 } |
|
1398 |
|
1399 return EPass; |
|
1400 } |
|
1401 |
|
1402 #ifdef SYMBIAN_BUILD_GCE |
|
1403 |
|
1404 RTestVclntAutoScale::RTestVclntAutoScale(const TDesC& aTestName) |
|
1405 : RTestVclntPlayAviFile(aTestName, KNullDesC, KNullDesC, KErrNone, EFalse) |
|
1406 { |
|
1407 } |
|
1408 |
|
1409 /** |
|
1410 * RTestVclntCrop::Constructor |
|
1411 */ |
|
1412 RTestVclntAutoScale* RTestVclntAutoScale::NewL(const TDesC& aTestName) |
|
1413 { |
|
1414 RTestVclntAutoScale* self = new (ELeave) RTestVclntAutoScale(aTestName); |
|
1415 return self; |
|
1416 } |
|
1417 |
|
1418 /** |
|
1419 * RTestVclntCrop::Constructor |
|
1420 */ |
|
1421 TVerdict RTestVclntAutoScale::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1422 { |
|
1423 INFO_PRINTF1(_L("Test : Video Player - AutoScale Values")); |
|
1424 |
|
1425 CActiveScheduler::Stop(); |
|
1426 |
|
1427 // Set auto scale |
|
1428 INFO_PRINTF1(_L("iVideoPlayer->SetAutoScaleL()")); |
|
1429 TRAPD(err, aPlayer->SetAutoScaleL(EAutoScaleBestFit)); |
|
1430 |
|
1431 if (err != KErrNone) |
|
1432 { |
|
1433 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1434 return EFail; |
|
1435 } |
|
1436 |
|
1437 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleNone)); |
|
1438 |
|
1439 if (err != KErrNone) |
|
1440 { |
|
1441 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1442 return EFail; |
|
1443 } |
|
1444 |
|
1445 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleClip)); |
|
1446 |
|
1447 if (err != KErrNone) |
|
1448 { |
|
1449 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1450 return EFail; |
|
1451 } |
|
1452 |
|
1453 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleStretch, EHorizontalAlignLeft, EVerticalAlignBottom)); |
|
1454 |
|
1455 if (err != KErrNone) |
|
1456 { |
|
1457 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1458 return EFail; |
|
1459 } |
|
1460 |
|
1461 return EPass; |
|
1462 } |
|
1463 |
|
1464 #endif // SYMBIAN_BUILD_GCE |
|
1465 |
|
1466 // |
|
1467 // RTestVclntGetFrame |
|
1468 // |
|
1469 |
|
1470 /** |
|
1471 * RTestVclntGetFrame::Constructor |
|
1472 */ |
|
1473 RTestVclntGetFrame::RTestVclntGetFrame(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI) |
|
1474 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse), iUseIntentAPI(aUseIntentAPI) |
|
1475 { |
|
1476 } |
|
1477 |
|
1478 /** |
|
1479 * RTestVclntGetFrame::Constructor |
|
1480 */ |
|
1481 RTestVclntGetFrame* RTestVclntGetFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI) |
|
1482 { |
|
1483 RTestVclntGetFrame* self = new (ELeave) RTestVclntGetFrame(aTestName, aSectName, aKeyName, aExpectedError, aUseIntentAPI); |
|
1484 return self; |
|
1485 } |
|
1486 |
|
1487 /** |
|
1488 * RTestVclntGetFrame::DoTestStepL |
|
1489 */ |
|
1490 TVerdict RTestVclntGetFrame::DoTestStepL() |
|
1491 { |
|
1492 // Call the state handler from IDLE state |
|
1493 FsmL(EVPIdle); |
|
1494 |
|
1495 // Start the scheduler - Done only once ! |
|
1496 CActiveScheduler::Start(); |
|
1497 |
|
1498 return iTestStepResult; |
|
1499 } |
|
1500 |
|
1501 /** |
|
1502 * RTestVclntGetFrame::FsmL |
|
1503 */ |
|
1504 void RTestVclntGetFrame::FsmL(TVclntTestPlayEvents aEventCode) |
|
1505 { |
|
1506 if (FsmCheck(aEventCode)) |
|
1507 { |
|
1508 switch (aEventCode) |
|
1509 { |
|
1510 case EVPIdle: |
|
1511 // Open iVideoPlayer |
|
1512 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
1513 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
1514 PrepareState(EVPOpenComplete, KErrNone); |
|
1515 break; |
|
1516 case EVPOpenComplete: |
|
1517 // Prepare iVideoPlayer |
|
1518 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1519 iVideoPlayer->Prepare(); |
|
1520 PrepareState(EVPPrepareComplete, KErrNone); |
|
1521 break; |
|
1522 case EVPPrepareComplete: |
|
1523 // Play iVideoPlayer |
|
1524 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1525 iVideoPlayer->Play(); |
|
1526 // Call GetFrameL |
|
1527 if (iUseIntentAPI) |
|
1528 { |
|
1529 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL() with EPeek Intent")); |
|
1530 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M, ContentAccess::EPeek)); |
|
1531 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError); |
|
1532 } |
|
1533 else |
|
1534 { |
|
1535 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL()")); |
|
1536 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M)); |
|
1537 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError); |
|
1538 } |
|
1539 PrepareState(EVPFrameReady, KErrNone); |
|
1540 case EVPFrameReady: |
|
1541 // Stop iVideoPlayer |
|
1542 iVideoPlayer->Stop(); |
|
1543 CActiveScheduler::Stop(); |
|
1544 iTestStepResult = EPass; |
|
1545 break; |
|
1546 } |
|
1547 } |
|
1548 } |
|
1549 |
|
1550 /** |
|
1551 * RTestVclntGetFrame::MvpuoFrameReady |
|
1552 * Overriding the callback method here, to check the bitmap.. |
|
1553 */ |
|
1554 void RTestVclntGetFrame::MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError) |
|
1555 { |
|
1556 if (aError!=KErrNone) |
|
1557 { |
|
1558 iError = aError; |
|
1559 } |
|
1560 else if (aFrame.Handle() == NULL || aFrame.SizeInPixels() != TSize(KFrameWidth, KFrameHeight) ) |
|
1561 { |
|
1562 iError = KErrArgument; |
|
1563 ERR_PRINTF1(_L("The Frame returned is either NULL or there is a mismatch in the size..")); |
|
1564 } |
|
1565 TRAP(iError, FsmL(EVPFrameReady)); |
|
1566 INFO_PRINTF2(_L("Error code : %d"),iError); |
|
1567 } |
|
1568 |
|
1569 |
|
1570 // |
|
1571 // RTestVclntRebuffering |
|
1572 // |
|
1573 |
|
1574 /** |
|
1575 * RTestVclntRebuffering::Constructor |
|
1576 */ |
|
1577 RTestVclntRebuffering::RTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1578 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1579 { |
|
1580 } |
|
1581 |
|
1582 /** |
|
1583 * RTestVclntRebuffering::NewL |
|
1584 */ |
|
1585 RTestVclntRebuffering* RTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1586 { |
|
1587 RTestVclntRebuffering* self = new (ELeave) RTestVclntRebuffering(aTestName, aSectName, aKeyName, aExpectedError); |
|
1588 return self; |
|
1589 } |
|
1590 |
|
1591 /** |
|
1592 * RTestVclntRebuffering::DoTestL |
|
1593 */ |
|
1594 TVerdict RTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1595 { |
|
1596 INFO_PRINTF1(_L("Test : Video Player - Rebuffering")); |
|
1597 |
|
1598 aPlayer->RegisterForVideoLoadingNotification(*this); |
|
1599 |
|
1600 INFO_PRINTF1(_L("Rebuffering request completed")); |
|
1601 |
|
1602 CActiveScheduler::Stop(); |
|
1603 |
|
1604 return EPass; |
|
1605 } |
|
1606 |
|
1607 /** |
|
1608 * RTestVclntRebuffering::MvloLoadingStarted |
|
1609 */ |
|
1610 void RTestVclntRebuffering::MvloLoadingStarted() |
|
1611 { |
|
1612 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingStarted")); |
|
1613 } |
|
1614 |
|
1615 /** |
|
1616 * RTestVclntRebuffering::MvloLoadingComplete |
|
1617 */ |
|
1618 void RTestVclntRebuffering::MvloLoadingComplete() |
|
1619 { |
|
1620 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingComplete")); |
|
1621 } |
|
1622 |
|
1623 // |
|
1624 // RTestVclntRepeat |
|
1625 // |
|
1626 |
|
1627 /** |
|
1628 * RTestVclntRepeat::Constructor |
|
1629 */ |
|
1630 RTestVclntRepeat::RTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat) |
|
1631 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1632 { |
|
1633 iRepeat = aRepeat; |
|
1634 } |
|
1635 |
|
1636 /** |
|
1637 * RTestVclntRepeat::NewL |
|
1638 */ |
|
1639 RTestVclntRepeat* RTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat) |
|
1640 { |
|
1641 RTestVclntRepeat* self = new (ELeave) RTestVclntRepeat(aTestName, aSectName, aKeyName, aExpectedError, aRepeat); |
|
1642 return self; |
|
1643 } |
|
1644 |
|
1645 /** |
|
1646 * RTestVclntRepeat::DoTestL |
|
1647 */ |
|
1648 //The commented lines are kept for future implementation |
|
1649 |
|
1650 TVerdict RTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1651 { |
|
1652 TVerdict ret = EFail; |
|
1653 |
|
1654 INFO_PRINTF1(_L("Test : Video Player - Repeats")); |
|
1655 iRepeat = 1; |
|
1656 INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in iVideoPlayer API. Repeat count set to 1")); |
|
1657 |
|
1658 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1659 PrepareState(EVPPlayComplete, KErrNone); |
|
1660 aPlayer->Play(); |
|
1661 |
|
1662 CActiveScheduler::Start(); |
|
1663 |
|
1664 if(iError == KErrNotSupported || iRepeat == 1) |
|
1665 { |
|
1666 ret = EPass; |
|
1667 INFO_PRINTF2(_L("Repeat not supported currently : err : %d"),iError); |
|
1668 } |
|
1669 else |
|
1670 { |
|
1671 ret = EFail; |
|
1672 INFO_PRINTF2(_L("Returned with : err : %d"),iError); |
|
1673 } |
|
1674 |
|
1675 CActiveScheduler::Stop(); |
|
1676 |
|
1677 return ret; |
|
1678 } |
|
1679 |
|
1680 // |
|
1681 // RTestVclntDelete |
|
1682 // |
|
1683 |
|
1684 /** |
|
1685 * RTestVclntDelete::Constructor |
|
1686 */ |
|
1687 RTestVclntDelete::RTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1688 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1689 {} |
|
1690 |
|
1691 /** |
|
1692 * RTestVclntDelete::NewL |
|
1693 */ |
|
1694 RTestVclntDelete* RTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1695 { |
|
1696 RTestVclntDelete* self = new (ELeave) RTestVclntDelete(aTestName, aSectName, aKeyName, aExpectedError); |
|
1697 return self; |
|
1698 } |
|
1699 |
|
1700 /** |
|
1701 * RTestVclntDelete::DoTestStepL |
|
1702 */ |
|
1703 TVerdict RTestVclntDelete::DoTestStepL() |
|
1704 { |
|
1705 // Call the state handler from IDLE state |
|
1706 FsmL(EVPIdle); |
|
1707 |
|
1708 // Start the scheduler - Done only once ! |
|
1709 CActiveScheduler::Start(); |
|
1710 |
|
1711 return iTestStepResult; |
|
1712 } |
|
1713 |
|
1714 /** |
|
1715 * RTestVclntDelete::FsmL |
|
1716 */ |
|
1717 void RTestVclntDelete::FsmL(TVclntTestPlayEvents aEventCode) |
|
1718 { |
|
1719 if (FsmCheck(aEventCode)) |
|
1720 { |
|
1721 switch (aEventCode) |
|
1722 { |
|
1723 case EVPIdle: |
|
1724 // Open iVideoPlayer |
|
1725 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
1726 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
1727 PrepareState(EVPOpenComplete, KErrNone); |
|
1728 break; |
|
1729 case EVPOpenComplete: |
|
1730 // Prepare iVideoPlayer |
|
1731 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1732 iVideoPlayer->Prepare(); |
|
1733 PrepareState(EVPPrepareComplete, KErrNone); |
|
1734 break; |
|
1735 case EVPPrepareComplete: |
|
1736 // Play iVideoPlayer |
|
1737 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1738 iVideoPlayer->Play(); |
|
1739 PrepareState(EVPPlayComplete, KErrNone); |
|
1740 INFO_PRINTF1(_L("delete iVideoPlayer before Play completes")); |
|
1741 |
|
1742 iVideoPlayer = NULL; |
|
1743 delete iVideoPlayer; // destroy iVideoPlayer before play has completed |
|
1744 |
|
1745 CActiveScheduler::Stop(); |
|
1746 iTestStepResult = EPass; |
|
1747 break; |
|
1748 } |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 // |
|
1753 // RTestVclntPlayAviFileHandle |
|
1754 // |
|
1755 |
|
1756 /** |
|
1757 * RTestVclntPlayAviFileHandle::Constructor |
|
1758 */ |
|
1759 RTestVclntPlayAviFileHandle::RTestVclntPlayAviFileHandle(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1760 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iAlloc(aAlloc) |
|
1761 { |
|
1762 iIsOpen = EFalse; |
|
1763 } |
|
1764 |
|
1765 /** |
|
1766 * RTestVclntPlayAviFileHandle::NewL |
|
1767 */ |
|
1768 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1769 { |
|
1770 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc); |
|
1771 return self; |
|
1772 } |
|
1773 |
|
1774 /** |
|
1775 * RTestVclntPlayAviFileHandle::NewLC |
|
1776 */ |
|
1777 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1778 { |
|
1779 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc); |
|
1780 CleanupStack::PushL(self); |
|
1781 return self; |
|
1782 } |
|
1783 |
|
1784 /** |
|
1785 * RTestVclntPlayAviFileHandle::DoTestStepL() |
|
1786 */ |
|
1787 TVerdict RTestVclntPlayAviFileHandle::DoTestStepL() |
|
1788 { |
|
1789 if(SetCacheSize()!=KErrNone) |
|
1790 { |
|
1791 return EInconclusive; |
|
1792 } |
|
1793 |
|
1794 if (iAlloc) |
|
1795 { |
|
1796 TVerdict iAllocTestStepResult=EPass; |
|
1797 TInt err = KErrNone; |
|
1798 TBool result = EFalse; |
|
1799 |
|
1800 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<< |
|
1801 if( PerformTestStepL() != EPass ) |
|
1802 { |
|
1803 err = iError; |
|
1804 } |
|
1805 |
|
1806 if (err != KErrNone) |
|
1807 { |
|
1808 INFO_PRINTF2(_L("Test error, returned error code = %d"), err); |
|
1809 User::Leave(err); |
|
1810 } |
|
1811 else |
|
1812 { |
|
1813 //Check the iAllocTestStepResult |
|
1814 if (iAllocTestStepResult != EPass) |
|
1815 { |
|
1816 result = ETrue; |
|
1817 } |
|
1818 } |
|
1819 |
|
1820 TInt failCount = 1; |
|
1821 TBool completed = EFalse; |
|
1822 iAllocTestStepResult = EPass; // TODO check?? assume pass |
|
1823 TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging |
|
1824 for(;;) |
|
1825 { |
|
1826 __UHEAP_SETFAIL(RHeap::EFailNext, failCount); |
|
1827 __MM_HEAP_MARK; |
|
1828 |
|
1829 //INFO_PRINTF2(_L("CVideoPlayerUtility: Alloc Test Loop: %d"), failCount); |
|
1830 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<< |
|
1831 TVerdict verdict = EFail; |
|
1832 TRAP(err, verdict = PerformTestStepL()); |
|
1833 if (err == KErrNone && verdict != EPass) |
|
1834 { |
|
1835 err = iError; |
|
1836 } |
|
1837 |
|
1838 completed = EFalse; |
|
1839 if (err == KErrNone) |
|
1840 { |
|
1841 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test |
|
1842 if (testAlloc == NULL) |
|
1843 { |
|
1844 reachedEnd = ETrue; |
|
1845 failCount -= 1; |
|
1846 } |
|
1847 else |
|
1848 { |
|
1849 User::Free(testAlloc); |
|
1850 } |
|
1851 |
|
1852 //Check the iAllocTestStepResult |
|
1853 if (iAllocTestStepResult != EPass) |
|
1854 { |
|
1855 result = ETrue; |
|
1856 } |
|
1857 |
|
1858 completed = reachedEnd || result; |
|
1859 } |
|
1860 else if (err != KErrNoMemory) // bad error code |
|
1861 { |
|
1862 completed = ETrue; |
|
1863 result = EFail; |
|
1864 } |
|
1865 |
|
1866 __MM_HEAP_MARKEND; |
|
1867 __UHEAP_SETFAIL(RHeap::ENone, 0); |
|
1868 |
|
1869 if (completed) |
|
1870 { |
|
1871 break; // exit loop |
|
1872 } |
|
1873 |
|
1874 failCount++; |
|
1875 } |
|
1876 |
|
1877 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc |
|
1878 |
|
1879 if (err != KErrNone || result) |
|
1880 { |
|
1881 iAllocTestStepResult = EFail; |
|
1882 TBuf<80> format; |
|
1883 if (result) |
|
1884 { |
|
1885 format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount); |
|
1886 } |
|
1887 else |
|
1888 { |
|
1889 format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount); |
|
1890 } |
|
1891 Log(format); |
|
1892 } |
|
1893 else |
|
1894 { |
|
1895 TBuf<80> format; |
|
1896 format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount); |
|
1897 Log(format); |
|
1898 } |
|
1899 TUint defaultCacheSize = 0; |
|
1900 //Done with the test. Setting 0 makes the cache size revert back to boot up values |
|
1901 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize); |
|
1902 if(CheckCacheError(error)!=KErrNone) |
|
1903 { |
|
1904 INFO_PRINTF1(_L("Could not revert the cache size to default")); |
|
1905 iAllocTestStepResult=EInconclusive; |
|
1906 } |
|
1907 return iAllocTestStepResult; |
|
1908 } |
|
1909 else |
|
1910 { |
|
1911 return( PerformTestStepL() ); |
|
1912 } |
|
1913 } |
|
1914 |
|
1915 /** |
|
1916 * RTestVclntPlayAviFileHandle::PerformTestStepL() |
|
1917 */ |
|
1918 TVerdict RTestVclntPlayAviFileHandle::PerformTestStepL() |
|
1919 { |
|
1920 INFO_PRINTF1(_L("Test : Video Player - OpenFileL(RFile&)")); |
|
1921 |
|
1922 // Connect to RFs |
|
1923 User::LeaveIfError(iFs.Connect()); |
|
1924 User::LeaveIfError(iFs.ShareProtected()); |
|
1925 CleanupClosePushL(iFs); |
|
1926 |
|
1927 // Open RFile |
|
1928 User::LeaveIfError(iFile.Open(iFs, iFilename, EFileRead)); |
|
1929 CleanupClosePushL(iFile); |
|
1930 |
|
1931 // Call the state handler from IDLE state |
|
1932 iError = KErrNone; |
|
1933 PrepareState(EVPIdle, KErrNone); |
|
1934 FsmL(EVPIdle); |
|
1935 |
|
1936 // Start the scheduler - Done only once ! |
|
1937 CActiveScheduler::Start(); |
|
1938 |
|
1939 CleanupStack::PopAndDestroy(2); |
|
1940 |
|
1941 // Leave if the Expected error is KErrNone |
|
1942 if (iTestExpectedError == KErrNone) |
|
1943 { |
|
1944 User::LeaveIfError(iError); |
|
1945 } |
|
1946 |
|
1947 return iTestStepResult; |
|
1948 } |
|
1949 |
|
1950 |
|
1951 /** |
|
1952 * RTestVclntPlayAviFileHandle::FsmL() |
|
1953 */ |
|
1954 void RTestVclntPlayAviFileHandle::FsmL(TVclntTestPlayEvents aEventCode) |
|
1955 { |
|
1956 if (FsmCheck(aEventCode)) |
|
1957 { |
|
1958 switch (aEventCode) |
|
1959 { |
|
1960 case EVPIdle: |
|
1961 // Open iVideoPlayer |
|
1962 if ((iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-1013-HP")) == 0) || |
|
1963 (iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-9113-HP")) == 0)) |
|
1964 { |
|
1965 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S with Invalid Controller UID"), &iFilename); |
|
1966 TRAP(iError, iVideoPlayer->OpenFileL(iFile, KVideoInvalidControllerUid)); |
|
1967 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() returned error - %d"), iError); |
|
1968 PrepareState(EVPOpenComplete, KErrNone); |
|
1969 } |
|
1970 else |
|
1971 { |
|
1972 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
1973 iVideoPlayer->OpenFileL(iFile, ControllerUid()); |
|
1974 PrepareState(EVPOpenComplete, KErrNone); |
|
1975 } |
|
1976 break; |
|
1977 case EVPOpenComplete: |
|
1978 iIsOpen = ETrue; //-set iIsOpen flag (for closing Player, in case of Underflow)... |
|
1979 // Prepare iVideoPlayer |
|
1980 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1981 PrepareState(EVPPrepareComplete, KErrNone); |
|
1982 iVideoPlayer->Prepare(); |
|
1983 break; |
|
1984 case EVPPrepareComplete: |
|
1985 // Play iVideoPlayer |
|
1986 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1987 iVideoPlayer->Play(); |
|
1988 PrepareState(EVPPlayComplete, KErrNone); |
|
1989 break; |
|
1990 case EVPPlayComplete: |
|
1991 iVideoPlayer->Stop(); |
|
1992 iVideoPlayer->Close(); |
|
1993 CActiveScheduler::Stop(); |
|
1994 iTestStepResult = EPass; |
|
1995 break; |
|
1996 } |
|
1997 } |
|
1998 else if(iIsOpen) |
|
1999 { |
|
2000 iVideoPlayer->Close(); |
|
2001 } |
|
2002 } |
|
2003 |
|
2004 TInt RTestVclntPlayAviFileHandle::SetCacheSize() |
|
2005 { |
|
2006 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize); |
|
2007 TInt ret=CheckCacheError(error); |
|
2008 |
|
2009 return ret; |
|
2010 } |
|
2011 |
|
2012 TInt RTestVclntPlayAviFileHandle::CheckCacheError(TInt aError) |
|
2013 { |
|
2014 TInt ret=KErrNone; |
|
2015 #ifdef __WINSCW__ |
|
2016 //Winscw does not support getting cache size. Ignoring -5 error |
|
2017 if(aError!=KErrNone) |
|
2018 { |
|
2019 if(aError!=KErrNotSupported) |
|
2020 { |
|
2021 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
2022 ret=aError; |
|
2023 } |
|
2024 } |
|
2025 #else |
|
2026 if(aError!=KErrNone) |
|
2027 {//For ARMV5 we stop for all errors |
|
2028 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
2029 ret=aError; |
|
2030 } |
|
2031 #endif |
|
2032 return ret; |
|
2033 } |
|
2034 |
|
2035 |
|
2036 // |
|
2037 // RTestVideoPlayCapabilityVelocity |
|
2038 // |
|
2039 |
|
2040 /** |
|
2041 RTestVideoPlayCapabilityVelocity::Constructor |
|
2042 */ |
|
2043 RTestVideoPlayCapabilityVelocity::RTestVideoPlayCapabilityVelocity(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2044 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2045 { ; |
|
2046 } |
|
2047 |
|
2048 /** |
|
2049 RTestVideoPlayCapabilityVelocity::NewL |
|
2050 */ |
|
2051 RTestVideoPlayCapabilityVelocity* RTestVideoPlayCapabilityVelocity::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2052 { |
|
2053 RTestVideoPlayCapabilityVelocity* self = new (ELeave) RTestVideoPlayCapabilityVelocity(aTestName, aSectName, aKeyName, aExpectedError); |
|
2054 return self; |
|
2055 } |
|
2056 |
|
2057 /** |
|
2058 RTestVideoPlayCapabilityVelocity::DoTestStepL() |
|
2059 */ |
|
2060 TVerdict RTestVideoPlayCapabilityVelocity::DoTestStepL() |
|
2061 { |
|
2062 // Call the state handler from IDLE state |
|
2063 TRAPD(err, FsmL(EVPIdle)); |
|
2064 if (err == KErrNone) |
|
2065 { |
|
2066 // Start the scheduler - Done only once ! |
|
2067 CActiveScheduler::Start(); |
|
2068 } |
|
2069 return iTestStepResult; |
|
2070 } |
|
2071 /** |
|
2072 RTestVideoPlayCapabilityVelocity::FsmL() |
|
2073 */ |
|
2074 void RTestVideoPlayCapabilityVelocity::FsmL(TVclntTestPlayEvents aEventCode) |
|
2075 { |
|
2076 const TUint KVelocityDefault = 100; |
|
2077 const TUint KVelocityMinPositive = 1; |
|
2078 const TInt KVelocityMinNegative = -1; |
|
2079 const TUint KVelocityPositive = 200; |
|
2080 const TUint KVelocityBigPositive = 500; |
|
2081 const TInt KVelocityNegative = -200; |
|
2082 const TInt KVelocityBigNegative= -500; |
|
2083 //Set default value for PlayRateCapability |
|
2084 iVideoPlayRateCapabilities.iStepForward = 1; |
|
2085 iVideoPlayRateCapabilities.iPlayBackward = 0; |
|
2086 if (FsmCheck(aEventCode)) |
|
2087 { |
|
2088 TInt err; |
|
2089 switch (aEventCode) |
|
2090 { |
|
2091 case EVPIdle: |
|
2092 //Calling GetPlayRateCapabilitiesL() before opening should return KErrNotReady. |
|
2093 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2094 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2095 if( err != KErrNotReady) |
|
2096 { |
|
2097 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned wrong err= %d"), err); |
|
2098 iTestStepResult = EFail; |
|
2099 CActiveScheduler::Stop(); |
|
2100 return; |
|
2101 } |
|
2102 iPlayVelocity = KVelocityDefault; |
|
2103 //Calling SetPlayVelocityL() before opening should return KErrNotReady. |
|
2104 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2105 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2106 if(KErrNotReady != err) |
|
2107 { |
|
2108 INFO_PRINTF2(_L("SetPlayVelocityL returned wrong err= %d"), err); |
|
2109 iTestStepResult = EFail; |
|
2110 CActiveScheduler::Stop(); |
|
2111 return; |
|
2112 } |
|
2113 |
|
2114 //calling PlayVelocityL before opening should result in error KErrNotReady |
|
2115 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()")); |
|
2116 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL()); |
|
2117 if( err != KErrNotReady) |
|
2118 { |
|
2119 INFO_PRINTF2(_L("PlayVelocityL returned wrong err= %d"), err); |
|
2120 iTestStepResult = EFail; |
|
2121 CActiveScheduler::Stop(); |
|
2122 return; |
|
2123 } |
|
2124 |
|
2125 // Open iVideoPlayer |
|
2126 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2127 iVideoPlayer->OpenFileL(iFilename); |
|
2128 PrepareState(EVPOpenComplete, KErrNone); |
|
2129 break; |
|
2130 case EVPOpenComplete: |
|
2131 //Get playrate capabilities |
|
2132 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2133 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2134 if( err != KErrNone) |
|
2135 { |
|
2136 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err); |
|
2137 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2138 iTestStepResult = EFail; |
|
2139 CActiveScheduler::Stop(); |
|
2140 return; |
|
2141 } |
|
2142 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayForward= %d"), iVideoPlayRateCapabilities.iPlayForward); |
|
2143 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayBackward= %d"), iVideoPlayRateCapabilities.iPlayBackward); |
|
2144 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepForward= %d"), iVideoPlayRateCapabilities.iStepForward); |
|
2145 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepBackward= %d"), iVideoPlayRateCapabilities.iStepBackward); |
|
2146 if ((iVideoPlayRateCapabilities.iPlayForward != 0) && (iVideoPlayRateCapabilities.iPlayForward != 1)|| |
|
2147 (iVideoPlayRateCapabilities.iPlayBackward != 0) && (iVideoPlayRateCapabilities.iPlayBackward != 1)|| |
|
2148 (iVideoPlayRateCapabilities.iStepForward != 0) && (iVideoPlayRateCapabilities.iStepForward != 1)|| |
|
2149 (iVideoPlayRateCapabilities.iStepBackward != 0) && (iVideoPlayRateCapabilities.iStepBackward != 1) ) |
|
2150 { |
|
2151 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2152 iTestStepResult = EFail; |
|
2153 CActiveScheduler::Stop(); |
|
2154 return; |
|
2155 } |
|
2156 |
|
2157 //Get default play velocity, it shall be 100. |
|
2158 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()")); |
|
2159 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL()); |
|
2160 if( err != KErrNone) |
|
2161 { |
|
2162 INFO_PRINTF2(_L("PlayVelocityL returned err= %d"), err); |
|
2163 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2164 iTestStepResult = EFail; |
|
2165 CActiveScheduler::Stop(); |
|
2166 return; |
|
2167 } |
|
2168 |
|
2169 if( iPlayVelocity != KVelocityDefault ) |
|
2170 { |
|
2171 INFO_PRINTF2(_L("invalid default play velocity =%d"), iPlayVelocity); |
|
2172 iTestStepResult = EFail; |
|
2173 CActiveScheduler::Stop(); |
|
2174 return; |
|
2175 } |
|
2176 |
|
2177 // Prepare iVideoPlayer |
|
2178 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2179 PrepareState(EVPPrepareComplete, KErrNone); |
|
2180 iVideoPlayer->Prepare(); |
|
2181 break; |
|
2182 case EVPPrepareComplete: |
|
2183 //Try to set different play velocities and play. |
|
2184 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2185 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2186 if(KErrNotSupported == err) |
|
2187 { |
|
2188 if(iVideoPlayRateCapabilities.iPlayForward || iVideoPlayRateCapabilities.iPlayBackward) |
|
2189 { |
|
2190 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err); |
|
2191 iTestStepResult = EFail; |
|
2192 CActiveScheduler::Stop(); |
|
2193 return; |
|
2194 } |
|
2195 INFO_PRINTF1(_L("SetPlayVelocityL returned err KErrNotSupported")); |
|
2196 } |
|
2197 else if( err != KErrNone) |
|
2198 { |
|
2199 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err); |
|
2200 iTestStepResult = EFail; |
|
2201 CActiveScheduler::Stop(); |
|
2202 return; |
|
2203 } |
|
2204 // Play iVideoPlayer |
|
2205 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2206 iVideoPlayer->Play(); |
|
2207 PrepareState(EVPPlayComplete, KErrNone); |
|
2208 break; |
|
2209 case EVPPlayComplete: |
|
2210 //Try to set different play velocities and play. |
|
2211 if (iVideoPlayRateCapabilities.iPlayForward ) |
|
2212 { |
|
2213 if (iPlayVelocity == KVelocityDefault) |
|
2214 { |
|
2215 iPlayVelocity = KVelocityMinPositive; |
|
2216 } |
|
2217 else if(iPlayVelocity == KVelocityMinPositive) |
|
2218 { |
|
2219 iPlayVelocity = KVelocityPositive; |
|
2220 } |
|
2221 else if(iPlayVelocity == KVelocityPositive) |
|
2222 { |
|
2223 iPlayVelocity = KVelocityBigPositive; |
|
2224 } |
|
2225 } |
|
2226 if (iVideoPlayRateCapabilities.iPlayBackward ) |
|
2227 { |
|
2228 if (iPlayVelocity == KVelocityBigPositive) |
|
2229 { |
|
2230 iPlayVelocity = KVelocityMinNegative; |
|
2231 } |
|
2232 else if(iPlayVelocity == KVelocityMinNegative) |
|
2233 { |
|
2234 iPlayVelocity = KVelocityNegative; |
|
2235 } |
|
2236 else if(iPlayVelocity == KVelocityNegative) |
|
2237 { |
|
2238 iPlayVelocity = KVelocityBigNegative; |
|
2239 } |
|
2240 else if(iPlayVelocity == KVelocityBigNegative) |
|
2241 { |
|
2242 iVideoPlayer->Close(); |
|
2243 CActiveScheduler::Stop(); |
|
2244 iTestStepResult = EPass; |
|
2245 return; |
|
2246 } |
|
2247 } |
|
2248 |
|
2249 //Set next velocity |
|
2250 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2251 TRAP(err,iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2252 if ( err == KErrNotSupported ) |
|
2253 { |
|
2254 INFO_PRINTF1(_L("iVideoPlayer->SetPlayVelocityL returned KErrNotSupported")); |
|
2255 if( (iPlayVelocity >0) && iVideoPlayRateCapabilities.iPlayForward) |
|
2256 { |
|
2257 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid, still returned KErrNotSupported!!")); |
|
2258 User::Leave(err); |
|
2259 } |
|
2260 else if( (iPlayVelocity <0) && iVideoPlayRateCapabilities.iPlayBackward) |
|
2261 { |
|
2262 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid still returned KErrNotSupported!!")); |
|
2263 User::Leave(err); |
|
2264 } |
|
2265 else |
|
2266 { |
|
2267 // Play The file once again to test with different play velocity. |
|
2268 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2269 iVideoPlayer->Play(); |
|
2270 PrepareState(EVPPlayComplete, KErrNone); |
|
2271 } |
|
2272 } |
|
2273 else if (err != KErrNone) |
|
2274 { |
|
2275 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL returned (%d)"),err); |
|
2276 User::Leave(err); |
|
2277 } |
|
2278 else //Success case |
|
2279 { |
|
2280 // Play The file once again to test with different play velocity. |
|
2281 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2282 iVideoPlayer->Play(); |
|
2283 PrepareState(EVPPlayComplete, KErrNone); |
|
2284 } |
|
2285 |
|
2286 if ((!iVideoPlayRateCapabilities.iPlayForward ) && (!iVideoPlayRateCapabilities.iPlayBackward )) |
|
2287 { |
|
2288 INFO_PRINTF1(_L("Both forward and backward is not supported")); |
|
2289 INFO_PRINTF1(_L("Pass the test, error checking for API SetPlayVelocity is already done.")); |
|
2290 iVideoPlayer->Close(); |
|
2291 CActiveScheduler::Stop(); |
|
2292 iTestStepResult = EPass; |
|
2293 return; |
|
2294 } |
|
2295 break; |
|
2296 } |
|
2297 } |
|
2298 } |
|
2299 |
|
2300 |
|
2301 // |
|
2302 // RTestVideoPlayStepFrame |
|
2303 // |
|
2304 |
|
2305 /** |
|
2306 RTestVideoPlayStepFrame::Constructor |
|
2307 */ |
|
2308 RTestVideoPlayStepFrame::RTestVideoPlayStepFrame(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2309 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iTimer(NULL) |
|
2310 { |
|
2311 } |
|
2312 |
|
2313 /** |
|
2314 RTestVideoPlayStepFrame::NewL |
|
2315 */ |
|
2316 RTestVideoPlayStepFrame* RTestVideoPlayStepFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2317 { |
|
2318 RTestVideoPlayStepFrame* self = new (ELeave) RTestVideoPlayStepFrame(aTestName, aSectName, aKeyName, aExpectedError); |
|
2319 return self; |
|
2320 } |
|
2321 |
|
2322 /** |
|
2323 RTestVideoPlayStepFrame::DoTestStepL() |
|
2324 */ |
|
2325 TVerdict RTestVideoPlayStepFrame::DoTestStepL() |
|
2326 { |
|
2327 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2328 // Call the state handler from IDLE state |
|
2329 TRAPD(err, FsmL(EVPIdle)); |
|
2330 if (err == KErrNone) |
|
2331 { |
|
2332 // Start the scheduler - Done only once ! |
|
2333 CActiveScheduler::Start(); |
|
2334 } |
|
2335 delete iTimer; |
|
2336 return iTestStepResult; |
|
2337 } |
|
2338 |
|
2339 /** |
|
2340 RTestVideoPlayStepFrame::FsmL() |
|
2341 */ |
|
2342 void RTestVideoPlayStepFrame::FsmL(TVclntTestPlayEvents aEventCode) |
|
2343 { |
|
2344 if (FsmCheck(aEventCode)) |
|
2345 { |
|
2346 TInt err = KErrNone; |
|
2347 TInt frame = 0xff; |
|
2348 TBool pauseSupported = ETrue; |
|
2349 const TUint KStepForwardZeroFrame = 0; |
|
2350 const TUint KStepForwardOneFrame = 1; |
|
2351 const TInt KStepBackwardOneFrame = -1; |
|
2352 const TUint KStepForwardFourFrames = 4; |
|
2353 const TInt KStepBackwardFourFrames = -4; |
|
2354 |
|
2355 switch (aEventCode) |
|
2356 { |
|
2357 case EVPIdle: |
|
2358 // Calling StepFrameL() before Opeing file should result KErrNotReady. |
|
2359 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1); |
|
2360 TRAP(err,iVideoPlayer->StepFrameL(1)); |
|
2361 if(err != KErrNotReady) |
|
2362 { |
|
2363 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady); |
|
2364 iTestStepResult = EFail; |
|
2365 CActiveScheduler::Stop(); |
|
2366 return; |
|
2367 } |
|
2368 |
|
2369 // Open iVideoPlayer |
|
2370 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2371 iVideoPlayer->OpenFileL(iFilename); |
|
2372 PrepareState(EVPOpenComplete, KErrNone); |
|
2373 break; |
|
2374 case EVPOpenComplete: |
|
2375 //Get playrate capabilities |
|
2376 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2377 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2378 if( err != KErrNone) |
|
2379 { |
|
2380 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err); |
|
2381 iTestStepResult = EFail; |
|
2382 CActiveScheduler::Stop(); |
|
2383 return; |
|
2384 } |
|
2385 // Calling StepFrameL() in non-pause state should result KErrNotReady. |
|
2386 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1); |
|
2387 TRAP(err,iVideoPlayer->StepFrameL(1)); |
|
2388 if(err != KErrNotReady) |
|
2389 { |
|
2390 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady); |
|
2391 iTestStepResult = EFail; |
|
2392 CActiveScheduler::Stop(); |
|
2393 return; |
|
2394 } |
|
2395 |
|
2396 // Prepare iVideoPlayer |
|
2397 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2398 PrepareState(EVPPrepareComplete, KErrNone); |
|
2399 iVideoPlayer->Prepare(); |
|
2400 break; |
|
2401 case EVPPrepareComplete: |
|
2402 // Play iVideoPlayer |
|
2403 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2404 iVideoPlayer->Play(); |
|
2405 |
|
2406 //wait for 1Second to pause the playback. |
|
2407 INFO_PRINTF1(_L("calling User::After(KOneSecond);")); |
|
2408 User::After(KOneSecond); |
|
2409 |
|
2410 /* |
|
2411 Pause the playback, if pause is not supported wait for play to complete. |
|
2412 In case of any other err fail the test with appropriate error code. |
|
2413 */ |
|
2414 TRAP(err, iVideoPlayer->PauseL()); |
|
2415 |
|
2416 if( err == KErrNotSupported) |
|
2417 { |
|
2418 pauseSupported = EFalse; |
|
2419 PrepareState(EVPPlayComplete, KErrNone); |
|
2420 } |
|
2421 else if( err != KErrNone) |
|
2422 { |
|
2423 INFO_PRINTF2(_L("PauseL has returned error =%d"), err); |
|
2424 iVideoPlayer->Stop(); |
|
2425 iVideoPlayer->Close(); |
|
2426 CActiveScheduler::Stop(); |
|
2427 iTestStepResult = EFail; |
|
2428 return; |
|
2429 } |
|
2430 |
|
2431 INFO_PRINTF1(_L("Playback paused")); |
|
2432 |
|
2433 //Call StepFrameL with different step values. |
|
2434 while(1) |
|
2435 { |
|
2436 if( frame == 0xff) |
|
2437 frame = KStepForwardZeroFrame; |
|
2438 else if (frame == KStepForwardZeroFrame) |
|
2439 frame = KStepForwardOneFrame; |
|
2440 else if (frame == KStepForwardOneFrame) |
|
2441 frame = KStepForwardFourFrames; |
|
2442 else if (frame == KStepForwardFourFrames) |
|
2443 frame = KStepBackwardOneFrame; |
|
2444 else if (frame == KStepBackwardOneFrame) |
|
2445 frame = KStepBackwardFourFrames; |
|
2446 else if (frame == KStepBackwardFourFrames) |
|
2447 { |
|
2448 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2449 iVideoPlayer->Stop(); |
|
2450 iVideoPlayer->Close(); |
|
2451 CActiveScheduler::Stop(); |
|
2452 iTestStepResult = EPass; |
|
2453 return; //Break the while loop |
|
2454 } |
|
2455 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),frame); |
|
2456 TRAP(err,iVideoPlayer->StepFrameL(frame)); |
|
2457 if(err == KErrNotSupported) |
|
2458 { |
|
2459 if( ((iVideoPlayRateCapabilities.iStepForward) && (frame>0)) || |
|
2460 ((iVideoPlayRateCapabilities.iStepBackward) && (frame<0)) ) |
|
2461 { |
|
2462 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), err); |
|
2463 iTestStepResult = EFail; |
|
2464 CActiveScheduler::Stop(); |
|
2465 return; |
|
2466 } |
|
2467 INFO_PRINTF1(_L("StepFrameL returned KErrNotSupported")); |
|
2468 continue; |
|
2469 } |
|
2470 else if( (err == KErrNotReady) && (!pauseSupported) ) |
|
2471 { |
|
2472 INFO_PRINTF1(_L("pause is not supported in controller plugin. Returned correct err(KErrNotReady)")); |
|
2473 continue; |
|
2474 } |
|
2475 else if( err != KErrNone) |
|
2476 { |
|
2477 INFO_PRINTF2(_L("StepFrameL returned err= %d"), err); |
|
2478 iTestStepResult = EFail; |
|
2479 CActiveScheduler::Stop(); |
|
2480 break; |
|
2481 } |
|
2482 } |
|
2483 break; |
|
2484 case EVPPlayComplete: |
|
2485 INFO_PRINTF1(_L("Plyback completed before pausing!!")); |
|
2486 INFO_PRINTF1(_L("Video clip is too small to run this test step")); |
|
2487 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2488 iVideoPlayer->Stop(); |
|
2489 iVideoPlayer->Close(); |
|
2490 CActiveScheduler::Stop(); |
|
2491 iTestStepResult = EInconclusive; |
|
2492 return; |
|
2493 } |
|
2494 } |
|
2495 } |
|
2496 |
|
2497 // |
|
2498 // RTestVideoPlayAudVidEnable. |
|
2499 // |
|
2500 |
|
2501 /** |
|
2502 * RTestVideoPlayAudVidEnable::Constructor |
|
2503 */ |
|
2504 RTestVideoPlayAudVidEnable::RTestVideoPlayAudVidEnable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2505 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2506 { |
|
2507 } |
|
2508 |
|
2509 /** |
|
2510 * RTestVideoPlayAudVidEnable::NewL |
|
2511 */ |
|
2512 RTestVideoPlayAudVidEnable* RTestVideoPlayAudVidEnable::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2513 { |
|
2514 RTestVideoPlayAudVidEnable* self = new (ELeave) RTestVideoPlayAudVidEnable(aTestName, aSectName, aKeyName, aExpectedError); |
|
2515 return self; |
|
2516 } |
|
2517 |
|
2518 /** |
|
2519 * RTestVideoPlayAudVidEnable::DoTestStepL() |
|
2520 */ |
|
2521 TVerdict RTestVideoPlayAudVidEnable::DoTestStepL() |
|
2522 { |
|
2523 // Call the state handler from IDLE state |
|
2524 TRAPD(err, FsmL(EVPIdle)); |
|
2525 if (err == KErrNone) |
|
2526 { |
|
2527 // Start the scheduler - Done only once ! |
|
2528 CActiveScheduler::Start(); |
|
2529 } |
|
2530 return iTestStepResult; |
|
2531 } |
|
2532 /** |
|
2533 * RTestVideoPlayAudVidEnable::FsmL() |
|
2534 */ |
|
2535 void RTestVideoPlayAudVidEnable::FsmL(TVclntTestPlayEvents aEventCode) |
|
2536 { |
|
2537 if (FsmCheck(aEventCode)) |
|
2538 { |
|
2539 TInt err = KErrNone; |
|
2540 TBool enableFlag = EFalse; |
|
2541 |
|
2542 switch (aEventCode) |
|
2543 { |
|
2544 case EVPIdle: |
|
2545 //Calling SetAudioEnabledL() before opening file should return KErrNotReady |
|
2546 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2547 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2548 if (err != KErrNotReady) |
|
2549 { |
|
2550 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2551 iTestStepResult = EFail; |
|
2552 CActiveScheduler::Stop(); |
|
2553 return; |
|
2554 } |
|
2555 //Calling SetVideoEnabledL() before opening file should return KErrNotReady |
|
2556 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2557 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2558 if (err != KErrNotReady) |
|
2559 { |
|
2560 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2561 iTestStepResult = EFail; |
|
2562 CActiveScheduler::Stop(); |
|
2563 return; |
|
2564 } |
|
2565 //Calling VideoEnabledL() before opening file should return KErrNotReady |
|
2566 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()")); |
|
2567 TRAP(err, iVideoPlayer->VideoEnabledL()); |
|
2568 if(err != KErrNotReady) |
|
2569 { |
|
2570 INFO_PRINTF2(_L("VideoEnabledL returned wrong error code= %d"), err); |
|
2571 iTestStepResult = EFail; |
|
2572 CActiveScheduler::Stop(); |
|
2573 return; |
|
2574 } |
|
2575 // Open iVideoPlayer |
|
2576 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2577 iVideoPlayer->OpenFileL(iFilename); |
|
2578 PrepareState(EVPOpenComplete, KErrNone); |
|
2579 break; |
|
2580 case EVPOpenComplete: |
|
2581 //Check that by default audio is enabled. |
|
2582 INFO_PRINTF1(_L("iVideoPlayer->AudioEnabledL()")); |
|
2583 TRAP(err,enableFlag = iVideoPlayer->AudioEnabledL()); |
|
2584 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) ) |
|
2585 { |
|
2586 INFO_PRINTF3(_L("AudioEnabledL Leave err= %d, returned:%d"), err,enableFlag); |
|
2587 iTestStepResult = EFail; |
|
2588 CActiveScheduler::Stop(); |
|
2589 return; |
|
2590 } |
|
2591 |
|
2592 //Check that by default video is enabled. |
|
2593 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()")); |
|
2594 TRAP(err,enableFlag = iVideoPlayer->VideoEnabledL()); |
|
2595 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) ) |
|
2596 { |
|
2597 INFO_PRINTF3(_L("VideoEnabledL Leave err= %d, returned:%d"), err,enableFlag); |
|
2598 iTestStepResult = EFail; |
|
2599 CActiveScheduler::Stop(); |
|
2600 return; |
|
2601 } |
|
2602 |
|
2603 //Try to disable audio, It shall leave with notsupported error. |
|
2604 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2605 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2606 if (err != KErrNotSupported) |
|
2607 { |
|
2608 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2609 iTestStepResult = EFail; |
|
2610 CActiveScheduler::Stop(); |
|
2611 return; |
|
2612 } |
|
2613 |
|
2614 //Try to disable video, It shall leave with notsupported error. |
|
2615 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2616 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2617 if (err != KErrNotSupported) |
|
2618 { |
|
2619 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2620 iTestStepResult = EFail; |
|
2621 CActiveScheduler::Stop(); |
|
2622 return; |
|
2623 } |
|
2624 |
|
2625 // Prepare iVideoPlayer |
|
2626 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2627 PrepareState(EVPPrepareComplete, KErrNone); |
|
2628 iVideoPlayer->Prepare(); |
|
2629 break; |
|
2630 case EVPPrepareComplete: |
|
2631 //Enabling/disabling audio after prepare() shall return KErrNotSupported error. |
|
2632 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2633 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2634 if(err != KErrNotSupported) |
|
2635 { |
|
2636 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2637 iTestStepResult = EFail; |
|
2638 CActiveScheduler::Stop(); |
|
2639 return; |
|
2640 } |
|
2641 |
|
2642 //Enabling/disabling video after prepare() shll return KErrNotSupported error. |
|
2643 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2644 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2645 if(err != KErrNotSupported) |
|
2646 { |
|
2647 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2648 iTestStepResult = EFail; |
|
2649 CActiveScheduler::Stop(); |
|
2650 return; |
|
2651 } |
|
2652 |
|
2653 // Play iVideoPlayer |
|
2654 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2655 iVideoPlayer->Play(); |
|
2656 PrepareState(EVPPlayComplete, KErrNone); |
|
2657 |
|
2658 //calling SetAudioEnabledL while playing should return KErrNotReady |
|
2659 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2660 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2661 if (err != KErrNotReady) |
|
2662 { |
|
2663 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2664 iTestStepResult = EFail; |
|
2665 iVideoPlayer->Stop(); |
|
2666 iVideoPlayer->Close(); |
|
2667 CActiveScheduler::Stop(); |
|
2668 return; |
|
2669 } |
|
2670 |
|
2671 //calling SetVideoEnabledL while playing should return KErrNotReady |
|
2672 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2673 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2674 if (err != KErrNotReady) |
|
2675 { |
|
2676 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2677 iTestStepResult = EFail; |
|
2678 iVideoPlayer->Stop(); |
|
2679 iVideoPlayer->Close(); |
|
2680 CActiveScheduler::Stop(); |
|
2681 return; |
|
2682 } |
|
2683 |
|
2684 break; |
|
2685 case EVPPlayComplete: |
|
2686 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2687 iVideoPlayer->Stop(); |
|
2688 iVideoPlayer->Close(); |
|
2689 CActiveScheduler::Stop(); |
|
2690 iTestStepResult = EPass; |
|
2691 break; |
|
2692 } |
|
2693 } |
|
2694 } |
|
2695 |
|
2696 |
|
2697 // |
|
2698 // RTestVideoPlayAutoScale. |
|
2699 // |
|
2700 |
|
2701 /** |
|
2702 * RTestVideoPlayAutoScale::Constructor |
|
2703 */ |
|
2704 RTestVideoPlayAutoScale::RTestVideoPlayAutoScale(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2705 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2706 { |
|
2707 } |
|
2708 |
|
2709 /** |
|
2710 * RTestVideoPlayAutoScale::NewL |
|
2711 */ |
|
2712 RTestVideoPlayAutoScale* RTestVideoPlayAutoScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2713 { |
|
2714 RTestVideoPlayAutoScale* self = new (ELeave) RTestVideoPlayAutoScale(aTestName, aSectName, aKeyName, aExpectedError); |
|
2715 return self; |
|
2716 } |
|
2717 |
|
2718 /** |
|
2719 * RTestVideoPlayAutoScale::DoTestStepL() |
|
2720 */ |
|
2721 TVerdict RTestVideoPlayAutoScale::DoTestStepL() |
|
2722 { |
|
2723 // Call the state handler from IDLE state |
|
2724 TRAPD(err, FsmL(EVPIdle)); |
|
2725 if (err == KErrNone) |
|
2726 { |
|
2727 // Start the scheduler - Done only once ! |
|
2728 CActiveScheduler::Start(); |
|
2729 } |
|
2730 return iTestStepResult; |
|
2731 } |
|
2732 /** |
|
2733 * RTestVideoPlayAutoScale::FsmL() |
|
2734 */ |
|
2735 void RTestVideoPlayAutoScale::FsmL(TVclntTestPlayEvents aEventCode) |
|
2736 { |
|
2737 if (FsmCheck(aEventCode)) |
|
2738 { |
|
2739 TInt err = KErrNone; |
|
2740 TAutoScaleType scaleType = EAutoScaleNone; |
|
2741 THorizontalAlign horizontalAlign = EHorizontalAlignCenter; |
|
2742 TVerticalAlign verticalAlign = EVerticalAlignCenter; |
|
2743 |
|
2744 switch (aEventCode) |
|
2745 { |
|
2746 case EVPIdle: |
|
2747 //Calling SetAutoScaleL() before opening file should return KErrNotReady error. |
|
2748 INFO_PRINTF1(_L("Calling SetAutoScaleL(EAutoScaleNone);")); |
|
2749 TRAP(err, iVideoPlayer->SetAutoScaleL(EAutoScaleNone)); |
|
2750 if( err != KErrNotReady) |
|
2751 { |
|
2752 INFO_PRINTF2(_L("SetAutoScaleL() returned wrong error=%d"),err); |
|
2753 CActiveScheduler::Stop(); |
|
2754 iTestStepResult = EFail; |
|
2755 return; |
|
2756 } |
|
2757 |
|
2758 // Open iVideoPlayer |
|
2759 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2760 iVideoPlayer->OpenFileL(iFilename); |
|
2761 PrepareState(EVPOpenComplete, KErrNone); |
|
2762 break; |
|
2763 case EVPOpenComplete: |
|
2764 // Prepare iVideoPlayer |
|
2765 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2766 PrepareState(EVPPrepareComplete, KErrNone); |
|
2767 iVideoPlayer->Prepare(); |
|
2768 break; |
|
2769 case EVPPrepareComplete: |
|
2770 // Play iVideoPlayer |
|
2771 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2772 iVideoPlayer->Play(); |
|
2773 PrepareState(EVPPlayComplete, KErrNone); |
|
2774 |
|
2775 /* |
|
2776 Wait for 1/4th of a second each time and call SetAutoScaleL multiple times |
|
2777 with different scale parameters. |
|
2778 This loop tests only "void SetAutoScaleL(TAutoScaleType aScaleType);" |
|
2779 */ |
|
2780 |
|
2781 while(1) |
|
2782 { |
|
2783 switch(scaleType) |
|
2784 { |
|
2785 case EAutoScaleNone: |
|
2786 scaleType = EAutoScaleBestFit; |
|
2787 break; |
|
2788 case EAutoScaleBestFit: |
|
2789 scaleType = EAutoScaleClip; |
|
2790 break; |
|
2791 case EAutoScaleClip: |
|
2792 scaleType = EAutoScaleStretch; |
|
2793 break; |
|
2794 case EAutoScaleStretch: |
|
2795 scaleType = EAutoScaleNone; |
|
2796 break; |
|
2797 } |
|
2798 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);")); |
|
2799 User::After(KOneSecond/4); |
|
2800 |
|
2801 INFO_PRINTF1(_L("Calling SetAutoScaleL();")); |
|
2802 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType)); |
|
2803 |
|
2804 #ifdef SYMBIAN_BUILD_GCE |
|
2805 const TInt KExpected = GCEAvailable() ? KErrNone : KErrNotSupported; |
|
2806 #else |
|
2807 const TInt KExpected = KErrNotSupported; |
|
2808 #endif |
|
2809 |
|
2810 if( err == KExpected) |
|
2811 { |
|
2812 INFO_PRINTF3(_L("SetAutoScaleL(%d) successfully returned %d"), scaleType, err); |
|
2813 } |
|
2814 else |
|
2815 { |
|
2816 INFO_PRINTF4(_L("SetAutoScaleL(%d) returned error= %d. Expected %d"),scaleType, err, KExpected); |
|
2817 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2818 iVideoPlayer->Stop(); |
|
2819 iVideoPlayer->Close(); |
|
2820 CActiveScheduler::Stop(); |
|
2821 iTestStepResult = EFail; |
|
2822 return; |
|
2823 } |
|
2824 if( scaleType == EAutoScaleNone ) |
|
2825 { |
|
2826 break;//Break the forever while loop; |
|
2827 } |
|
2828 } |
|
2829 |
|
2830 /* |
|
2831 Wait for half second each time and call SetAutoScaleL multiple times |
|
2832 with all combinations of TAutoScaleType, THorizontalAlign, and TVerticalAlign. |
|
2833 */ |
|
2834 |
|
2835 while(1) |
|
2836 { |
|
2837 switch(scaleType) |
|
2838 { |
|
2839 case EAutoScaleNone: |
|
2840 scaleType = EAutoScaleBestFit; |
|
2841 break; |
|
2842 case EAutoScaleBestFit: |
|
2843 scaleType = EAutoScaleClip; |
|
2844 break; |
|
2845 case EAutoScaleClip: |
|
2846 scaleType = EAutoScaleStretch; |
|
2847 break; |
|
2848 case EAutoScaleStretch: |
|
2849 scaleType = EAutoScaleNone; |
|
2850 break; |
|
2851 } |
|
2852 while(1) |
|
2853 { |
|
2854 if( horizontalAlign == EHorizontalAlignCenter) |
|
2855 { |
|
2856 horizontalAlign = EHorizontalAlignLeft; |
|
2857 } |
|
2858 else if( horizontalAlign == EHorizontalAlignLeft) |
|
2859 { |
|
2860 horizontalAlign = EHorizontalAlignRight; |
|
2861 } |
|
2862 else if( horizontalAlign == EHorizontalAlignRight) |
|
2863 { |
|
2864 horizontalAlign = EHorizontalAlignCenter; |
|
2865 } |
|
2866 while(1) |
|
2867 { |
|
2868 if( verticalAlign == EVerticalAlignCenter) |
|
2869 { |
|
2870 verticalAlign = EVerticalAlignTop; |
|
2871 } |
|
2872 else if( verticalAlign == EVerticalAlignTop) |
|
2873 { |
|
2874 verticalAlign = EVerticalAlignBottom; |
|
2875 } |
|
2876 else if( verticalAlign == EVerticalAlignBottom) |
|
2877 { |
|
2878 verticalAlign = EVerticalAlignCenter; |
|
2879 } |
|
2880 |
|
2881 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);")); |
|
2882 User::After(KOneSecond/4); |
|
2883 err = KErrNone; |
|
2884 |
|
2885 INFO_PRINTF1(_L("Calling SetAutoScaleL();")); |
|
2886 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType,horizontalAlign,verticalAlign)); |
|
2887 if( err == KErrNotSupported) |
|
2888 { |
|
2889 INFO_PRINTF4(_L("SetAutoScaleL(%d,%d, %d) returned KErrNotSupported"),scaleType, horizontalAlign,verticalAlign); |
|
2890 } |
|
2891 else if( err == KErrNone) |
|
2892 { |
|
2893 INFO_PRINTF1(_L("Success calling SetAutoScaleL()")); |
|
2894 } |
|
2895 else |
|
2896 { |
|
2897 INFO_PRINTF3(_L("SetAutoScaleL(%d) returned error= %d"),scaleType, err); |
|
2898 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2899 iVideoPlayer->Stop(); |
|
2900 iVideoPlayer->Close(); |
|
2901 CActiveScheduler::Stop(); |
|
2902 iTestStepResult = EFail; |
|
2903 return; |
|
2904 } |
|
2905 |
|
2906 if( verticalAlign == EVerticalAlignCenter ) |
|
2907 { |
|
2908 break;//Break the forever while loop; |
|
2909 } |
|
2910 } |
|
2911 if( horizontalAlign == EHorizontalAlignCenter ) |
|
2912 { |
|
2913 break;//Break the forever while loop; |
|
2914 } |
|
2915 } |
|
2916 if( scaleType == EAutoScaleNone ) |
|
2917 { |
|
2918 break;//Break the forever while loop; |
|
2919 } |
|
2920 } |
|
2921 |
|
2922 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2923 iVideoPlayer->Stop(); |
|
2924 iVideoPlayer->Close(); |
|
2925 CActiveScheduler::Stop(); |
|
2926 iTestStepResult = EPass; |
|
2927 break; |
|
2928 case EVPPlayComplete: |
|
2929 INFO_PRINTF1(_L("Clip is too small to run the test")); |
|
2930 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2931 iVideoPlayer->Stop(); |
|
2932 iVideoPlayer->Close(); |
|
2933 CActiveScheduler::Stop(); |
|
2934 iTestStepResult = EInconclusive; |
|
2935 break; |
|
2936 } |
|
2937 } |
|
2938 } |