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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __TSU_MMF_CODECTESTS_H__
17 #define __TSU_MMF_CODECTESTS_H__
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>
26 #include <mmf/common/mmfcontroller.h>
27 #include <mmf/common/mmfcontrollerpluginresolver.h>
28 #include <mmf/plugin/mmfplugininterfaceuids.hrh>
29 #include "TSU_MMF_ACOD.h"
31 const TInt KMaxMethods = 2;
34 class CTestSuite_MMF_SwCodecDevices;
36 //[ comparator class used to compare results in a unit test ]
40 virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength );
43 //[Comparator class used when the results differ]
44 template <TInt T= -300>
45 class TDbComparator : public TComparator
48 virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength );
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
57 CTestStepCodecUnitTest( TUint aTestIndex );
58 virtual ~CTestStepCodecUnitTest();
59 virtual enum TVerdict DoTestStepL();
60 virtual TVerdict DoTestStepPreambleL(void);
61 virtual TVerdict DoTestStepPostambleL(void);
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);
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 );
73 virtual void Print8BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength );
74 virtual void Print16BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength );
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 ]