os/mm/mmlibs/mmfw/tsrc/mmfunittest/SwCodecDevices/tsu_mmf_CodecTests.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-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 #ifndef __TSU_MMF_CODECTESTS_H__
    17 #define __TSU_MMF_CODECTESTS_H__
    18 
    19 #include <testframework.h>
    20 #include <mmf/server/mmfcodec.h>
    21 #include <mmf/server/mmfbuffer.h>
    22 #include <mmf/server/mmfdatabuffer.h>
    23 #include <mmf/common/mmfutilities.h>
    24 #include <mmf/common/mmffourcc.h>
    25 
    26 #include <mmf/common/mmfcontroller.h>
    27 #include <mmf/common/mmfcontrollerpluginresolver.h>
    28 #include <mmf/plugin/mmfplugininterfaceuids.hrh>
    29 #include "TSU_MMF_ACOD.h"
    30 
    31 const TInt KMaxMethods = 2;
    32 
    33 class CTestSuite ;
    34 class CTestSuite_MMF_SwCodecDevices;
    35 
    36 //[ comparator class used to compare results in a unit test ]
    37 class TComparator
    38 {
    39 public:
    40 	virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength );
    41 };
    42 
    43 //[Comparator class used when the results differ]
    44 template <TInt T= -300>
    45 class TDbComparator : public  TComparator
    46 {
    47 public:
    48 	virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength );
    49 };
    50 
    51 
    52 class TCodecUnitTestParams;
    53 template <class T, class Comparator, TInt a=0, TInt b=0, TInt c = 0>
    54 class CTestStepCodecUnitTest : public CTestStep_MMF_SwCodecDevices
    55 	{
    56 public:
    57 	CTestStepCodecUnitTest( TUint aTestIndex );
    58 	virtual ~CTestStepCodecUnitTest();
    59 	virtual enum TVerdict DoTestStepL();
    60 	virtual TVerdict DoTestStepPreambleL(void);
    61 	virtual TVerdict DoTestStepPostambleL(void);
    62 public:
    63 	// set up typedef for pointer to dispatch function
    64     typedef void (CTestStepCodecUnitTest::*pCallBack)(CMMFDataBuffer* &aBuffer, const TDesC& aFile );
    65     typedef void (CTestStepCodecUnitTest::*pPrintFormatCallBack)(TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength);
    66 
    67     virtual void ReadWavFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile );
    68 	virtual void ReadAuFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile );
    69     TInt ReadIntB( RFile& aFile, TInt& aValue );
    70 	TInt ComputeBuffersToProcess();
    71 	TInt ReadInt( RFile& aFile, TInt& aValue );
    72 protected:
    73 	virtual void Print8BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength );
    74 	virtual void Print16BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength );
    75 protected:
    76 	const TCodecUnitTestParams *iTestParameters;
    77 	Comparator iComparator;
    78 	T*  iCodecUnderTest;  // The Codec Under Test
    79     CMMFDataBuffer* iSourceData;   // reference source data
    80 	CMMFDataBuffer* iCodedData;    // coded data
    81 	CMMFDataBuffer* iRefCodedData; // reference coded data
    82 	RFs iFs;                       // file server
    83 	pCallBack iReaders[KMaxMethods]; //[Configurable file readers]
    84 	pPrintFormatCallBack iPrintFormats[KMaxMethods]; //[ configurable print formats ]
    85 	};
    86 
    87 #endif