mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/testvideoplayer2.cpp
branchRCL_3
changeset 12 b74061f7f3d2
parent 0 40261b775718
equal deleted inserted replaced
11:d5f04de580b7 12:b74061f7f3d2
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   263     // ==================
   263     // ==================
   264     
   264     
   265     iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
   265     iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
   266     
   266     
   267 	TRect videoExtent = clipRect;
   267 	TRect videoExtent = clipRect;
   268 	TVideoRotation rotation = EVideoRotationNone;
       
   269 	TReal32 scaleWidth(100.0f);
   268 	TReal32 scaleWidth(100.0f);
   270 	TReal32 scaleHeight(100.0f);
   269 	TReal32 scaleHeight(100.0f);
   271 	TInt horizPos(EHorizontalAlignCenter);
   270 	TInt horizPos(EHorizontalAlignCenter);
   272 	TInt vertPos(EVerticalAlignCenter);	
   271 	TInt vertPos(EVerticalAlignCenter);	
   273 	
   272 	
   274 	TReal32 widthPercentage(50.0f); 
   273 	TReal32 widthPercentage(50.0f); 
   275 	TReal32 heightPercentage(50.0f);
   274 	TReal32 heightPercentage(50.0f);
   276 	TReal32 widthP; 
   275 	TReal32 widthP; 
   277 	TReal32 heightP;
   276 	TReal32 heightP;
   278 	RWindow newWindow;
   277 	RWindow newWindow;
   279 	TVideoRotation videoRotation(EVideoRotationClockwise180);
   278 	
       
   279 	// Check for invalid rotation when adding new window
       
   280 	INFO_PRINTF1(_L("Testing invalid rotations for AddDisplayWindowL"));
       
   281 	TInt err = KErrNone;
       
   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)
       
   285 		{
       
   286 		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative rotation"));
       
   287     	iTestStepResult = EFail;
       
   288     	CActiveScheduler::Stop();
       
   289     	return;
       
   290 		}
       
   291 
       
   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)
       
   295 		{
       
   296 		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range rotation"));
       
   297     	iTestStepResult = EFail;
       
   298     	CActiveScheduler::Stop();
       
   299     	return;
       
   300 		}
       
   301 
       
   302 	rotation = EVideoRotationNone;
       
   303 
       
   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)
       
   309 		{
       
   310 		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative scale"));
       
   311     	iTestStepResult = EFail;
       
   312     	CActiveScheduler::Stop();
       
   313     	return;
       
   314 		}
       
   315 
       
   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)
       
   319 		{
       
   320 		ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range scale"));
       
   321     	iTestStepResult = EFail;
       
   322     	CActiveScheduler::Stop();
       
   323     	return;
       
   324 		}
   280 	
   325 	
   281 	iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow);
   326 	iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow);
   282 	INFO_PRINTF1(_L("iMediaClientVideoDisplay->AddDisplayWindowL()"));   
   327 	INFO_PRINTF1(_L("iMediaClientVideoDisplay->AddDisplayWindowL()"));   
   283     
   328 
       
   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)
       
   334 		{
       
   335 		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for negative value"));
       
   336     	iTestStepResult = EFail;
       
   337     	CActiveScheduler::Stop();
       
   338     	return;
       
   339 		}
       
   340 
       
   341 	videoRotation = static_cast<TVideoRotation>(4);
       
   342 	TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
       
   343 	if (err != KErrArgument)
       
   344 		{
       
   345 		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for out of range value"));
       
   346     	iTestStepResult = EFail;
       
   347     	CActiveScheduler::Stop();
       
   348     	return;
       
   349 		}
       
   350 
       
   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)
       
   355 		{
       
   356 		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for negative value"));
       
   357     	iTestStepResult = EFail;
       
   358     	CActiveScheduler::Stop();
       
   359     	return;
       
   360 		}
       
   361 
       
   362 	videoRotation = static_cast<TVideoRotation>(4);
       
   363 	TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
       
   364 	if (err != KErrArgument)
       
   365 		{
       
   366 		ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for out of range value"));
       
   367     	iTestStepResult = EFail;
       
   368     	CActiveScheduler::Stop();
       
   369     	return;
       
   370 		}
       
   371 
       
   372 	videoRotation = EVideoRotationClockwise180;
       
   373 
   284     iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion);
   374     iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion);
   285     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
   375     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
   286     
   376     
   287     if (iMediaClientVideoDisplay->RotationL(*iWindow) != videoRotation)
   377     if (iMediaClientVideoDisplay->RotationL(*iWindow) != videoRotation)
   288         {
   378         {
   309     iMediaClientVideoDisplay->SetVideoExtentL(*iWindow, videoExtent, cropRegion);
   399     iMediaClientVideoDisplay->SetVideoExtentL(*iWindow, videoExtent, cropRegion);
   310     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetVideoExtentL()"));
   400     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetVideoExtentL()"));
   311     
   401     
   312     iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow, clipRect, cropRegion);
   402     iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow, clipRect, cropRegion);
   313     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetWindowClipRectL()"));
   403     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetWindowClipRectL()"));
       
   404 
       
   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)
       
   410 		{
       
   411 		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for negative value"));
       
   412     	iTestStepResult = EFail;
       
   413     	CActiveScheduler::Stop();
       
   414     	return;
       
   415 		}
       
   416 
       
   417 	autoScaleType = static_cast<TAutoScaleType>(4);
       
   418 	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
       
   419 	if (err != KErrArgument)
       
   420 		{
       
   421 		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for out of range value"));
       
   422     	iTestStepResult = EFail;
       
   423     	CActiveScheduler::Stop();
       
   424     	return;
       
   425 		}
       
   426 
       
   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)
       
   431 		{
       
   432 		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for negative value"));
       
   433     	iTestStepResult = EFail;
       
   434     	CActiveScheduler::Stop();
       
   435     	return;
       
   436 		}
       
   437 
       
   438 	autoScaleType = static_cast<TAutoScaleType>(4);
       
   439 	TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
       
   440 	if (err != KErrArgument)
       
   441 		{
       
   442 		ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for out of range value"));
       
   443     	iTestStepResult = EFail;
       
   444     	CActiveScheduler::Stop();
       
   445     	return;
       
   446 		}
   314     
   447     
   315     iMediaClientVideoDisplay->SetAutoScaleL(EAutoScaleBestFit, horizPos, vertPos, cropRegion);
   448     iMediaClientVideoDisplay->SetAutoScaleL(EAutoScaleBestFit, horizPos, vertPos, cropRegion);
   316     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetAutoScaleL()"));
   449     INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetAutoScaleL()"));
   317     
   450     
   318     iMediaClientVideoDisplay->RedrawWindows(cropRegion);
   451     iMediaClientVideoDisplay->RedrawWindows(cropRegion);