1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/MidiClnt/TSU_MMFMIDICLNT.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,215 @@
1.4 +
1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// TSI_MMFMIDICLNT.h
1.19 +// Header file: Basic tests.
1.20 +//
1.21 +//
1.22 +
1.23 +/**
1.24 + @file TSI_MMFVCLNT.h
1.25 +*/
1.26 +
1.27 +#ifndef TSU_MMFMIDICLNT_H__
1.28 +#define TSU_MMFMIDICLNT_H__
1.29 +
1.30 +#include <e32base.h>
1.31 +#include <badesca.h>
1.32 +#include <e32test.h>
1.33 +#include <e32keys.h>
1.34 +#include <c32comm.h>
1.35 +#include <f32file.h>
1.36 +#include <etel.h>
1.37 +#include <etelmm.h>
1.38 +#include <testframework.h>
1.39 +
1.40 +#include <fbs.h>
1.41 +#include <w32std.h>
1.42 +#include <mmf/common/mmfstandardcustomcommands.h>
1.43 +#include <midiclientutility.h>
1.44 +#include <mmf/common/mmfcontrollerframework.h>
1.45 +
1.46 +// Uncomment this line for Jet-stream project
1.47 +//#define JETSTREAM_TESTS 1
1.48 +
1.49 +class CTestSuite ;
1.50 +
1.51 +// Flags for test step differentiation
1.52 +enum TTestStepType
1.53 +{
1.54 + ETestValid = 0,
1.55 + ETestNegative,
1.56 + ETestNullMessage,
1.57 + ETestInvalidMessage,
1.58 + ETestInvalidId,
1.59 + ETestInvalidIndex,
1.60 + ETestInvalidChannel,
1.61 + ETestAlreadyLoaded,
1.62 + ETestNotLoaded,
1.63 + ETestNotUnloadable,
1.64 + ETestOutOfRangeHigh,
1.65 + ETestOutOfRangeLow,
1.66 + ETestTimeOutOfRangeHigh,
1.67 + ETestTimeOutOfRangeLow,
1.68 + ETestUnsupported,
1.69 + ETestCorrupt,
1.70 + ETestOverflow,
1.71 + ETestNoPlugin,
1.72 + ETestInvalidState,
1.73 + ETestNoResource,
1.74 + ETestZeroDurationOutOfRange,
1.75 + ETestInvalidChannelOutOfRange,
1.76 + ETestNoteHighOutOfRange,
1.77 + ETestNoteLowOutOfRange,
1.78 + ETestAttackHighOutOfRange,
1.79 + ETestAttackLowOutOfRange,
1.80 + ETestReleaseHighOutOfRange,
1.81 + ETestReleaseLowOutOfRange,
1.82 + ETestNoNoteAvailable,
1.83 + ETestDifferentNoteVelocity,
1.84 + ETestVelocityHighOutOfRange,
1.85 + ETestVelocityLowOutOfRange,
1.86 + ETestBeatsHighOutOfRange,
1.87 + ETestBeatsLowOutOfRange,
1.88 + ETestInvalidTrack,
1.89 + ETestNoResourcePlaying,
1.90 + ETestMicrosecondsHighOutOfRange,
1.91 + ETestMicrosecondsLowOutOfRange,
1.92 + ETestMicrobeatsHighOutOfRange,
1.93 + ETestMicrobeatsLowOutOfRange,
1.94 + ETestMicrosecondsMicrobeatsZero,
1.95 + ETestVolumeHighOutOfRange,
1.96 + ETestVolumeLowOutOfRange,
1.97 + ETestRampDurationHighOutOfRange,
1.98 + ETestRampDurationLowOutOfRange,
1.99 + ETestBalanceHighOutOfRange,
1.100 + ETestBalanceLowOutOfRange,
1.101 + ETestPreferenceConflictsCannotBeResolved,
1.102 + ETestMetaDataIndexInvalid,
1.103 + ETestOutOfRange,
1.104 + ETestNoStandardBanks,
1.105 + ETestNoCustomBanks,
1.106 + ETestCheckInterface
1.107 +};
1.108 +
1.109 +/**
1.110 + * @ MCallbackHandlerObserver, provides an Observer
1.111 + * @ for monitoring callbacks.
1.112 + */
1.113 +class MCallbackHandlerObserver
1.114 + {
1.115 +public:
1.116 + virtual void MchoComplete(TInt aID, TInt aError)=0;
1.117 + };
1.118 +
1.119 +/**
1.120 + *
1.121 + * CActiveListener provides the asynchronous operation
1.122 + * of an active object
1.123 + *
1.124 + * @class CActiveListener
1.125 + *
1.126 + */
1.127 +class CActiveListener : public CActive
1.128 + {
1.129 +public:
1.130 + CActiveListener() : CActive(CActive::EPriorityIdle) { CActiveScheduler::Add(this); }
1.131 + void InitialiseActiveListener() { iStatus = KRequestPending; SetActive(); }
1.132 + // From CActive, From Base Class
1.133 + void RunL() { CActiveScheduler::Stop(); }
1.134 + void DoCancel() {};
1.135 + };
1.136 +
1.137 +/**
1.138 + * Global Data used within tests
1.139 + *
1.140 + */
1.141 +
1.142 +const TInt KTwelfthOfSec = 83333;
1.143 +const TInt KTenthOfSec = 100000 ;
1.144 +const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)
1.145 +const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds)
1.146 +const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds)
1.147 +const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds)
1.148 +const TInt KExpectedDeviation = 1500000; // 1.5 second tolerance for timed tests
1.149 +const TInt KNameBufSize = 25;
1.150 +
1.151 +const TInt KMaxBalance = 100;
1.152 +const TInt KMinBalance = -100;
1.153 +
1.154 +const TInt KMaxVolume = 100;
1.155 +
1.156 +
1.157 +enum TDevMidiByPass
1.158 + {
1.159 + EDevMidiOff = 0,
1.160 + EDevMidiOn = 1
1.161 + };
1.162 +
1.163 +/**
1.164 + * It's a base class for all test steps.
1.165 + *
1.166 + * @class CTestMmfVclntStep
1.167 + * @brief Test class that enables tests.
1.168 + *
1.169 + */
1.170 +class CTestMmfMidiClntStep : public CTestStep, public MMidiClientUtilityObserver
1.171 + {
1.172 +public:
1.173 + CTestMmfMidiClntStep(const TDesC& aTestName, const TTestStepType aTestType);
1.174 + CTestMmfMidiClntStep();
1.175 + ~CTestMmfMidiClntStep();
1.176 + //void Close();
1.177 + static void CleanUp(TAny *aPtr) ;
1.178 + void SetTestSuite(const CTestSuite* aTestSuite ) { iTestSuite = aTestSuite; }
1.179 +
1.180 + // MMidiClientUtilityObserver
1.181 + virtual void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
1.182 + virtual void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
1.183 + virtual void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
1.184 + virtual void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
1.185 + virtual void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
1.186 + virtual void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
1.187 + virtual void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aEntry);
1.188 + virtual void MmcuoPolyphonyChanged(TInt aNewPolyphony);
1.189 + virtual void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
1.190 +
1.191 +protected:
1.192 + void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
1.193 + TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
1.194 + // tests may optionally implement pre- and post-ambles, From Base Class
1.195 + virtual TVerdict DoTestStepPreambleL();
1.196 + virtual TVerdict DoTestStepPostambleL();
1.197 + virtual TVerdict DoTestStepL();
1.198 + virtual TVerdict DoTestL(CMidiClientUtility* aMidi);
1.199 + void InitWservL();
1.200 +
1.201 +protected:
1.202 + const CTestSuite* iTestSuite ;
1.203 + CActiveScheduler* iActiveScheduler;
1.204 + TInt iError;
1.205 +
1.206 + TInt iTestType;
1.207 +
1.208 + CWsScreenDevice* iScreen;
1.209 + RWindow* iWindow;
1.210 + RWsSession iWs;
1.211 + TMidiState iCurrentState;
1.212 + };
1.213 +
1.214 +#endif
1.215 +
1.216 +
1.217 +
1.218 +