Update contrib.
2 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
3 // All rights reserved.
4 // This component and the accompanying materials are made available
5 // under the terms of "Eclipse Public License v1.0"
6 // which accompanies this distribution, and is available
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
16 // Header file: Basic tests.
24 #ifndef TSU_MMFMIDICLNT_H__
25 #define TSU_MMFMIDICLNT_H__
35 #include <testframework.h>
39 #include <mmf/common/mmfstandardcustomcommands.h>
40 #include <midiclientutility.h>
41 #include <mmf/common/mmfcontrollerframework.h>
43 // Uncomment this line for Jet-stream project
44 //#define JETSTREAM_TESTS 1
48 // Flags for test step differentiation
63 ETestTimeOutOfRangeHigh,
64 ETestTimeOutOfRangeLow,
71 ETestZeroDurationOutOfRange,
72 ETestInvalidChannelOutOfRange,
73 ETestNoteHighOutOfRange,
74 ETestNoteLowOutOfRange,
75 ETestAttackHighOutOfRange,
76 ETestAttackLowOutOfRange,
77 ETestReleaseHighOutOfRange,
78 ETestReleaseLowOutOfRange,
80 ETestDifferentNoteVelocity,
81 ETestVelocityHighOutOfRange,
82 ETestVelocityLowOutOfRange,
83 ETestBeatsHighOutOfRange,
84 ETestBeatsLowOutOfRange,
86 ETestNoResourcePlaying,
87 ETestMicrosecondsHighOutOfRange,
88 ETestMicrosecondsLowOutOfRange,
89 ETestMicrobeatsHighOutOfRange,
90 ETestMicrobeatsLowOutOfRange,
91 ETestMicrosecondsMicrobeatsZero,
92 ETestVolumeHighOutOfRange,
93 ETestVolumeLowOutOfRange,
94 ETestRampDurationHighOutOfRange,
95 ETestRampDurationLowOutOfRange,
96 ETestBalanceHighOutOfRange,
97 ETestBalanceLowOutOfRange,
98 ETestPreferenceConflictsCannotBeResolved,
99 ETestMetaDataIndexInvalid,
101 ETestNoStandardBanks,
107 * @ MCallbackHandlerObserver, provides an Observer
108 * @ for monitoring callbacks.
110 class MCallbackHandlerObserver
113 virtual void MchoComplete(TInt aID, TInt aError)=0;
118 * CActiveListener provides the asynchronous operation
119 * of an active object
121 * @class CActiveListener
124 class CActiveListener : public CActive
127 CActiveListener() : CActive(CActive::EPriorityIdle) { CActiveScheduler::Add(this); }
128 void InitialiseActiveListener() { iStatus = KRequestPending; SetActive(); }
129 // From CActive, From Base Class
130 void RunL() { CActiveScheduler::Stop(); }
135 * Global Data used within tests
139 const TInt KTwelfthOfSec = 83333;
140 const TInt KTenthOfSec = 100000 ;
141 const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)
142 const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds)
143 const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds)
144 const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds)
145 const TInt KExpectedDeviation = 1500000; // 1.5 second tolerance for timed tests
146 const TInt KNameBufSize = 25;
148 const TInt KMaxBalance = 100;
149 const TInt KMinBalance = -100;
151 const TInt KMaxVolume = 100;
161 * It's a base class for all test steps.
163 * @class CTestMmfVclntStep
164 * @brief Test class that enables tests.
167 class CTestMmfMidiClntStep : public CTestStep, public MMidiClientUtilityObserver
170 CTestMmfMidiClntStep(const TDesC& aTestName, const TTestStepType aTestType);
171 CTestMmfMidiClntStep();
172 ~CTestMmfMidiClntStep();
174 static void CleanUp(TAny *aPtr) ;
175 void SetTestSuite(const CTestSuite* aTestSuite ) { iTestSuite = aTestSuite; }
177 // MMidiClientUtilityObserver
178 virtual void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
179 virtual void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
180 virtual void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
181 virtual void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
182 virtual void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
183 virtual void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
184 virtual void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aEntry);
185 virtual void MmcuoPolyphonyChanged(TInt aNewPolyphony);
186 virtual void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
189 void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
190 TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
191 // tests may optionally implement pre- and post-ambles, From Base Class
192 virtual TVerdict DoTestStepPreambleL();
193 virtual TVerdict DoTestStepPostambleL();
194 virtual TVerdict DoTestStepL();
195 virtual TVerdict DoTestL(CMidiClientUtility* aMidi);
199 const CTestSuite* iTestSuite ;
200 CActiveScheduler* iActiveScheduler;
205 CWsScreenDevice* iScreen;
208 TMidiState iCurrentState;