sl@0
|
1 |
|
sl@0
|
2 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
// All rights reserved.
|
sl@0
|
4 |
// This component and the accompanying materials are made available
|
sl@0
|
5 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
// which accompanies this distribution, and is available
|
sl@0
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
//
|
sl@0
|
9 |
// Initial Contributors:
|
sl@0
|
10 |
// Nokia Corporation - initial contribution.
|
sl@0
|
11 |
//
|
sl@0
|
12 |
// Contributors:
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// Description:
|
sl@0
|
15 |
// TSI_MMFMIDICLNT.h
|
sl@0
|
16 |
// Header file: Basic tests.
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file TSI_MMFVCLNT.h
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef TSU_MMFMIDICLNT_H__
|
sl@0
|
25 |
#define TSU_MMFMIDICLNT_H__
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <e32base.h>
|
sl@0
|
28 |
#include <badesca.h>
|
sl@0
|
29 |
#include <e32test.h>
|
sl@0
|
30 |
#include <e32keys.h>
|
sl@0
|
31 |
#include <c32comm.h>
|
sl@0
|
32 |
#include <f32file.h>
|
sl@0
|
33 |
#include <etel.h>
|
sl@0
|
34 |
#include <etelmm.h>
|
sl@0
|
35 |
#include <testframework.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
#include <fbs.h>
|
sl@0
|
38 |
#include <w32std.h>
|
sl@0
|
39 |
#include <mmf/common/mmfstandardcustomcommands.h>
|
sl@0
|
40 |
#include <midiclientutility.h>
|
sl@0
|
41 |
#include <mmf/common/mmfcontrollerframework.h>
|
sl@0
|
42 |
|
sl@0
|
43 |
// Uncomment this line for Jet-stream project
|
sl@0
|
44 |
//#define JETSTREAM_TESTS 1
|
sl@0
|
45 |
|
sl@0
|
46 |
class CTestSuite ;
|
sl@0
|
47 |
|
sl@0
|
48 |
// Flags for test step differentiation
|
sl@0
|
49 |
enum TTestStepType
|
sl@0
|
50 |
{
|
sl@0
|
51 |
ETestValid = 0,
|
sl@0
|
52 |
ETestNegative,
|
sl@0
|
53 |
ETestNullMessage,
|
sl@0
|
54 |
ETestInvalidMessage,
|
sl@0
|
55 |
ETestInvalidId,
|
sl@0
|
56 |
ETestInvalidIndex,
|
sl@0
|
57 |
ETestInvalidChannel,
|
sl@0
|
58 |
ETestAlreadyLoaded,
|
sl@0
|
59 |
ETestNotLoaded,
|
sl@0
|
60 |
ETestNotUnloadable,
|
sl@0
|
61 |
ETestOutOfRangeHigh,
|
sl@0
|
62 |
ETestOutOfRangeLow,
|
sl@0
|
63 |
ETestTimeOutOfRangeHigh,
|
sl@0
|
64 |
ETestTimeOutOfRangeLow,
|
sl@0
|
65 |
ETestUnsupported,
|
sl@0
|
66 |
ETestCorrupt,
|
sl@0
|
67 |
ETestOverflow,
|
sl@0
|
68 |
ETestNoPlugin,
|
sl@0
|
69 |
ETestInvalidState,
|
sl@0
|
70 |
ETestNoResource,
|
sl@0
|
71 |
ETestZeroDurationOutOfRange,
|
sl@0
|
72 |
ETestInvalidChannelOutOfRange,
|
sl@0
|
73 |
ETestNoteHighOutOfRange,
|
sl@0
|
74 |
ETestNoteLowOutOfRange,
|
sl@0
|
75 |
ETestAttackHighOutOfRange,
|
sl@0
|
76 |
ETestAttackLowOutOfRange,
|
sl@0
|
77 |
ETestReleaseHighOutOfRange,
|
sl@0
|
78 |
ETestReleaseLowOutOfRange,
|
sl@0
|
79 |
ETestNoNoteAvailable,
|
sl@0
|
80 |
ETestDifferentNoteVelocity,
|
sl@0
|
81 |
ETestVelocityHighOutOfRange,
|
sl@0
|
82 |
ETestVelocityLowOutOfRange,
|
sl@0
|
83 |
ETestBeatsHighOutOfRange,
|
sl@0
|
84 |
ETestBeatsLowOutOfRange,
|
sl@0
|
85 |
ETestInvalidTrack,
|
sl@0
|
86 |
ETestNoResourcePlaying,
|
sl@0
|
87 |
ETestMicrosecondsHighOutOfRange,
|
sl@0
|
88 |
ETestMicrosecondsLowOutOfRange,
|
sl@0
|
89 |
ETestMicrobeatsHighOutOfRange,
|
sl@0
|
90 |
ETestMicrobeatsLowOutOfRange,
|
sl@0
|
91 |
ETestMicrosecondsMicrobeatsZero,
|
sl@0
|
92 |
ETestVolumeHighOutOfRange,
|
sl@0
|
93 |
ETestVolumeLowOutOfRange,
|
sl@0
|
94 |
ETestRampDurationHighOutOfRange,
|
sl@0
|
95 |
ETestRampDurationLowOutOfRange,
|
sl@0
|
96 |
ETestBalanceHighOutOfRange,
|
sl@0
|
97 |
ETestBalanceLowOutOfRange,
|
sl@0
|
98 |
ETestPreferenceConflictsCannotBeResolved,
|
sl@0
|
99 |
ETestMetaDataIndexInvalid,
|
sl@0
|
100 |
ETestOutOfRange,
|
sl@0
|
101 |
ETestNoStandardBanks,
|
sl@0
|
102 |
ETestNoCustomBanks,
|
sl@0
|
103 |
ETestCheckInterface
|
sl@0
|
104 |
};
|
sl@0
|
105 |
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
* @ MCallbackHandlerObserver, provides an Observer
|
sl@0
|
108 |
* @ for monitoring callbacks.
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
class MCallbackHandlerObserver
|
sl@0
|
111 |
{
|
sl@0
|
112 |
public:
|
sl@0
|
113 |
virtual void MchoComplete(TInt aID, TInt aError)=0;
|
sl@0
|
114 |
};
|
sl@0
|
115 |
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
*
|
sl@0
|
118 |
* CActiveListener provides the asynchronous operation
|
sl@0
|
119 |
* of an active object
|
sl@0
|
120 |
*
|
sl@0
|
121 |
* @class CActiveListener
|
sl@0
|
122 |
*
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
class CActiveListener : public CActive
|
sl@0
|
125 |
{
|
sl@0
|
126 |
public:
|
sl@0
|
127 |
CActiveListener() : CActive(CActive::EPriorityIdle) { CActiveScheduler::Add(this); }
|
sl@0
|
128 |
void InitialiseActiveListener() { iStatus = KRequestPending; SetActive(); }
|
sl@0
|
129 |
// From CActive, From Base Class
|
sl@0
|
130 |
void RunL() { CActiveScheduler::Stop(); }
|
sl@0
|
131 |
void DoCancel() {};
|
sl@0
|
132 |
};
|
sl@0
|
133 |
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
* Global Data used within tests
|
sl@0
|
136 |
*
|
sl@0
|
137 |
*/
|
sl@0
|
138 |
|
sl@0
|
139 |
const TInt KTwelfthOfSec = 83333;
|
sl@0
|
140 |
const TInt KTenthOfSec = 100000 ;
|
sl@0
|
141 |
const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)
|
sl@0
|
142 |
const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds)
|
sl@0
|
143 |
const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds)
|
sl@0
|
144 |
const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds)
|
sl@0
|
145 |
const TInt KExpectedDeviation = 1500000; // 1.5 second tolerance for timed tests
|
sl@0
|
146 |
const TInt KNameBufSize = 25;
|
sl@0
|
147 |
|
sl@0
|
148 |
const TInt KMaxBalance = 100;
|
sl@0
|
149 |
const TInt KMinBalance = -100;
|
sl@0
|
150 |
|
sl@0
|
151 |
const TInt KMaxVolume = 100;
|
sl@0
|
152 |
|
sl@0
|
153 |
|
sl@0
|
154 |
enum TDevMidiByPass
|
sl@0
|
155 |
{
|
sl@0
|
156 |
EDevMidiOff = 0,
|
sl@0
|
157 |
EDevMidiOn = 1
|
sl@0
|
158 |
};
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
* It's a base class for all test steps.
|
sl@0
|
162 |
*
|
sl@0
|
163 |
* @class CTestMmfVclntStep
|
sl@0
|
164 |
* @brief Test class that enables tests.
|
sl@0
|
165 |
*
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
class CTestMmfMidiClntStep : public CTestStep, public MMidiClientUtilityObserver
|
sl@0
|
168 |
{
|
sl@0
|
169 |
public:
|
sl@0
|
170 |
CTestMmfMidiClntStep(const TDesC& aTestName, const TTestStepType aTestType);
|
sl@0
|
171 |
CTestMmfMidiClntStep();
|
sl@0
|
172 |
~CTestMmfMidiClntStep();
|
sl@0
|
173 |
//void Close();
|
sl@0
|
174 |
static void CleanUp(TAny *aPtr) ;
|
sl@0
|
175 |
void SetTestSuite(const CTestSuite* aTestSuite ) { iTestSuite = aTestSuite; }
|
sl@0
|
176 |
|
sl@0
|
177 |
// MMidiClientUtilityObserver
|
sl@0
|
178 |
virtual void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
|
sl@0
|
179 |
virtual void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
|
sl@0
|
180 |
virtual void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
|
sl@0
|
181 |
virtual void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
|
sl@0
|
182 |
virtual void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
|
sl@0
|
183 |
virtual void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
|
sl@0
|
184 |
virtual void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aEntry);
|
sl@0
|
185 |
virtual void MmcuoPolyphonyChanged(TInt aNewPolyphony);
|
sl@0
|
186 |
virtual void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
|
sl@0
|
187 |
|
sl@0
|
188 |
protected:
|
sl@0
|
189 |
void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
|
sl@0
|
190 |
TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
|
sl@0
|
191 |
// tests may optionally implement pre- and post-ambles, From Base Class
|
sl@0
|
192 |
virtual TVerdict DoTestStepPreambleL();
|
sl@0
|
193 |
virtual TVerdict DoTestStepPostambleL();
|
sl@0
|
194 |
virtual TVerdict DoTestStepL();
|
sl@0
|
195 |
virtual TVerdict DoTestL(CMidiClientUtility* aMidi);
|
sl@0
|
196 |
void InitWservL();
|
sl@0
|
197 |
|
sl@0
|
198 |
protected:
|
sl@0
|
199 |
const CTestSuite* iTestSuite ;
|
sl@0
|
200 |
CActiveScheduler* iActiveScheduler;
|
sl@0
|
201 |
TInt iError;
|
sl@0
|
202 |
|
sl@0
|
203 |
TInt iTestType;
|
sl@0
|
204 |
|
sl@0
|
205 |
CWsScreenDevice* iScreen;
|
sl@0
|
206 |
RWindow* iWindow;
|
sl@0
|
207 |
RWsSession iWs;
|
sl@0
|
208 |
TMidiState iCurrentState;
|
sl@0
|
209 |
};
|
sl@0
|
210 |
|
sl@0
|
211 |
#endif
|
sl@0
|
212 |
|
sl@0
|
213 |
|
sl@0
|
214 |
|
sl@0
|
215 |
|