First public contribution.
1 // Copyright (c) 2007-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "testvideoplayer2.h"
19 #ifdef SYMBIAN_BUILD_GCE
20 #include <graphics/surfacemanager.h>
23 const TInt KSettingsAndAlignmentTest = 3;
26 // RTestVclntPlayAviFile
30 * RTestVclnt2PlayFile::Constructor
32 RTestVclnt2PlayFile::RTestVclnt2PlayFile(const TDesC& aTestName,
33 const TDesC& aSectName,
34 const TDesC& aKeyName,
36 : RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
41 * RTestVclnt2PlayFile::NewL
43 RTestVclnt2PlayFile* RTestVclnt2PlayFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
45 RTestVclnt2PlayFile* self = new (ELeave) RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError);
50 * RTestVclnt2PlayFile::DoTestStepPreambleL
52 TVerdict RTestVclnt2PlayFile::DoTestStepPreambleL()
54 return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
58 * RTestVclnt2PlayFile::DoTestStepPostambleL
60 TVerdict RTestVclnt2PlayFile::DoTestStepPostambleL()
62 return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();
66 * RTestVclnt2PlayFile::FsmL
68 void RTestVclnt2PlayFile::FsmL(TVclntTestPlayEvents aEventCode)
70 if (FsmCheck(aEventCode))
79 HandleOpenCompleteL();
82 case EVPPrepareComplete:
83 HandlePrepareCompleteL();
87 HandlePlayCompleteL();
93 void RTestVclnt2PlayFile::HandleIdleL()
96 INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
97 iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
98 PrepareState(EVPOpenComplete, KErrNone);
101 void RTestVclnt2PlayFile::HandleOpenCompleteL()
103 // Prepare iVideoPlayer2
104 INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
105 iVideoPlayer2->Prepare();
106 PrepareState(EVPPrepareComplete, KErrNone);
109 void RTestVclnt2PlayFile::HandlePrepareCompleteL()
111 // Add display window using default values - ie. video extent & window clipping
112 // defaulted to whole window
113 INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
114 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
116 // trigger the video to start playing
120 void RTestVclnt2PlayFile::HandlePlayCompleteL()
122 iTestStepResult = EPass;
123 CActiveScheduler::Stop();
126 void RTestVclnt2PlayFile::StartPlayback()
128 iError = KErrTimedOut;
129 INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
130 PrepareState(EVPPlayComplete, KErrNone);
131 iVideoPlayer2->Play();
134 #ifdef SYMBIAN_BUILD_GCE
136 // RTestMediaClientVideoDisplay
140 * RTestMediaClientVideoDisplay::Constructor
144 RTestMediaClientVideoDisplay::RTestMediaClientVideoDisplay(const TDesC& aTestName,
145 const TDesC& aSectName,
146 const TDesC& aKeyName,
148 : RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
153 * RTestMediaClientVideoDisplay::NewL
156 RTestMediaClientVideoDisplay* RTestMediaClientVideoDisplay::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
158 RTestMediaClientVideoDisplay* self = new (ELeave) RTestMediaClientVideoDisplay(aTestName, aSectName, aKeyName, aExpectedError);
163 * RTestMediaClientVideoDisplay::DoTestStepPreambleL
166 TVerdict RTestMediaClientVideoDisplay::DoTestStepPreambleL()
168 return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
172 * RTestMediaClientVideoDisplay::DoTestStepPostambleL
175 TVerdict RTestMediaClientVideoDisplay::DoTestStepPostambleL()
177 return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();
181 * RTestMediaClientVideoDisplay::FsmL
183 void RTestMediaClientVideoDisplay::FsmL(TVclntTestPlayEvents aEventCode)
185 if (FsmCheck(aEventCode))
193 case EVPOpenComplete:
194 HandleOpenCompleteL();
197 case EVPPrepareComplete:
198 HandlePrepareCompleteL();
201 case EVPPlayComplete:
202 HandlePlayCompleteL();
208 void RTestMediaClientVideoDisplay::HandleIdleL()
211 INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
212 iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
213 PrepareState(EVPOpenComplete, KErrNone);
216 void RTestMediaClientVideoDisplay::HandleOpenCompleteL()
218 // Prepare iVideoPlayer2
219 INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
220 iVideoPlayer2->Prepare();
221 PrepareState(EVPPrepareComplete, KErrNone);
224 void RTestMediaClientVideoDisplay::HandlePrepareCompleteL()
226 // trigger the video to start playing
229 TInt displayId = iScreen->GetScreenNumber();
230 TRect clipRect = TRect(iWindow->Size());
231 TRect cropRegion = clipRect;
233 // ==========================
235 iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
237 RSurfaceManager surfaceManager;
238 User::LeaveIfError(surfaceManager.Open());
240 RSurfaceManager::TSurfaceCreationAttributesBuf bf;
241 RSurfaceManager::TSurfaceCreationAttributes& b=bf();
242 b.iSize.iWidth = 320;
243 b.iSize.iHeight = 240;
245 b.iPixelFormat = EUidPixelFormatXRGB_8888;
247 b.iOffsetToFirstBuffer = 0;
251 TRect cropRect(0, 0, 320, 240);
252 TVideoAspectRatio par(1,2);
253 TSurfaceId surfaceId;
255 User::LeaveIfError(surfaceManager.CreateSurface(bf, surfaceId));
257 iMediaClientVideoDisplay->SurfaceCreated(surfaceId, cropRect, par, cropRegion);
258 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceCreated()"));
260 delete iMediaClientVideoDisplay;
261 iMediaClientVideoDisplay = NULL;
263 // ==================
265 iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
267 TRect videoExtent = clipRect;
268 TReal32 scaleWidth(100.0f);
269 TReal32 scaleHeight(100.0f);
270 TInt horizPos(EHorizontalAlignCenter);
271 TInt vertPos(EVerticalAlignCenter);
273 TReal32 widthPercentage(50.0f);
274 TReal32 heightPercentage(50.0f);
279 // Check for invalid rotation when adding new window
280 INFO_PRINTF1(_L("Testing invalid rotations for AddDisplayWindowL"));
282 TVideoRotation rotation = static_cast<TVideoRotation>(-1);
283 TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
284 if (err != KErrArgument)
286 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative rotation"));
287 iTestStepResult = EFail;
288 CActiveScheduler::Stop();
292 rotation = static_cast<TVideoRotation>(4);
293 TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
294 if (err != KErrArgument)
296 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range rotation"));
297 iTestStepResult = EFail;
298 CActiveScheduler::Stop();
302 rotation = EVideoRotationNone;
304 // Check for invalid autoScaleType when adding new window
305 INFO_PRINTF1(_L("Testing invalid autoScaleType for AddDisplayWindowL"));
306 TAutoScaleType autoScaleType = static_cast<TAutoScaleType>(-1);
307 TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
308 if (err != KErrArgument)
310 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative scale"));
311 iTestStepResult = EFail;
312 CActiveScheduler::Stop();
316 autoScaleType = static_cast<TAutoScaleType>(4);
317 TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
318 if (err != KErrArgument)
320 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range scale"));
321 iTestStepResult = EFail;
322 CActiveScheduler::Stop();
326 iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow);
327 INFO_PRINTF1(_L("iMediaClientVideoDisplay->AddDisplayWindowL()"));
329 // Check for invalid rotation when setting rotation for window
330 INFO_PRINTF1(_L("Testing invalid rotation for SetRotationL"));
331 TVideoRotation videoRotation = static_cast<TVideoRotation>(-1);
332 TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
333 if (err != KErrArgument)
335 ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for negative value"));
336 iTestStepResult = EFail;
337 CActiveScheduler::Stop();
341 videoRotation = static_cast<TVideoRotation>(4);
342 TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
343 if (err != KErrArgument)
345 ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for out of range value"));
346 iTestStepResult = EFail;
347 CActiveScheduler::Stop();
351 // Check for invalid rotation when setting rotation for all windows
352 videoRotation = static_cast<TVideoRotation>(-1);
353 TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
354 if (err != KErrArgument)
356 ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for negative value"));
357 iTestStepResult = EFail;
358 CActiveScheduler::Stop();
362 videoRotation = static_cast<TVideoRotation>(4);
363 TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
364 if (err != KErrArgument)
366 ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for out of range value"));
367 iTestStepResult = EFail;
368 CActiveScheduler::Stop();
372 videoRotation = EVideoRotationClockwise180;
374 iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion);
375 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
377 if (iMediaClientVideoDisplay->RotationL(*iWindow) != videoRotation)
379 ERR_PRINTF1(_L("iMediaClientVideoDisplay->RotationL() returns an unexpected value. Test aborted."));
381 iTestStepResult = EInconclusive;
382 CActiveScheduler::Stop();
386 INFO_PRINTF1(_L("iMediaClientVideoDisplay->RotationL()"));
389 iMediaClientVideoDisplay->SetScaleFactorL(*iWindow, widthPercentage, heightPercentage, cropRegion);
390 iMediaClientVideoDisplay->SetScaleFactorL(widthPercentage, heightPercentage, cropRegion);
391 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetScaleFactorL()"));
393 iMediaClientVideoDisplay->SetRotationL(EVideoRotationClockwise90, cropRegion);
394 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
396 iMediaClientVideoDisplay->GetScaleFactorL(*iWindow, widthP, heightP);
397 INFO_PRINTF3(_L("iMediaClientVideoDisplay->GetScaleFactorL() %df %df"), &widthP, &heightP);
399 iMediaClientVideoDisplay->SetVideoExtentL(*iWindow, videoExtent, cropRegion);
400 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetVideoExtentL()"));
402 iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow, clipRect, cropRegion);
403 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetWindowClipRectL()"));
405 // Check for invalid autoScaleType when setting autoScaleType for window
406 INFO_PRINTF1(_L("Testing invalid autoScaleType for SetAutoScaleL"));
407 autoScaleType = static_cast<TAutoScaleType>(-1);
408 TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
409 if (err != KErrArgument)
411 ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for negative value"));
412 iTestStepResult = EFail;
413 CActiveScheduler::Stop();
417 autoScaleType = static_cast<TAutoScaleType>(4);
418 TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
419 if (err != KErrArgument)
421 ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for out of range value"));
422 iTestStepResult = EFail;
423 CActiveScheduler::Stop();
427 // Check for invalid autoScaleType when setting autoScaleType for all windows
428 autoScaleType = static_cast<TAutoScaleType>(-1);
429 TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
430 if (err != KErrArgument)
432 ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for negative value"));
433 iTestStepResult = EFail;
434 CActiveScheduler::Stop();
438 autoScaleType = static_cast<TAutoScaleType>(4);
439 TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
440 if (err != KErrArgument)
442 ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for out of range value"));
443 iTestStepResult = EFail;
444 CActiveScheduler::Stop();
448 iMediaClientVideoDisplay->SetAutoScaleL(EAutoScaleBestFit, horizPos, vertPos, cropRegion);
449 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetAutoScaleL()"));
451 iMediaClientVideoDisplay->RedrawWindows(cropRegion);
452 INFO_PRINTF1(_L("iMediaClientVideoDisplay->RedrawWindows()"));
454 iMediaClientVideoDisplay->SurfaceParametersChanged(surfaceId, cropRect, par);
455 INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceParametersChanged()"));
457 iMediaClientVideoDisplay->RemoveSurface();
458 INFO_PRINTF1(_L("iMediaClientVideoDisplay->ReplaceSurface()"));
460 iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
461 INFO_PRINTF1(_L("iMediaClientVideoDisplay->RemoveDisplayWindow()"));
463 surfaceManager.CloseSurface(surfaceId);
464 surfaceId = TSurfaceId::CreateNullId();
465 surfaceManager.Close();
467 delete iMediaClientVideoDisplay;
468 iMediaClientVideoDisplay = NULL;
471 void RTestMediaClientVideoDisplay::HandlePlayCompleteL()
473 iTestStepResult = EPass;
474 CActiveScheduler::Stop();
477 void RTestMediaClientVideoDisplay::StartPlayback()
479 iError = KErrTimedOut;
480 INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
481 PrepareState(EVPPlayComplete, KErrNone);
482 iVideoPlayer2->Play();
488 // RTestVclnt2PerformActionDuringVideoPlayback
492 * RTestVclnt2PerformActionDuringVideoPlayback::Constructor
494 RTestVclnt2PerformActionDuringVideoPlayback::RTestVclnt2PerformActionDuringVideoPlayback(
495 const TDesC& aTestName,
496 const TDesC& aSectName,
497 const TDesC& aKeyName,
499 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
504 * RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL
506 void RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL()
508 if (iActionError != KErrNone)
510 ERR_PRINTF2(_L("Playback event left with error %d."), iActionError);
511 iTestStepResult = EFail;
515 iTestStepResult = EPass;
518 CActiveScheduler::Stop();
522 * RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback
524 void RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback()
526 RTestVclnt2PlayFile::StartPlayback();
528 iActionError = KErrNone;
529 TRAP(iActionError, DoThisActionDuringPlaybackL(*iVideoPlayer2));
537 * RTestVclnt2AddWin::Constructor
539 RTestVclnt2AddWin::RTestVclnt2AddWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
540 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
545 * RTestVclnt2AddWin::NewL
547 RTestVclnt2AddWin* RTestVclnt2AddWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
549 RTestVclnt2AddWin* self = new (ELeave) RTestVclnt2AddWin(aTestName, aSectName, aKeyName, aExpectedError);
554 * RTestVclnt2AddWin::HandlePrepareCompleteL
556 void RTestVclnt2AddWin::HandlePrepareCompleteL()
558 // retrieve video size
560 iVideoPlayer2->VideoFrameSizeL(videoSize);
562 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0)
564 // create a clipping rect partially out of screen
565 TRect windowRect(iWindow->Size());
566 windowRect.SetWidth(windowRect.Width() * 2);
568 // Add the display window with a partially out of screen clipping rect
569 TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs,
572 TRect(iWindow->Size()),
574 if (err != iTestExpectedError)
576 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
578 iTestStepResult = EFail;
579 CActiveScheduler::Stop();
584 // create a clipping rect completely out of screen
585 windowRect.SetRect(TPoint(0, 0), iWindow->Size());
586 windowRect.Move(windowRect.Width() + 10, 0);
588 // Add the display window with a completely out of screen clipping rect
589 TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs,
592 TRect(iWindow->Size()),
594 if (err != iTestExpectedError)
596 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
598 iTestStepResult = EFail;
599 CActiveScheduler::Stop();
605 // Reset the expected error to KErrNone as all expected failure tests have been completed.
606 // Any error that appears after this should fail the test
607 iTestExpectedError = KErrNone;
610 // after failing to add window display with a partially & a completely out of screen
611 // clipping rect, proceed to add a valid clipping rect below
614 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0401")) == 0 ||
615 iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0)
617 // shrink both the video & window size by half
618 TRect videoRect(videoSize);
619 videoRect.SetHeight(videoSize.iHeight / 2);
620 videoRect.SetWidth(videoSize.iWidth / 2);
622 TRect windowRect(iWindow->Size());
623 windowRect.SetHeight(iWindow->Size().iHeight / 2);
624 windowRect.SetWidth(iWindow->Size().iWidth / 2);
626 // ensure the rect is within the boundary of the window
627 TRect finalRect(windowRect);
628 finalRect.Intersection(videoRect);
630 // add display window using this valid clipping rect
631 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
636 User::Panic(_L("RTestVclnt2AddWin"), KErrArgument);
639 // Start video playback
645 // RTestVclnt2RemoveWin
649 * RTestVclnt2RemoveWin::Constructor
651 RTestVclnt2RemoveWin::RTestVclnt2RemoveWin(const TDesC& aTestName,
652 const TDesC& aSectName,
653 const TDesC& aKeyName,
656 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError),
662 * RTestVclnt2RemoveWin::NewL
664 RTestVclnt2RemoveWin* RTestVclnt2RemoveWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aAddBack)
666 RTestVclnt2RemoveWin* self = new (ELeave) RTestVclnt2RemoveWin(aTestName, aSectName, aKeyName, aExpectedError, aAddBack);
671 * RTestVclnt2RemoveWin::HandlePrepareCompleteL
673 void RTestVclnt2RemoveWin::HandlePrepareCompleteL()
675 // retrieve video size
677 iVideoPlayer2->VideoFrameSizeL(videoSize);
679 // shrink both the video & window size by half
680 TRect videoRect(videoSize);
681 videoRect.SetHeight(videoSize.iHeight / 2);
682 videoRect.SetWidth(videoSize.iWidth / 2);
684 TRect windowRect(iWindow->Size());
685 windowRect.SetHeight(iWindow->Size().iHeight / 2);
686 windowRect.SetWidth(iWindow->Size().iWidth / 2);
688 // ensure the rect is within the boundary of the window
689 TRect finalRect(windowRect);
690 finalRect.Intersection(videoRect);
692 // add display window using this valid clipping rect
693 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
695 // trigger the video to start playing
700 * RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL
702 void RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
704 // Play the video clip using a specific display window & video clipping setting
706 TTimeIntervalMicroSeconds duration = aPlayer.DurationL();
708 // After a quarter of the clip's duration
709 User::After(duration.Int64() / 4);
711 // remove the original display
712 aPlayer.RemoveDisplayWindow(*iWindow);
717 // Add the window using default values to continues
718 aPlayer.AddDisplayWindowL(iWs, *iScreen, *iWindow);
728 * RTestVclnt2WinPos::Constructor
730 RTestVclnt2WinPos::RTestVclnt2WinPos(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
731 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
736 * RTestVclnt2WinPos::NewL
738 RTestVclnt2WinPos* RTestVclnt2WinPos::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
740 RTestVclnt2WinPos* self = new (ELeave) RTestVclnt2WinPos(aTestName, aSectName, aKeyName, aExpectedError);
745 * RTestVclnt2WinPos::DoThisActionDuringPlaybackL
747 void RTestVclnt2WinPos::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
749 TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
751 // shrink the window clipping rect by half the height & width
752 aPlayer.SetWindowClipRectL(*iWindow, TRect(windowSize));
757 // RTestVclnt2VideoExt
761 * RTestVclnt2VideoExt::Constructor
763 RTestVclnt2VideoExt::RTestVclnt2VideoExt(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
764 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
769 * RTestVclnt2VideoExt::NewL
771 RTestVclnt2VideoExt* RTestVclnt2VideoExt::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
773 RTestVclnt2VideoExt* self = new (ELeave) RTestVclnt2VideoExt(aTestName, aSectName, aKeyName, aExpectedError);
778 * RTestVclnt2VideoExt::DoThisActionDuringPlaybackL
780 void RTestVclnt2VideoExt::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
782 TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
784 // shrink the video extent by half the height & width
785 aPlayer.SetVideoExtentL(*iWindow, TRect(windowSize));
790 // RTestVclnt2ClipRect
794 * RTestVclnt2ClipRect::Constructor
796 RTestVclnt2ClipRect::RTestVclnt2ClipRect(const TDesC& aTestName,
797 const TDesC& aSectName,
798 const TDesC& aKeyName,
800 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
805 * RTestVclnt2ClipRect::NewL
807 RTestVclnt2ClipRect* RTestVclnt2ClipRect::NewL(const TDesC& aTestName,
808 const TDesC& aSectName,
809 const TDesC& aKeyName,
812 RTestVclnt2ClipRect* self
813 = new (ELeave) RTestVclnt2ClipRect(aTestName, aSectName, aKeyName, aExpectedError);
818 * RTestVclnt2ClipRect::DoThisActionDuringPlaybackL
820 void RTestVclnt2ClipRect::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
823 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0405")) == 0)
825 // shrink the current window clipping rect by half the height & width
826 clipRect.Resize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
828 else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0)
830 // grow the current window clipping rect by double the width
831 clipRect.Resize(iWindow->Size().iWidth * 2, iWindow->Size().iHeight);
833 else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
835 // move the current window clipping rect to be out of the window
836 clipRect.SetSize(iWindow->Size());
837 clipRect.Move(TPoint(iWindow->Size().iWidth + 1, 0));
841 User::Panic(_L("RTestVclnt2ClipRect"), KErrArgument);
844 // change the window clipping of the display window
845 TRAPD(err, aPlayer.SetWindowClipRectL(*iWindow, clipRect));
846 if (err != iTestExpectedError)
848 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0 ||
849 iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
851 // for negative tests, stop the test if the failure is not expected
852 ERR_PRINTF1(_L("iVideoPlayer2->SetWindowClipRectL() did not failed as expected. Test failed."));
854 iTestStepResult = EInconclusive;
855 CActiveScheduler::Stop();
861 // fail only if error is returned for positive tests
862 User::LeaveIfError(err);
867 // Reset the expected error to KErrNone as all expected failure tests have been completed.
868 // Any error that appears after this should fail the test
869 iTestExpectedError = KErrNone;
878 * RTestVclnt2Scale::Constructor
880 RTestVclnt2Scale::RTestVclnt2Scale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
881 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
886 * RTestVclnt2Scale::NewL
888 RTestVclnt2Scale* RTestVclnt2Scale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
890 RTestVclnt2Scale* self = new (ELeave) RTestVclnt2Scale(aTestName, aSectName, aKeyName, aExpectedError);
895 * RTestVclnt2Scale::DoThisActionDuringPlaybackL
897 void RTestVclnt2Scale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
899 // Change the scale factor during playback
900 aPlayer.SetScaleFactorL(*iWindow, 150, 150);
904 * RTestVclnt2Scale::HandlePrepareCompleteL
906 void RTestVclnt2Scale::HandlePrepareCompleteL()
908 // Continue to setup the video utility and then trigger playback
909 RTestVclnt2PerformActionDuringVideoPlayback::HandlePrepareCompleteL();
911 TReal32 scaleFactor = 50.0;
913 // set scale factor to less than 100%
914 iVideoPlayer2->SetScaleFactorL(*iWindow, scaleFactor, scaleFactor);
919 iVideoPlayer2->GetScaleFactorL(*iWindow, widthScale, heightScale);
921 if (widthScale != scaleFactor || heightScale != scaleFactor)
923 ERR_PRINTF1(_L("iVideoPlayer2->GetScaleFactorL() returns unexpected values. Test aborted."));
925 iTestStepResult = EInconclusive;
926 CActiveScheduler::Stop();
934 // RTestVclnt2Viewport
938 * RTestVclnt2Viewport::Constructor
940 RTestVclnt2Viewport::RTestVclnt2Viewport(const TDesC& aTestName,
941 const TDesC& aSectName,
942 const TDesC& aKeyName,
943 const TSize& aViewportSize,
945 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError),
946 iViewportSize(aViewportSize)
951 * RTestVclnt2Viewport::NewL
953 RTestVclnt2Viewport* RTestVclnt2Viewport::NewL(const TDesC& aTestName,
954 const TDesC& aSectName,
955 const TDesC& aKeyName,
956 const TSize& aViewportSize,
959 RTestVclnt2Viewport* self = new (ELeave) RTestVclnt2Viewport(aTestName,
967 void RTestVclnt2Viewport::HandlePrepareCompleteL()
969 // retrive original video size
971 iVideoPlayer2->VideoFrameSizeL(videoSize);
973 // crop the top left quarter of the video
975 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
977 // Crop the right half of the video
978 cropRegion.SetHeight(videoSize.iHeight);
979 cropRegion.SetWidth(videoSize.iWidth / 2);
980 cropRegion.Move(cropRegion.Width(), 0);
984 cropRegion.SetWidth(iViewportSize.iWidth == -1 ? videoSize.iWidth : iViewportSize.iWidth);
985 cropRegion.SetHeight(iViewportSize.iHeight == -1 ? videoSize.iHeight : iViewportSize.iHeight);
988 TRect videoExtentRect;
991 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
993 videoExtentRect.SetRect(TPoint(0, 0), videoSize);
994 clipRegion.SetRect(TPoint(0, 0), videoSize);
995 clipRegion.SetWidth(clipRegion.Width() / 2);
996 clipRegion.Move(clipRegion.Width(), 0);
1000 // Calculate the video extent to be exactly the same size as the cropped video picture,
1001 // placed at the center of the window
1002 TInt offsetX = (iWindow->Size().iWidth - cropRegion.Width()) / 2;
1003 TInt offsetY = (iWindow->Size().iHeight - cropRegion.Height()) / 2;
1004 videoExtentRect.SetRect(TPoint(offsetX, offsetY), cropRegion.Size());
1006 // Set the window clipping region to the top vertical half of the cropped image, originating
1007 // from the top left corner of the window
1008 clipRegion = videoExtentRect;
1009 clipRegion.SetHeight(videoExtentRect.Height() / 2);
1012 HandlePrepareCompleteL(cropRegion, videoExtentRect, clipRegion);
1014 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
1016 // Align the image to the left of the window
1017 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, 0);
1019 // trigger the video to start playing
1023 void RTestVclnt2Viewport::HandlePrepareCompleteL(const TRect& aCropRegion,
1024 const TRect& aVideoExtent,
1025 const TRect& aClipRect)
1027 iVideoPlayer2->SetCropRegionL(aCropRegion);
1029 // get the video crop region to ensure the crop region is set
1030 TRect currentCropRegion;
1031 iVideoPlayer2->GetCropRegionL(currentCropRegion);
1033 if (currentCropRegion != aCropRegion)
1035 ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value. Test aborted."));
1037 iTestStepResult = EInconclusive;
1038 CActiveScheduler::Stop();
1041 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, aVideoExtent, aClipRect);
1045 // RTestVclnt2InvalidViewport
1049 * RTestVclnt2InvalidViewport::Constructor
1051 RTestVclnt2InvalidViewport::RTestVclnt2InvalidViewport(const TDesC& aTestName,
1052 const TDesC& aSectName,
1053 const TDesC& aKeyName,
1054 TInt aExpectedError)
1055 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1060 * RTestVclnt2InvalidViewport::NewL
1062 RTestVclnt2InvalidViewport* RTestVclnt2InvalidViewport::NewL(const TDesC& aTestName,
1063 const TDesC& aSectName,
1064 const TDesC& aKeyName,
1065 TInt aExpectedError)
1067 RTestVclnt2InvalidViewport* self = new (ELeave) RTestVclnt2InvalidViewport(aTestName,
1075 * RTestVclnt2InvalidViewport::HandlePrepareCompleteL
1077 void RTestVclnt2InvalidViewport::HandlePrepareCompleteL()
1079 // retrive original video size
1081 iVideoPlayer2->VideoFrameSizeL(videoSize);
1083 // set the crop region to be completely out of the video image bound
1085 cropRegion.SetRect(TPoint(videoSize.iWidth, videoSize.iHeight), TSize(100, 100));
1087 // continue playback even if this fails
1088 TRAPD(err, iVideoPlayer2->SetCropRegionL(cropRegion));
1089 if (err == iTestExpectedError)
1091 // the invalid crop area is not supposed to be set
1092 INFO_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() returned expected. Test continues."));
1094 // reset the expected error. Any error that appears after this should fail the test
1095 iTestExpectedError = KErrNone;
1099 // the invalid crop area is not supposed to be set
1100 ERR_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() didn't leave with expected error. Test cannot be continued."));
1102 iTestStepResult = EInconclusive;
1103 CActiveScheduler::Stop();
1107 // get the video crop region to ensure the crop region is set
1108 TRect currentCropRegion;
1109 iVideoPlayer2->GetCropRegionL(currentCropRegion);
1111 if (currentCropRegion != cropRegion)
1113 // the invalid crop area is not supposed to be set
1114 ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value. Test cannot be continued."));
1116 iTestStepResult = EInconclusive;
1117 CActiveScheduler::Stop();
1121 // setup the display then trigger the video to start playing
1122 RTestVclnt2PlayFile::HandlePrepareCompleteL();
1127 // RTestVclnt2Rotation
1130 * RTestVclnt2Rotation::Constructor
1132 RTestVclnt2Rotation::RTestVclnt2Rotation(const TDesC& aTestName,
1133 const TDesC& aSectName,
1134 const TDesC& aKeyName,
1135 TInt aExpectedError)
1136 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1141 * RTestVclnt2Rotation::NewL
1143 RTestVclnt2Rotation* RTestVclnt2Rotation::NewL(const TDesC& aTestName,
1144 const TDesC& aSectName,
1145 const TDesC& aKeyName,
1146 TInt aExpectedError)
1148 RTestVclnt2Rotation* self = new (ELeave) RTestVclnt2Rotation(aTestName,
1156 * RTestVclnt2Rotation::HandlePrepareCompleteL
1158 void RTestVclnt2Rotation::HandlePrepareCompleteL()
1160 // call parent's HandlePrepareCompleteL to finish off all preparation
1161 RTestVclnt2PlayFile::HandlePrepareCompleteL();
1163 // set the video to be displayed upside-down
1164 TVideoRotation videoRotation(EVideoRotationClockwise180);
1165 iVideoPlayer2->SetRotationL(*iWindow, videoRotation);
1167 // retrieve the rotation setting, and check if it's been properly updated
1168 if (iVideoPlayer2->RotationL(*iWindow) != videoRotation)
1170 ERR_PRINTF1(_L("iVideoPlayer2->RotationL() returns an unexpected value. Test aborted."));
1172 iTestStepResult = EInconclusive;
1173 CActiveScheduler::Stop();
1180 // RTestVclnt2Settings
1183 * RTestVclnt2Settings::Constructor
1185 RTestVclnt2Settings::RTestVclnt2Settings(const TDesC& aTestName,
1186 const TDesC& aSectName,
1187 const TDesC& aKeyName,
1188 TInt aExpectedError)
1189 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1194 * RTestVclnt2Settings::NewL
1196 RTestVclnt2Settings* RTestVclnt2Settings::NewL(const TDesC& aTestName,
1197 const TDesC& aSectName,
1198 const TDesC& aKeyName,
1199 TInt aExpectedError)
1201 RTestVclnt2Settings* self = new (ELeave) RTestVclnt2Settings(aTestName, aSectName, aKeyName, aExpectedError);
1206 * RTestVclnt2Settings::HandlePrepareCompleteL
1208 void RTestVclnt2Settings::HandlePrepareCompleteL()
1210 // retrieve the current frame size
1212 iVideoPlayer2->VideoFrameSizeL(frameSize);
1214 TRect cropRegion(frameSize);
1215 // shrink the crop region to half its original height
1216 cropRegion.SetHeight(cropRegion.Height() / 2);
1217 iVideoPlayer2->SetCropRegionL(cropRegion);
1219 TRect videoExtentRect;
1220 videoExtentRect.SetWidth(cropRegion.Width());
1221 videoExtentRect.SetHeight(cropRegion.Height());
1223 videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2,
1224 (iWindow->Size().iHeight - videoExtentRect.Height()) / 2);
1226 TRect clippingRect(videoExtentRect);
1227 clippingRect.SetWidth(clippingRect.Height() / 2);
1229 // add display window using this valid clipping rect
1230 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);
1232 // Scale the movie with best fit scaling, and vertically center the picture
1233 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleBestFit);
1235 // Start video playback
1242 // RTestVclnt2SettingsAndAlignments
1245 * RTestVclnt2SettingsAndAlignments::Constructor
1247 RTestVclnt2SettingsAndAlignments::RTestVclnt2SettingsAndAlignments(const TDesC& aTestName,
1248 const TDesC& aSectName,
1249 const TDesC& aKeyName,
1250 TInt aExpectedError)
1251 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1256 * RTestVclnt2SettingsAndAlignments::NewL
1258 RTestVclnt2SettingsAndAlignments* RTestVclnt2SettingsAndAlignments::NewL(const TDesC& aTestName,
1259 const TDesC& aSectName,
1260 const TDesC& aKeyName,
1261 TInt aExpectedError)
1263 RTestVclnt2SettingsAndAlignments* self = new (ELeave) RTestVclnt2SettingsAndAlignments(aTestName, aSectName, aKeyName, aExpectedError);
1267 TVerdict RTestVclnt2SettingsAndAlignments::DoTestStepPreambleL()
1270 return RTestVclnt2PlayFile::DoTestStepPreambleL();
1274 * RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL
1276 void RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL()
1279 SetCropRegionL(cropRegion);
1281 AddDisplayWindowL(cropRegion);
1283 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0418")) == 0)
1285 SetContentOffsetL();
1287 else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0419")) == 0)
1289 SetContentAlignmentL();
1294 // Start video playback
1299 * RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL
1301 void RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL()
1305 if (iCount == KSettingsAndAlignmentTest)
1307 iTestStepResult = EPass;
1308 CActiveScheduler::Stop();
1312 HandlePrepareCompleteL();
1317 * RTestVclnt2SettingsAndAlignments::SetCropRegionL
1319 void RTestVclnt2SettingsAndAlignments::SetCropRegionL(TRect& aCropRegion)
1321 // retrieve the current frame size
1323 iVideoPlayer2->VideoFrameSizeL(frameSize);
1325 // Framesize is used in this case as crop region is not returning default values
1326 aCropRegion.SetRect(TPoint(0, 0), frameSize);
1328 // set the crop region
1329 switch (iCount % KSettingsAndAlignmentTest)
1332 // set the crop region to the top half of the image
1333 aCropRegion.SetHeight(aCropRegion.Height() / 2);
1334 iVideoPlayer2->SetCropRegionL(aCropRegion);
1338 // set the crop region to the left half of the image
1339 aCropRegion.SetWidth(aCropRegion.Width() / 2);
1340 iVideoPlayer2->SetCropRegionL(aCropRegion);
1344 // set the crop region to the bottom, right quarter of the image
1345 aCropRegion.SetHeight(aCropRegion.Height() / 2);
1346 aCropRegion.SetWidth(aCropRegion.Width() / 2);
1347 aCropRegion.Move(aCropRegion.Width(), aCropRegion.Height());
1348 iVideoPlayer2->SetCropRegionL(aCropRegion);
1354 * RTestVclnt2SettingsAndAlignments::SetContentOffsetL
1356 void RTestVclnt2SettingsAndAlignments::SetContentOffsetL()
1358 switch (iCount % KSettingsAndAlignmentTest)
1361 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, 100);
1365 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 0);
1369 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
1375 * RTestVclnt2SettingsAndAlignments::SetContentAlignmentL
1377 void RTestVclnt2SettingsAndAlignments::SetContentAlignmentL()
1379 switch (iCount % KSettingsAndAlignmentTest)
1382 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, EVerticalAlignCenter);
1386 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, 0);
1390 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
1396 * RTestVclnt2SettingsAndAlignments::SetScaleFactorL
1398 void RTestVclnt2SettingsAndAlignments::SetScaleFactorL()
1400 switch (iCount % KSettingsAndAlignmentTest)
1403 iVideoPlayer2->SetScaleFactorL(*iWindow, 1, 200);
1407 iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 1);
1411 iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 200);
1417 * RTestVclnt2SettingsAndAlignments::AddDisplayWindowL
1419 void RTestVclnt2SettingsAndAlignments::AddDisplayWindowL(const TRect& aCropRegion)
1421 TRect videoExtentRect(iWindow->Size());
1422 TRect clippingRect(iWindow->Size());
1424 switch (iCount % KSettingsAndAlignmentTest)
1427 videoExtentRect.SetWidth(aCropRegion.Width());
1428 if (iWindow->Size().iWidth > videoExtentRect.Width())
1430 videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2, 0);
1432 clippingRect = videoExtentRect;
1436 videoExtentRect.SetHeight(aCropRegion.Height());
1437 if (iWindow->Size().iHeight > videoExtentRect.Height())
1439 videoExtentRect.Move(0, (iWindow->Size().iHeight - videoExtentRect.Height()) / 2);
1441 clippingRect = videoExtentRect;
1445 clippingRect.SetHeight(clippingRect.Height() / 2);
1446 clippingRect.SetWidth(clippingRect.Width() / 2);
1447 clippingRect.Move(clippingRect.Width(), clippingRect.Height());
1451 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1452 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);
1457 // RTestVclnt2SecDisplay
1460 * RTestVclnt2SecDisplay::Constructor
1462 RTestVclnt2SecDisplay::RTestVclnt2SecDisplay(const TDesC& aTestName,
1463 const TDesC& aSectName,
1464 const TDesC& aKeyName,
1465 TInt aExpectedError)
1466 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1471 * RTestVclnt2SecDisplay::NewL
1473 RTestVclnt2SecDisplay* RTestVclnt2SecDisplay::NewL(const TDesC& aTestName,
1474 const TDesC& aSectName,
1475 const TDesC& aKeyName,
1476 TInt aExpectedError)
1478 RTestVclnt2SecDisplay* self = new (ELeave) RTestVclnt2SecDisplay(aTestName, aSectName, aKeyName, aExpectedError);
1483 * RTestVclnt2SecDisplay::DoTestStepPreambleL
1485 TVerdict RTestVclnt2SecDisplay::DoTestStepPreambleL()
1487 TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();
1488 if (verdict == EPass)
1490 // make a 2nd device for this session
1491 iSecondScreen = new (ELeave) CWsScreenDevice(iWs);
1492 User::LeaveIfError(iSecondScreen->Construct());
1499 * RTestVclnt2SecDisplay::DoTestStepPostambleL
1501 TVerdict RTestVclnt2SecDisplay::DoTestStepPostambleL()
1503 delete iSecondScreen;
1509 * RTestVclnt2SecDisplay::HandlePrepareCompleteL
1511 void RTestVclnt2SecDisplay::HandlePrepareCompleteL()
1513 // Add display window using default values - ie. video extent & window clipping
1514 // defaulted to whole window
1515 INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
1516 iVideoPlayer2->AddDisplayWindowL(iWs, *iSecondScreen, *iWindow);
1518 // trigger the video to start playing
1524 // RTestVclnt2CropRectPause
1527 * RTestVclnt2CropRectPause::Constructor
1529 RTestVclnt2CropRectPause::RTestVclnt2CropRectPause(const TDesC& aTestName,
1530 const TDesC& aSectName,
1531 const TDesC& aKeyName,
1532 TInt aExpectedError)
1533 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
1538 * RTestVclnt2CropRectPause::NewL
1540 RTestVclnt2CropRectPause* RTestVclnt2CropRectPause::NewL(const TDesC& aTestName,
1541 const TDesC& aSectName,
1542 const TDesC& aKeyName,
1543 TInt aExpectedError)
1545 RTestVclnt2CropRectPause* self
1546 = new (ELeave) RTestVclnt2CropRectPause(aTestName, aSectName, aKeyName, aExpectedError);
1551 * RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL
1553 void RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
1556 aPlayer.GetCropRegionL(cropRegion);
1558 // change the crop region and continue to play the clip
1559 cropRegion.SetHeight(cropRegion.Height() / 2);
1560 aPlayer.SetCropRegionL(cropRegion);
1566 // RTestVclnt2Overlay
1569 * RTestVclnt2Overlay::Constructor
1571 RTestVclnt2Overlay::RTestVclnt2Overlay(const TDesC& aTestName,
1572 const TDesC& aSectName,
1573 const TDesC& aKeyName,
1574 TInt aExpectedError)
1575 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1580 * RTestVclnt2Overlay::NewL
1582 RTestVclnt2Overlay* RTestVclnt2Overlay::NewL(const TDesC& aTestName,
1583 const TDesC& aSectName,
1584 const TDesC& aKeyName,
1585 TInt aExpectedError)
1587 RTestVclnt2Overlay* self = new (ELeave) RTestVclnt2Overlay(aTestName,
1595 * RTestVclnt2Overlay::DoTestStepPreambleL
1597 TVerdict RTestVclnt2Overlay::DoTestStepPreambleL()
1599 TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();
1600 if (verdict == EPass)
1602 TFontSpec fontSpec; // use default fonts
1603 fontSpec.iHeight = 20;
1605 // Get a font to draw overlay text
1606 if (iScreen->GetNearestFontToDesignHeightInPixels(iFont, fontSpec) != KErrNone)
1608 // if no font can be retrieved, abort the test
1609 ERR_PRINTF1(_L("Cannot retrieve font to perform test. Test aborted."));
1611 return EInconclusive;
1614 iGc->Activate(*iWindow);
1615 iGc->UseFont(iFont);
1622 * RTestVclnt2Overlay::DoTestStepPostambleL
1624 TVerdict RTestVclnt2Overlay::DoTestStepPostambleL()
1629 return RTestVclnt2PlayFile::DoTestStepPostambleL();
1633 * RTestVclnt2Overlay::HandlePrepareCompleteL
1635 void RTestVclnt2Overlay::HandlePrepareCompleteL()
1637 TRect rect(iWindow->Size());
1638 TInt baseline = (rect.Height() + iFont->AscentInPixels()) >> 1;
1640 // Draw the overlay text if needed
1641 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1642 iGc->SetBrushColor(KRgbRed);
1644 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
1645 iGc->SetPenColor(KRgbBlue);
1647 iGc->DrawText(_L("Overlay Testing"), rect, baseline, CGraphicsContext::ELeft);
1649 // setup the display window and trigger the video to start playing
1650 RTestVclnt2PlayFile::HandlePrepareCompleteL();
1655 // RTestVclnt2AddWin2
1659 * RTestVclnt2AddWin2::Constructor
1661 RTestVclnt2AddWin2::RTestVclnt2AddWin2(const TDesC& aTestName,
1662 const TDesC& aSectName,
1663 const TDesC& aKeyName,
1664 TInt aExpectedError)
1665 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1670 * RTestVclnt2AddWin2::NewL
1672 RTestVclnt2AddWin2* RTestVclnt2AddWin2::NewL(const TDesC& aTestName,
1673 const TDesC& aSectName,
1674 const TDesC& aKeyName,
1675 TInt aExpectedError)
1677 RTestVclnt2AddWin2* self = new (ELeave) RTestVclnt2AddWin2(aTestName,
1685 * RTestVclnt2AddWin2::HandlePrepareCompleteL
1687 void RTestVclnt2AddWin2::HandlePrepareCompleteL()
1689 // add the display window for the player to use for displaying the video
1690 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1692 // Add the same display window again
1693 TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
1694 if (err != iTestExpectedError)
1696 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
1698 iTestStepResult = EFail;
1699 CActiveScheduler::Stop();
1705 INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error. Test continues."));
1707 // reset the expected error. Any error that appears after this should fail the test
1708 iTestExpectedError = KErrNone;
1711 // trigger the video to start playing
1716 // RTestVclnt2AddWin2WithSettings
1720 * RTestVclnt2AddWin2WithSettings::Constructor
1722 RTestVclnt2AddWin2WithSettings::RTestVclnt2AddWin2WithSettings(const TDesC& aTestName,
1723 const TDesC& aSectName,
1724 const TDesC& aKeyName,
1725 TInt aExpectedError)
1726 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1731 * RTestVclnt2AddWin2WithSettings::NewL
1733 RTestVclnt2AddWin2WithSettings* RTestVclnt2AddWin2WithSettings::NewL(const TDesC& aTestName,
1734 const TDesC& aSectName,
1735 const TDesC& aKeyName,
1736 TInt aExpectedError)
1738 RTestVclnt2AddWin2WithSettings* self = new (ELeave) RTestVclnt2AddWin2WithSettings(aTestName,
1746 * RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL
1748 void RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL()
1750 TRect windowRect(iWindow->Size());
1751 windowRect.SetHeight(windowRect.Height() / 2);
1753 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, windowRect, windowRect);
1755 // Add the same display window again with default values
1756 TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
1757 if (err != iTestExpectedError)
1759 ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
1761 iTestStepResult = EFail;
1762 CActiveScheduler::Stop();
1768 INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error. Test continues."));
1770 // reset the expected error. Any error that appears after this should fail the test
1771 iTestExpectedError = KErrNone;
1774 // trigger the video to start playing
1779 // RTestVclnt2ContOffset
1783 * RTestVclnt2ContOffset::Constructor
1785 RTestVclnt2ContOffset::RTestVclnt2ContOffset(const TDesC& aTestName,
1786 const TDesC& aSectName,
1787 const TDesC& aKeyName,
1788 TInt aExpectedError)
1789 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
1791 iHeapSize = 2000000; //~2MB
1795 * RTestVclnt2ContOffset::NewL
1797 RTestVclnt2ContOffset* RTestVclnt2ContOffset::NewL(const TDesC& aTestName,
1798 const TDesC& aSectName,
1799 const TDesC& aKeyName,
1800 TInt aExpectedError)
1802 RTestVclnt2ContOffset* self = new (ELeave) RTestVclnt2ContOffset(aTestName,
1810 * RTestVclnt2ContOffset::HandlePrepareCompleteL
1812 void RTestVclnt2ContOffset::HandlePrepareCompleteL()
1814 // call parent's HandlePrepareCompleteL to finish off all preparation
1815 RTestVclnt2PlayFile::HandlePrepareCompleteL();
1816 // Set the content offset before starting to play the video.
1817 INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
1818 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
1820 if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0409")) == 0)
1822 // Set the content alignment after setting the content offset
1823 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
1828 // RTestVclnt2ContOffsetAtPlay
1831 * RTestVclnt2ContOffsetAtPlay::Constructor
1833 RTestVclnt2ContOffsetAtPlay::RTestVclnt2ContOffsetAtPlay(const TDesC& aTestName,
1834 const TDesC& aSectName,
1835 const TDesC& aKeyName,
1836 TInt aExpectedError)
1837 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
1839 iHeapSize = 2000000; //~2MB
1843 * RTestVclnt2ContOffsetAtPlay::NewL
1845 RTestVclnt2ContOffsetAtPlay* RTestVclnt2ContOffsetAtPlay::NewL(const TDesC& aTestName,
1846 const TDesC& aSectName,
1847 const TDesC& aKeyName,
1848 TInt aExpectedError)
1850 RTestVclnt2ContOffsetAtPlay* self = new (ELeave) RTestVclnt2ContOffsetAtPlay(aTestName,
1858 * RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL
1860 void RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
1862 // Change the scale factor during playback
1863 INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
1864 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 10, 10);
1872 * RTestVclnt2Align::Constructor
1874 RTestVclnt2Align::RTestVclnt2Align(const TDesC& aTestName,
1875 const TDesC& aSectName,
1876 const TDesC& aKeyName,
1877 TInt aExpectedError)
1878 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
1880 iHeapSize = 2000000; //~2MB
1884 * RTestVclnt2Align::NewL
1886 RTestVclnt2Align* RTestVclnt2Align::NewL(const TDesC& aTestName,
1887 const TDesC& aSectName,
1888 const TDesC& aKeyName,
1889 TInt aExpectedError)
1891 RTestVclnt2Align* self = new (ELeave) RTestVclnt2Align(aTestName, aSectName, aKeyName, aExpectedError);
1896 * RTestVclnt2Align::HandlePrepareCompleteL
1898 void RTestVclnt2Align::HandlePrepareCompleteL()
1900 // Continue to setup the video utility and then trigger playback
1901 RTestVclnt2PlayFile::HandlePrepareCompleteL();
1902 // Set the content offset before starting to play the video.
1903 INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
1904 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
1908 * RTestVclnt2Align::DoThisActionDuringPlaybackL
1910 void RTestVclnt2Align::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
1912 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignCenter);
1913 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1914 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 3, 4, 220));
1916 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignCenter);
1917 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1918 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1920 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignTop);
1921 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1922 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 5, 5, 200));
1924 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
1925 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1926 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1928 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignTop);
1929 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1930 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 5, 200));
1932 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignBottom);
1933 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1934 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1936 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignBottom);
1937 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1938 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 300, 230));
1940 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignBottom);
1941 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
1942 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1947 // RTestVclnt2AutoScale
1950 * RTestVclnt2AutoScale::Constructor
1952 RTestVclnt2AutoScale::RTestVclnt2AutoScale(const TDesC& aTestName,
1953 const TDesC& aSectName,
1954 const TDesC& aKeyName,
1955 TInt aExpectedError)
1956 : RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
1958 iHeapSize = 2000000; //~2MB
1962 * RTestVclnt2AutoScale::NewL
1964 RTestVclnt2AutoScale* RTestVclnt2AutoScale::NewL(const TDesC& aTestName,
1965 const TDesC& aSectName,
1966 const TDesC& aKeyName,
1967 TInt aExpectedError)
1969 RTestVclnt2AutoScale* self = new (ELeave) RTestVclnt2AutoScale(aTestName, aSectName, aKeyName, aExpectedError);
1974 * RTestVclnt2AutoScale::HandlePrepareCompleteL
1976 void RTestVclnt2AutoScale::HandlePrepareCompleteL()
1978 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
1979 // Set the content offset before starting to play the video.
1980 INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
1981 iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleClip);
1983 // trigger the video to start playing
1988 * RTestVclnt2AutoScale::DoThisActionDuringPlaybackL
1990 void RTestVclnt2AutoScale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
1992 aPlayer.SetAutoScaleL(*iWindow, EAutoScaleBestFit);
1993 aPlayer.SetAutoScaleL(*iWindow, EAutoScaleNone);
1994 aPlayer.SetAutoScaleL(*iWindow, EAutoScaleStretch);
1998 // RTestVclnt2OldController
2001 RTestVclnt2OldController::RTestVclnt2OldController(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2002 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2007 * RTestVclnt2OldController::NewL
2009 RTestVclnt2OldController* RTestVclnt2OldController::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2011 RTestVclnt2OldController* self = new (ELeave) RTestVclnt2OldController(aTestName, aSectName, aKeyName, aExpectedError);
2015 void RTestVclnt2OldController::HandleIdleL()
2017 // Open iVideoPlayer using a controller that does not support surfaces.
2018 INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
2019 iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviNonGcePlayControllerUid);
2020 PrepareState(EVPOpenComplete, KErrNone);
2023 void RTestVclnt2OldController::HandlePrepareCompleteL()
2025 TRAPD(err, RTestVclnt2PlayFile::HandlePrepareCompleteL());
2027 if (err != KErrNotSupported)
2029 ERR_PRINTF1(_L("AddDisplay did not leave with KErrNotSupported."));
2030 iTestStepResult = EFail;
2034 iTestStepResult = EPass;
2038 CActiveScheduler::Stop();
2041 // RTestVclnt2NoFile
2044 RTestVclnt2NoFile::RTestVclnt2NoFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2045 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2050 * RTestVclnt2NoFile::NewL
2052 RTestVclnt2NoFile* RTestVclnt2NoFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2054 RTestVclnt2NoFile* self = new (ELeave) RTestVclnt2NoFile(aTestName, aSectName, aKeyName, aExpectedError);
2058 void RTestVclnt2NoFile::HandleIdleL()
2060 iTestStepResult = EFail;
2061 TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
2063 if (err != iTestExpectedError)
2065 ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
2066 User::Leave(KErrGeneral);
2069 TSize windowSize = iWindow->Size();
2070 TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
2071 TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
2072 TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect));
2074 if (err != iTestExpectedError)
2076 ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
2077 User::Leave(KErrGeneral);
2080 TRAP(err, iVideoPlayer2->SetWindowClipRectL(*iWindow, windowClipRect));
2082 if (err != iTestExpectedError)
2084 ERR_PRINTF1(_L("SetWindowClipRectL did not leave with KErrNotReady."));
2085 User::Leave(KErrGeneral);
2088 TRAP(err, iVideoPlayer2->SetVideoExtentL(*iWindow, videoExtent));
2090 if (err != iTestExpectedError)
2092 ERR_PRINTF1(_L("SetVideoExtentL did not leave with KErrNotReady."));
2093 User::Leave(KErrGeneral);
2096 // reset the expected error to KErrNone as any error happens after this is unexpected
2097 iTestExpectedError = KErrNone;
2099 // The video should still play when we try to play the video. Perform
2100 // the basic play test now.
2101 RTestVclnt2PlayFile::HandleIdleL();
2105 // RTestVclnt2PlayAfterRemoveWin
2108 RTestVclnt2PlayAfterRemoveWin::RTestVclnt2PlayAfterRemoveWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2109 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2114 * RTestVclnt2PlayAfterRemoveWin::NewL
2116 RTestVclnt2PlayAfterRemoveWin* RTestVclnt2PlayAfterRemoveWin::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2118 RTestVclnt2PlayAfterRemoveWin* self = new (ELeave) RTestVclnt2PlayAfterRemoveWin(aTestName, aSectName, aKeyName, aExpectedError);
2122 void RTestVclnt2PlayAfterRemoveWin::HandlePrepareCompleteL()
2124 // Don't add a window. Just play the video.
2128 void RTestVclnt2PlayAfterRemoveWin::HandlePlayCompleteL()
2130 switch(iPlayAttempt)
2134 TSize windowSize = iWindow->Size();
2135 TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
2136 TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
2137 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect);
2138 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
2139 iVideoPlayer2->Play();
2140 PrepareState(EVPPlayComplete, KErrNone);
2144 // Removing the window again should have no effect.
2145 iVideoPlayer2->RemoveDisplayWindow(*iWindow);
2146 iVideoPlayer2->Play();
2147 PrepareState(EVPPlayComplete, KErrNone);
2150 // The previous play commands should have no effect when we try to add a
2151 // display window and render to surfaces. Use the base class to do this.
2152 RTestVclnt2PlayFile::HandlePrepareCompleteL();
2155 // Use the parent handler after we have tried the above play commands.
2156 RTestVclnt2PlayFile::HandlePlayCompleteL();
2167 RTestVclnt2NoGce::RTestVclnt2NoGce(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2168 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2173 * RTestVclnt2NoGce::NewL
2175 RTestVclnt2NoGce* RTestVclnt2NoGce::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2177 RTestVclnt2NoGce* self = new (ELeave) RTestVclnt2NoGce(aTestName, aSectName, aKeyName, aExpectedError);
2181 void RTestVclnt2NoGce::HandleIdleL()
2183 // Open iVideoPlayer
2184 INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
2185 iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
2186 PrepareState(EVPOpenComplete, KErrNotSupported);
2189 void RTestVclnt2NoGce::HandleOpenCompleteL()
2191 iTestStepResult = EPass;
2192 CActiveScheduler::Stop();
2199 RTestVclnt2Alloc::RTestVclnt2Alloc(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2200 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2205 * RTestVclnt2Alloc::NewL
2207 RTestVclnt2Alloc* RTestVclnt2Alloc::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2209 RTestVclnt2Alloc* self = new (ELeave) RTestVclnt2Alloc(aTestName, aSectName, aKeyName, aExpectedError);
2213 TVerdict RTestVclnt2Alloc::DoTestStepPreambleL()
2215 INFO_PRINTF1(_L("RTestVclnt2Alloc::DoTestStepPreambleL()"));
2217 // Call RTestMmfVclntAviStep::DoTestStepPreambleL instead of the immediate parent's
2218 // DoTestStepPreambleL as there is no need for CVideoPlayerUtility setup.
2219 // Similarly, there is no need to initialize CVideoPlayerUtility2, as it will be
2220 // created in each alloc iteration.
2221 return RTestMmfVclntAviStep::DoTestStepPreambleL();
2224 TVerdict RTestVclnt2Alloc::PerformTestL()
2226 iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
2229 TVerdict result = RTestVclnt2AviPlayerStep::DoTestStepL();
2230 delete iVideoPlayer2;
2231 iVideoPlayer2 = NULL;
2236 * RTestVclnt2Alloc::DoTestStepL()
2238 TVerdict RTestVclnt2Alloc::DoTestStepL()
2240 TVerdict allocTestStepResult = EPass;
2241 TInt err = KErrNone;
2242 TBool result = EFalse;
2244 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
2245 if (PerformTestL() != EPass)
2250 if (err != KErrNone)
2252 INFO_PRINTF2(_L("Test error, returned error code = %d"), err);
2257 //Check the iAllocTestStepResult
2258 if (allocTestStepResult != EPass)
2265 TBool completed = EFalse;
2266 allocTestStepResult = EPass;
2267 TBool reachedEnd = EFalse;
2270 __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
2273 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
2274 TVerdict verdict = EFail;
2275 TRAP(err, verdict = PerformTestL());
2276 if (err == KErrNone && verdict != EPass)
2282 if (err == KErrNone)
2284 TAny* testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
2285 if (testAlloc == NULL)
2292 User::Free(testAlloc);
2295 //Check the iAllocTestStepResult
2296 if (allocTestStepResult != EPass)
2301 completed = reachedEnd || result;
2303 else if (err != KErrNoMemory) // bad error code
2310 __UHEAP_SETFAIL(RHeap::ENone, 0);
2320 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
2322 if (err != KErrNone || result)
2324 allocTestStepResult = EFail;
2328 format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount);
2332 format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount);
2339 format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount);
2343 return allocTestStepResult;
2347 // RTestVclnt2InvalidScaleFactor
2349 RTestVclnt2InvalidScaleFactor::RTestVclnt2InvalidScaleFactor(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2350 : RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
2355 * RTestVclnt2InvalidScaleFactor::NewL
2357 RTestVclnt2InvalidScaleFactor* RTestVclnt2InvalidScaleFactor::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2359 RTestVclnt2InvalidScaleFactor* self = new (ELeave) RTestVclnt2InvalidScaleFactor(aTestName, aSectName, aKeyName, aExpectedError);
2363 void RTestVclnt2InvalidScaleFactor::HandlePrepareCompleteL()
2365 INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
2366 iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
2368 // Try to scale the video to an invalid values
2369 TRAPD(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 0, 100));
2370 if (err != KErrArgument)
2372 User::Leave(err == KErrNone ? KErrGeneral : err);
2375 TRAP(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 100, -100));
2376 if (err != KErrArgument)
2378 User::Leave(err == KErrNone ? KErrGeneral : err);
2381 // trigger the video to start playing