imagingandcamerafws/imaginginttest/TSI_ICL_IMGDISP/src/MngPITestStepImageDisplay.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-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 // EPOC includes
       
    17 #include <e32base.h>
       
    18 #include <imagedisplay.h>
       
    19 #include <icl/imagedisplayplugin.h>
       
    20 #include "TestHelperIface.h"
       
    21 
       
    22 // Test system includes
       
    23 #include <testframework.h>
       
    24 
       
    25 #include "TestStepImageDisplay.h"
       
    26 #include "TestSuiteImageDisplay.h"
       
    27 
       
    28 #include "MngPITestStepImageDisplay.h"
       
    29 
       
    30 /******************************************************************************
       
    31  *
       
    32  * class CScaleToRecommendedSize
       
    33  *
       
    34  *****************************************************************************/
       
    35 
       
    36 /*
       
    37  * CScaleToRecommendedSize::CScaleToRecommendedSize()
       
    38  *
       
    39  * Test step constructor.
       
    40  */
       
    41 
       
    42 CScaleToRecommendedSize::CScaleToRecommendedSize(const TImageDisplayUnitTestParams& aTestParams)
       
    43 	: CTestStepImgDisplayGeneric(aTestParams)
       
    44 	{
       
    45 	}
       
    46 
       
    47 
       
    48 TBool CScaleToRecommendedSize::ConsumeFrame(const CFbsBitmap& aBitmap)
       
    49 	{
       
    50 	TFileName fileName;
       
    51 	++iFrameNumber;
       
    52 	fileName.Format(_L("scaled_digit_%d.mbm "),10-iFrameNumber);
       
    53 	SetRefFilename(fileName);
       
    54 	if (CompareBitmapWithFileL(aBitmap, RefFilename() ) != EPass )
       
    55 		{
       
    56 		iLastError = KErrGeneral;
       
    57 		}
       
    58 	return ETrue;
       
    59 	}
       
    60 
       
    61 /*
       
    62  * TVerdict CScaleToRecommendedSize::TestL()
       
    63  *
       
    64  * Test step specific code.
       
    65  */
       
    66 
       
    67 TVerdict CScaleToRecommendedSize::TestL()
       
    68 	{
       
    69 	TVerdict testStepResult = EPass;	// assume success
       
    70 
       
    71 	ASSERT(iImageDisplay == NULL);
       
    72 	// create an ImageDisplay object
       
    73 	iImageDisplay = CImageDisplay::NewL(*this, iFs);
       
    74 
       
    75 	SetupPluginL();
       
    76 
       
    77 	// Opened -> Configured
       
    78 	iImageDisplay->SetOptions(CImageDisplay::EOptionMainImage);
       
    79 
       
    80 	iImageDisplay->SetupL();
       
    81 
       
    82 	TSize	scaleSize = TSize( 64, 64 );
       
    83 	iImageDisplay->SetSizeInPixels( scaleSize );
       
    84 
       
    85 	iImageDisplay->Play();
       
    86 	CActiveScheduler::Start();
       
    87 
       
    88 	if (KErrNone != iLastError)
       
    89 		{
       
    90 		INFO_PRINTF2(_L("Decoding error %d"),iLastError);
       
    91 		return (testStepResult = EFail );
       
    92 		}
       
    93 	if (iFrameNumber !=2 )
       
    94 		{
       
    95 		testStepResult = EFail;
       
    96 		}
       
    97 
       
    98 	iImageDisplay->StopPlay();
       
    99 
       
   100 	return testStepResult;
       
   101 	}
       
   102 
       
   103 /******************************************************************************
       
   104  *
       
   105  * class CScaleToNonRecommendedSize
       
   106  *
       
   107  *****************************************************************************/
       
   108 
       
   109 /*
       
   110  * CScaleToNonRecommendedSize::CScaleToNonRecommendedSize()
       
   111  *
       
   112  * Test step constructor.
       
   113  */
       
   114 
       
   115 CScaleToNonRecommendedSize::CScaleToNonRecommendedSize(const TImageDisplayUnitTestParams& aTestParams)
       
   116 	: CTestStepImgDisplayGeneric(aTestParams)
       
   117 	{
       
   118 	}
       
   119 
       
   120 /*
       
   121  * TVerdict CScaleToNonRecommendedSize::TestL()
       
   122  *
       
   123  * Test step specific code.
       
   124  */
       
   125 
       
   126 TBool CScaleToNonRecommendedSize::ConsumeFrame(const CFbsBitmap& aBitmap)
       
   127 	{
       
   128 	TFileName fileName;
       
   129 	++iFrameNumber;
       
   130 	fileName.Format(_L("scaled_digit_%d.mbm "),10-iFrameNumber);
       
   131 	SetRefFilename(fileName);
       
   132 	if (CompareBitmapWithFileL(aBitmap, RefFilename() ) != EPass )
       
   133 		{
       
   134 		iLastError = KErrGeneral;
       
   135 		}
       
   136 	return ETrue;
       
   137 	}
       
   138 
       
   139 TVerdict CScaleToNonRecommendedSize::TestL()
       
   140 	{
       
   141 	TVerdict testStepResult = EPass;	// assume success
       
   142 
       
   143 	ASSERT(iImageDisplay == NULL);
       
   144 	// create an ImageDisplay object
       
   145 	iImageDisplay = CImageDisplay::NewL(*this, iFs);
       
   146 
       
   147 	SetupPluginL();
       
   148 
       
   149 	// Opened -> Configured
       
   150 	iImageDisplay->SetOptions(CImageDisplay::EOptionMainImage);
       
   151 
       
   152 	iImageDisplay->SetupL();
       
   153 
       
   154 	TSize	scaleSize = TSize( 64, 64 );
       
   155 	iImageDisplay->SetSizeInPixels( scaleSize );
       
   156 
       
   157 	iImageDisplay->Play();
       
   158 	CActiveScheduler::Start();
       
   159 
       
   160 	if (KErrNone != iLastError)
       
   161 		{
       
   162 		INFO_PRINTF2(_L("Decoding error %d"),iLastError);
       
   163 		return (testStepResult = EFail );
       
   164 		}
       
   165 	if (iFrameNumber !=2 )
       
   166 		{
       
   167 		testStepResult = EFail;
       
   168 		}
       
   169 
       
   170 	iImageDisplay->StopPlay();
       
   171 
       
   172 	return testStepResult;
       
   173 	}