|
1 |
|
2 // Copyright (c) 2004-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". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // |
|
16 |
|
17 #include "TestMidiClientUtility.h" |
|
18 #include <e32math.h> |
|
19 |
|
20 |
|
21 CTestMidiClntOpenFile::CTestMidiClntOpenFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
22 :CTestMmfMidiClntStep(aTestName, ETestValid), |
|
23 iPlay(aPlay) |
|
24 { |
|
25 iSectName = aSectName; |
|
26 iKeyName = aKeyName; |
|
27 } |
|
28 |
|
29 CTestMidiClntOpenFile* CTestMidiClntOpenFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
30 { |
|
31 CTestMidiClntOpenFile* self = new(ELeave) CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay); |
|
32 return self; |
|
33 } |
|
34 |
|
35 TVerdict CTestMidiClntOpenFile::DoTestStepL() |
|
36 { |
|
37 TPtrC filename; |
|
38 if(!GetStringFromConfig(iSectName,iKeyName,filename)) |
|
39 return EInconclusive; |
|
40 |
|
41 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
|
42 if (!player) |
|
43 { |
|
44 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
45 return EInconclusive; |
|
46 } |
|
47 CleanupStack::PushL(player); |
|
48 |
|
49 TMMFMessageDestinationPckg dummyPckg; |
|
50 TInt dummyFunc = 0; //EDevMidiOff; |
|
51 TBuf8<8> dummyBuff; |
|
52 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); |
|
53 |
|
54 player->OpenFile(filename); |
|
55 |
|
56 // Wait for initialisation callback |
|
57 INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); |
|
58 CActiveScheduler::Start(); |
|
59 |
|
60 TVerdict ret = EFail; |
|
61 |
|
62 // Check for errors. |
|
63 if (iError == KErrNone) |
|
64 ret = DoTestL(player); |
|
65 |
|
66 INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); |
|
67 CleanupStack::PopAndDestroy(player); |
|
68 |
|
69 if(iError != KErrNone) |
|
70 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); |
|
71 |
|
72 return ret; |
|
73 } |
|
74 |
|
75 TVerdict CTestMidiClntOpenFile::DoTestL(CMidiClientUtility* /*aMidi*/) |
|
76 { |
|
77 return EPass; |
|
78 } |
|
79 |
|
80 //------------------------------------------------------------------ |
|
81 |
|
82 CTestMidiClntOpenDes::CTestMidiClntOpenDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
83 :CTestMmfMidiClntStep(aTestName, ETestValid), |
|
84 iPlay(aPlay) |
|
85 { |
|
86 iSectName = aSectName; |
|
87 iKeyName = aKeyName; |
|
88 } |
|
89 |
|
90 CTestMidiClntOpenDes* CTestMidiClntOpenDes::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
91 { |
|
92 CTestMidiClntOpenDes* self = new(ELeave) CTestMidiClntOpenDes(aTestName, aSectName, aKeyName, aPlay); |
|
93 return self; |
|
94 } |
|
95 |
|
96 TVerdict CTestMidiClntOpenDes::DoTestStepPreambleL() |
|
97 { |
|
98 TPtrC filename; |
|
99 if(!GetStringFromConfig(iSectName, iKeyName, filename)) |
|
100 return EInconclusive; |
|
101 |
|
102 RFs fs; |
|
103 RFile file; |
|
104 TInt size = 0; |
|
105 |
|
106 // connect to file system and open file |
|
107 User::LeaveIfError(fs.Connect()); |
|
108 User::LeaveIfError(file.Open(fs,filename,EFileRead)); |
|
109 CleanupClosePushL(file); |
|
110 |
|
111 // Set HBuf size |
|
112 User::LeaveIfError(file.Size(size)); |
|
113 INFO_PRINTF2(_L("size of file = %d\n"),size); |
|
114 |
|
115 iAudio = HBufC8::NewMaxL(size); |
|
116 |
|
117 // read data into Hbuf |
|
118 TPtr8 bufferDes(iAudio->Des()); |
|
119 User::LeaveIfError(file.Read(bufferDes)); |
|
120 |
|
121 CleanupStack::PopAndDestroy(); //file |
|
122 return CTestMmfMidiClntStep::DoTestStepPreambleL(); |
|
123 } |
|
124 |
|
125 TVerdict CTestMidiClntOpenDes::DoTestStepPostambleL() |
|
126 { |
|
127 delete iAudio; |
|
128 iAudio = NULL; |
|
129 return CTestMmfMidiClntStep::DoTestStepPostambleL(); |
|
130 } |
|
131 |
|
132 TVerdict CTestMidiClntOpenDes::DoTestStepL() |
|
133 { |
|
134 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
|
135 if (!player) |
|
136 { |
|
137 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
138 return EInconclusive; |
|
139 } |
|
140 |
|
141 CleanupStack::PushL(player); |
|
142 |
|
143 TMMFMessageDestinationPckg dummyPckg; |
|
144 TInt dummyFunc = EDevMidiOff; |
|
145 TBuf8<8> dummyBuff; |
|
146 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); |
|
147 |
|
148 player->OpenDes(iAudio->Des()); |
|
149 |
|
150 // Wait for initialisation callback |
|
151 INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); |
|
152 CActiveScheduler::Start(); |
|
153 |
|
154 TVerdict ret = EFail; |
|
155 |
|
156 // Check for errors. |
|
157 if (iError == KErrNone) |
|
158 ret = DoTestL(player); |
|
159 |
|
160 INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); |
|
161 CleanupStack::PopAndDestroy(player); |
|
162 |
|
163 if(iError != KErrNone) |
|
164 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); |
|
165 |
|
166 return ret; |
|
167 } |
|
168 |
|
169 TVerdict CTestMidiClntOpenDes::DoTestL(CMidiClientUtility* /*aMidi*/) |
|
170 { |
|
171 return EPass; |
|
172 } |
|
173 |
|
174 //------------------------------------------------------------------ |
|
175 |
|
176 CTestMidiClntOpenUrl::CTestMidiClntOpenUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
177 :CTestMmfMidiClntStep(aTestName, ETestValid), |
|
178 iPlay(aPlay) |
|
179 { |
|
180 iSectName = aSectName; |
|
181 iKeyName = aKeyName; |
|
182 } |
|
183 |
|
184 CTestMidiClntOpenUrl* CTestMidiClntOpenUrl::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
185 { |
|
186 CTestMidiClntOpenUrl* self = new(ELeave) CTestMidiClntOpenUrl(aTestName, aSectName, aKeyName, aPlay); |
|
187 return self; |
|
188 } |
|
189 |
|
190 TVerdict CTestMidiClntOpenUrl::DoTestStepL() |
|
191 { |
|
192 TPtrC urlname; |
|
193 if(!GetStringFromConfig(iSectName,iKeyName,urlname)) |
|
194 return EInconclusive; |
|
195 |
|
196 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
|
197 if (!player) |
|
198 { |
|
199 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
200 return EInconclusive; |
|
201 } |
|
202 |
|
203 CleanupStack::PushL(player); |
|
204 |
|
205 TMMFMessageDestinationPckg dummyPckg; |
|
206 TInt dummyFunc = EDevMidiOff; |
|
207 TBuf8<8> dummyBuff; |
|
208 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); |
|
209 |
|
210 player->OpenUrl(urlname); |
|
211 |
|
212 // Wait for initialisation callback |
|
213 INFO_PRINTF1(_L("CMidiClientUtility: Opening url")); |
|
214 CActiveScheduler::Start(); |
|
215 |
|
216 TVerdict ret = EFail; |
|
217 |
|
218 // Check for errors. |
|
219 if (iError == KErrNone) |
|
220 ret = DoTestL(player); |
|
221 |
|
222 INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); |
|
223 CleanupStack::PopAndDestroy(player); |
|
224 |
|
225 if(iError != KErrNone) |
|
226 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); |
|
227 |
|
228 return ret; |
|
229 } |
|
230 |
|
231 TVerdict CTestMidiClntOpenUrl::DoTestL(CMidiClientUtility* /*aMidi*/) |
|
232 { |
|
233 return EPass; |
|
234 } |
|
235 |
|
236 //------------------------------------------------------------------ |
|
237 |
|
238 CTestMidiClntClose::CTestMidiClntClose(const TDesC& aTestName) |
|
239 :CTestMmfMidiClntStep(aTestName, ETestValid) |
|
240 { |
|
241 } |
|
242 |
|
243 CTestMidiClntClose* CTestMidiClntClose::NewL(const TDesC& aTestName) |
|
244 { |
|
245 CTestMidiClntClose* self = new(ELeave) CTestMidiClntClose(aTestName); |
|
246 return self; |
|
247 } |
|
248 |
|
249 TVerdict CTestMidiClntClose::DoTestL(CMidiClientUtility* aMidi) |
|
250 { |
|
251 INFO_PRINTF1(_L("CMidiClientUtility: Closing file")); |
|
252 aMidi->Close(); |
|
253 return EPass; |
|
254 } |
|
255 |
|
256 //------------------------------------------------------------------ |
|
257 |
|
258 CTestMidiClntPlay::CTestMidiClntPlay(const TDesC& aTestName, const TTestStepType aTestType) |
|
259 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
260 { |
|
261 } |
|
262 |
|
263 CTestMidiClntPlay* CTestMidiClntPlay::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
264 { |
|
265 CTestMidiClntPlay* self = new(ELeave) CTestMidiClntPlay(aTestName, aTestType); |
|
266 return self; |
|
267 } |
|
268 |
|
269 TVerdict CTestMidiClntPlay::DoTestL(CMidiClientUtility* aMidi) |
|
270 { |
|
271 TInt expErr = KErrNone; |
|
272 //TTimeIntervalMicroSeconds fadeOutDuration(0); |
|
273 |
|
274 INFO_PRINTF1(_L("CMidiClientUtility: Play midi file")); |
|
275 // expected results |
|
276 switch(iTestType) |
|
277 { |
|
278 case ETestValid: |
|
279 expErr = KErrNone; |
|
280 break; |
|
281 case ETestNoPlugin: |
|
282 expErr = KErrNotSupported; |
|
283 break; |
|
284 case ETestInvalidState: |
|
285 expErr = KErrUnknown; |
|
286 break; |
|
287 default: |
|
288 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
289 return EInconclusive; |
|
290 } |
|
291 |
|
292 iCurrentState = EMidiStateClosedDisengaged; |
|
293 aMidi->OpenFile(_L("c:\\DoesntExist.mid")); |
|
294 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
295 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged |
|
296 if (iCurrentState != EMidiStateOpenDisengaged) |
|
297 { |
|
298 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
299 return EFail; |
|
300 } |
|
301 |
|
302 aMidi->Play(); |
|
303 if (expErr != iError) |
|
304 { |
|
305 ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr); |
|
306 return EFail; |
|
307 } |
|
308 else |
|
309 INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr); |
|
310 |
|
311 return EPass; |
|
312 } |
|
313 |
|
314 //------------------------------------------------------------------ |
|
315 |
|
316 |
|
317 CTestMidiClntStop::CTestMidiClntStop(const TDesC& aTestName, const TTestStepType aTestType) |
|
318 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
319 { |
|
320 } |
|
321 |
|
322 CTestMidiClntStop* CTestMidiClntStop::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
323 { |
|
324 CTestMidiClntStop* self = new(ELeave) CTestMidiClntStop(aTestName, aTestType); |
|
325 return self; |
|
326 } |
|
327 |
|
328 TVerdict CTestMidiClntStop::DoTestL(CMidiClientUtility* aMidi) |
|
329 { |
|
330 TVerdict ret = EPass; |
|
331 TInt expErr = KErrNone; |
|
332 TTimeIntervalMicroSeconds fadeOutDuration(0); |
|
333 |
|
334 INFO_PRINTF1(_L("CMidiClientUtility: Stop midi file")); |
|
335 // expected results |
|
336 switch(iTestType) |
|
337 { |
|
338 case ETestValid: |
|
339 expErr = KErrNone; |
|
340 fadeOutDuration = 20; |
|
341 break; |
|
342 case ETestNoPlugin: |
|
343 expErr = KErrNotSupported; |
|
344 break; |
|
345 case ETestNoResource: |
|
346 expErr = KErrNotReady; |
|
347 break; |
|
348 default: |
|
349 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
350 return EInconclusive; |
|
351 } |
|
352 |
|
353 aMidi->Stop(fadeOutDuration); |
|
354 if (expErr != KErrNone) |
|
355 INFO_PRINTF2(_L("Stop gave error %d"),expErr); |
|
356 else |
|
357 INFO_PRINTF1(_L("Stopping midi file")); |
|
358 |
|
359 return ret; |
|
360 } |
|
361 |
|
362 //------------------------------------------------------------------ |
|
363 |
|
364 |
|
365 CTestMidiClntGetState::CTestMidiClntGetState(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay) |
|
366 :CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay) |
|
367 { |
|
368 // NB this inherits from CTestMidiClntOpenFile, NOT from CTestMmfMidiClntStep |
|
369 // so we have to set this manually. |
|
370 iTestType = aTestType; |
|
371 } |
|
372 |
|
373 CTestMidiClntGetState* CTestMidiClntGetState::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay) |
|
374 { |
|
375 CTestMidiClntGetState* self = new(ELeave) CTestMidiClntGetState(aTestName, aSectName, aKeyName, aTestType, aPlay); |
|
376 return self; |
|
377 } |
|
378 |
|
379 TVerdict CTestMidiClntGetState::DoTestL(CMidiClientUtility* aMidi) |
|
380 { |
|
381 TVerdict ret = EPass; |
|
382 TMidiState expErr; |
|
383 //TTimeIntervalMicroSeconds fadeOutDuration(10); |
|
384 |
|
385 INFO_PRINTF1(_L("CMidiClientUtility: Get current state of midi file")); |
|
386 // expected results |
|
387 switch(iTestType) |
|
388 { |
|
389 case ETestValid: |
|
390 expErr = EMidiStateOpenDisengaged; |
|
391 break; |
|
392 case ETestNegative: |
|
393 expErr = EMidiStateClosedDisengaged; |
|
394 // Close player so we can perform negative test, get state before any initialisation has been done |
|
395 aMidi->Close(); |
|
396 break; |
|
397 default: |
|
398 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
399 return EInconclusive; |
|
400 } |
|
401 |
|
402 TMidiState state = aMidi->State(); |
|
403 if (expErr != state) |
|
404 { |
|
405 ERR_PRINTF3(_L("State gave error %d (expected %d)"),state, expErr); |
|
406 ret = EFail; |
|
407 } |
|
408 else |
|
409 INFO_PRINTF3(_L("State %d = %d"),state, expErr); |
|
410 |
|
411 return ret; |
|
412 } |
|
413 |
|
414 //------------------------------------------------------------------ |
|
415 |
|
416 CTestMidiClntPlayNote::CTestMidiClntPlayNote(const TDesC& aTestName, const TTestStepType aTestType) |
|
417 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
418 { |
|
419 } |
|
420 |
|
421 CTestMidiClntPlayNote* CTestMidiClntPlayNote::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
422 { |
|
423 CTestMidiClntPlayNote* self = new(ELeave) CTestMidiClntPlayNote(aTestName, aTestType); |
|
424 return self; |
|
425 } |
|
426 |
|
427 TVerdict CTestMidiClntPlayNote::DoTestL(CMidiClientUtility* aMidi) |
|
428 { |
|
429 TVerdict ret = EPass; |
|
430 TInt expErr = KErrNone; |
|
431 TInt channel = 0; |
|
432 TInt note = 0; |
|
433 TTimeIntervalMicroSeconds duration(10); |
|
434 TInt noteOnVelocity = 0; |
|
435 TInt noteOffVelocity = 0; |
|
436 |
|
437 INFO_PRINTF1(_L("CMidiClientUtility: Play midi note")); |
|
438 // expected results |
|
439 switch(iTestType) |
|
440 { |
|
441 case ETestValid: |
|
442 expErr = KErrNone; |
|
443 break; |
|
444 case ETestZeroDurationOutOfRange: |
|
445 expErr = KErrNotSupported; |
|
446 duration = 0; |
|
447 break; |
|
448 case ETestInvalidChannelOutOfRange: |
|
449 expErr = KErrArgument; |
|
450 channel = 16; |
|
451 break; |
|
452 case ETestNoteHighOutOfRange: |
|
453 expErr = KErrArgument; |
|
454 note = 128; |
|
455 break; |
|
456 case ETestNoteLowOutOfRange: |
|
457 expErr = KErrArgument; |
|
458 note = -1; |
|
459 break; |
|
460 case ETestAttackHighOutOfRange: |
|
461 expErr = KErrArgument; |
|
462 noteOnVelocity = 128; |
|
463 break; |
|
464 case ETestAttackLowOutOfRange: |
|
465 expErr = KErrArgument; |
|
466 noteOnVelocity = -1; |
|
467 break; |
|
468 case ETestReleaseHighOutOfRange: |
|
469 expErr = KErrArgument; |
|
470 noteOffVelocity = 128; |
|
471 break; |
|
472 case ETestReleaseLowOutOfRange: |
|
473 expErr = KErrArgument; |
|
474 noteOffVelocity = -1; |
|
475 break; |
|
476 default: |
|
477 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
478 return EInconclusive; |
|
479 } |
|
480 TRAPD(err, aMidi->PlayNoteL(channel, note, duration, noteOnVelocity, noteOffVelocity)); |
|
481 |
|
482 if (expErr != err) |
|
483 { |
|
484 ERR_PRINTF3(_L("State gave error %d (expected %d)"),err, expErr); |
|
485 ret = EFail; |
|
486 } |
|
487 else |
|
488 INFO_PRINTF3(_L("PlayNoteL %d = %d"),err ,expErr); |
|
489 |
|
490 return ret; |
|
491 } |
|
492 |
|
493 //------------------------------------------------------------------ |
|
494 |
|
495 CTestMidiClntStopNotes::CTestMidiClntStopNotes(const TDesC& aTestName, const TTestStepType aTestType) |
|
496 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
497 { |
|
498 } |
|
499 |
|
500 CTestMidiClntStopNotes* CTestMidiClntStopNotes::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
501 { |
|
502 CTestMidiClntStopNotes* self = new(ELeave) CTestMidiClntStopNotes(aTestName, aTestType); |
|
503 return self; |
|
504 } |
|
505 |
|
506 TVerdict CTestMidiClntStopNotes::DoTestL(CMidiClientUtility* aMidi) |
|
507 { |
|
508 // The framework will catch the invalid channel and no note available |
|
509 TVerdict ret = EPass; |
|
510 TInt channel = 0; |
|
511 //TInt expErr = KErrNone; |
|
512 |
|
513 switch(iTestType) |
|
514 { |
|
515 case ETestValid: |
|
516 break; |
|
517 case ETestInvalidChannelOutOfRange: |
|
518 channel = 16; |
|
519 break; |
|
520 case ETestNoNoteAvailable: |
|
521 break; |
|
522 default: |
|
523 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
524 return EInconclusive; |
|
525 } |
|
526 |
|
527 INFO_PRINTF1(_L("CMidiClientUtility: Stop midi note")); |
|
528 aMidi->StopNotes(channel); |
|
529 return ret; |
|
530 } |
|
531 |
|
532 //------------------------------------------------------------------ |
|
533 |
|
534 |
|
535 CTestMidiClntNoteOn::CTestMidiClntNoteOn(const TDesC& aTestName, const TTestStepType aTestType) |
|
536 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
537 { |
|
538 } |
|
539 |
|
540 CTestMidiClntNoteOn* CTestMidiClntNoteOn::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
541 { |
|
542 CTestMidiClntNoteOn* self = new(ELeave) CTestMidiClntNoteOn(aTestName, aTestType); |
|
543 return self; |
|
544 } |
|
545 |
|
546 TVerdict CTestMidiClntNoteOn::DoTestL(CMidiClientUtility* aMidi) |
|
547 { |
|
548 TVerdict ret = EPass; |
|
549 TInt expErr = KErrNone; |
|
550 TInt channel = 0; |
|
551 TInt note = 0; |
|
552 TInt velocity = 0; |
|
553 |
|
554 INFO_PRINTF1(_L("CMidiClientUtility: Midi note on")); |
|
555 // expected results |
|
556 switch(iTestType) |
|
557 { |
|
558 case ETestValid: |
|
559 expErr = KErrNone; |
|
560 channel = 1; |
|
561 note = 2; |
|
562 velocity = 10; |
|
563 break; |
|
564 case ETestNoNoteAvailable: |
|
565 expErr = KErrArgument; |
|
566 break; |
|
567 case ETestInvalidChannelOutOfRange: |
|
568 expErr = KErrArgument; |
|
569 channel = 16; |
|
570 break; |
|
571 case ETestNoteHighOutOfRange: |
|
572 expErr = KErrArgument; |
|
573 note = 128; |
|
574 break; |
|
575 case ETestNoteLowOutOfRange: |
|
576 expErr = KErrArgument; |
|
577 note = -1; |
|
578 break; |
|
579 case ETestVelocityHighOutOfRange: |
|
580 expErr = KErrArgument; |
|
581 velocity = 128; |
|
582 break; |
|
583 case ETestVelocityLowOutOfRange: |
|
584 expErr = KErrArgument; |
|
585 velocity = -1; |
|
586 break; |
|
587 default: |
|
588 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
589 return EInconclusive; |
|
590 } |
|
591 |
|
592 TRAPD(err, aMidi->NoteOnL(channel,note,velocity)); |
|
593 if (expErr != err) |
|
594 { |
|
595 ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr); |
|
596 ret = EFail; |
|
597 } |
|
598 else |
|
599 INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr); |
|
600 |
|
601 return ret; |
|
602 } |
|
603 |
|
604 //------------------------------------------------------------------ |
|
605 |
|
606 |
|
607 CTestMidiClntNoteOff::CTestMidiClntNoteOff(const TDesC& aTestName, const TTestStepType aTestType) |
|
608 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
609 { |
|
610 } |
|
611 |
|
612 CTestMidiClntNoteOff* CTestMidiClntNoteOff::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
613 { |
|
614 CTestMidiClntNoteOff* self = new(ELeave) CTestMidiClntNoteOff(aTestName, aTestType); |
|
615 return self; |
|
616 } |
|
617 |
|
618 TVerdict CTestMidiClntNoteOff::DoTestL(CMidiClientUtility* aMidi) |
|
619 { |
|
620 TVerdict ret = EPass; |
|
621 TInt expErr = KErrNone; |
|
622 TInt channel = 0; |
|
623 TInt note = 0; |
|
624 TInt velocity = 0; |
|
625 |
|
626 // Play Midi Note on channel=0, note=1, velocity=50 |
|
627 TRAPD(err, aMidi->NoteOnL(0,1,50)); |
|
628 if (expErr != err) |
|
629 { |
|
630 ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr); |
|
631 ret = EFail; |
|
632 } |
|
633 else |
|
634 INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr); |
|
635 |
|
636 INFO_PRINTF1(_L("CMidiClientUtility: Midi note off")); |
|
637 // expected results |
|
638 switch(iTestType) |
|
639 { |
|
640 case ETestValid: |
|
641 expErr = KErrNone; |
|
642 channel = 1; |
|
643 note = 2; |
|
644 velocity = 10; |
|
645 break; |
|
646 case ETestNoNoteAvailable: |
|
647 expErr = KErrNone; // No error is raised, as per specification |
|
648 break; |
|
649 case ETestInvalidChannelOutOfRange: |
|
650 expErr = KErrArgument; |
|
651 channel = 16; |
|
652 break; |
|
653 case ETestDifferentNoteVelocity: |
|
654 expErr = KErrArgument; |
|
655 note = 1; |
|
656 velocity = 127; |
|
657 break; |
|
658 default: |
|
659 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
660 return EInconclusive; |
|
661 } |
|
662 |
|
663 TRAPD(err2, aMidi->NoteOffL(channel,note,velocity)); |
|
664 if (expErr != err2) |
|
665 { |
|
666 ERR_PRINTF3(_L("NoteOffL gave error %d (expected %d)"),err2, expErr); |
|
667 ret = EFail; |
|
668 } |
|
669 else |
|
670 INFO_PRINTF3(_L("NoteOffL %d = %d"),err2 ,expErr); |
|
671 |
|
672 return ret; |
|
673 } |
|
674 |
|
675 //------------------------------------------------------------------ |
|
676 |
|
677 |
|
678 CTestMidiClntReturnPlaybackRate::CTestMidiClntReturnPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType) |
|
679 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
680 { |
|
681 } |
|
682 |
|
683 CTestMidiClntReturnPlaybackRate* CTestMidiClntReturnPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
684 { |
|
685 CTestMidiClntReturnPlaybackRate* self = new(ELeave) CTestMidiClntReturnPlaybackRate(aTestName, aTestType); |
|
686 return self; |
|
687 } |
|
688 |
|
689 TVerdict CTestMidiClntReturnPlaybackRate::DoTestL(CMidiClientUtility* aMidi) |
|
690 { |
|
691 TVerdict ret = EPass; |
|
692 TInt expErr = KErrNone; |
|
693 |
|
694 INFO_PRINTF1(_L("CMidiClientUtility: Check playback rate")); |
|
695 |
|
696 // expected results |
|
697 switch (iTestType) |
|
698 { |
|
699 case ETestValid: |
|
700 expErr = KErrNone; |
|
701 break; |
|
702 case ETestNoResource: |
|
703 expErr = KErrNotReady; |
|
704 break; |
|
705 default: |
|
706 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
707 return EInconclusive; |
|
708 } |
|
709 // TInt rate = 0; // fixes warning |
|
710 |
|
711 // TRAPD(err, rate = aMidi->PlaybackRateL()); |
|
712 TRAPD(err, aMidi->PlaybackRateL()); // EABI warning removal |
|
713 if(expErr != err) |
|
714 { |
|
715 ERR_PRINTF3( _L("PlaybackRateL gave error %d (expected %d)"),err, expErr); |
|
716 ret = EFail; |
|
717 } |
|
718 else |
|
719 INFO_PRINTF3(_L("PlaybackRateL %d = %d"), err, expErr); |
|
720 |
|
721 return ret; |
|
722 } |
|
723 |
|
724 //------------------------------------------------------------------ |
|
725 |
|
726 |
|
727 CTestMidiClntSetPlaybackRate::CTestMidiClntSetPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType) |
|
728 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
729 { |
|
730 } |
|
731 |
|
732 CTestMidiClntSetPlaybackRate* CTestMidiClntSetPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
733 { |
|
734 CTestMidiClntSetPlaybackRate* self = new(ELeave) CTestMidiClntSetPlaybackRate(aTestName, aTestType); |
|
735 return self; |
|
736 } |
|
737 |
|
738 TVerdict CTestMidiClntSetPlaybackRate::DoTestL(CMidiClientUtility* aMidi) |
|
739 { |
|
740 TVerdict ret = EPass; |
|
741 TInt expErr = KErrNone; |
|
742 TInt playbackRate = 0; |
|
743 |
|
744 INFO_PRINTF1(_L("CMidiClientUtility: Set playback rate")); |
|
745 |
|
746 switch (iTestType) |
|
747 { |
|
748 case ETestValid: |
|
749 expErr = KErrNone; |
|
750 break; |
|
751 case ETestNoResource: |
|
752 expErr = KErrNotReady; |
|
753 break; |
|
754 case ETestOutOfRangeHigh: |
|
755 // high limit on playback rate is dependant on controller |
|
756 // when have a proper controller the value below should be changed |
|
757 // to a value higher than the upper limit |
|
758 playbackRate = -1; |
|
759 expErr = KErrNotSupported; |
|
760 break; |
|
761 case ETestOutOfRangeLow: |
|
762 playbackRate = -1; // negative values not supported |
|
763 expErr = KErrNotSupported; |
|
764 break; |
|
765 default: |
|
766 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
767 return EInconclusive; |
|
768 } |
|
769 |
|
770 TRAPD(err, aMidi->SetPlaybackRateL(playbackRate)); |
|
771 if(expErr != err) |
|
772 { |
|
773 ERR_PRINTF3( _L("SetPlaybackRateL gave error %d (expected %d)"),err, expErr); |
|
774 ret = EFail; |
|
775 } |
|
776 else |
|
777 INFO_PRINTF3(_L("SetPlaybackRateL %d = %d"), err, expErr); |
|
778 |
|
779 return ret; |
|
780 } |
|
781 |
|
782 //------------------------------------------------------------------ |
|
783 |
|
784 |
|
785 CTestMidiClntReturnMaxPlayRate::CTestMidiClntReturnMaxPlayRate(const TDesC& aTestName, const TTestStepType aTestType) |
|
786 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
787 { |
|
788 } |
|
789 |
|
790 CTestMidiClntReturnMaxPlayRate* CTestMidiClntReturnMaxPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
791 { |
|
792 CTestMidiClntReturnMaxPlayRate* self = new(ELeave) CTestMidiClntReturnMaxPlayRate(aTestName, aTestType); |
|
793 return self; |
|
794 } |
|
795 |
|
796 TVerdict CTestMidiClntReturnMaxPlayRate::DoTestL(CMidiClientUtility* aMidi) |
|
797 { |
|
798 TVerdict ret = EPass; |
|
799 TInt expErr = KErrNone; |
|
800 |
|
801 INFO_PRINTF1(_L("CMidiClientUtility: Check the max play rate")); |
|
802 |
|
803 // expected results |
|
804 switch (iTestType) |
|
805 { |
|
806 case ETestValid: |
|
807 expErr = KErrNone; |
|
808 break; |
|
809 case ETestNoResource: |
|
810 expErr = KErrNotReady; |
|
811 break; |
|
812 default: |
|
813 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
814 return EInconclusive; |
|
815 } |
|
816 // TInt rate = 0; // fixes warning |
|
817 // TRAPD(err, rate = aMidi->MaxPlaybackRateL()); |
|
818 TRAPD(err, aMidi->MaxPlaybackRateL()); // EABI warning removal |
|
819 if(expErr != err) |
|
820 { |
|
821 ERR_PRINTF3( _L("MaxPlayRateL gave error %d (expected %d)"),err, expErr); |
|
822 ret = EFail; |
|
823 } |
|
824 else |
|
825 INFO_PRINTF3(_L("MaxPlayRateL %d = %d"), err, expErr); |
|
826 |
|
827 return ret; |
|
828 } |
|
829 |
|
830 //------------------------------------------------------------------ |
|
831 |
|
832 |
|
833 CTestMidiClntReturnMinPlayRate::CTestMidiClntReturnMinPlayRate(const TDesC& aTestName, const TTestStepType aTestType) |
|
834 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
835 { |
|
836 } |
|
837 |
|
838 CTestMidiClntReturnMinPlayRate* CTestMidiClntReturnMinPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
839 { |
|
840 CTestMidiClntReturnMinPlayRate* self = new(ELeave) CTestMidiClntReturnMinPlayRate(aTestName, aTestType); |
|
841 return self; |
|
842 } |
|
843 |
|
844 TVerdict CTestMidiClntReturnMinPlayRate::DoTestL(CMidiClientUtility* aMidi) |
|
845 { |
|
846 TVerdict ret = EPass; |
|
847 TInt expErr = KErrNone; |
|
848 |
|
849 INFO_PRINTF1(_L("CMidiClientUtility: Check the min play rate")); |
|
850 |
|
851 // expected results |
|
852 switch (iTestType) |
|
853 { |
|
854 case ETestValid: |
|
855 expErr = KErrNone; |
|
856 break; |
|
857 case ETestNoResource: |
|
858 expErr = KErrNotReady; |
|
859 break; |
|
860 default: |
|
861 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
862 return EInconclusive; |
|
863 } |
|
864 |
|
865 // TInt rate = 0; // fixes warning |
|
866 // TRAPD(err, rate = aMidi->MinPlaybackRateL()); |
|
867 TRAPD(err, aMidi->MinPlaybackRateL()); // EABI warning removal |
|
868 if(expErr != err) |
|
869 { |
|
870 ERR_PRINTF3( _L("MinPlayRateL gave error %d (expected %d)"),err, expErr); |
|
871 ret = EFail; |
|
872 } |
|
873 else |
|
874 INFO_PRINTF3(_L("MinPlayRateL %d = %d"), err, expErr); |
|
875 |
|
876 return ret; |
|
877 } |
|
878 |
|
879 //------------------------------------------------------------------ |
|
880 |
|
881 |
|
882 CTestMidiClntTempoMicroBeatsPerMinute::CTestMidiClntTempoMicroBeatsPerMinute(const TDesC& aTestName, const TTestStepType aTestType) |
|
883 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
884 { |
|
885 } |
|
886 |
|
887 CTestMidiClntTempoMicroBeatsPerMinute* CTestMidiClntTempoMicroBeatsPerMinute::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
888 { |
|
889 CTestMidiClntTempoMicroBeatsPerMinute* self = new(ELeave) CTestMidiClntTempoMicroBeatsPerMinute(aTestName, aTestType); |
|
890 return self; |
|
891 } |
|
892 |
|
893 TVerdict CTestMidiClntTempoMicroBeatsPerMinute::DoTestL(CMidiClientUtility* aMidi) |
|
894 { |
|
895 TVerdict ret = EPass; |
|
896 TInt expErr = KErrNone; |
|
897 // TInt microBeatsPerMinute = 0; // EABI warning removal |
|
898 |
|
899 INFO_PRINTF1(_L("CMidiClientUtility: Return the tempo micro beats per minute")); |
|
900 // expected results |
|
901 switch(iTestType) |
|
902 { |
|
903 case ETestValid: |
|
904 expErr = KErrNone; |
|
905 break; |
|
906 case ETestNoResource: |
|
907 expErr = KErrNotReady; |
|
908 break; |
|
909 default: |
|
910 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
911 return EInconclusive; |
|
912 } |
|
913 |
|
914 // TRAPD(err, microBeatsPerMinute = aMidi->TempoMicroBeatsPerMinuteL()); |
|
915 TRAPD(err, aMidi->TempoMicroBeatsPerMinuteL()); // EABI warning removal |
|
916 if (expErr != err) |
|
917 { |
|
918 ERR_PRINTF3(_L("TempoMicroBeatsPerMinuteL gave error %d (expected %d)"),err, expErr); |
|
919 ret = EFail; |
|
920 } |
|
921 else |
|
922 INFO_PRINTF3(_L("TempoMicroBeatsPerMinuteL %d = %d"),err ,expErr); |
|
923 |
|
924 return ret; |
|
925 } |
|
926 |
|
927 //------------------------------------------------------------------ |
|
928 |
|
929 |
|
930 CTestMidiClntSetTempo::CTestMidiClntSetTempo(const TDesC& aTestName, const TTestStepType aTestType) |
|
931 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
932 { |
|
933 } |
|
934 |
|
935 CTestMidiClntSetTempo* CTestMidiClntSetTempo::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
936 { |
|
937 CTestMidiClntSetTempo* self = new(ELeave) CTestMidiClntSetTempo(aTestName, aTestType); |
|
938 return self; |
|
939 } |
|
940 |
|
941 TVerdict CTestMidiClntSetTempo::DoTestL(CMidiClientUtility* aMidi) |
|
942 { |
|
943 TVerdict ret = EPass; |
|
944 TInt expErr = KErrNone; |
|
945 TInt microBeatsPerMinute = 0; |
|
946 |
|
947 INFO_PRINTF1(_L("CMidiClientUtility: Set the tempo micro beats per minute")); |
|
948 // expected results |
|
949 switch(iTestType) |
|
950 { |
|
951 case ETestValid: |
|
952 expErr = KErrNone; |
|
953 microBeatsPerMinute = 60*1000000; |
|
954 break; |
|
955 case ETestNoResource: |
|
956 expErr = KErrNotReady; |
|
957 microBeatsPerMinute = 80*1000000; |
|
958 break; |
|
959 case ETestBeatsLowOutOfRange: |
|
960 expErr = KErrArgument; |
|
961 microBeatsPerMinute = -1*1000000; |
|
962 break; |
|
963 case ETestBeatsHighOutOfRange: |
|
964 expErr = KErrArgument; |
|
965 //microBeatsPerMinute = 1000001*1000000; FIXME overflow warning |
|
966 microBeatsPerMinute = 1000001; |
|
967 break; |
|
968 default: |
|
969 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
970 return EInconclusive; |
|
971 } |
|
972 |
|
973 TRAPD(err, aMidi->SetTempoL(microBeatsPerMinute)); |
|
974 if (expErr != err) |
|
975 { |
|
976 ERR_PRINTF3(_L("SetTempoL gave error %d (expected %d)"),err, expErr); |
|
977 ret = EFail; |
|
978 } |
|
979 else |
|
980 INFO_PRINTF3(_L("SetTempoL %d = %d"),err ,expErr); |
|
981 |
|
982 return ret; |
|
983 } |
|
984 |
|
985 //------------------------------------------------------------------ |
|
986 |
|
987 |
|
988 CTestMidiClntGetPitchTranspositionCents::CTestMidiClntGetPitchTranspositionCents(const TDesC& aTestName, const TTestStepType aTestType) |
|
989 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
990 { |
|
991 } |
|
992 |
|
993 CTestMidiClntGetPitchTranspositionCents* CTestMidiClntGetPitchTranspositionCents::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
994 { |
|
995 CTestMidiClntGetPitchTranspositionCents* self = new(ELeave) CTestMidiClntGetPitchTranspositionCents(aTestName, aTestType); |
|
996 return self; |
|
997 } |
|
998 |
|
999 TVerdict CTestMidiClntGetPitchTranspositionCents::DoTestL(CMidiClientUtility* aMidi) |
|
1000 { |
|
1001 TVerdict ret = EPass; |
|
1002 TInt expErr = KErrNone; |
|
1003 |
|
1004 INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition")); |
|
1005 // expected results |
|
1006 |
|
1007 switch (iTestType) |
|
1008 { |
|
1009 case ETestValid: |
|
1010 expErr = KErrNone; |
|
1011 break; |
|
1012 case ETestNoResource: |
|
1013 expErr = KErrNotReady; |
|
1014 break; |
|
1015 default: |
|
1016 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1017 return EInconclusive; |
|
1018 } |
|
1019 |
|
1020 // TInt pitch = 0; // fixes warning |
|
1021 // TRAPD(err, pitch = aMidi->PitchTranspositionCentsL()); |
|
1022 TRAPD(err, aMidi->PitchTranspositionCentsL()); // EABI warning removal - "I see trouble ahead..." |
|
1023 if(expErr != err) |
|
1024 { |
|
1025 ERR_PRINTF3( _L("PitchTranspositionCentsL gave error %d (expected %d)"),err, expErr); |
|
1026 ret = EFail; |
|
1027 } |
|
1028 else |
|
1029 INFO_PRINTF3(_L("PitchTranspositionCentsL %d = %d"), err, expErr); |
|
1030 |
|
1031 return ret; |
|
1032 } |
|
1033 |
|
1034 //------------------------------------------------------------------ |
|
1035 |
|
1036 |
|
1037 CTestMidiClntSetPitchTransposition::CTestMidiClntSetPitchTransposition(const TDesC& aTestName, const TTestStepType aTestType) |
|
1038 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1039 { |
|
1040 } |
|
1041 |
|
1042 CTestMidiClntSetPitchTransposition* CTestMidiClntSetPitchTransposition::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1043 { |
|
1044 CTestMidiClntSetPitchTransposition* self = new(ELeave) CTestMidiClntSetPitchTransposition(aTestName, aTestType); |
|
1045 return self; |
|
1046 } |
|
1047 |
|
1048 TVerdict CTestMidiClntSetPitchTransposition::DoTestL(CMidiClientUtility* aMidi) |
|
1049 { |
|
1050 TVerdict ret = EPass; |
|
1051 TInt expErr = KErrNone; |
|
1052 TInt pitchTrans = 1200; // one octave |
|
1053 |
|
1054 INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition")); |
|
1055 // expected results |
|
1056 |
|
1057 switch (iTestType) |
|
1058 { |
|
1059 case ETestValid: |
|
1060 expErr = KErrNone; |
|
1061 break; |
|
1062 case ETestNoResource: |
|
1063 expErr = KErrNotReady; |
|
1064 break; |
|
1065 //According to GM2 spec, the minimum value can be -6499 cents, or at least -1299 cents. |
|
1066 case ETestOutOfRangeHigh: |
|
1067 // high limit on pitch transposition is dependant on controller |
|
1068 // when have a proper controller the value below should be changed |
|
1069 // to a value higher than the upper limit |
|
1070 pitchTrans = -6499; //KErrArgument expect by a real controller implementation if out-of-range |
|
1071 expErr = KErrNone; |
|
1072 break; |
|
1073 /*This test has been removed by AD as it was not valid - negative values ARE allowed by MIDI spec |
|
1074 According to GM2 spec, the minimum value can be -6499 cents, or at least -1299 cents. |
|
1075 case ETestOutOfRangeLow: |
|
1076 pitchTrans = -1; // negative values not supported |
|
1077 expErr = KErrNotSupported; |
|
1078 break; |
|
1079 */ |
|
1080 default: |
|
1081 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1082 return EInconclusive; |
|
1083 } |
|
1084 |
|
1085 TRAPD(err, aMidi->SetPitchTranspositionL(pitchTrans)); |
|
1086 if(expErr != err) |
|
1087 { |
|
1088 ERR_PRINTF3( _L("SetPitchTranspositionL gave error %d (expected %d)"),err, expErr); |
|
1089 ret = EFail; |
|
1090 } |
|
1091 else |
|
1092 INFO_PRINTF3(_L("SetPitchTranspositionL %d = %d"), err, expErr); |
|
1093 |
|
1094 return ret; |
|
1095 } |
|
1096 |
|
1097 //------------------------------------------------------------------ |
|
1098 |
|
1099 |
|
1100 CTestMidiClntDurationMicroSeconds::CTestMidiClntDurationMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) |
|
1101 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1102 { |
|
1103 } |
|
1104 |
|
1105 CTestMidiClntDurationMicroSeconds* CTestMidiClntDurationMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1106 { |
|
1107 CTestMidiClntDurationMicroSeconds* self = new(ELeave) CTestMidiClntDurationMicroSeconds(aTestName, aTestType); |
|
1108 return self; |
|
1109 } |
|
1110 |
|
1111 TVerdict CTestMidiClntDurationMicroSeconds::DoTestL(CMidiClientUtility* aMidi) |
|
1112 { |
|
1113 TVerdict ret = EPass; |
|
1114 TInt expErr = KErrNone; |
|
1115 TTimeIntervalMicroSeconds durationMicroSeconds(0); |
|
1116 |
|
1117 INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro seconds")); |
|
1118 // expected results |
|
1119 switch(iTestType) |
|
1120 { |
|
1121 case ETestValid: |
|
1122 expErr = KErrNone; |
|
1123 break; |
|
1124 case ETestNoResource: |
|
1125 expErr = KErrNotReady; |
|
1126 break; |
|
1127 default: |
|
1128 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1129 return EInconclusive; |
|
1130 } |
|
1131 |
|
1132 TRAPD(err, durationMicroSeconds = aMidi->DurationMicroSecondsL()); |
|
1133 if (expErr != err) |
|
1134 { |
|
1135 ERR_PRINTF3(_L("DurationMicroSecondsL gave error %d (expected %d)"),err, expErr); |
|
1136 ret = EFail; |
|
1137 } |
|
1138 else |
|
1139 INFO_PRINTF3(_L("DurationMicroSecondsL %d = %d"),err ,expErr); |
|
1140 |
|
1141 return ret; |
|
1142 } |
|
1143 |
|
1144 //------------------------------------------------------------------ |
|
1145 |
|
1146 |
|
1147 CTestMidiClntDurationMicroBeats::CTestMidiClntDurationMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) |
|
1148 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1149 { |
|
1150 } |
|
1151 |
|
1152 CTestMidiClntDurationMicroBeats* CTestMidiClntDurationMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1153 { |
|
1154 CTestMidiClntDurationMicroBeats* self = new(ELeave) CTestMidiClntDurationMicroBeats(aTestName, aTestType); |
|
1155 return self; |
|
1156 } |
|
1157 |
|
1158 TVerdict CTestMidiClntDurationMicroBeats::DoTestL(CMidiClientUtility* aMidi) |
|
1159 { |
|
1160 TVerdict ret = EPass; |
|
1161 TInt expErr = KErrNone; |
|
1162 //TTimeIntervalMicroSeconds durationMicroSeconds(0); |
|
1163 |
|
1164 INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro beats")); |
|
1165 // expected results |
|
1166 switch(iTestType) |
|
1167 { |
|
1168 case ETestValid: |
|
1169 expErr = KErrNone; |
|
1170 break; |
|
1171 case ETestNoResource: |
|
1172 expErr = KErrNotReady; |
|
1173 break; |
|
1174 default: |
|
1175 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1176 return EInconclusive; |
|
1177 } |
|
1178 TRAPD(err, aMidi->DurationMicroBeatsL()); |
|
1179 if (expErr != err) |
|
1180 { |
|
1181 ERR_PRINTF3(_L("DurationMicroBeatsL gave error %d (expected %d)"),err, expErr); |
|
1182 ret = EFail; |
|
1183 } |
|
1184 else |
|
1185 INFO_PRINTF3(_L("DurationMicroBeatsL %d = %d"),err ,expErr); |
|
1186 |
|
1187 return ret; |
|
1188 } |
|
1189 |
|
1190 //------------------------------------------------------------------ |
|
1191 |
|
1192 |
|
1193 CTestMidiClntNumTracks::CTestMidiClntNumTracks(const TDesC& aTestName, const TTestStepType aTestType) |
|
1194 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1195 { |
|
1196 } |
|
1197 |
|
1198 CTestMidiClntNumTracks* CTestMidiClntNumTracks::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1199 { |
|
1200 CTestMidiClntNumTracks* self = new(ELeave) CTestMidiClntNumTracks(aTestName, aTestType); |
|
1201 return self; |
|
1202 } |
|
1203 |
|
1204 TVerdict CTestMidiClntNumTracks::DoTestL(CMidiClientUtility* aMidi) |
|
1205 { |
|
1206 TVerdict ret = EPass; |
|
1207 TInt expErr = KErrNone; |
|
1208 |
|
1209 INFO_PRINTF1(_L("CMidiClientUtility: Get current number of tracks")); |
|
1210 // expected results |
|
1211 switch(iTestType) |
|
1212 { |
|
1213 case ETestValid: |
|
1214 expErr = KErrNone; |
|
1215 break; |
|
1216 default: |
|
1217 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1218 return EInconclusive; |
|
1219 } |
|
1220 // TInt numOfTracks = 0; |
|
1221 // TRAPD(err, numOfTracks = aMidi->NumTracksL()); |
|
1222 TRAPD(err, aMidi->NumTracksL()); // EABI warning removal |
|
1223 if (expErr != err) |
|
1224 { |
|
1225 ERR_PRINTF3(_L("NumTracksL gave error %d (expected %d)"),err, expErr); |
|
1226 ret = EFail; |
|
1227 } |
|
1228 else |
|
1229 INFO_PRINTF3(_L("NumTracksL %d = %d"),err ,expErr); |
|
1230 |
|
1231 return ret; |
|
1232 } |
|
1233 |
|
1234 //------------------------------------------------------------------ |
|
1235 |
|
1236 |
|
1237 CTestMidiClntSetTrackMute::CTestMidiClntSetTrackMute(const TDesC& aTestName, const TTestStepType aTestType) |
|
1238 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1239 { |
|
1240 } |
|
1241 |
|
1242 CTestMidiClntSetTrackMute* CTestMidiClntSetTrackMute::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1243 { |
|
1244 CTestMidiClntSetTrackMute* self = new(ELeave) CTestMidiClntSetTrackMute(aTestName, aTestType); |
|
1245 return self; |
|
1246 } |
|
1247 |
|
1248 TVerdict CTestMidiClntSetTrackMute::DoTestL(CMidiClientUtility* aMidi) |
|
1249 { |
|
1250 TVerdict ret = EPass; |
|
1251 TInt expErr = KErrNone; |
|
1252 TInt track = 0; |
|
1253 TBool muted = ETrue; |
|
1254 |
|
1255 INFO_PRINTF1(_L("CMidiClientUtility: Set track mute")); |
|
1256 // expected results |
|
1257 switch(iTestType) |
|
1258 { |
|
1259 case ETestValid: |
|
1260 expErr = KErrNone; |
|
1261 break; |
|
1262 case ETestNoResource: |
|
1263 expErr = KErrNotReady; |
|
1264 TRAP_IGNORE(track = aMidi->NumTracksL()+1); |
|
1265 break; |
|
1266 case ETestInvalidTrack: |
|
1267 expErr = KErrArgument; |
|
1268 TRAP_IGNORE(track = aMidi->NumTracksL()+1); |
|
1269 break; |
|
1270 default: |
|
1271 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1272 return EInconclusive; |
|
1273 } |
|
1274 |
|
1275 TRAPD(err, aMidi->SetTrackMuteL(track, muted)); |
|
1276 |
|
1277 // check correct result |
|
1278 if (iTestType == ETestValid) |
|
1279 { |
|
1280 TBool currMuted = EFalse; |
|
1281 |
|
1282 // until real MIDI controller IsTrackMuteL is always TRUE |
|
1283 TRAPD(err2, currMuted = aMidi->IsTrackMuteL(track)); |
|
1284 |
|
1285 if(err2 != KErrNone) |
|
1286 { |
|
1287 ERR_PRINTF2(_L("IsTrackMuteL() returned %d"), err2); |
|
1288 ret = EInconclusive; |
|
1289 return ret; |
|
1290 } |
|
1291 |
|
1292 if(currMuted != muted) |
|
1293 { |
|
1294 ERR_PRINTF2(_L("Error : expected %d"), muted); |
|
1295 ret = EFail; |
|
1296 return ret; |
|
1297 } |
|
1298 } |
|
1299 |
|
1300 if (expErr != err) |
|
1301 { |
|
1302 ERR_PRINTF3(_L("SetTrackMuteL gave error %d (expected %d)"),err, expErr); |
|
1303 ret = EFail; |
|
1304 } |
|
1305 else |
|
1306 INFO_PRINTF3(_L("SetTrackMuteL %d = %d"),err ,expErr); |
|
1307 |
|
1308 return ret; |
|
1309 } |
|
1310 |
|
1311 //------------------------------------------------------------------ |
|
1312 |
|
1313 |
|
1314 CTestMidiClntMimeType::CTestMidiClntMimeType(const TDesC& aTestName, const TTestStepType aTestType) |
|
1315 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1316 { |
|
1317 } |
|
1318 |
|
1319 CTestMidiClntMimeType* CTestMidiClntMimeType::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1320 { |
|
1321 CTestMidiClntMimeType* self = new(ELeave) CTestMidiClntMimeType(aTestName, aTestType); |
|
1322 return self; |
|
1323 } |
|
1324 |
|
1325 TVerdict CTestMidiClntMimeType::DoTestL(CMidiClientUtility* aMidi) |
|
1326 { |
|
1327 TVerdict ret = EPass; |
|
1328 TInt expErr = KErrNone; |
|
1329 |
|
1330 INFO_PRINTF1(_L("CMidiClientUtility: Get mime type")); |
|
1331 // expected results |
|
1332 switch(iTestType) |
|
1333 { |
|
1334 case ETestValid: |
|
1335 expErr = KErrNone; |
|
1336 break; |
|
1337 case ETestNoResource: |
|
1338 expErr = KErrNotReady; |
|
1339 break; |
|
1340 default: |
|
1341 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1342 return EInconclusive; |
|
1343 } |
|
1344 |
|
1345 //TRAPD(err, TDesC8 mimeType = aMidi->MimeTypeL());//FIXME: TDesC8 mimeType has to be define above |
|
1346 TRAPD(err, aMidi->MimeTypeL());//FIXME: TDesC8 mimeType has to be define above |
|
1347 if (expErr != err) |
|
1348 { |
|
1349 ERR_PRINTF3(_L("MimeTypeL gave error %d (expected %d)"),err, expErr); |
|
1350 ret = EFail; |
|
1351 } |
|
1352 else |
|
1353 INFO_PRINTF3(_L("MimeTypeL %d = %d"),err ,expErr); |
|
1354 |
|
1355 return ret; |
|
1356 } |
|
1357 |
|
1358 //------------------------------------------------------------------ |
|
1359 |
|
1360 |
|
1361 CTestMidiClntReturnPositionMicroSeconds::CTestMidiClntReturnPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) |
|
1362 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1363 { |
|
1364 } |
|
1365 |
|
1366 CTestMidiClntReturnPositionMicroSeconds* CTestMidiClntReturnPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1367 { |
|
1368 CTestMidiClntReturnPositionMicroSeconds* self = new(ELeave) CTestMidiClntReturnPositionMicroSeconds(aTestName, aTestType); |
|
1369 return self; |
|
1370 } |
|
1371 |
|
1372 TVerdict CTestMidiClntReturnPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi) |
|
1373 { |
|
1374 TVerdict ret = EPass; |
|
1375 TInt expErr = KErrNone; |
|
1376 |
|
1377 INFO_PRINTF1(_L("CMidiClientUtility: Get position in micro seconds")); |
|
1378 // expected results |
|
1379 switch(iTestType) |
|
1380 { |
|
1381 case ETestValid: |
|
1382 expErr = KErrNone; |
|
1383 break; |
|
1384 case ETestNoResource: |
|
1385 expErr = KErrNotReady; |
|
1386 break; |
|
1387 case ETestNoResourcePlaying: |
|
1388 expErr = KErrNotReady; |
|
1389 break; |
|
1390 default: |
|
1391 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1392 return EInconclusive; |
|
1393 } |
|
1394 TTimeIntervalMicroSeconds positionMicroSeconds(0); |
|
1395 TRAPD(err, positionMicroSeconds = aMidi->PositionMicroSecondsL()); |
|
1396 if (expErr != err) |
|
1397 { |
|
1398 if (KErrNotReady != err) |
|
1399 { |
|
1400 ERR_PRINTF3(_L("Get PositionMicroSecondsL gave error %d (expected %d)"),err, expErr); |
|
1401 ret = EFail; |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 ret = EPass; |
|
1406 } |
|
1407 } |
|
1408 else |
|
1409 INFO_PRINTF3(_L("Get PositionMicroSecondsL %d = %d"),err ,expErr); |
|
1410 |
|
1411 return ret; |
|
1412 } |
|
1413 |
|
1414 //------------------------------------------------------------------ |
|
1415 |
|
1416 |
|
1417 CTestMidiClntSetPositionMicroSeconds::CTestMidiClntSetPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) |
|
1418 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1419 { |
|
1420 } |
|
1421 |
|
1422 CTestMidiClntSetPositionMicroSeconds* CTestMidiClntSetPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1423 { |
|
1424 CTestMidiClntSetPositionMicroSeconds* self = new(ELeave) CTestMidiClntSetPositionMicroSeconds(aTestName, aTestType); |
|
1425 return self; |
|
1426 } |
|
1427 |
|
1428 TVerdict CTestMidiClntSetPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi) |
|
1429 { |
|
1430 TVerdict ret = EPass; |
|
1431 TInt expErr = KErrNone; |
|
1432 TTimeIntervalMicroSeconds position(0);; |
|
1433 |
|
1434 INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro seconds")); |
|
1435 // expected results |
|
1436 switch(iTestType) |
|
1437 { |
|
1438 case ETestValid: |
|
1439 expErr = KErrNone; |
|
1440 break; |
|
1441 case ETestNoResource: |
|
1442 expErr = KErrNotReady; |
|
1443 break; |
|
1444 case ETestMicrosecondsHighOutOfRange: |
|
1445 expErr = KErrNotSupported; |
|
1446 position = 1008; |
|
1447 break; |
|
1448 case ETestMicrosecondsLowOutOfRange: |
|
1449 expErr = KErrNotSupported; |
|
1450 position = -1; |
|
1451 break; |
|
1452 default: |
|
1453 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1454 return EInconclusive; |
|
1455 } |
|
1456 |
|
1457 TRAPD(err, aMidi->SetPositionMicroSecondsL(position)); |
|
1458 if (expErr != err) |
|
1459 { |
|
1460 ERR_PRINTF3(_L("Set PositionMicroSecondsL gave error %d (expected %d)"),err, expErr); |
|
1461 ret = EFail; |
|
1462 } |
|
1463 else |
|
1464 INFO_PRINTF3(_L("Set PositionMicroSecondsL %d = %d"),err ,expErr); |
|
1465 |
|
1466 return ret; |
|
1467 } |
|
1468 |
|
1469 //------------------------------------------------------------------ |
|
1470 |
|
1471 |
|
1472 CTestMidiClntReturnsPositionMicroBeats::CTestMidiClntReturnsPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) |
|
1473 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1474 { |
|
1475 } |
|
1476 |
|
1477 CTestMidiClntReturnsPositionMicroBeats* CTestMidiClntReturnsPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1478 { |
|
1479 CTestMidiClntReturnsPositionMicroBeats* self = new(ELeave) CTestMidiClntReturnsPositionMicroBeats(aTestName, aTestType); |
|
1480 return self; |
|
1481 } |
|
1482 |
|
1483 TVerdict CTestMidiClntReturnsPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi) |
|
1484 { |
|
1485 TVerdict ret = EPass; |
|
1486 TInt expErr = KErrNone; |
|
1487 |
|
1488 INFO_PRINTF1(_L("CMidiClientUtility: Return position in micro beats")); |
|
1489 // expected results |
|
1490 switch(iTestType) |
|
1491 { |
|
1492 case ETestValid: |
|
1493 expErr = KErrNone; |
|
1494 break; |
|
1495 case ETestNoResource: |
|
1496 expErr = KErrNotReady; |
|
1497 break; |
|
1498 case ETestNoResourcePlaying: |
|
1499 expErr = KErrNotReady; |
|
1500 break; |
|
1501 default: |
|
1502 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1503 return EInconclusive; |
|
1504 } |
|
1505 TRAPD(err, aMidi->PositionMicroBeatsL()); |
|
1506 if (expErr != err) |
|
1507 { |
|
1508 ERR_PRINTF3(_L("PositionMicroBeatsL gave error %d (expected %d)"),err, expErr); |
|
1509 ret = EFail; |
|
1510 } |
|
1511 else |
|
1512 INFO_PRINTF3(_L("PositionMicroBeatsL %d = %d"),err ,expErr); |
|
1513 |
|
1514 return ret; |
|
1515 } |
|
1516 |
|
1517 //------------------------------------------------------------------ |
|
1518 |
|
1519 |
|
1520 CTestMidiClntSetPositionMicroBeats::CTestMidiClntSetPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) |
|
1521 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1522 { |
|
1523 } |
|
1524 |
|
1525 CTestMidiClntSetPositionMicroBeats* CTestMidiClntSetPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1526 { |
|
1527 CTestMidiClntSetPositionMicroBeats* self = new(ELeave) CTestMidiClntSetPositionMicroBeats(aTestName, aTestType); |
|
1528 return self; |
|
1529 } |
|
1530 |
|
1531 TVerdict CTestMidiClntSetPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi) |
|
1532 { |
|
1533 TVerdict ret = EPass; |
|
1534 TInt expErr = KErrNone; |
|
1535 TInt64 microBeats = 0; |
|
1536 |
|
1537 INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro beats")); |
|
1538 // expected results |
|
1539 switch(iTestType) |
|
1540 { |
|
1541 case ETestValid: |
|
1542 expErr = KErrNone; |
|
1543 break; |
|
1544 case ETestNoResource: |
|
1545 expErr = KErrNotReady; |
|
1546 break; |
|
1547 case ETestMicrobeatsHighOutOfRange: |
|
1548 expErr = KErrNotSupported; |
|
1549 microBeats = 1000000; |
|
1550 break; |
|
1551 case ETestMicrobeatsLowOutOfRange: |
|
1552 expErr = KErrNotSupported; |
|
1553 microBeats = -1; |
|
1554 break; |
|
1555 default: |
|
1556 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1557 return EInconclusive; |
|
1558 } |
|
1559 |
|
1560 TRAPD(err, aMidi->SetPositionMicroBeatsL(microBeats)); |
|
1561 if (expErr != err) |
|
1562 { |
|
1563 ERR_PRINTF3(_L("SetPositionMicroBeatsL gave error %d (expected %d)"),err, expErr); |
|
1564 ret = EFail; |
|
1565 } |
|
1566 else |
|
1567 INFO_PRINTF3(_L("SetPositionMicroBeatsL %d = %d"),err ,expErr); |
|
1568 |
|
1569 return ret; |
|
1570 } |
|
1571 |
|
1572 //------------------------------------------------------------------ |
|
1573 |
|
1574 |
|
1575 CTestSetSyncUpdateCallbackInterval::CTestSetSyncUpdateCallbackInterval(const TDesC& aTestName, const TTestStepType aTestType) |
|
1576 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1577 { |
|
1578 } |
|
1579 |
|
1580 CTestSetSyncUpdateCallbackInterval* CTestSetSyncUpdateCallbackInterval::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
1581 { |
|
1582 CTestSetSyncUpdateCallbackInterval* self = new(ELeave) CTestSetSyncUpdateCallbackInterval(aTestName, aTestType); |
|
1583 return self; |
|
1584 } |
|
1585 |
|
1586 TVerdict CTestSetSyncUpdateCallbackInterval::DoTestL(CMidiClientUtility* aMidi) |
|
1587 { |
|
1588 TVerdict ret = EPass; |
|
1589 TInt expErr = KErrNone; |
|
1590 TTimeIntervalMicroSeconds microSeconds(0); |
|
1591 TInt64 microBeats = 0; |
|
1592 |
|
1593 INFO_PRINTF1(_L("CMidiClientUtility: Set update call back interval")); |
|
1594 // expected results |
|
1595 switch(iTestType) |
|
1596 { |
|
1597 case ETestValid: |
|
1598 expErr = KErrNone; |
|
1599 break; |
|
1600 case ETestMicrosecondsMicrobeatsZero: |
|
1601 microSeconds = 0; |
|
1602 microBeats = 0; |
|
1603 expErr = KErrNotReady; |
|
1604 break; |
|
1605 case ETestMicrosecondsLowOutOfRange: |
|
1606 expErr = KErrArgument; |
|
1607 microSeconds = -1; |
|
1608 break; |
|
1609 case ETestMicrobeatsHighOutOfRange: |
|
1610 expErr = KErrArgument; |
|
1611 microBeats = 1000000; |
|
1612 break; |
|
1613 case ETestMicrobeatsLowOutOfRange: |
|
1614 expErr = KErrArgument; |
|
1615 microBeats = -1; |
|
1616 break; |
|
1617 default: |
|
1618 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1619 return EInconclusive; |
|
1620 } |
|
1621 |
|
1622 TRAPD(err, aMidi->SetSyncUpdateCallbackIntervalL(microSeconds, microBeats)); |
|
1623 if (expErr != err) |
|
1624 { |
|
1625 ERR_PRINTF3(_L("SetSyncUpdateCallbackIntervalL gave error %d (expected %d)"),err, expErr); |
|
1626 ret = EFail; |
|
1627 } |
|
1628 else |
|
1629 INFO_PRINTF3(_L("SetSyncUpdateCallbackIntervalL %d = %d"),err ,expErr); |
|
1630 |
|
1631 return ret; |
|
1632 } |
|
1633 |
|
1634 CTestSendMessage::CTestSendMessage(const TDesC& aTestName, |
|
1635 const TTestStepType aTestType, const TDesC8& aMessage) |
|
1636 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1637 { |
|
1638 iMessage = aMessage; |
|
1639 } |
|
1640 |
|
1641 CTestSendMessage* CTestSendMessage::NewL(const TDesC& aTestName, |
|
1642 const TTestStepType aTestType, const TDesC8& aMessage) |
|
1643 { |
|
1644 CTestSendMessage* self = new (ELeave) CTestSendMessage(aTestName, |
|
1645 aTestType, aMessage); |
|
1646 return self; |
|
1647 } |
|
1648 |
|
1649 TVerdict CTestSendMessage::DoTestL(CMidiClientUtility* aMidi) |
|
1650 { |
|
1651 INFO_PRINTF1(_L("CMidiClientUtility: Send Message")); |
|
1652 |
|
1653 TVerdict ret = EPass; |
|
1654 TInt expErr = KErrNone; |
|
1655 |
|
1656 // expected results |
|
1657 switch(iTestType) |
|
1658 { |
|
1659 case ETestValid: |
|
1660 expErr = KErrNone; |
|
1661 break; |
|
1662 case ETestNullMessage: |
|
1663 expErr = KErrArgument; |
|
1664 break; |
|
1665 case ETestUnsupported: |
|
1666 expErr = KErrNotSupported; |
|
1667 break; |
|
1668 case ETestCorrupt: |
|
1669 expErr = KErrCorrupt; |
|
1670 break; |
|
1671 default: |
|
1672 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1673 return EInconclusive; |
|
1674 } |
|
1675 |
|
1676 // TInt byteProcessed; |
|
1677 // TRAPD(err1, byteProcessed = aMidi->SendMessageL(iMessage)); |
|
1678 TRAPD(err1, aMidi->SendMessageL(iMessage)); // EABI warning removal |
|
1679 if(err1 != expErr) |
|
1680 { |
|
1681 ERR_PRINTF3(_L("SendMessageL(iMessage) gave error %d (expected %d)"), err1, expErr); |
|
1682 ret = EFail; |
|
1683 } |
|
1684 |
|
1685 TTimeIntervalMicroSeconds startTime(105); |
|
1686 // TRAPD(err2, byteProcessed = aMidi->SendMessageL(iMessage, startTime)); |
|
1687 TRAPD(err2, aMidi->SendMessageL(iMessage, startTime)); // EABI warning removal |
|
1688 if(err2 != expErr) |
|
1689 { |
|
1690 ERR_PRINTF3(_L("SendMessageL(iMessage, startTime) gave error %d (expected %d)"), err1, expErr); |
|
1691 ret = EFail; |
|
1692 } |
|
1693 |
|
1694 return ret; |
|
1695 } |
|
1696 |
|
1697 //------------------------------------------------------------------ |
|
1698 |
|
1699 |
|
1700 // CTestSendMessageTime incorporated into CTestSendMessage |
|
1701 |
|
1702 //------------------------------------------------------------------ |
|
1703 |
|
1704 // aTestType as follows : |
|
1705 // 0115 : valid |
|
1706 // 0116 : invalid device ID - REMOVED, API has changed |
|
1707 // 0117 : null |
|
1708 // 0118 : unsupported |
|
1709 // 0119 : unsupported - REMOVED, duplicate |
|
1710 // 0120 : corrupt |
|
1711 |
|
1712 CTestSendMipMessage::CTestSendMipMessage(const TDesC& aTestName, |
|
1713 const TTestStepType aTestType) |
|
1714 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1715 { |
|
1716 } |
|
1717 |
|
1718 CTestSendMipMessage* CTestSendMipMessage::NewL(const TDesC& aTestName, |
|
1719 const TTestStepType aTestType) |
|
1720 { |
|
1721 CTestSendMipMessage* self = new (ELeave) CTestSendMipMessage(aTestName, |
|
1722 aTestType); |
|
1723 return self; |
|
1724 } |
|
1725 |
|
1726 TVerdict CTestSendMipMessage::DoTestL(CMidiClientUtility* aMidi) |
|
1727 { |
|
1728 INFO_PRINTF1(_L("CMidiClientUtility: Send Mip Message")); |
|
1729 |
|
1730 TVerdict ret = EPass; |
|
1731 TInt expErr = KErrNone; |
|
1732 |
|
1733 RArray<TMipMessageEntry> mipArray; |
|
1734 TMipMessageEntry mipEntry1; |
|
1735 TMipMessageEntry mipEntry2; |
|
1736 |
|
1737 // expected results |
|
1738 switch(iTestType) |
|
1739 { |
|
1740 case ETestValid: |
|
1741 expErr = KErrNone; |
|
1742 break; |
|
1743 case ETestNullMessage: |
|
1744 expErr = KErrArgument; |
|
1745 break; |
|
1746 case ETestUnsupported: |
|
1747 expErr = KErrNotSupported; |
|
1748 break; |
|
1749 case ETestCorrupt: |
|
1750 expErr = KErrCorrupt; |
|
1751 break; |
|
1752 default: |
|
1753 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1754 return EInconclusive; |
|
1755 } |
|
1756 |
|
1757 switch(iTestType) |
|
1758 { |
|
1759 case ETestValid: |
|
1760 mipEntry1.iChannel = 10; |
|
1761 mipEntry1.iMIPValue = 20; |
|
1762 mipEntry2.iChannel = 11; |
|
1763 mipEntry2.iMIPValue = 21; |
|
1764 |
|
1765 mipArray.Append(mipEntry1); |
|
1766 mipArray.Append(mipEntry2); |
|
1767 break; |
|
1768 |
|
1769 case ETestNullMessage: |
|
1770 // leave array empty |
|
1771 // *** NB this will cause a problem in debug mode - causes a server panic! |
|
1772 break; |
|
1773 |
|
1774 case ETestUnsupported: |
|
1775 // TODO : values defined as unsupported? |
|
1776 mipEntry1.iChannel = 0; |
|
1777 mipEntry1.iMIPValue = 0; |
|
1778 mipEntry2.iChannel = 0; |
|
1779 mipEntry2.iMIPValue = 0; |
|
1780 |
|
1781 mipArray.Append(mipEntry1); |
|
1782 mipArray.Append(mipEntry2); |
|
1783 break; |
|
1784 |
|
1785 case ETestCorrupt: |
|
1786 // TODO : values defined as corrupt? |
|
1787 mipEntry1.iChannel = -1; |
|
1788 mipEntry1.iMIPValue = -1; |
|
1789 mipEntry2.iChannel = -1; |
|
1790 mipEntry2.iMIPValue = -1; |
|
1791 |
|
1792 mipArray.Append(mipEntry1); |
|
1793 mipArray.Append(mipEntry2); |
|
1794 break; |
|
1795 } |
|
1796 |
|
1797 TRAPD(err1, aMidi->SendMipMessageL(mipArray)); |
|
1798 if(err1 != expErr) |
|
1799 { |
|
1800 ERR_PRINTF3(_L("SendMipMessageL(iMessage) gave error %d (expected %d)"), err1, expErr); |
|
1801 ret = EFail; |
|
1802 } |
|
1803 |
|
1804 mipArray.Close(); |
|
1805 return ret; |
|
1806 } |
|
1807 |
|
1808 //------------------------------------------------------------------ |
|
1809 |
|
1810 |
|
1811 CTestNumberOfBanks::CTestNumberOfBanks(const TDesC& aTestName, |
|
1812 const TTestStepType aTestType) |
|
1813 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1814 { |
|
1815 } |
|
1816 |
|
1817 CTestNumberOfBanks* CTestNumberOfBanks::NewL(const TDesC& aTestName, |
|
1818 const TTestStepType aTestType) |
|
1819 { |
|
1820 CTestNumberOfBanks* self = new (ELeave) CTestNumberOfBanks(aTestName, |
|
1821 aTestType); |
|
1822 return self; |
|
1823 } |
|
1824 |
|
1825 TVerdict CTestNumberOfBanks::DoTestL(CMidiClientUtility* aMidi) |
|
1826 { |
|
1827 // to do : test for standard & custom banks |
|
1828 |
|
1829 // currently using ETestOverflow to simulate no banks |
|
1830 |
|
1831 TVerdict ret = EPass; |
|
1832 TInt expErr = KErrNone; |
|
1833 |
|
1834 // expected results |
|
1835 switch(iTestType) |
|
1836 { |
|
1837 case ETestValid: |
|
1838 expErr = KErrNone; |
|
1839 break; |
|
1840 case ETestNegative: |
|
1841 expErr = KErrArgument; |
|
1842 break; |
|
1843 default: |
|
1844 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1845 return EInconclusive; |
|
1846 } |
|
1847 |
|
1848 TInt numBanks = 0; |
|
1849 TRAPD(err1, numBanks = aMidi->NumberOfBanksL(EFalse)); |
|
1850 if(err1 != expErr) |
|
1851 { |
|
1852 ERR_PRINTF3(_L("NumberOfBanksL(EFalse) gave error %d (expected %d)"), err1, expErr); |
|
1853 ret = EFail; |
|
1854 } |
|
1855 else |
|
1856 INFO_PRINTF2(_L("Number of Banks (standard) = %d"), numBanks); |
|
1857 |
|
1858 |
|
1859 TRAPD(err2, numBanks = aMidi->NumberOfBanksL(ETrue)); |
|
1860 if(err1 != expErr) |
|
1861 { |
|
1862 ERR_PRINTF3(_L("NumberOfBanksL(ETrue) gave error %d (expected %d)"), err2, expErr); |
|
1863 ret = EFail; |
|
1864 } |
|
1865 else |
|
1866 INFO_PRINTF2(_L("Number of Banks (custom) = %d"), numBanks); |
|
1867 |
|
1868 return ret; |
|
1869 } |
|
1870 |
|
1871 //------------------------------------------------------------------ |
|
1872 |
|
1873 |
|
1874 CTestGetBankId::CTestGetBankId(const TDesC& aTestName, |
|
1875 const TTestStepType aTestType) |
|
1876 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1877 { |
|
1878 } |
|
1879 |
|
1880 CTestGetBankId* CTestGetBankId::NewL(const TDesC& aTestName, |
|
1881 const TTestStepType aTestType) |
|
1882 { |
|
1883 CTestGetBankId* self = new (ELeave) CTestGetBankId(aTestName, |
|
1884 aTestType); |
|
1885 return self; |
|
1886 } |
|
1887 |
|
1888 TVerdict CTestGetBankId::DoTestL(CMidiClientUtility* aMidi) |
|
1889 { |
|
1890 // currently using ETestOverflow to simulate no banks |
|
1891 TVerdict ret = EPass; |
|
1892 TInt expErr; |
|
1893 TInt bankNum; |
|
1894 |
|
1895 // expected results |
|
1896 switch(iTestType) |
|
1897 { |
|
1898 case ETestValid: |
|
1899 expErr = KErrNone; |
|
1900 bankNum = 54; |
|
1901 break; |
|
1902 case ETestNegative: |
|
1903 expErr = KErrArgument; |
|
1904 bankNum = -1; |
|
1905 break; |
|
1906 case ETestOverflow: |
|
1907 expErr = KErrArgument; |
|
1908 bankNum = 12000; |
|
1909 break; |
|
1910 default: |
|
1911 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1912 return EInconclusive; |
|
1913 } |
|
1914 |
|
1915 TInt bankId = 0; |
|
1916 TRAPD(err1, bankId = aMidi->GetBankIdL(EFalse, bankNum)); |
|
1917 if(err1 != expErr) |
|
1918 { |
|
1919 ERR_PRINTF4(_L("GetBankIdL(EFalse, %d) gave error %d (expected %d)"), bankNum, err1, expErr); |
|
1920 ret = EFail; |
|
1921 } |
|
1922 else |
|
1923 INFO_PRINTF3(_L("GetBankIdL(EFalse, %d) = %d"), bankNum, bankId); |
|
1924 |
|
1925 TRAPD(err2, bankId = aMidi->GetBankIdL(ETrue, bankNum)); |
|
1926 if(err2 != expErr) |
|
1927 { |
|
1928 ERR_PRINTF4(_L("GetBankIdL(ETrue, %d) gave error %d (expected %d)"), bankNum, err2, expErr); |
|
1929 ret = EFail; |
|
1930 } |
|
1931 else |
|
1932 INFO_PRINTF3(_L("GetBankIdL(ETrue, %d) = %d"), bankNum, bankId); |
|
1933 |
|
1934 return ret; |
|
1935 } |
|
1936 |
|
1937 //------------------------------------------------------------------ |
|
1938 |
|
1939 |
|
1940 CTestLoadCustomBank::CTestLoadCustomBank(const TDesC& aTestName, |
|
1941 const TTestStepType aTestType) |
|
1942 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
1943 { |
|
1944 } |
|
1945 |
|
1946 CTestLoadCustomBank* CTestLoadCustomBank::NewL(const TDesC& aTestName, |
|
1947 const TTestStepType aTestType) |
|
1948 { |
|
1949 CTestLoadCustomBank* self = new (ELeave) CTestLoadCustomBank(aTestName, |
|
1950 aTestType); |
|
1951 return self; |
|
1952 } |
|
1953 |
|
1954 TVerdict CTestLoadCustomBank::DoTestL(CMidiClientUtility* aMidi) |
|
1955 { |
|
1956 TVerdict ret = EPass; |
|
1957 TInt expErr; |
|
1958 TFileName bankFileName; |
|
1959 |
|
1960 _LIT8(KBankFileName, "Bank file name"); |
|
1961 _LIT8(KBankFileNameInvalid, "Invalid file name"); |
|
1962 _LIT8(KBankFileNameUnsupported, "Unsupported file name"); |
|
1963 |
|
1964 // expected results |
|
1965 switch(iTestType) |
|
1966 { |
|
1967 case ETestValid: |
|
1968 expErr = KErrNone; |
|
1969 bankFileName.Copy(KBankFileName); |
|
1970 break; |
|
1971 case ETestNullMessage: |
|
1972 expErr = KErrArgument; |
|
1973 bankFileName.Copy(KNullDesC16); |
|
1974 break; |
|
1975 case ETestInvalidMessage: |
|
1976 expErr = KErrArgument; |
|
1977 bankFileName.Copy(KBankFileNameInvalid); |
|
1978 break; |
|
1979 case ETestUnsupported: |
|
1980 expErr = KErrNotSupported; |
|
1981 bankFileName.Copy(KBankFileNameUnsupported); |
|
1982 break; |
|
1983 default: |
|
1984 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
1985 return EInconclusive; |
|
1986 } |
|
1987 |
|
1988 TInt bankId = 0; |
|
1989 |
|
1990 TRAPD(err1, aMidi->LoadCustomBankL(bankFileName, bankId)); |
|
1991 INFO_PRINTF3(_L("LoadCustomBankL gave error %d (expected %d)"), err1, expErr); |
|
1992 if(err1 != expErr) |
|
1993 { |
|
1994 ret = EFail; |
|
1995 return ret; |
|
1996 } |
|
1997 // see if it's loaded |
|
1998 TBool loaded = EFalse; |
|
1999 TRAP(err1, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2000 if(err1 != KErrNone) |
|
2001 { |
|
2002 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err1); |
|
2003 ret = EFail; |
|
2004 return ret; |
|
2005 } |
|
2006 if(iTestType == ETestValid) |
|
2007 { |
|
2008 if(!loaded) |
|
2009 { |
|
2010 ERR_PRINTF1(_L("CustomBankLoadedL returned false")); |
|
2011 ret = EFail; |
|
2012 } |
|
2013 } |
|
2014 else |
|
2015 { |
|
2016 if(loaded) |
|
2017 { |
|
2018 ERR_PRINTF1(_L("CustomBankLoadedL returned true")); |
|
2019 ret = EFail; |
|
2020 } |
|
2021 } |
|
2022 |
|
2023 return ret; |
|
2024 } |
|
2025 |
|
2026 //------------------------------------------------------------------ |
|
2027 |
|
2028 |
|
2029 CTestUnloadCustomBank::CTestUnloadCustomBank(const TDesC& aTestName, |
|
2030 const TTestStepType aTestType) |
|
2031 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2032 { |
|
2033 } |
|
2034 |
|
2035 CTestUnloadCustomBank* CTestUnloadCustomBank::NewL(const TDesC& aTestName, |
|
2036 const TTestStepType aTestType) |
|
2037 { |
|
2038 CTestUnloadCustomBank* self = new (ELeave) CTestUnloadCustomBank(aTestName, |
|
2039 aTestType); |
|
2040 return self; |
|
2041 } |
|
2042 |
|
2043 TVerdict CTestUnloadCustomBank::DoTestL(CMidiClientUtility* aMidi) |
|
2044 { |
|
2045 TVerdict ret = EPass; |
|
2046 TInt expErr; |
|
2047 TFileName bankFileName; |
|
2048 |
|
2049 _LIT8(KBankFileName, "Bank file name"); |
|
2050 bankFileName.Copy(KBankFileName); |
|
2051 |
|
2052 // expected results |
|
2053 switch(iTestType) |
|
2054 { |
|
2055 case ETestValid: |
|
2056 expErr = KErrNone; |
|
2057 break; |
|
2058 case ETestNegative: |
|
2059 expErr = KErrNotFound; |
|
2060 break; |
|
2061 default: |
|
2062 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2063 return EInconclusive; |
|
2064 } |
|
2065 |
|
2066 TInt bankId = 0; |
|
2067 |
|
2068 // load a known bank |
|
2069 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); |
|
2070 if(err != KErrNone) |
|
2071 { |
|
2072 ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err); |
|
2073 ret = EInconclusive; |
|
2074 return ret; |
|
2075 } |
|
2076 |
|
2077 // ensure it's loaded |
|
2078 TBool loaded = EFalse; |
|
2079 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2080 if(err != KErrNone) |
|
2081 { |
|
2082 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2083 ret = EInconclusive; |
|
2084 return ret; |
|
2085 } |
|
2086 if(!loaded) |
|
2087 { |
|
2088 ERR_PRINTF1(_L("CustomBankLoadedL returned false")); |
|
2089 ret = EInconclusive; |
|
2090 return ret; |
|
2091 } |
|
2092 |
|
2093 // unload the bank we know is loaded |
|
2094 TRAP(err, aMidi->UnloadCustomBankL(bankId)); |
|
2095 if(err != KErrNone) |
|
2096 { |
|
2097 ERR_PRINTF2(_L("UnloadCustomBankL gave error %d"), err); |
|
2098 ret = EFail; |
|
2099 return ret; |
|
2100 } |
|
2101 |
|
2102 // ensure it's not loaded |
|
2103 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2104 if(err != KErrNone) |
|
2105 { |
|
2106 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2107 ret = EInconclusive; |
|
2108 return ret; |
|
2109 } |
|
2110 if(loaded) |
|
2111 { |
|
2112 ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded")); |
|
2113 ret = EFail; |
|
2114 return ret; |
|
2115 } |
|
2116 |
|
2117 // if negative test, try and unload the same bank again |
|
2118 if(iTestType == ETestValid) |
|
2119 return ret; |
|
2120 else |
|
2121 { |
|
2122 TRAP(err, aMidi->UnloadCustomBankL(bankId)); |
|
2123 INFO_PRINTF3(_L("UnloadCustomBankL gave error %d (expected %d)"), err, expErr); |
|
2124 if(err != expErr) |
|
2125 ret = EFail; |
|
2126 } |
|
2127 |
|
2128 return ret; |
|
2129 } |
|
2130 |
|
2131 //------------------------------------------------------------------ |
|
2132 |
|
2133 |
|
2134 CTestUnloadAllCustomBanks::CTestUnloadAllCustomBanks(const TDesC& aTestName, |
|
2135 const TTestStepType aTestType) |
|
2136 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2137 { |
|
2138 } |
|
2139 |
|
2140 CTestUnloadAllCustomBanks* CTestUnloadAllCustomBanks::NewL(const TDesC& aTestName, |
|
2141 const TTestStepType aTestType) |
|
2142 { |
|
2143 CTestUnloadAllCustomBanks* self = new (ELeave) CTestUnloadAllCustomBanks(aTestName, |
|
2144 aTestType); |
|
2145 return self; |
|
2146 } |
|
2147 |
|
2148 TVerdict CTestUnloadAllCustomBanks::DoTestL(CMidiClientUtility* aMidi) |
|
2149 { |
|
2150 TVerdict ret = EPass; |
|
2151 TInt expErr; |
|
2152 TFileName bankFileName; |
|
2153 |
|
2154 _LIT8(KBankFileName, "Bank file name"); |
|
2155 bankFileName.Copy(KBankFileName); |
|
2156 |
|
2157 // expected results |
|
2158 switch(iTestType) |
|
2159 { |
|
2160 case ETestValid: |
|
2161 expErr = KErrNone; |
|
2162 break; |
|
2163 case ETestNegative: |
|
2164 expErr = KErrNotFound; |
|
2165 break; |
|
2166 default: |
|
2167 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2168 return EInconclusive; |
|
2169 } |
|
2170 |
|
2171 TInt bankId = 0; |
|
2172 |
|
2173 // load a known bank |
|
2174 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); |
|
2175 if(err != KErrNone) |
|
2176 { |
|
2177 ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err); |
|
2178 ret = EInconclusive; |
|
2179 return ret; |
|
2180 } |
|
2181 |
|
2182 // ensure it's loaded |
|
2183 TBool loaded = EFalse; |
|
2184 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2185 if(err != KErrNone) |
|
2186 { |
|
2187 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2188 ret = EInconclusive; |
|
2189 return ret; |
|
2190 } |
|
2191 if(!loaded) |
|
2192 { |
|
2193 ERR_PRINTF1(_L("CustomBankLoadedL returned false")); |
|
2194 ret = EInconclusive; |
|
2195 return ret; |
|
2196 } |
|
2197 |
|
2198 // unload all |
|
2199 TRAP(err, aMidi->UnloadAllCustomBanksL()); |
|
2200 if(err != KErrNone) |
|
2201 { |
|
2202 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); |
|
2203 ret = EFail; |
|
2204 return ret; |
|
2205 } |
|
2206 |
|
2207 loaded = EFalse; |
|
2208 // ensure our bank is not loaded |
|
2209 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2210 if(err != KErrNone) |
|
2211 { |
|
2212 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2213 ret = EInconclusive; |
|
2214 return ret; |
|
2215 } |
|
2216 if(loaded) |
|
2217 { |
|
2218 ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded")); |
|
2219 ret = EFail; |
|
2220 return ret; |
|
2221 } |
|
2222 |
|
2223 // if negative test, try and unload again |
|
2224 if(iTestType == ETestValid) |
|
2225 return ret; |
|
2226 else |
|
2227 { |
|
2228 TRAP(err, aMidi->UnloadAllCustomBanksL()); |
|
2229 INFO_PRINTF3(_L("UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr); |
|
2230 if(err != expErr) |
|
2231 ret = EFail; |
|
2232 } |
|
2233 |
|
2234 return ret; |
|
2235 } |
|
2236 |
|
2237 //------------------------------------------------------------------ |
|
2238 |
|
2239 |
|
2240 CTestNumberOfInstruments::CTestNumberOfInstruments(const TDesC& aTestName, |
|
2241 const TTestStepType aTestType) |
|
2242 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2243 { |
|
2244 } |
|
2245 |
|
2246 CTestNumberOfInstruments* CTestNumberOfInstruments::NewL(const TDesC& aTestName, |
|
2247 const TTestStepType aTestType) |
|
2248 { |
|
2249 CTestNumberOfInstruments* self = new (ELeave) CTestNumberOfInstruments(aTestName, |
|
2250 aTestType); |
|
2251 return self; |
|
2252 } |
|
2253 |
|
2254 TVerdict CTestNumberOfInstruments::DoTestL(CMidiClientUtility* aMidi) |
|
2255 { |
|
2256 // TO DO : situation where no standard banks exist |
|
2257 |
|
2258 TVerdict ret = EPass; |
|
2259 TInt expErr; |
|
2260 TFileName bankFileName; |
|
2261 |
|
2262 _LIT8(KBankFileName, "Bank file name"); |
|
2263 bankFileName.Copy(KBankFileName); |
|
2264 TInt bankId = 0; |
|
2265 TInt numInstruments = 0; |
|
2266 |
|
2267 // expected results |
|
2268 switch(iTestType) |
|
2269 { |
|
2270 case ETestValid: |
|
2271 expErr = KErrNone; |
|
2272 bankId = 0; |
|
2273 break; |
|
2274 case ETestNegative: |
|
2275 expErr = KErrNotFound; |
|
2276 bankId = 0; |
|
2277 break; |
|
2278 case ETestInvalidId: |
|
2279 expErr = KErrArgument; |
|
2280 bankId = -2; |
|
2281 break; |
|
2282 default: |
|
2283 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2284 return EInconclusive; |
|
2285 } |
|
2286 |
|
2287 // check a known bank - standard |
|
2288 // *** TO DO : this will cause a failure with ETestNegative. To be re-done |
|
2289 // for no standard banks present |
|
2290 TRAPD(err, numInstruments = aMidi->NumberOfInstrumentsL(bankId, EFalse)); |
|
2291 if(err != expErr) |
|
2292 { |
|
2293 ERR_PRINTF3(_L("NumberOfInstrumentsL(bankId, EFalse) gave error %d (expected %d)"), err, expErr); |
|
2294 ret = EFail; |
|
2295 return ret; |
|
2296 } |
|
2297 INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, EFalse) = %d"), numInstruments); |
|
2298 |
|
2299 if(iTestType != ETestInvalidMessage) |
|
2300 { |
|
2301 // load a known bank - custom |
|
2302 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); |
|
2303 if(err != KErrNone) |
|
2304 { |
|
2305 ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err); |
|
2306 ret = EInconclusive; |
|
2307 return ret; |
|
2308 } |
|
2309 // ensure it's loaded |
|
2310 TBool loaded = EFalse; |
|
2311 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2312 if(err != KErrNone) |
|
2313 { |
|
2314 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2315 ret = EInconclusive; |
|
2316 return ret; |
|
2317 } |
|
2318 if(!loaded) |
|
2319 { |
|
2320 ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded")); |
|
2321 ret = EInconclusive; |
|
2322 return ret; |
|
2323 } |
|
2324 } |
|
2325 |
|
2326 // check the custom bank |
|
2327 // NB if test type is InvalidId then we haven't bothered to load anything |
|
2328 TRAP(err, aMidi->NumberOfInstrumentsL(bankId, ETrue)); |
|
2329 if(err != expErr) |
|
2330 { |
|
2331 ERR_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) gave error %d"), err); |
|
2332 ret = EFail; |
|
2333 return ret; |
|
2334 } |
|
2335 INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) = %d"), numInstruments); |
|
2336 |
|
2337 if(iTestType == ETestNegative) |
|
2338 { |
|
2339 // negative test :- unload all, then check it again |
|
2340 TRAP(err, aMidi->UnloadAllCustomBanksL()); |
|
2341 if(err != KErrNone) |
|
2342 { |
|
2343 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); |
|
2344 ret = EInconclusive; |
|
2345 return ret; |
|
2346 } |
|
2347 // check it. it should leave |
|
2348 TRAP(err, aMidi->NumberOfInstrumentsL(bankId, ETrue)); |
|
2349 if(err != expErr) |
|
2350 { |
|
2351 ERR_PRINTF3(_L("NumberOfInstrumentsL gave error %d (expected %d)"), err, expErr); |
|
2352 ret = EFail; |
|
2353 return ret; |
|
2354 } |
|
2355 } |
|
2356 |
|
2357 return ret; |
|
2358 } |
|
2359 |
|
2360 //------------------------------------------------------------------ |
|
2361 |
|
2362 |
|
2363 CTestGetInstrumentId::CTestGetInstrumentId(const TDesC& aTestName, |
|
2364 const TTestStepType aTestType) |
|
2365 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2366 { |
|
2367 } |
|
2368 |
|
2369 CTestGetInstrumentId* CTestGetInstrumentId::NewL(const TDesC& aTestName, |
|
2370 const TTestStepType aTestType) |
|
2371 { |
|
2372 CTestGetInstrumentId* self = new (ELeave) CTestGetInstrumentId(aTestName, |
|
2373 aTestType); |
|
2374 return self; |
|
2375 } |
|
2376 |
|
2377 TVerdict CTestGetInstrumentId::DoTestL(CMidiClientUtility* aMidi) |
|
2378 { |
|
2379 // TO DO : situation where no standard banks exist |
|
2380 |
|
2381 TVerdict ret = EPass; |
|
2382 TInt expErr; |
|
2383 TFileName bankFileName; |
|
2384 |
|
2385 _LIT8(KBankFileName, "Bank file name"); |
|
2386 bankFileName.Copy(KBankFileName); |
|
2387 TInt bankId = 0; |
|
2388 TInt instrIndex = 0; |
|
2389 TInt instrId = 0; |
|
2390 |
|
2391 // expected results |
|
2392 switch(iTestType) |
|
2393 { |
|
2394 case ETestValid: |
|
2395 expErr = KErrNone; |
|
2396 bankId = 0; |
|
2397 instrIndex = 0; |
|
2398 break; |
|
2399 case ETestNegative: |
|
2400 expErr = KErrNotFound; |
|
2401 bankId = 0; |
|
2402 instrIndex = 0; |
|
2403 break; |
|
2404 case ETestInvalidId: |
|
2405 expErr = KErrArgument; |
|
2406 bankId = -2; |
|
2407 instrIndex = 0; |
|
2408 break; |
|
2409 case ETestInvalidIndex: |
|
2410 expErr = KErrArgument; |
|
2411 bankId = 0; |
|
2412 instrIndex = -2; |
|
2413 break; |
|
2414 default: |
|
2415 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2416 return EInconclusive; |
|
2417 } |
|
2418 |
|
2419 // check a known bank - standard |
|
2420 // *** TO DO : this will cause a failure with ETestNegative. To be re-done |
|
2421 // for no standard banks present |
|
2422 TRAPD(err, instrId = aMidi->GetInstrumentIdL(bankId, EFalse, instrIndex)); |
|
2423 if(err != expErr) |
|
2424 { |
|
2425 ERR_PRINTF3(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) gave error %d (expected %d)"), err, expErr); |
|
2426 ret = EFail; |
|
2427 return ret; |
|
2428 } |
|
2429 INFO_PRINTF2(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) = %d"), instrId); |
|
2430 |
|
2431 if(iTestType != ETestInvalidId && iTestType != ETestInvalidIndex) |
|
2432 { |
|
2433 // load a known bank - custom |
|
2434 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); |
|
2435 if(err != KErrNone) |
|
2436 { |
|
2437 ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err); |
|
2438 ret = EInconclusive; |
|
2439 return ret; |
|
2440 } |
|
2441 // ensure it's loaded |
|
2442 TBool loaded = EFalse; |
|
2443 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); |
|
2444 if(err != KErrNone) |
|
2445 { |
|
2446 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); |
|
2447 ret = EInconclusive; |
|
2448 return ret; |
|
2449 } |
|
2450 if(!loaded) |
|
2451 { |
|
2452 ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded")); |
|
2453 ret = EInconclusive; |
|
2454 return ret; |
|
2455 } |
|
2456 } |
|
2457 |
|
2458 // check the custom bank |
|
2459 // NB if test type is InvalidId/Index then we haven't bothered to load anything |
|
2460 TRAP(err, instrId = aMidi->GetInstrumentIdL(bankId, ETrue, instrIndex)); |
|
2461 if(err != expErr) |
|
2462 { |
|
2463 ERR_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) gave error %d"), err); |
|
2464 ret = EFail; |
|
2465 return ret; |
|
2466 } |
|
2467 INFO_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) = %d"), instrId); |
|
2468 |
|
2469 if(iTestType == ETestNegative) |
|
2470 { |
|
2471 // negative test :- unload all, then check it again |
|
2472 TRAP(err, aMidi->UnloadAllCustomBanksL()); |
|
2473 if(err != KErrNone) |
|
2474 { |
|
2475 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); |
|
2476 ret = EInconclusive; |
|
2477 return ret; |
|
2478 } |
|
2479 // check it. it should leave |
|
2480 TRAP(err, instrId = aMidi->GetInstrumentIdL(bankId, ETrue, instrIndex)); |
|
2481 if(err != expErr) |
|
2482 { |
|
2483 ERR_PRINTF3(_L("GetInstrumentIdL gave error %d (expected %d)"), err, expErr); |
|
2484 ret = EFail; |
|
2485 return ret; |
|
2486 } |
|
2487 } |
|
2488 |
|
2489 return ret; |
|
2490 } |
|
2491 |
|
2492 //Check this |
|
2493 //Change it to return EFail for failing negative test |
|
2494 //------------------------------------------------------------------ |
|
2495 CTestReturnsInstrumentName::CTestReturnsInstrumentName(const TDesC& aTestName, |
|
2496 const TTestStepType aTestType) |
|
2497 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2498 { |
|
2499 } |
|
2500 |
|
2501 CTestReturnsInstrumentName* CTestReturnsInstrumentName::NewL(const TDesC& aTestName, |
|
2502 const TTestStepType aTestType) |
|
2503 { |
|
2504 CTestReturnsInstrumentName* self = new (ELeave) CTestReturnsInstrumentName(aTestName, |
|
2505 aTestType); |
|
2506 return self; |
|
2507 } |
|
2508 |
|
2509 TVerdict CTestReturnsInstrumentName::DoTestL(CMidiClientUtility* aMidi) |
|
2510 { |
|
2511 TVerdict ret = EPass; |
|
2512 TInt expErr; |
|
2513 //TFileName bankFileName; |
|
2514 |
|
2515 TInt bankId = 0; |
|
2516 TInt instrId = 0; |
|
2517 HBufC* instrName = NULL; |
|
2518 |
|
2519 // expected results |
|
2520 switch(iTestType) |
|
2521 { |
|
2522 case ETestValid: |
|
2523 expErr = KErrNone; |
|
2524 bankId = 0; |
|
2525 instrId = 89; |
|
2526 break; |
|
2527 case ETestNegative: |
|
2528 expErr = KErrArgument; |
|
2529 bankId = 0; |
|
2530 instrId = -241; |
|
2531 break; |
|
2532 default: |
|
2533 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2534 return EInconclusive; |
|
2535 } |
|
2536 |
|
2537 // check a known bank - standard |
|
2538 // *** TO DO : custom? |
|
2539 |
|
2540 TRAPD(err, instrName = aMidi->InstrumentNameL(bankId, EFalse, instrId)); |
|
2541 INFO_PRINTF3(_L("InstrumentNameL(bankId, EFalse, instrId) gave error %d (expected %d)"), err, expErr); |
|
2542 if(err != expErr) |
|
2543 { |
|
2544 //ret = EInconclusive; |
|
2545 ret = EFail; |
|
2546 return ret; |
|
2547 } |
|
2548 // don't try and do this for negative test! it'll panic |
|
2549 if(iTestType == ETestValid) |
|
2550 INFO_PRINTF2(_L("InstrumentNameL(bankId, EFalse, instrId) = \'%S\'"), instrName); |
|
2551 |
|
2552 delete instrName; |
|
2553 return ret; |
|
2554 } |
|
2555 |
|
2556 |
|
2557 |
|
2558 //------------------------------------------------------------------ |
|
2559 // Tests that the GetInstrumentL() doesn't return KErrArgument when the |
|
2560 // channel value is between 0 and 15, but it will return KErrArgument |
|
2561 // when the channel value is out of range |
|
2562 |
|
2563 CTestGetInstrument::CTestGetInstrument(const TDesC& aTestName, |
|
2564 const TTestStepType aTestType) |
|
2565 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2566 { |
|
2567 } |
|
2568 |
|
2569 CTestGetInstrument* CTestGetInstrument::NewL(const TDesC& aTestName, |
|
2570 const TTestStepType aTestType) |
|
2571 { |
|
2572 CTestGetInstrument* self = new (ELeave) CTestGetInstrument(aTestName, |
|
2573 aTestType); |
|
2574 return self; |
|
2575 } |
|
2576 |
|
2577 TVerdict CTestGetInstrument::DoTestL(CMidiClientUtility* aMidi) |
|
2578 { |
|
2579 TVerdict ret = EPass; |
|
2580 TInt instrumentId = 0; |
|
2581 TInt bankId = 0; |
|
2582 TInt validChannelId = 0; |
|
2583 TInt invalidChannelId = 16; |
|
2584 |
|
2585 TRAPD(err, aMidi->GetInstrumentL(validChannelId, instrumentId, bankId)); |
|
2586 |
|
2587 if(err == KErrArgument) |
|
2588 { |
|
2589 ERR_PRINTF2(_L("GetInstrumentL(validChannelId, ...) gave an error = %d"), err); |
|
2590 ret = EFail; |
|
2591 return ret; |
|
2592 } |
|
2593 |
|
2594 TRAPD(err1, aMidi->GetInstrumentL(invalidChannelId, instrumentId, bankId)); |
|
2595 |
|
2596 if(err1 != KErrArgument) |
|
2597 { |
|
2598 ERR_PRINTF2(_L("GetInstrumentL(invalidChannelId, ...) gave an error = %d"), err); |
|
2599 ret = EFail; |
|
2600 return ret; |
|
2601 } |
|
2602 |
|
2603 return ret; |
|
2604 } |
|
2605 |
|
2606 //------------------------------------------------------------------ |
|
2607 |
|
2608 CTestSetInstrument::CTestSetInstrument(const TDesC& aTestName, |
|
2609 const TTestStepType aTestType) |
|
2610 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2611 { |
|
2612 } |
|
2613 |
|
2614 CTestSetInstrument* CTestSetInstrument::NewL(const TDesC& aTestName, |
|
2615 const TTestStepType aTestType) |
|
2616 { |
|
2617 CTestSetInstrument* self = new (ELeave) CTestSetInstrument(aTestName, |
|
2618 aTestType); |
|
2619 return self; |
|
2620 } |
|
2621 |
|
2622 TVerdict CTestSetInstrument::DoTestL(CMidiClientUtility* aMidi) |
|
2623 { |
|
2624 TVerdict ret = EPass; |
|
2625 TInt expErr; |
|
2626 //TFileName bankFileName; |
|
2627 |
|
2628 TInt bankId = 0; |
|
2629 TInt channelId = 0; |
|
2630 TInt instrId = 0; |
|
2631 |
|
2632 // expected results |
|
2633 switch(iTestType) |
|
2634 { |
|
2635 case ETestValid: |
|
2636 expErr = KErrNone; |
|
2637 bankId = 0; |
|
2638 channelId = 0; |
|
2639 instrId = 89; |
|
2640 break; |
|
2641 case ETestInvalidChannel: |
|
2642 expErr = KErrNotFound; |
|
2643 bankId = 0; |
|
2644 channelId = -2; |
|
2645 instrId = 89; |
|
2646 break; |
|
2647 case ETestInvalidId: |
|
2648 expErr = KErrNotFound; |
|
2649 bankId = 0; |
|
2650 channelId = 0; |
|
2651 instrId = -241; |
|
2652 break; |
|
2653 default: |
|
2654 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2655 return EInconclusive; |
|
2656 } |
|
2657 |
|
2658 // *** TO DO : custom? |
|
2659 |
|
2660 TRAPD(err, aMidi->SetInstrumentL(channelId, bankId, instrId)); |
|
2661 INFO_PRINTF3(_L("SetInstrumentL(channelId, bankId, instrId) gave error %d (expected %d)"), err, expErr); |
|
2662 if(err != expErr) |
|
2663 { |
|
2664 ret = EFail; |
|
2665 return ret; |
|
2666 } |
|
2667 |
|
2668 return ret; |
|
2669 } |
|
2670 |
|
2671 //------------------------------------------------------------------ |
|
2672 |
|
2673 |
|
2674 CTestLoadCustomInstrument::CTestLoadCustomInstrument(const TDesC& aTestName, |
|
2675 const TTestStepType aTestType) |
|
2676 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2677 { |
|
2678 } |
|
2679 |
|
2680 CTestLoadCustomInstrument* CTestLoadCustomInstrument::NewL(const TDesC& aTestName, |
|
2681 const TTestStepType aTestType) |
|
2682 { |
|
2683 CTestLoadCustomInstrument* self = new (ELeave) CTestLoadCustomInstrument(aTestName, |
|
2684 aTestType); |
|
2685 return self; |
|
2686 } |
|
2687 |
|
2688 TVerdict CTestLoadCustomInstrument::DoTestL(CMidiClientUtility* aMidi) |
|
2689 { |
|
2690 // TO DO : need instrument file which we can load, with known bank and instrument IDs |
|
2691 // Negative tests to be done properly. |
|
2692 |
|
2693 TVerdict ret = EPass; |
|
2694 TInt expErr; |
|
2695 |
|
2696 _LIT(KInstrumentFile, "Instrument File Name"); // *** to change |
|
2697 _LIT(KBadInstrumentFile, "Bad Instrument File Name"); // *** to change |
|
2698 TFileName instFileName; |
|
2699 |
|
2700 TInt fileBankId = 90; |
|
2701 TInt fileInstrId = 91; |
|
2702 TInt bankId = 92; |
|
2703 TInt instrId = 93; |
|
2704 |
|
2705 // expected results |
|
2706 switch(iTestType) |
|
2707 { |
|
2708 case ETestValid: |
|
2709 expErr = KErrNone; |
|
2710 instFileName.Copy(KInstrumentFile); |
|
2711 break; |
|
2712 case ETestInvalidId: |
|
2713 expErr = KErrArgument; |
|
2714 instFileName.Copy(KInstrumentFile); |
|
2715 fileBankId = -2; |
|
2716 break; |
|
2717 case ETestAlreadyLoaded: |
|
2718 // ** to do : load once and attempt to load again. |
|
2719 // when instrument data files are available, this will work |
|
2720 instFileName.Copy(KInstrumentFile); |
|
2721 expErr = KErrInUse; |
|
2722 break; |
|
2723 case ETestUnsupported: // ** to define test data for this |
|
2724 instFileName.Copy(KBadInstrumentFile); |
|
2725 expErr = KErrNotSupported; |
|
2726 break; |
|
2727 default: |
|
2728 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2729 return EInconclusive; |
|
2730 } |
|
2731 |
|
2732 // if testing already loaded, preload the instrument here |
|
2733 if(iTestType == ETestAlreadyLoaded) |
|
2734 { |
|
2735 TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); |
|
2736 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err); |
|
2737 if(err != KErrNone) |
|
2738 { |
|
2739 ret = EInconclusive; |
|
2740 return ret; |
|
2741 } |
|
2742 } |
|
2743 |
|
2744 // load the instrument for real |
|
2745 TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); |
|
2746 INFO_PRINTF3(_L("LoadCustomInstrumentL gave error %d (expected %d)"), err, expErr); |
|
2747 if(err != expErr) |
|
2748 { |
|
2749 ret = EFail; |
|
2750 return ret; |
|
2751 } |
|
2752 |
|
2753 return ret; |
|
2754 } |
|
2755 |
|
2756 |
|
2757 //------------------------------------------------------------------ |
|
2758 |
|
2759 CTestUnloadCustomInstrument::CTestUnloadCustomInstrument(const TDesC& aTestName, |
|
2760 const TTestStepType aTestType) |
|
2761 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2762 { |
|
2763 } |
|
2764 |
|
2765 CTestUnloadCustomInstrument* CTestUnloadCustomInstrument::NewL(const TDesC& aTestName, |
|
2766 const TTestStepType aTestType) |
|
2767 { |
|
2768 CTestUnloadCustomInstrument* self = new (ELeave) CTestUnloadCustomInstrument(aTestName, |
|
2769 aTestType); |
|
2770 return self; |
|
2771 } |
|
2772 |
|
2773 TVerdict CTestUnloadCustomInstrument::DoTestL(CMidiClientUtility* aMidi) |
|
2774 { |
|
2775 TVerdict ret = EPass; |
|
2776 TInt expErr; |
|
2777 |
|
2778 _LIT(KInstrumentFile, "Instrument File Name"); // *** to change |
|
2779 TFileName instFileName; |
|
2780 |
|
2781 TInt fileBankId = 90; |
|
2782 TInt fileInstrId = 91; |
|
2783 TInt bankId = 92; |
|
2784 TInt instrId = 93; |
|
2785 |
|
2786 // expected results |
|
2787 switch(iTestType) |
|
2788 { |
|
2789 case ETestValid: |
|
2790 expErr = KErrNone; |
|
2791 instFileName.Copy(KInstrumentFile); |
|
2792 break; |
|
2793 case ETestInvalidId: |
|
2794 expErr = KErrNotFound; |
|
2795 instFileName.Copy(KInstrumentFile); |
|
2796 bankId = -2; |
|
2797 break; |
|
2798 case ETestNotLoaded: |
|
2799 expErr = KErrNotFound; |
|
2800 instFileName.Copy(KInstrumentFile); |
|
2801 break; |
|
2802 case ETestNotUnloadable: // ** TO DO : define test data for this |
|
2803 expErr = KErrNotSupported; |
|
2804 break; |
|
2805 default: |
|
2806 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2807 return EInconclusive; |
|
2808 } |
|
2809 |
|
2810 // preload the instrument here |
|
2811 if(iTestType == ETestValid) |
|
2812 { |
|
2813 TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); |
|
2814 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err); |
|
2815 if(err != KErrNone) |
|
2816 { |
|
2817 ret = EInconclusive; |
|
2818 return ret; |
|
2819 } |
|
2820 } |
|
2821 |
|
2822 // now unload it |
|
2823 TRAPD(err, aMidi->UnloadCustomInstrumentL(bankId, instrId)); |
|
2824 INFO_PRINTF3(_L("UnloadCustomInstrumentL gave error %d (expected %d)"), err, expErr); |
|
2825 if(err != expErr) |
|
2826 { |
|
2827 ret = EFail; |
|
2828 return ret; |
|
2829 } |
|
2830 |
|
2831 return ret; |
|
2832 } |
|
2833 |
|
2834 //------------------------------------------------------------------ |
|
2835 |
|
2836 |
|
2837 CTestPercussionKeyName::CTestPercussionKeyName(const TDesC& aTestName, |
|
2838 const TTestStepType aTestType) |
|
2839 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2840 { |
|
2841 } |
|
2842 |
|
2843 CTestPercussionKeyName* CTestPercussionKeyName::NewL(const TDesC& aTestName, |
|
2844 const TTestStepType aTestType) |
|
2845 { |
|
2846 CTestPercussionKeyName* self = new (ELeave) CTestPercussionKeyName(aTestName, |
|
2847 aTestType); |
|
2848 return self; |
|
2849 } |
|
2850 |
|
2851 TVerdict CTestPercussionKeyName::DoTestL(CMidiClientUtility* aMidi) |
|
2852 { |
|
2853 // *** NB the actual arguments do not match those in the current API or test specs |
|
2854 TVerdict ret = EPass; |
|
2855 TInt expErr; |
|
2856 //TFileName bankFileName; |
|
2857 |
|
2858 TInt bankId = 0; |
|
2859 TInt instrId = 89; |
|
2860 TInt keyId = 0; |
|
2861 HBufC* keyName = NULL; |
|
2862 |
|
2863 // expected results |
|
2864 switch(iTestType) |
|
2865 { |
|
2866 case ETestValid: |
|
2867 expErr = KErrNone; |
|
2868 break; |
|
2869 case ETestInvalidId: |
|
2870 expErr = KErrNotFound; |
|
2871 keyId = -2; |
|
2872 break; |
|
2873 default: |
|
2874 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2875 return EInconclusive; |
|
2876 } |
|
2877 |
|
2878 // check a known bank - standard |
|
2879 // *** TO DO : custom? |
|
2880 |
|
2881 TRAPD(err, keyName = aMidi->PercussionKeyNameL(keyId, bankId, EFalse, instrId)); |
|
2882 INFO_PRINTF3(_L("PercussionKeyNameL gave error %d (expected %d)"), err, expErr); |
|
2883 if(err != expErr) |
|
2884 { |
|
2885 ret = EFail; |
|
2886 return ret; |
|
2887 } |
|
2888 // don't try and do this for negative test! it'll panic |
|
2889 if(iTestType == ETestValid) |
|
2890 INFO_PRINTF2(_L("PercussionKeyNameL(keyId, bankId, EFalse, instrId) = \'%S\'"), keyName); |
|
2891 |
|
2892 delete keyName; |
|
2893 return ret; |
|
2894 } |
|
2895 |
|
2896 //Check this// |
|
2897 //Not sure how to implement 'no opened resource' |
|
2898 //------------------------------------------------------------------ |
|
2899 CTestStopTime::CTestStopTime(const TDesC& aTestName, |
|
2900 const TTestStepType aTestType) |
|
2901 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2902 { |
|
2903 } |
|
2904 |
|
2905 CTestStopTime* CTestStopTime::NewL(const TDesC& aTestName, |
|
2906 const TTestStepType aTestType) |
|
2907 { |
|
2908 CTestStopTime* self = new (ELeave) CTestStopTime(aTestName, |
|
2909 aTestType); |
|
2910 return self; |
|
2911 } |
|
2912 |
|
2913 TVerdict CTestStopTime::DoTestL(CMidiClientUtility* aMidi) |
|
2914 { |
|
2915 TVerdict ret = EPass; |
|
2916 TInt expErr; |
|
2917 TTimeIntervalMicroSeconds stopTime(0); |
|
2918 |
|
2919 // expected results |
|
2920 switch(iTestType) |
|
2921 { |
|
2922 case ETestValid: |
|
2923 expErr = KErrNone; |
|
2924 break; |
|
2925 |
|
2926 // NB no negative test specified |
|
2927 //Not sure how to implement 'no opened resource' |
|
2928 case ETestNoResource: |
|
2929 expErr = KErrNotReady; |
|
2930 break; |
|
2931 |
|
2932 default: |
|
2933 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2934 return EInconclusive; |
|
2935 } |
|
2936 |
|
2937 TRAPD(err, aMidi->StopTimeL(stopTime)); |
|
2938 INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr); |
|
2939 if(err != expErr) |
|
2940 { |
|
2941 ret = EFail; |
|
2942 return ret; |
|
2943 } |
|
2944 INFO_PRINTF2(_L("StopTime = %ld"), I64INT(stopTime.Int64())); |
|
2945 return ret; |
|
2946 } |
|
2947 |
|
2948 |
|
2949 //------------------------------------------------------------------ |
|
2950 |
|
2951 |
|
2952 CTestSetStopTime::CTestSetStopTime(const TDesC& aTestName, |
|
2953 const TTestStepType aTestType) |
|
2954 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
2955 { |
|
2956 } |
|
2957 |
|
2958 CTestSetStopTime* CTestSetStopTime::NewL(const TDesC& aTestName, |
|
2959 const TTestStepType aTestType) |
|
2960 { |
|
2961 CTestSetStopTime* self = new (ELeave) CTestSetStopTime(aTestName, |
|
2962 aTestType); |
|
2963 return self; |
|
2964 } |
|
2965 |
|
2966 TVerdict CTestSetStopTime::DoTestL(CMidiClientUtility* aMidi) |
|
2967 { |
|
2968 TVerdict ret = EPass; |
|
2969 TInt expErr; |
|
2970 TTimeIntervalMicroSeconds stopTime(999); |
|
2971 |
|
2972 // expected results |
|
2973 switch(iTestType) |
|
2974 { |
|
2975 case ETestValid: |
|
2976 expErr = KErrNone; |
|
2977 break; |
|
2978 case ETestOutOfRangeHigh: |
|
2979 stopTime = 999999999; |
|
2980 expErr = KErrArgument; |
|
2981 break; |
|
2982 case ETestOutOfRangeLow: |
|
2983 stopTime = -1; |
|
2984 expErr = KErrArgument; |
|
2985 break; |
|
2986 default: |
|
2987 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
2988 return EInconclusive; |
|
2989 } |
|
2990 |
|
2991 TRAPD(err, aMidi->SetStopTimeL(stopTime)); |
|
2992 INFO_PRINTF3(_L("SetStopTimeL gave error %d (expected %d)"), err, expErr); |
|
2993 if(err != expErr) |
|
2994 { |
|
2995 ret = EFail; |
|
2996 return ret; |
|
2997 } |
|
2998 |
|
2999 // check set correctly if a valid test |
|
3000 if (iTestType == ETestValid) |
|
3001 { |
|
3002 TTimeIntervalMicroSeconds newStopTime(999); |
|
3003 TRAP(err, aMidi->StopTimeL(newStopTime)); |
|
3004 INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr); |
|
3005 |
|
3006 if(err != expErr) |
|
3007 { |
|
3008 ret = EInconclusive; |
|
3009 return ret; |
|
3010 } |
|
3011 INFO_PRINTF2(_L("StopTime = %ld"), I64INT(newStopTime.Int64())); |
|
3012 |
|
3013 if(newStopTime != stopTime) |
|
3014 { |
|
3015 ERR_PRINTF2(_L("Error : expected %ld"), I64INT(stopTime.Int64())); |
|
3016 ret = EFail; |
|
3017 return ret; |
|
3018 } |
|
3019 } |
|
3020 |
|
3021 return ret; |
|
3022 } |
|
3023 |
|
3024 //------------------------------------------------------------------ |
|
3025 |
|
3026 |
|
3027 CTestSetRepeats::CTestSetRepeats(const TDesC& aTestName, |
|
3028 const TTestStepType aTestType) |
|
3029 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3030 { |
|
3031 } |
|
3032 |
|
3033 CTestSetRepeats* CTestSetRepeats::NewL(const TDesC& aTestName, |
|
3034 const TTestStepType aTestType) |
|
3035 { |
|
3036 CTestSetRepeats* self = new (ELeave) CTestSetRepeats(aTestName, |
|
3037 aTestType); |
|
3038 return self; |
|
3039 } |
|
3040 |
|
3041 TVerdict CTestSetRepeats::DoTestL(CMidiClientUtility* aMidi) |
|
3042 { |
|
3043 TVerdict ret = EPass; |
|
3044 TInt expErr; |
|
3045 TInt repeats = 0; |
|
3046 TTimeIntervalMicroSeconds silentTime(1000000); |
|
3047 |
|
3048 // expected results |
|
3049 switch(iTestType) |
|
3050 { |
|
3051 case ETestValid: |
|
3052 expErr = KErrNone; |
|
3053 break; |
|
3054 // ** NB these are testing ONE out-of-range argument at a time. Suggest |
|
3055 // we modify the test spec to go with this? |
|
3056 case ETestOutOfRange: |
|
3057 expErr = KErrArgument; |
|
3058 //repeats = 9999; // ** TBD : max. range of repeats? |
|
3059 repeats = -1; |
|
3060 silentTime = 1000000; |
|
3061 break; |
|
3062 default: |
|
3063 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3064 return EInconclusive; |
|
3065 } |
|
3066 |
|
3067 TRAPD(err, aMidi->SetRepeatsL(repeats, silentTime)); |
|
3068 |
|
3069 // check set correctly if a valid test |
|
3070 if (iTestType == ETestValid) |
|
3071 { |
|
3072 // check the repeats value |
|
3073 TInt currRepeats = -1; |
|
3074 currRepeats = aMidi->GetRepeats(); |
|
3075 |
|
3076 INFO_PRINTF2(_L("Repeats = %d"), currRepeats); |
|
3077 |
|
3078 if(currRepeats != repeats) |
|
3079 { |
|
3080 ERR_PRINTF2(_L("Error : expected %d"), currRepeats); |
|
3081 ret = EFail; |
|
3082 return ret; |
|
3083 } |
|
3084 } |
|
3085 |
|
3086 INFO_PRINTF3(_L("SetRepeatsL gave error %d (expected %d)"), err, expErr); |
|
3087 if(err != expErr) |
|
3088 { |
|
3089 ret = EFail; |
|
3090 return ret; |
|
3091 } |
|
3092 |
|
3093 return ret; |
|
3094 } |
|
3095 |
|
3096 //------------------------------------------------------------------ |
|
3097 // This test case has two steps: |
|
3098 // 1. High Polyphony Song vs. Low Polyphony Midi Utility |
|
3099 // - a test file has exactly 57 voices from beginning to end |
|
3100 // - during the instantiation of utility, the Maximum Polyphony is default to 48 implicitly. |
|
3101 // For this case: |
|
3102 // MaxPolyphonyL() return value is 48 |
|
3103 // PolyphonyL() return value is 48 (number of active voice the engine is playing now, |
|
3104 // this is being limited by the MaxPolyphonyL() number) |
|
3105 // |
|
3106 // |
|
3107 // 2. Low Polyphony Song vs. High Polyphony Midi Utility |
|
3108 // - a test file has exactly 57 voices from beginning to end |
|
3109 // - during the instantiation of utility, the Maximum Polyphony is default to 60 implicitly |
|
3110 // For this case: |
|
3111 // MaxPolyphonyL() return value is 60 |
|
3112 // PolyphonyL() return value is 57 |
|
3113 |
|
3114 // constants for the test case |
|
3115 const TUint8 KMaxPolyphonyValue1 = 48; |
|
3116 const TUint8 KMaxPolyphonyValue2 = 60; |
|
3117 const TUint8 KPolyphonyValue = 57; |
|
3118 |
|
3119 CTestPolyphony::CTestPolyphony(const TDesC& aTestName, |
|
3120 const TTestStepType aTestType) |
|
3121 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3122 { |
|
3123 } |
|
3124 |
|
3125 CTestPolyphony* CTestPolyphony::NewL(const TDesC& aTestName, |
|
3126 const TTestStepType aTestType) |
|
3127 { |
|
3128 CTestPolyphony* self = new (ELeave) CTestPolyphony(aTestName, |
|
3129 aTestType); |
|
3130 return self; |
|
3131 } |
|
3132 |
|
3133 TVerdict CTestPolyphony::DoTestL(CMidiClientUtility* aMidi) |
|
3134 { |
|
3135 TVerdict ret = EPass; |
|
3136 TInt poly = 0; |
|
3137 TInt maxPoly = 0; |
|
3138 TInt expErr = 0; |
|
3139 |
|
3140 // expected results |
|
3141 switch(iTestType) |
|
3142 { |
|
3143 case ETestValid: |
|
3144 expErr = KErrNone; |
|
3145 break; |
|
3146 // NB no negative test specified |
|
3147 default: |
|
3148 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3149 return EInconclusive; |
|
3150 } |
|
3151 |
|
3152 // set the maxPolyphony to KMaxPolyphponyValue1 |
|
3153 TRAPD(err, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue1)); |
|
3154 if (err != expErr) |
|
3155 { |
|
3156 INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err); |
|
3157 ret = EFail; |
|
3158 return ret; |
|
3159 } |
|
3160 |
|
3161 // verify that the maxPolyphony value was correctly set |
|
3162 TRAPD(err1, maxPoly = aMidi->MaxPolyphonyL()); |
|
3163 if (err1 != expErr) |
|
3164 { |
|
3165 INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err); |
|
3166 ret = EFail; |
|
3167 return ret; |
|
3168 } |
|
3169 INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue1); |
|
3170 |
|
3171 // get the number of the currently active voices. This value is set as |
|
3172 // KPolyphonyValue, but because the max number of voices that can be handled by the |
|
3173 // engine is smaller than the currently active voce, PolyphonyL() will |
|
3174 // return the MaxPolyphony() value |
|
3175 TRAPD(err2, poly = aMidi->PolyphonyL()); |
|
3176 |
|
3177 if (err2 != expErr) |
|
3178 { |
|
3179 INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err); |
|
3180 ret = EFail; |
|
3181 return ret; |
|
3182 } |
|
3183 |
|
3184 INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KMaxPolyphonyValue1); |
|
3185 INFO_PRINTF1(_L("----------------------------------------------------------")); |
|
3186 |
|
3187 // set the maxPolyphony to KMaxPolyphonyValue2 |
|
3188 TRAPD(err3, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue2)); |
|
3189 if (err3 != expErr) |
|
3190 { |
|
3191 INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err); |
|
3192 ret = EFail; |
|
3193 return ret; |
|
3194 } |
|
3195 |
|
3196 // verify that the maxPolyphony value was correctly set |
|
3197 TRAPD(err4, maxPoly = aMidi->MaxPolyphonyL()); |
|
3198 if (err4 != expErr) |
|
3199 { |
|
3200 INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err); |
|
3201 ret = EFail; |
|
3202 return ret; |
|
3203 } |
|
3204 INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue2); |
|
3205 |
|
3206 // get the number of the currently active voices. This value is set as |
|
3207 // KPolyphonyValue, but because the max number of voices that can be handled by the |
|
3208 // engine is smaller than the currently active voce, PolyphonyL() will |
|
3209 // return the MaxPolyphony() value |
|
3210 TRAPD(err5, poly = aMidi->PolyphonyL()); |
|
3211 if (err5 != expErr) |
|
3212 { |
|
3213 INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err); |
|
3214 ret = EFail; |
|
3215 return ret; |
|
3216 } |
|
3217 INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KPolyphonyValue); |
|
3218 |
|
3219 return ret; |
|
3220 } |
|
3221 |
|
3222 //Check this (0086) // |
|
3223 //Not sure how to implement 'no opened resource' |
|
3224 //------------------------------------------------------------------ |
|
3225 |
|
3226 |
|
3227 CTestChannelsSupported::CTestChannelsSupported(const TDesC& aTestName, |
|
3228 const TTestStepType aTestType) |
|
3229 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3230 { |
|
3231 } |
|
3232 |
|
3233 CTestChannelsSupported* CTestChannelsSupported::NewL(const TDesC& aTestName, |
|
3234 const TTestStepType aTestType) |
|
3235 { |
|
3236 CTestChannelsSupported* self = new (ELeave) CTestChannelsSupported(aTestName, |
|
3237 aTestType); |
|
3238 return self; |
|
3239 } |
|
3240 |
|
3241 TVerdict CTestChannelsSupported::DoTestL(CMidiClientUtility* aMidi) |
|
3242 { |
|
3243 TVerdict ret = EPass; |
|
3244 TInt expErr; |
|
3245 TInt numChannels = 0; |
|
3246 |
|
3247 // expected results |
|
3248 switch(iTestType) |
|
3249 { |
|
3250 case ETestValid: |
|
3251 expErr = KErrNone; |
|
3252 break; |
|
3253 |
|
3254 // NB no negative test specified |
|
3255 |
|
3256 //Not sure how to implement 'no opened resource' |
|
3257 case ETestNoResource: |
|
3258 expErr = KErrNotReady; |
|
3259 break; |
|
3260 |
|
3261 default: |
|
3262 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3263 return EInconclusive; |
|
3264 } |
|
3265 |
|
3266 TRAPD(err, numChannels = aMidi->ChannelsSupportedL()); |
|
3267 INFO_PRINTF3(_L("ChannelsSupportedL gave error %d (expected %d)"), err, expErr); |
|
3268 if(err != expErr) |
|
3269 { |
|
3270 ret = EFail; |
|
3271 return ret; |
|
3272 } |
|
3273 INFO_PRINTF2(_L("Channels supported = %d"), numChannels); |
|
3274 return ret; |
|
3275 } |
|
3276 |
|
3277 //------------------------------------------------------------------ |
|
3278 // Checks the ChannelVolumeL(...) method behaivior |
|
3279 // - if the argument passed in is a valid channel, the test should |
|
3280 // not return any error code, but should return the expected volume |
|
3281 // value |
|
3282 // - if the argument passed in is an invalid channel, the test should |
|
3283 // return KErrArgument |
|
3284 |
|
3285 CTestReturnChannelVolume::CTestReturnChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3286 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3287 { |
|
3288 } |
|
3289 |
|
3290 CTestReturnChannelVolume* CTestReturnChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3291 { |
|
3292 CTestReturnChannelVolume* self = new(ELeave) CTestReturnChannelVolume(aTestName, aTestType); |
|
3293 return self; |
|
3294 } |
|
3295 |
|
3296 TVerdict CTestReturnChannelVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3297 { |
|
3298 TInt channel = 2; |
|
3299 TInt volume = 0; |
|
3300 |
|
3301 INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume")); |
|
3302 |
|
3303 // positive test |
|
3304 if (iTestType == ETestValid) |
|
3305 { |
|
3306 // if the test is valid check that the value returned for the |
|
3307 // volume is correct |
|
3308 TInt chanVolume = aMidi->MaxChannelVolumeL() - 10; |
|
3309 TRAPD(err1, aMidi->SetChannelVolumeL(channel, chanVolume)); |
|
3310 if (err1 != KErrNone) |
|
3311 { |
|
3312 ERR_PRINTF2(_L("SetChannelVolumeL gave error %d"),err1); |
|
3313 return EFail; |
|
3314 } |
|
3315 |
|
3316 TRAPD(err, volume = aMidi->ChannelVolumeL(channel)); |
|
3317 if (err != KErrNone) |
|
3318 { |
|
3319 ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrNone)"),err); |
|
3320 return EFail; |
|
3321 } |
|
3322 |
|
3323 if (volume != chanVolume) |
|
3324 { |
|
3325 ERR_PRINTF3(_L("ChannelVolumeL retrieve volume value %d (expected %d)"),volume, chanVolume); |
|
3326 return EFail; |
|
3327 } |
|
3328 return EPass; |
|
3329 } |
|
3330 |
|
3331 // negative test |
|
3332 if (iTestType == ETestInvalidChannel) |
|
3333 { |
|
3334 channel = -1; |
|
3335 TRAPD(err, aMidi->ChannelVolumeL(channel)); |
|
3336 if (err != KErrArgument) |
|
3337 { |
|
3338 ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrArgument)"),err); |
|
3339 return EFail; |
|
3340 } |
|
3341 return EPass; |
|
3342 } |
|
3343 |
|
3344 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3345 return EInconclusive; |
|
3346 } |
|
3347 |
|
3348 |
|
3349 //Check This// |
|
3350 //------------------------------------------------------------------ |
|
3351 CTestMaxChannelVolume::CTestMaxChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3352 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3353 { |
|
3354 } |
|
3355 |
|
3356 CTestMaxChannelVolume* CTestMaxChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3357 { |
|
3358 CTestMaxChannelVolume* self = new(ELeave) CTestMaxChannelVolume(aTestName, aTestType); |
|
3359 return self; |
|
3360 } |
|
3361 |
|
3362 TVerdict CTestMaxChannelVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3363 { |
|
3364 TVerdict ret = EPass; |
|
3365 TInt expErr = KErrNone; |
|
3366 |
|
3367 INFO_PRINTF1(_L("CMidiClientUtility: Return Maximum channel volume")); |
|
3368 // expected results |
|
3369 switch(iTestType) |
|
3370 { |
|
3371 case ETestValid: |
|
3372 expErr = KErrNone; |
|
3373 break; |
|
3374 |
|
3375 default: |
|
3376 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3377 return EInconclusive; |
|
3378 } |
|
3379 // TReal32 volume = 0; |
|
3380 // TRAPD(err, volume = aMidi->MaxChannelVolumeL() ); |
|
3381 TRAPD(err, aMidi->MaxChannelVolumeL() ); // EABI warning removal |
|
3382 |
|
3383 if (expErr != err) |
|
3384 { |
|
3385 ERR_PRINTF3(_L("MaxChannelVolumeL gave error %d (expected %d)"),err, expErr); |
|
3386 ret = EFail; |
|
3387 } |
|
3388 else |
|
3389 INFO_PRINTF3(_L("MaxChannelVolumeL %d = %d "),err ,expErr); |
|
3390 |
|
3391 return ret; |
|
3392 } |
|
3393 |
|
3394 //------------------------------------------------------------------ |
|
3395 |
|
3396 CTestSetChannelVolume::CTestSetChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3397 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3398 { |
|
3399 } |
|
3400 |
|
3401 CTestSetChannelVolume* CTestSetChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3402 { |
|
3403 CTestSetChannelVolume* self = new(ELeave) CTestSetChannelVolume(aTestName, aTestType); |
|
3404 return self; |
|
3405 } |
|
3406 |
|
3407 TVerdict CTestSetChannelVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3408 { |
|
3409 TVerdict ret = EPass; |
|
3410 TInt expErr = KErrNone; |
|
3411 TInt channel = 0; |
|
3412 TReal32 volume = 0; |
|
3413 |
|
3414 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume")); |
|
3415 // expected results |
|
3416 switch(iTestType) |
|
3417 { |
|
3418 case ETestValid: |
|
3419 expErr = KErrNone; |
|
3420 break; |
|
3421 case ETestInvalidChannelOutOfRange: |
|
3422 expErr = KErrArgument; |
|
3423 channel = 16; |
|
3424 volume = 10; |
|
3425 break; |
|
3426 case ETestVolumeHighOutOfRange: |
|
3427 expErr = KErrArgument; |
|
3428 channel = 0; |
|
3429 volume = aMidi->MaxChannelVolumeL()+1; |
|
3430 break; |
|
3431 case ETestVolumeLowOutOfRange: |
|
3432 expErr = KErrNone; //real controller may return KErrArgument if out of range |
|
3433 channel = 0; |
|
3434 volume = -1; |
|
3435 break; |
|
3436 default: |
|
3437 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3438 return EInconclusive; |
|
3439 } |
|
3440 |
|
3441 TRAPD(err, aMidi->SetChannelVolumeL(channel, volume)); |
|
3442 if (expErr != err) |
|
3443 { |
|
3444 ERR_PRINTF3(_L("SetChannelVolumeL gave error %d (expected %d)"),err, expErr); |
|
3445 ret = EFail; |
|
3446 } |
|
3447 else |
|
3448 INFO_PRINTF3(_L("SetChannelVolumeL %d = %d"),err ,expErr); |
|
3449 |
|
3450 return ret; |
|
3451 } |
|
3452 |
|
3453 //Check this |
|
3454 //------------------------------------------------------------------ |
|
3455 CTestSetChannelMute::CTestSetChannelMute(const TDesC& aTestName, const TTestStepType aTestType) |
|
3456 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3457 { |
|
3458 } |
|
3459 |
|
3460 CTestSetChannelMute* CTestSetChannelMute::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3461 { |
|
3462 CTestSetChannelMute* self = new(ELeave) CTestSetChannelMute(aTestName, aTestType); |
|
3463 return self; |
|
3464 } |
|
3465 |
|
3466 TVerdict CTestSetChannelMute::DoTestL(CMidiClientUtility* aMidi) |
|
3467 { |
|
3468 TVerdict ret = EPass; |
|
3469 TInt expErr = KErrNone; |
|
3470 TInt channel = 0; |
|
3471 TBool muted = ETrue; |
|
3472 |
|
3473 INFO_PRINTF1(_L("CMidiClientUtility: Set channel mute")); |
|
3474 // expected results |
|
3475 switch(iTestType) |
|
3476 { |
|
3477 case ETestValid: |
|
3478 expErr = KErrNone; |
|
3479 break; |
|
3480 case ETestInvalidChannelOutOfRange: |
|
3481 expErr = KErrArgument; |
|
3482 channel = 16; |
|
3483 break; |
|
3484 |
|
3485 default: |
|
3486 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3487 return EInconclusive; |
|
3488 } |
|
3489 |
|
3490 TRAPD(err, aMidi->SetChannelMuteL(channel, muted)); |
|
3491 |
|
3492 // check correct result |
|
3493 if (iTestType == ETestValid) |
|
3494 { |
|
3495 TBool currMuted = EFalse; |
|
3496 |
|
3497 // until real MIDI controller IsChannelMuteL is always TRUE |
|
3498 TRAPD(err2, currMuted = aMidi->IsChannelMuteL(channel)); |
|
3499 |
|
3500 if(err2 != KErrNone) |
|
3501 { |
|
3502 ERR_PRINTF2(_L("IsChannelMuteL() returned %d"), err2); |
|
3503 ret = EInconclusive; |
|
3504 return ret; |
|
3505 } |
|
3506 |
|
3507 if(currMuted != muted) |
|
3508 { |
|
3509 ERR_PRINTF2(_L("Error : expected %d"), muted); |
|
3510 ret = EFail; |
|
3511 return ret; |
|
3512 } |
|
3513 } |
|
3514 |
|
3515 |
|
3516 if (expErr != err) |
|
3517 { |
|
3518 ERR_PRINTF3(_L("SetChannelMuteL gave error %d (expected %d)"),err, expErr); |
|
3519 ret = EFail; |
|
3520 } |
|
3521 else |
|
3522 INFO_PRINTF3(_L("SetChannelMuteL %d = %d"),err ,expErr); |
|
3523 |
|
3524 return ret; |
|
3525 } |
|
3526 |
|
3527 //------------------------------------------------------------------ |
|
3528 |
|
3529 CTestReturnVolume::CTestReturnVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3530 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3531 { |
|
3532 } |
|
3533 |
|
3534 CTestReturnVolume* CTestReturnVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3535 { |
|
3536 |
|
3537 CTestReturnVolume* self = new(ELeave) CTestReturnVolume(aTestName, aTestType); |
|
3538 return self; |
|
3539 } |
|
3540 |
|
3541 TVerdict CTestReturnVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3542 { |
|
3543 TVerdict ret = EPass; |
|
3544 TInt expErr = KErrNone; |
|
3545 |
|
3546 INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume")); |
|
3547 // expected results |
|
3548 switch(iTestType) |
|
3549 { |
|
3550 case ETestValid: |
|
3551 expErr = KErrNone; |
|
3552 break; |
|
3553 default: |
|
3554 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3555 return EInconclusive; |
|
3556 } |
|
3557 // TInt volume = 0; |
|
3558 // TRAPD(err, volume = aMidi->VolumeL()); |
|
3559 TRAPD(err, aMidi->VolumeL()); // EABI warning removal |
|
3560 if (expErr != err) |
|
3561 { |
|
3562 ERR_PRINTF3(_L("VolumeL gave error %d (expected %d)"),err, expErr); |
|
3563 ret = EFail; |
|
3564 } |
|
3565 else |
|
3566 INFO_PRINTF3(_L("VolumeL %d = %d"),err ,expErr); |
|
3567 |
|
3568 return ret; |
|
3569 } |
|
3570 |
|
3571 //------------------------------------------------------------------ |
|
3572 |
|
3573 CTestReturnMaxVolume::CTestReturnMaxVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3574 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3575 { |
|
3576 } |
|
3577 |
|
3578 CTestReturnMaxVolume* CTestReturnMaxVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3579 { |
|
3580 CTestReturnMaxVolume* self = new(ELeave) CTestReturnMaxVolume(aTestName, aTestType); |
|
3581 return self; |
|
3582 } |
|
3583 |
|
3584 TVerdict CTestReturnMaxVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3585 { |
|
3586 TVerdict ret = EPass; |
|
3587 TInt expErr = KErrNone; |
|
3588 |
|
3589 INFO_PRINTF1(_L("CMidiClientUtility: Return max channel volume")); |
|
3590 // expected results |
|
3591 switch(iTestType) |
|
3592 { |
|
3593 case ETestValid: |
|
3594 expErr = KErrNone; |
|
3595 break; |
|
3596 default: |
|
3597 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3598 return EInconclusive; |
|
3599 } |
|
3600 // TInt volume = 0; |
|
3601 // TRAPD(err, volume = aMidi->MaxVolumeL()); |
|
3602 TRAPD(err, aMidi->MaxVolumeL()); // EABI warning removal |
|
3603 if (expErr != err) |
|
3604 { |
|
3605 ERR_PRINTF3(_L("MaxVolumeL gave error %d (expected %d)"),err, expErr); |
|
3606 ret = EFail; |
|
3607 } |
|
3608 else |
|
3609 INFO_PRINTF3(_L("MaxVolumeL %d = %d"),err ,expErr); |
|
3610 |
|
3611 return ret; |
|
3612 } |
|
3613 |
|
3614 //------------------------------------------------------------------ |
|
3615 |
|
3616 CTestSetVolume::CTestSetVolume(const TDesC& aTestName, const TTestStepType aTestType) |
|
3617 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3618 { |
|
3619 } |
|
3620 |
|
3621 CTestSetVolume* CTestSetVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3622 { |
|
3623 CTestSetVolume* self = new(ELeave) CTestSetVolume(aTestName, aTestType); |
|
3624 return self; |
|
3625 } |
|
3626 |
|
3627 TVerdict CTestSetVolume::DoTestL(CMidiClientUtility* aMidi) |
|
3628 { |
|
3629 TVerdict ret = EPass; |
|
3630 TInt expErr = KErrNone; |
|
3631 TInt volume = 0; |
|
3632 |
|
3633 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume")); |
|
3634 // expected results |
|
3635 switch(iTestType) |
|
3636 { |
|
3637 case ETestValid: |
|
3638 expErr = KErrNone; |
|
3639 volume = 10; |
|
3640 break; |
|
3641 case ETestVolumeHighOutOfRange: |
|
3642 expErr = KErrNotSupported; |
|
3643 volume = 9999999; |
|
3644 break; |
|
3645 case ETestVolumeLowOutOfRange: |
|
3646 expErr = KErrNotSupported; |
|
3647 volume = -9999999; |
|
3648 break; |
|
3649 default: |
|
3650 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3651 return EInconclusive; |
|
3652 } |
|
3653 |
|
3654 TRAPD(err, aMidi->SetVolumeL(volume)); |
|
3655 if (expErr != err) |
|
3656 { |
|
3657 ERR_PRINTF3(_L("SetVolumeL gave error %d (expected %d)"),err, expErr); |
|
3658 ret = EFail; |
|
3659 } |
|
3660 else |
|
3661 INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr); |
|
3662 |
|
3663 return ret; |
|
3664 } |
|
3665 |
|
3666 //------------------------------------------------------------------ |
|
3667 |
|
3668 CTestSetVolumeRamp::CTestSetVolumeRamp(const TDesC& aTestName, const TTestStepType aTestType) |
|
3669 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3670 { |
|
3671 } |
|
3672 |
|
3673 CTestSetVolumeRamp* CTestSetVolumeRamp::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3674 { |
|
3675 CTestSetVolumeRamp* self = new(ELeave) CTestSetVolumeRamp(aTestName, aTestType); |
|
3676 return self; |
|
3677 } |
|
3678 |
|
3679 TVerdict CTestSetVolumeRamp::DoTestL(CMidiClientUtility* aMidi) |
|
3680 { |
|
3681 TVerdict ret = EPass; |
|
3682 TInt expErr = KErrNone; |
|
3683 TTimeIntervalMicroSeconds rampDuration; |
|
3684 |
|
3685 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume ramp")); |
|
3686 // expected results |
|
3687 switch(iTestType) |
|
3688 { |
|
3689 case ETestValid: |
|
3690 expErr = KErrNone; |
|
3691 break; |
|
3692 case ETestRampDurationHighOutOfRange: |
|
3693 expErr = KErrNotSupported; |
|
3694 rampDuration = 9999999; |
|
3695 break; |
|
3696 case ETestRampDurationLowOutOfRange: |
|
3697 expErr = KErrNotSupported; |
|
3698 rampDuration = -9999999; |
|
3699 break; |
|
3700 default: |
|
3701 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3702 return EInconclusive; |
|
3703 } |
|
3704 |
|
3705 TRAPD(err, aMidi->SetVolumeRampL(rampDuration)); |
|
3706 if (expErr != err) |
|
3707 { |
|
3708 ERR_PRINTF3(_L("SetVolumeRampL gave error %d (expected %d)"),err, expErr); |
|
3709 ret = EFail; |
|
3710 } |
|
3711 else |
|
3712 INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr); |
|
3713 |
|
3714 return ret; |
|
3715 } |
|
3716 |
|
3717 //------------------------------------------------------------------ |
|
3718 |
|
3719 CTestGetBalance::CTestGetBalance(const TDesC& aTestName, const TTestStepType aTestType) |
|
3720 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3721 { |
|
3722 } |
|
3723 |
|
3724 CTestGetBalance* CTestGetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3725 { |
|
3726 CTestGetBalance* self = new(ELeave) CTestGetBalance(aTestName, aTestType); |
|
3727 return self; |
|
3728 } |
|
3729 |
|
3730 TVerdict CTestGetBalance::DoTestL(CMidiClientUtility* aMidi) |
|
3731 { |
|
3732 TVerdict ret = EPass; |
|
3733 TInt expErr = KErrNone; |
|
3734 //TTimeIntervalMicroSeconds rampDuration; |
|
3735 |
|
3736 INFO_PRINTF1(_L("CMidiClientUtility: Get balance")); |
|
3737 // expected results |
|
3738 switch(iTestType) |
|
3739 { |
|
3740 case ETestValid: |
|
3741 expErr = KErrNone; |
|
3742 break; |
|
3743 case ETestUnsupported: |
|
3744 expErr = KErrNotSupported; |
|
3745 break; |
|
3746 default: |
|
3747 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3748 return EInconclusive; |
|
3749 } |
|
3750 // TInt getBalance = 0; |
|
3751 // TRAPD(err, getBalance = aMidi->GetBalanceL()); |
|
3752 TRAPD(err, aMidi->GetBalanceL()); // EABI warning removal |
|
3753 |
|
3754 if (expErr != err) |
|
3755 { |
|
3756 ERR_PRINTF3(_L("GetBalanceL gave error %d (expected %d)"),err, expErr); |
|
3757 ret = EFail; |
|
3758 } |
|
3759 else |
|
3760 INFO_PRINTF3(_L("GetBalanceL %d = %d"),err ,expErr); |
|
3761 |
|
3762 return ret; |
|
3763 } |
|
3764 |
|
3765 //------------------------------------------------------------------ |
|
3766 |
|
3767 CTestSetBalance::CTestSetBalance(const TDesC& aTestName, const TTestStepType aTestType) |
|
3768 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3769 { |
|
3770 } |
|
3771 |
|
3772 CTestSetBalance* CTestSetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3773 { |
|
3774 CTestSetBalance* self = new(ELeave) CTestSetBalance(aTestName, aTestType); |
|
3775 return self; |
|
3776 } |
|
3777 |
|
3778 TVerdict CTestSetBalance::DoTestL(CMidiClientUtility* aMidi) |
|
3779 { |
|
3780 TVerdict ret = EPass; |
|
3781 TInt expErr = KErrNone; |
|
3782 // TInt balance = 0; // EABI warning removal |
|
3783 |
|
3784 INFO_PRINTF1(_L("CMidiClientUtility: Set balance")); |
|
3785 // expected results |
|
3786 switch(iTestType) |
|
3787 { |
|
3788 case ETestValid: |
|
3789 expErr = KErrNone; |
|
3790 break; |
|
3791 case ETestUnsupported: |
|
3792 expErr = KErrNotSupported; |
|
3793 break; |
|
3794 case ETestBalanceHighOutOfRange: |
|
3795 expErr = KErrNotSupported; |
|
3796 // balance = 101; // EABI warning removal |
|
3797 break; |
|
3798 case ETestBalanceLowOutOfRange: |
|
3799 expErr = KErrNotSupported; |
|
3800 // balance = -101; // EABI warning removal |
|
3801 break; |
|
3802 default: |
|
3803 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3804 return EInconclusive; |
|
3805 } |
|
3806 |
|
3807 TRAPD(err, aMidi->SetBalanceL()); |
|
3808 if (expErr != err) |
|
3809 { |
|
3810 ERR_PRINTF3(_L("SetBalanceL gave error %d (expected %d)"),err, expErr); |
|
3811 ret = EFail; |
|
3812 } |
|
3813 else |
|
3814 INFO_PRINTF3(_L("SetBalanceL %d = %d"),err ,expErr); |
|
3815 |
|
3816 return ret; |
|
3817 } |
|
3818 |
|
3819 //------------------------------------------------------------------ |
|
3820 |
|
3821 CTestSetPriority::CTestSetPriority(const TDesC& aTestName, const TTestStepType aTestType) |
|
3822 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3823 { |
|
3824 } |
|
3825 |
|
3826 CTestSetPriority* CTestSetPriority::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3827 { |
|
3828 CTestSetPriority* self = new(ELeave) CTestSetPriority(aTestName, aTestType); |
|
3829 return self; |
|
3830 } |
|
3831 |
|
3832 TVerdict CTestSetPriority::DoTestL(CMidiClientUtility* aMidi) |
|
3833 { |
|
3834 TVerdict ret = EPass; |
|
3835 TInt expErr = KErrNone; |
|
3836 TInt priority = 0; |
|
3837 TMdaPriorityPreference pref = EMdaPriorityPreferenceNone; |
|
3838 |
|
3839 INFO_PRINTF1(_L("CMidiClientUtility: Set priority")); |
|
3840 // expected results |
|
3841 switch(iTestType) |
|
3842 { |
|
3843 case ETestValid: |
|
3844 expErr = KErrNone; |
|
3845 break; |
|
3846 case ETestPreferenceConflictsCannotBeResolved: |
|
3847 expErr = KErrNotSupported; |
|
3848 break; |
|
3849 default: |
|
3850 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3851 return EInconclusive; |
|
3852 } |
|
3853 // TMdaPriorityPreference aPref Priority preference to use if there should be contention with another client. |
|
3854 // We need this to confict and cause PreferenceConflictsCannotBeResolved |
|
3855 TRAPD(err, aMidi->SetPriorityL(priority, pref)); |
|
3856 if (expErr != err) |
|
3857 { |
|
3858 ERR_PRINTF3(_L("SetPriorityL gave error %d (expected %d)"),err, expErr); |
|
3859 ret = EFail; |
|
3860 } |
|
3861 else |
|
3862 INFO_PRINTF3(_L("SetPriorityL %d = %d"),err ,expErr); |
|
3863 |
|
3864 return ret; |
|
3865 } |
|
3866 |
|
3867 //------------------------------------------------------------------ |
|
3868 |
|
3869 CTestNumberOfXmfMetaDataEntries::CTestNumberOfXmfMetaDataEntries(const TDesC& aTestName, const TTestStepType aTestType) |
|
3870 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3871 { |
|
3872 } |
|
3873 |
|
3874 CTestNumberOfXmfMetaDataEntries* CTestNumberOfXmfMetaDataEntries::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3875 { |
|
3876 CTestNumberOfXmfMetaDataEntries* self = new(ELeave) CTestNumberOfXmfMetaDataEntries(aTestName, aTestType); |
|
3877 return self; |
|
3878 } |
|
3879 |
|
3880 TVerdict CTestNumberOfXmfMetaDataEntries::DoTestL(CMidiClientUtility* aMidi) |
|
3881 { |
|
3882 TVerdict ret = EPass; |
|
3883 TInt expErr = KErrNone; |
|
3884 |
|
3885 INFO_PRINTF1(_L("CMidiClientUtility: Number Of Xmf Meta Data Entries")); |
|
3886 // expected results |
|
3887 switch(iTestType) |
|
3888 { |
|
3889 case ETestValid: |
|
3890 expErr = KErrNone; |
|
3891 break; |
|
3892 case ETestUnsupported: |
|
3893 expErr = KErrNotSupported; |
|
3894 break; |
|
3895 default: |
|
3896 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3897 return EInconclusive; |
|
3898 } |
|
3899 // TInt numberOfXmfMetaDataEntriesL = 0; |
|
3900 // TRAPD(err, numberOfXmfMetaDataEntriesL = aMidi->NumberOfMetaDataEntriesL()); |
|
3901 TRAPD(err, aMidi->NumberOfMetaDataEntriesL()); // EABI warning removal |
|
3902 if (expErr != err) |
|
3903 { |
|
3904 ERR_PRINTF3(_L("NumberOfXmfMetaDataEntriesL gave error %d (expected %d)"),err, expErr); |
|
3905 ret = EFail; |
|
3906 } |
|
3907 else |
|
3908 INFO_PRINTF3(_L("NumberOfXmfMetaDataEntriesL %d = %d"),err ,expErr); |
|
3909 |
|
3910 return ret; |
|
3911 } |
|
3912 |
|
3913 //------------------------------------------------------------------ |
|
3914 |
|
3915 CTestGetXmfMetaDataEntry::CTestGetXmfMetaDataEntry(const TDesC& aTestName, const TTestStepType aTestType) |
|
3916 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3917 { |
|
3918 } |
|
3919 |
|
3920 CTestGetXmfMetaDataEntry* CTestGetXmfMetaDataEntry::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
3921 { |
|
3922 CTestGetXmfMetaDataEntry* self = new(ELeave) CTestGetXmfMetaDataEntry(aTestName, aTestType); |
|
3923 return self; |
|
3924 } |
|
3925 |
|
3926 TVerdict CTestGetXmfMetaDataEntry::DoTestL(CMidiClientUtility* /*aMidi*/) |
|
3927 { |
|
3928 TVerdict ret = EPass; |
|
3929 TInt err = KErrNone; |
|
3930 |
|
3931 TInt expErr = KErrNone; |
|
3932 // TInt metaDataIndex = 1; // EABI warning removal |
|
3933 |
|
3934 INFO_PRINTF1(_L("CMidiClientUtility: Get Xmf Meta Data Entry")); |
|
3935 // expected results |
|
3936 switch(iTestType) |
|
3937 { |
|
3938 case ETestValid: |
|
3939 expErr = KErrNone; |
|
3940 break; |
|
3941 case ETestUnsupported: |
|
3942 expErr = KErrNotSupported; |
|
3943 break; |
|
3944 case ETestMetaDataIndexInvalid: |
|
3945 // metaDataIndex = -1; // EABI warning removal |
|
3946 break; |
|
3947 default: |
|
3948 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
3949 return EInconclusive; |
|
3950 } |
|
3951 |
|
3952 // Default constructor. Returns a blank meta data object. To be used when internalizing data into the object. |
|
3953 // CMMFMetaDataEntry* getXmfMetaDataEntry = CMMFMetaDataEntry::NewL(); |
|
3954 |
|
3955 // Causes Access Violation |
|
3956 // TRAPD(err, CMMFMetaDataEntry* getXmfMetaDataEntry = aMidi->GetMetaDataEntryL(metaDataIndex)); |
|
3957 if (expErr != err) |
|
3958 { |
|
3959 ERR_PRINTF3(_L("GetXmfMetaDataEntry gave error %d (expected %d)"), err, expErr); |
|
3960 ret = EFail; |
|
3961 } |
|
3962 else |
|
3963 INFO_PRINTF3(_L("GetXmfMetaDataEntry %d = %d"),err ,expErr); |
|
3964 |
|
3965 return ret; |
|
3966 } |
|
3967 |
|
3968 //------------------------------------------------------------------ |
|
3969 |
|
3970 |
|
3971 //------------------------------------------------------------------ |
|
3972 |
|
3973 CTestLoadCustomInstrumentData::CTestLoadCustomInstrumentData(const TDesC& aTestName, |
|
3974 const TTestStepType aTestType) |
|
3975 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
3976 { |
|
3977 } |
|
3978 |
|
3979 CTestLoadCustomInstrumentData* CTestLoadCustomInstrumentData::NewL(const TDesC& aTestName, |
|
3980 const TTestStepType aTestType) |
|
3981 { |
|
3982 CTestLoadCustomInstrumentData* self = new (ELeave) CTestLoadCustomInstrumentData(aTestName, |
|
3983 aTestType); |
|
3984 return self; |
|
3985 } |
|
3986 |
|
3987 |
|
3988 TVerdict CTestLoadCustomInstrumentData::DoTestL(CMidiClientUtility* aMidi) |
|
3989 { |
|
3990 // N.B. Until there is a MIDI controller there is no sense in having any |
|
3991 // invalid tests since at present LoadCustomInstrumentDataL always returns |
|
3992 // ETrue [it doesn't actually attempt a load]. When we actually have a |
|
3993 // proper MIDI instrument this test can be modified to load this instead of |
|
3994 // the NULL descriptor below. NJ |
|
3995 |
|
3996 TVerdict ret = EPass; |
|
3997 TInt expErr; |
|
3998 |
|
3999 TInt memBankId = 90; |
|
4000 TInt memInstrId = 91; |
|
4001 TInt bankId = 92; |
|
4002 TInt instrId = 93; |
|
4003 |
|
4004 // change these to real descriptors when we have a MIDI instruments |
|
4005 const TDesC8* ptrInstrument = &KNullDesC8; |
|
4006 const TDesC8* ptrBadInstrument = &KNullDesC8; |
|
4007 |
|
4008 // TODO::When we have a MIDI instrument / controller load the instrument |
|
4009 // into the descriptor here. |
|
4010 |
|
4011 // expected results |
|
4012 switch(iTestType) |
|
4013 { |
|
4014 case ETestValid: |
|
4015 expErr = KErrNone; |
|
4016 break; |
|
4017 case ETestInvalidId: |
|
4018 expErr = KErrArgument; |
|
4019 bankId = -2; |
|
4020 break; |
|
4021 case ETestAlreadyLoaded: |
|
4022 // ** to do : load once and attempt to load again. |
|
4023 // when instrument data files are available, this will work |
|
4024 expErr = KErrInUse; |
|
4025 break; |
|
4026 case ETestUnsupported: // ** to define test data for this |
|
4027 expErr = KErrNotSupported; |
|
4028 break; |
|
4029 |
|
4030 default: |
|
4031 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
4032 return EInconclusive; |
|
4033 } |
|
4034 TInt err = KErrNone; |
|
4035 |
|
4036 // bad descriptor test |
|
4037 if (iTestType == ETestUnsupported) |
|
4038 { |
|
4039 // load the bad / unsupported instrument |
|
4040 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrBadInstrument, bankId, instrId, memBankId, memInstrId)); |
|
4041 } |
|
4042 else |
|
4043 { |
|
4044 // if testing already loaded, preload the instrument here |
|
4045 if(iTestType == ETestAlreadyLoaded) |
|
4046 { |
|
4047 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId)); |
|
4048 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentDataL gave error %d"), err); |
|
4049 if(err != KErrNone) |
|
4050 { |
|
4051 ret = EInconclusive; |
|
4052 return ret; |
|
4053 } |
|
4054 } |
|
4055 |
|
4056 // load the instrument |
|
4057 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId)); |
|
4058 } |
|
4059 |
|
4060 INFO_PRINTF3(_L("LoadCustomInstrumentDataL gave error %d (expected %d)"), err, expErr); |
|
4061 if(err != expErr) |
|
4062 { |
|
4063 ret = EFail; |
|
4064 return ret; |
|
4065 } |
|
4066 |
|
4067 return ret; |
|
4068 } |
|
4069 |
|
4070 |
|
4071 //------------------------------------------------------------------ |
|
4072 |
|
4073 |
|
4074 //------------------------------------------------------------------ |
|
4075 |
|
4076 _LIT(KMidiClntChunk, "MidiClntChunk"); |
|
4077 _LIT(KMidiClntSemaphore, "MidiClntSemaphore"); |
|
4078 |
|
4079 CTestCheckInterface::CTestCheckInterface(const TDesC& aTestName, const TTestStepType aTestType) |
|
4080 :CTestMmfMidiClntStep(aTestName,aTestType) |
|
4081 { |
|
4082 } |
|
4083 |
|
4084 CTestCheckInterface* CTestCheckInterface::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
4085 { |
|
4086 CTestCheckInterface* self = new (ELeave) CTestCheckInterface(aTestName, aTestType); |
|
4087 CleanupStack::PushL(self); |
|
4088 self->ConstructL(); |
|
4089 CleanupStack::Pop(self); |
|
4090 return self; |
|
4091 } |
|
4092 |
|
4093 void CTestCheckInterface::ConstructL() |
|
4094 { |
|
4095 User::LeaveIfError(iChunk.CreateGlobal(KMidiClntChunk,20,20)); |
|
4096 User::LeaveIfError(iSemaphore.CreateGlobal(KMidiClntSemaphore, 0)); |
|
4097 |
|
4098 } |
|
4099 |
|
4100 CTestCheckInterface::~CTestCheckInterface() |
|
4101 { |
|
4102 } |
|
4103 |
|
4104 void CTestCheckInterface::Close() |
|
4105 { |
|
4106 iChunk.Close(); |
|
4107 iSemaphore.Close(); |
|
4108 } |
|
4109 |
|
4110 |
|
4111 TVerdict CTestCheckInterface::DoTestL(CMidiClientUtility* aMidi) |
|
4112 { |
|
4113 |
|
4114 TVerdict ret = EPass; |
|
4115 TInt expErr = KErrNone; |
|
4116 TInt err = KErrNone; |
|
4117 |
|
4118 // |
|
4119 //PlayNoteL// |
|
4120 // |
|
4121 TRAP_IGNORE(aMidi->PlayNoteL(0,0,TTimeIntervalMicroSeconds(0),0,0)); |
|
4122 err = CompareInterface( _L8("PlayNoteL")); |
|
4123 INFO_PRINTF3(_L("Check interface PlayNoteL gave error %d (expected %d)"), err, expErr); |
|
4124 if(err != expErr) |
|
4125 { |
|
4126 ret = EFail; |
|
4127 return ret; |
|
4128 } |
|
4129 |
|
4130 // |
|
4131 //PlayNoteL(WithStartTime)// |
|
4132 // |
|
4133 TRAP_IGNORE(aMidi->PlayNoteL(0,0,TTimeIntervalMicroSeconds(0),TTimeIntervalMicroSeconds(0),0,0)); |
|
4134 err = CompareInterface(_L8("PlayNoteWithStartTime")); |
|
4135 INFO_PRINTF3(_L("Check interface PlayNoteL (WithStartTime) gave error %d (expected %d)"), err, expErr); |
|
4136 if(err != expErr) |
|
4137 { |
|
4138 ret = EFail; |
|
4139 return ret; |
|
4140 } |
|
4141 |
|
4142 // |
|
4143 //StopNotes// |
|
4144 // |
|
4145 aMidi->StopNotes(0); |
|
4146 err = CompareInterface(_L8("StopNotes")); |
|
4147 INFO_PRINTF3(_L("Check interface StopNotes gave error %d (expected %d)"), err, expErr); |
|
4148 if(err != expErr) |
|
4149 { |
|
4150 ret = EFail; |
|
4151 return ret; |
|
4152 } |
|
4153 |
|
4154 // |
|
4155 //NoteOnL// |
|
4156 // |
|
4157 TRAP_IGNORE(aMidi->NoteOnL(0,0,0)); |
|
4158 err = CompareInterface(_L8("NoteOnL")); |
|
4159 INFO_PRINTF3(_L("Check interface NoteOnL gave error %d (expected %d)"), err, expErr); |
|
4160 if(err != expErr) |
|
4161 { |
|
4162 ret = EFail; |
|
4163 return ret; |
|
4164 } |
|
4165 |
|
4166 // |
|
4167 //NoteOffL// |
|
4168 // |
|
4169 TRAP_IGNORE(aMidi->NoteOffL(0,0,0)); |
|
4170 err = CompareInterface(_L8("NoteOffL")); |
|
4171 INFO_PRINTF3(_L("Check interface NoteOffL gave error %d (expected %d)"), err, expErr); |
|
4172 if(err != expErr) |
|
4173 { |
|
4174 ret = EFail; |
|
4175 return ret; |
|
4176 } |
|
4177 |
|
4178 // |
|
4179 //PlaybackRateL// |
|
4180 // |
|
4181 TRAP_IGNORE(aMidi->PlaybackRateL()); |
|
4182 err = CompareInterface(_L8("PlaybackRateL")); |
|
4183 INFO_PRINTF3(_L("Check interface PlaybackRateL gave error %d (expected %d)"), err, expErr); |
|
4184 if(err != expErr) |
|
4185 { |
|
4186 ret = EFail; |
|
4187 return ret; |
|
4188 } |
|
4189 |
|
4190 // |
|
4191 //SetPlaybackRateL// |
|
4192 // |
|
4193 TRAP_IGNORE(aMidi->SetPlaybackRateL(0)); |
|
4194 err = CompareInterface(_L8("SetPlaybackRateL")); |
|
4195 INFO_PRINTF3(_L("Check interface SetPlaybackRateL gave error %d (expected %d)"), err, expErr); |
|
4196 if(err != expErr) |
|
4197 { |
|
4198 ret = EFail; |
|
4199 return ret; |
|
4200 } |
|
4201 |
|
4202 // |
|
4203 //MaxPlaybackRateL// |
|
4204 // |
|
4205 TRAP_IGNORE(aMidi->MaxPlaybackRateL()); |
|
4206 err = CompareInterface(_L8("MaxPlaybackRateL")); |
|
4207 INFO_PRINTF3(_L("Check interface MaxPlaybackRateL gave error %d (expected %d)"), err, expErr); |
|
4208 if(err != expErr) |
|
4209 { |
|
4210 ret = EFail; |
|
4211 return ret; |
|
4212 } |
|
4213 |
|
4214 // |
|
4215 //MinPlaybackRateL// |
|
4216 // |
|
4217 TRAP_IGNORE(aMidi->MinPlaybackRateL()); |
|
4218 err = CompareInterface(_L8("MinPlaybackRateL")); |
|
4219 INFO_PRINTF3(_L("Check interface MinPlaybackRateL gave error %d (expected %d)"), err, expErr); |
|
4220 if(err != expErr) |
|
4221 { |
|
4222 ret = EFail; |
|
4223 return ret; |
|
4224 } |
|
4225 |
|
4226 // |
|
4227 //TempoMicroBeatsPerMinuteL// |
|
4228 // |
|
4229 TRAP_IGNORE(aMidi->TempoMicroBeatsPerMinuteL()); |
|
4230 err = CompareInterface(_L8("TempoMicroBeatsPerMinuteL")); |
|
4231 INFO_PRINTF3(_L("Check interface TempoMicroBeatsPerMinuteL gave error %d (expected %d)"), err, expErr); |
|
4232 if(err != expErr) |
|
4233 { |
|
4234 ret = EFail; |
|
4235 return ret; |
|
4236 } |
|
4237 |
|
4238 // |
|
4239 //SetTempoL// |
|
4240 // |
|
4241 TRAP_IGNORE(aMidi->SetTempoL(1)); |
|
4242 err = CompareInterface(_L8("SetTempoL")); |
|
4243 INFO_PRINTF3(_L("Check interface SetTempoL gave error %d (expected %d)"), err, expErr); |
|
4244 if(err != expErr) |
|
4245 { |
|
4246 ret = EFail; |
|
4247 return ret; |
|
4248 } |
|
4249 |
|
4250 // |
|
4251 //PitchTranspositionCentsL// |
|
4252 // |
|
4253 TRAP_IGNORE(aMidi->PitchTranspositionCentsL()); |
|
4254 err = CompareInterface(_L8("PitchTranspositionCentsL")); |
|
4255 INFO_PRINTF3(_L("Check interface PitchTranspositionCentsL gave error %d (expected %d)"), err, expErr); |
|
4256 if(err != expErr) |
|
4257 { |
|
4258 ret = EFail; |
|
4259 return ret; |
|
4260 } |
|
4261 |
|
4262 // |
|
4263 //SetPitchTranspositionL// |
|
4264 // |
|
4265 TRAP_IGNORE(aMidi->SetPitchTranspositionL(0)); |
|
4266 err = CompareInterface(_L8("SetPitchTranspositionL")); |
|
4267 INFO_PRINTF3(_L("Check interface SetPitchTranspositionL gave error %d (expected %d)"), err, expErr); |
|
4268 if(err != expErr) |
|
4269 { |
|
4270 ret = EFail; |
|
4271 return ret; |
|
4272 } |
|
4273 |
|
4274 // |
|
4275 //DurationMicroBeatsL// |
|
4276 // |
|
4277 TRAP_IGNORE(aMidi->DurationMicroBeatsL()); |
|
4278 err = CompareInterface(_L8("DurationMicroBeatsL")); |
|
4279 INFO_PRINTF3(_L("Check interface DurationMicroBeatsL gave error %d (expected %d)"), err, expErr); |
|
4280 if(err != expErr) |
|
4281 { |
|
4282 ret = EFail; |
|
4283 return ret; |
|
4284 } |
|
4285 |
|
4286 // |
|
4287 //NumTracksL// |
|
4288 // |
|
4289 TRAP_IGNORE(aMidi->NumTracksL()); |
|
4290 err = CompareInterface(_L8("NumTracksL")); |
|
4291 INFO_PRINTF3(_L("Check interface NumTracksL gave error %d (expected %d)"), err, expErr); |
|
4292 if(err != expErr) |
|
4293 { |
|
4294 ret = EFail; |
|
4295 return ret; |
|
4296 } |
|
4297 |
|
4298 // |
|
4299 //SetTrackMuteL// |
|
4300 // |
|
4301 TRAP_IGNORE(aMidi->SetTrackMuteL(0,ETrue)); |
|
4302 err = CompareInterface(_L8("SetTrackMuteL")); |
|
4303 INFO_PRINTF3(_L("Check interface SetTrackMuteL gave error %d (expected %d)"), err, expErr); |
|
4304 if(err != expErr) |
|
4305 { |
|
4306 ret = EFail; |
|
4307 return ret; |
|
4308 } |
|
4309 |
|
4310 // |
|
4311 //MimeTypeL// |
|
4312 // |
|
4313 TRAP_IGNORE(aMidi->MimeTypeL()); |
|
4314 err = CompareInterface(_L8("MimeTypeL")); |
|
4315 INFO_PRINTF3(_L("Check interface MimeTypeL gave error %d (expected %d)"), err, expErr); |
|
4316 if(err != expErr) |
|
4317 { |
|
4318 ret = EFail; |
|
4319 return ret; |
|
4320 } |
|
4321 |
|
4322 // |
|
4323 //PositionMicroBeatsL// |
|
4324 // |
|
4325 TRAP_IGNORE(aMidi->PositionMicroBeatsL()); |
|
4326 err = CompareInterface(_L8("PositionMicroBeatsL")); |
|
4327 INFO_PRINTF3(_L("Check interface PositionMicroBeatsL gave error %d (expected %d)"), err, expErr); |
|
4328 if(err != expErr) |
|
4329 { |
|
4330 ret = EFail; |
|
4331 return ret; |
|
4332 } |
|
4333 |
|
4334 // |
|
4335 //SetPositionMicroBeatsL// |
|
4336 // |
|
4337 TRAP_IGNORE(aMidi->SetPositionMicroBeatsL(0)); |
|
4338 err = CompareInterface(_L8("SetPositionMicroBeatsL")); |
|
4339 INFO_PRINTF3(_L("Check interface SetPositionMicroBeatsL gave error %d (expected %d)"), err, expErr); |
|
4340 if(err != expErr) |
|
4341 { |
|
4342 ret = EFail; |
|
4343 return ret; |
|
4344 } |
|
4345 |
|
4346 // |
|
4347 //SetSyncUpdateCallbackIntervalL// |
|
4348 // |
|
4349 TRAP_IGNORE(aMidi->SetSyncUpdateCallbackIntervalL(TTimeIntervalMicroSeconds(1))); |
|
4350 err = CompareInterface(_L8("SetSyncUpdateCallbackIntervalL")); |
|
4351 INFO_PRINTF3(_L("Check interface SetSyncUpdateCallbackIntervalL gave error %d (expected %d)"), err, expErr); |
|
4352 if(err != expErr) |
|
4353 { |
|
4354 ret = EFail; |
|
4355 return ret; |
|
4356 } |
|
4357 |
|
4358 // |
|
4359 //SendMessageL// |
|
4360 // |
|
4361 TRAP_IGNORE(aMidi->SendMessageL(_L8(""))); |
|
4362 err = CompareInterface(_L8("SendMessageL")); |
|
4363 INFO_PRINTF3(_L("Check interface SendMessageL gave error %d (expected %d)"), err, expErr); |
|
4364 if(err != expErr) |
|
4365 { |
|
4366 ret = EFail; |
|
4367 return ret; |
|
4368 } |
|
4369 |
|
4370 // |
|
4371 //SendMessageL (WithTimeStamp)// |
|
4372 // |
|
4373 TRAP_IGNORE(aMidi->SendMessageL(_L8(""), TTimeIntervalMicroSeconds(0))); |
|
4374 err = CompareInterface(_L8("SendMessageWithTimeStamp")); |
|
4375 INFO_PRINTF3(_L("Check interface SendMessageL (WithTimeStamp) gave error %d (expected %d)"), err, expErr); |
|
4376 if(err != expErr) |
|
4377 { |
|
4378 ret = EFail; |
|
4379 return ret; |
|
4380 } |
|
4381 |
|
4382 // |
|
4383 //SendMipMessageL// |
|
4384 // |
|
4385 { |
|
4386 TMipMessageEntry mipEntry; |
|
4387 mipEntry.iChannel = 10; |
|
4388 mipEntry.iMIPValue = 20; |
|
4389 RArray<TMipMessageEntry> mipArray; |
|
4390 mipArray.Append(mipEntry); |
|
4391 |
|
4392 TRAP_IGNORE(aMidi->SendMipMessageL(mipArray)); |
|
4393 mipArray.Close(); |
|
4394 } |
|
4395 err = CompareInterface(_L8("SendMipMessageL")); |
|
4396 INFO_PRINTF3(_L("Check interface SendMipMessageL gave error %d (expected %d)"), err, expErr); |
|
4397 if(err != expErr) |
|
4398 { |
|
4399 ret = EFail; |
|
4400 return ret; |
|
4401 } |
|
4402 |
|
4403 // |
|
4404 //NumberOfBanksL// |
|
4405 // |
|
4406 TRAP_IGNORE(aMidi->NumberOfBanksL(ETrue)); |
|
4407 err = CompareInterface(_L8("NumberOfBanksL")); |
|
4408 INFO_PRINTF3(_L("Check interface NumberOfBanksL gave error %d (expected %d)"), err, expErr); |
|
4409 if(err != expErr) |
|
4410 { |
|
4411 ret = EFail; |
|
4412 return ret; |
|
4413 } |
|
4414 |
|
4415 // |
|
4416 //GetBankIdL// |
|
4417 // |
|
4418 TRAP_IGNORE(aMidi->GetBankIdL(ETrue,0)); |
|
4419 err = CompareInterface(_L8("GetBankIdL")); |
|
4420 INFO_PRINTF3(_L("Check interface GetBankIdL gave error %d (expected %d)"), err, expErr); |
|
4421 if(err != expErr) |
|
4422 { |
|
4423 ret = EFail; |
|
4424 return ret; |
|
4425 } |
|
4426 |
|
4427 // |
|
4428 //LoadCustomBankL// |
|
4429 // |
|
4430 { |
|
4431 TInt bankId = 0; |
|
4432 TRAP_IGNORE(aMidi->LoadCustomBankL(_L(""),bankId)); |
|
4433 } |
|
4434 err = CompareInterface(_L8("LoadCustomBankL")); |
|
4435 INFO_PRINTF3(_L("Check interface LoadCustomBankL gave error %d (expected %d)"), err, expErr); |
|
4436 if(err != expErr) |
|
4437 { |
|
4438 ret = EFail; |
|
4439 return ret; |
|
4440 } |
|
4441 |
|
4442 // |
|
4443 //LoadCustomBankDataL// |
|
4444 // |
|
4445 { |
|
4446 TInt bankId = 0; |
|
4447 TRAP_IGNORE(aMidi->LoadCustomBankDataL(_L8(""),bankId)); |
|
4448 } |
|
4449 err = CompareInterface(_L8("LoadCustomBankDataL")); |
|
4450 INFO_PRINTF3(_L("Check interface LoadCustomBankDataL gave error %d (expected %d)"), err, expErr); |
|
4451 if(err != expErr) |
|
4452 { |
|
4453 ret = EFail; |
|
4454 return ret; |
|
4455 } |
|
4456 |
|
4457 // |
|
4458 //UnloadCustomBankL// |
|
4459 // |
|
4460 TRAP_IGNORE(aMidi->UnloadCustomBankL(0)); |
|
4461 err = CompareInterface(_L8("UnloadCustomBankL")); |
|
4462 INFO_PRINTF3(_L("Check interface UnloadCustomBankL gave error %d (expected %d)"), err, expErr); |
|
4463 if(err != expErr) |
|
4464 { |
|
4465 ret = EFail; |
|
4466 return ret; |
|
4467 } |
|
4468 |
|
4469 // |
|
4470 //CustomBankLoadedL// |
|
4471 // |
|
4472 TRAP_IGNORE(aMidi->CustomBankLoadedL(0)); |
|
4473 err = CompareInterface(_L8("CustomBankLoadedL")); |
|
4474 INFO_PRINTF3(_L("Check interface CustomBankLoadedL gave error %d (expected %d)"), err, expErr); |
|
4475 if(err != expErr) |
|
4476 { |
|
4477 ret = EFail; |
|
4478 return ret; |
|
4479 } |
|
4480 |
|
4481 // |
|
4482 //UnloadAllCustomBanksL// |
|
4483 // |
|
4484 TRAP_IGNORE(aMidi->UnloadAllCustomBanksL()); |
|
4485 err = CompareInterface(_L8("UnloadAllCustomBanksL")); |
|
4486 INFO_PRINTF3(_L("Check interface UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr); |
|
4487 if(err != expErr) |
|
4488 { |
|
4489 ret = EFail; |
|
4490 return ret; |
|
4491 } |
|
4492 |
|
4493 // |
|
4494 //NumberOfInstrumentsL// |
|
4495 // |
|
4496 TRAP_IGNORE(aMidi->NumberOfInstrumentsL(0,ETrue)); |
|
4497 err = CompareInterface(_L8("NumberOfInstrumentsL")); |
|
4498 INFO_PRINTF3(_L("Check interface NumberOfInstrumentsL gave error %d (expected %d)"), err, expErr); |
|
4499 if(err != expErr) |
|
4500 { |
|
4501 ret = EFail; |
|
4502 return ret; |
|
4503 } |
|
4504 |
|
4505 // |
|
4506 //GetInstrumentIdL// |
|
4507 // |
|
4508 TRAP_IGNORE(aMidi->GetInstrumentIdL(0, ETrue, 0)); |
|
4509 err = CompareInterface(_L8("GetInstrumentIdL")); |
|
4510 INFO_PRINTF3(_L("Check interface GetInstrumentIdL gave error %d (expected %d)"), err, expErr); |
|
4511 if(err != expErr) |
|
4512 { |
|
4513 ret = EFail; |
|
4514 return ret; |
|
4515 } |
|
4516 |
|
4517 // |
|
4518 //InstrumentNameL// |
|
4519 // |
|
4520 { |
|
4521 HBufC* instrumentName = NULL; |
|
4522 TRAP_IGNORE(instrumentName = aMidi->InstrumentNameL(0, ETrue, 0)); |
|
4523 delete instrumentName; |
|
4524 } |
|
4525 err = CompareInterface(_L8("InstrumentNameL")); |
|
4526 INFO_PRINTF3(_L("Check interface InstrumentNameL gave error %d (expected %d)"), err, expErr); |
|
4527 if(err != expErr) |
|
4528 { |
|
4529 ret = EFail; |
|
4530 return ret; |
|
4531 } |
|
4532 |
|
4533 // |
|
4534 //GetInstrumentL// |
|
4535 // |
|
4536 { |
|
4537 TInt instrumentId = 0; |
|
4538 TInt bankId = 0; |
|
4539 TRAP_IGNORE(aMidi->GetInstrumentL(0, instrumentId, bankId)); |
|
4540 } |
|
4541 err = CompareInterface(_L8("GetInstrumentL")); |
|
4542 INFO_PRINTF3(_L("Check interface GetInstrumentL gave error %d (expected %d)"), err, expErr); |
|
4543 if(err != expErr) |
|
4544 { |
|
4545 ret = EFail; |
|
4546 return ret; |
|
4547 } |
|
4548 |
|
4549 // |
|
4550 //SetInstrumentL// |
|
4551 // |
|
4552 TRAP_IGNORE(aMidi->SetInstrumentL(0, 0, 0)); |
|
4553 err = CompareInterface(_L8("SetInstrumentL")); |
|
4554 INFO_PRINTF3(_L("Check interface SetInstrumentL gave error %d (expected %d)"), err, expErr); |
|
4555 if(err != expErr) |
|
4556 { |
|
4557 ret = EFail; |
|
4558 return ret; |
|
4559 } |
|
4560 |
|
4561 // |
|
4562 //LoadCustomInstrumentL// |
|
4563 // |
|
4564 TRAP_IGNORE(aMidi->LoadCustomInstrumentL(_L(""),0,0,0,0)); |
|
4565 err = CompareInterface(_L8("LoadCustomInstrumentL")); |
|
4566 INFO_PRINTF3(_L("Check interface LoadCustomInstrumentL gave error %d (expected %d)"), err, expErr); |
|
4567 if(err != expErr) |
|
4568 { |
|
4569 ret = EFail; |
|
4570 return ret; |
|
4571 } |
|
4572 |
|
4573 // |
|
4574 //LoadCustomInstrumentDataL// |
|
4575 // |
|
4576 TRAP_IGNORE(aMidi->LoadCustomInstrumentDataL(_L8(""),0,0,0,0)); |
|
4577 err = CompareInterface(_L8("LoadCustomInstrumentDataL")); |
|
4578 INFO_PRINTF3(_L("Check interface LoadCustomInstrumentDataL gave error %d (expected %d)"), err, expErr); |
|
4579 if(err != expErr) |
|
4580 { |
|
4581 ret = EFail; |
|
4582 return ret; |
|
4583 } |
|
4584 |
|
4585 // |
|
4586 //UnloadCustomInstrumentL// |
|
4587 // |
|
4588 TRAP_IGNORE(aMidi->UnloadCustomInstrumentL(0,0)); |
|
4589 err = CompareInterface(_L8("UnloadCustomInstrumentL")); |
|
4590 INFO_PRINTF3(_L("Check interface UnloadCustomInstrumentL gave error %d (expected %d)"), err, expErr); |
|
4591 if(err != expErr) |
|
4592 { |
|
4593 ret = EFail; |
|
4594 return ret; |
|
4595 } |
|
4596 |
|
4597 // |
|
4598 //PercussionKeyNameL// |
|
4599 // |
|
4600 { |
|
4601 HBufC* percussionKeyName = NULL; |
|
4602 TRAP_IGNORE(percussionKeyName = aMidi->PercussionKeyNameL(0,0,0,0)); |
|
4603 delete percussionKeyName; |
|
4604 } |
|
4605 err = CompareInterface(_L8("PercussionKeyNameL")); |
|
4606 INFO_PRINTF3(_L("Check interface PercussionKeyNameL gave error %d (expected %d)"), err, expErr); |
|
4607 if(err != expErr) |
|
4608 { |
|
4609 ret = EFail; |
|
4610 return ret; |
|
4611 } |
|
4612 |
|
4613 // |
|
4614 //StopTimeL// |
|
4615 // |
|
4616 { |
|
4617 TTimeIntervalMicroSeconds stopTime(0); |
|
4618 TRAP_IGNORE(aMidi->StopTimeL(stopTime)); |
|
4619 } |
|
4620 err = CompareInterface(_L8("StopTimeL")); |
|
4621 INFO_PRINTF3(_L("Check interface StopTimeL gave error %d (expected %d)"), err, expErr); |
|
4622 if(err != expErr) |
|
4623 { |
|
4624 ret = EFail; |
|
4625 return ret; |
|
4626 } |
|
4627 |
|
4628 // |
|
4629 //SetStopTimeL// |
|
4630 // |
|
4631 { |
|
4632 TTimeIntervalMicroSeconds stopTime(0); |
|
4633 TRAP_IGNORE(aMidi->SetStopTimeL(stopTime)); |
|
4634 } |
|
4635 err = CompareInterface(_L8("SetStopTimeL")); |
|
4636 INFO_PRINTF3(_L("Check interface SetStopTimeL gave error %d (expected %d)"), err, expErr); |
|
4637 if(err != expErr) |
|
4638 { |
|
4639 ret = EFail; |
|
4640 return ret; |
|
4641 } |
|
4642 |
|
4643 // |
|
4644 //SetRepeatsL// |
|
4645 // |
|
4646 { |
|
4647 TInt repeatNumberOfTimes = 0; |
|
4648 TTimeIntervalMicroSeconds trailingSilence(0); |
|
4649 TRAP_IGNORE(aMidi->SetRepeatsL(repeatNumberOfTimes, trailingSilence)); |
|
4650 } |
|
4651 err = CompareInterface(_L8("SetRepeatsL")); |
|
4652 INFO_PRINTF3(_L("Check interface SetRepeatsL gave error %d (expected %d)"), err, expErr); |
|
4653 if(err != expErr) |
|
4654 { |
|
4655 ret = EFail; |
|
4656 return ret; |
|
4657 } |
|
4658 // |
|
4659 //GetRepeats// |
|
4660 // |
|
4661 TRAP_IGNORE(aMidi->GetRepeats()); |
|
4662 err = CompareInterface(_L8("GetRepeats")); |
|
4663 INFO_PRINTF3(_L("Check interface GetRepeats gave error %d (expected %d)"), err, expErr); |
|
4664 if(err != expErr) |
|
4665 { |
|
4666 ret = EFail; |
|
4667 return ret; |
|
4668 } |
|
4669 |
|
4670 |
|
4671 // |
|
4672 //PolyphonyL// |
|
4673 // |
|
4674 TRAP_IGNORE(aMidi->PolyphonyL()); |
|
4675 err = CompareInterface(_L8("PolyphonyL")); |
|
4676 INFO_PRINTF3(_L("Check interface PolyphonyL gave error %d (expected %d)"), err, expErr); |
|
4677 if(err != expErr) |
|
4678 { |
|
4679 ret = EFail; |
|
4680 return ret; |
|
4681 } |
|
4682 |
|
4683 // |
|
4684 //SetMaxPolyphonyL// |
|
4685 // |
|
4686 TRAP_IGNORE(aMidi->SetMaxPolyphonyL(1)); |
|
4687 err = CompareInterface(_L8("SetMaxPolyphonyL")); |
|
4688 INFO_PRINTF3(_L("Check interface SetMaxPolyphonyL gave error %d (expected %d)"), err, expErr); |
|
4689 if(err != expErr) |
|
4690 { |
|
4691 ret = EFail; |
|
4692 return ret; |
|
4693 } |
|
4694 |
|
4695 // |
|
4696 //ChannelsSupportedL// |
|
4697 // |
|
4698 TRAP_IGNORE(aMidi->ChannelsSupportedL()); |
|
4699 err = CompareInterface(_L8("ChannelsSupportedL")); |
|
4700 INFO_PRINTF3(_L("Check interface ChannelsSupportedL gave error %d (expected %d)"), err, expErr); |
|
4701 if(err != expErr) |
|
4702 { |
|
4703 ret = EFail; |
|
4704 return ret; |
|
4705 } |
|
4706 |
|
4707 // |
|
4708 //ChannelVolumeL// |
|
4709 // |
|
4710 TRAP_IGNORE(aMidi->ChannelVolumeL(0)); |
|
4711 err = CompareInterface(_L8("ChannelVolumeL")); |
|
4712 INFO_PRINTF3(_L("Check interface ChannelVolumeL gave error %d (expected %d)"), err, expErr); |
|
4713 if(err != expErr) |
|
4714 { |
|
4715 ret = EFail; |
|
4716 return ret; |
|
4717 } |
|
4718 |
|
4719 // |
|
4720 //MaxChannelVolumeL// |
|
4721 // |
|
4722 TRAP_IGNORE(aMidi->MaxChannelVolumeL()); |
|
4723 err = CompareInterface(_L8("MaxChannelVolumeL")); |
|
4724 INFO_PRINTF3(_L("Check interface MaxChannelVolumeL gave error %d (expected %d)"), err, expErr); |
|
4725 if(err != expErr) |
|
4726 { |
|
4727 ret = EFail; |
|
4728 return ret; |
|
4729 } |
|
4730 |
|
4731 // |
|
4732 //SetChannelVolumeL// |
|
4733 // |
|
4734 TRAP_IGNORE(aMidi->SetChannelVolumeL(0,0)); |
|
4735 err = CompareInterface(_L8("SetChannelVolumeL")); |
|
4736 INFO_PRINTF3(_L("Check interface SetChannelVolumeL gave error %d (expected %d)"), err, expErr); |
|
4737 if(err != expErr) |
|
4738 { |
|
4739 ret = EFail; |
|
4740 return ret; |
|
4741 } |
|
4742 |
|
4743 // |
|
4744 //SetChannelMuteL// |
|
4745 // |
|
4746 TRAP_IGNORE(aMidi->SetChannelMuteL(0,0)); |
|
4747 err = CompareInterface(_L8("SetChannelMuteL")); |
|
4748 INFO_PRINTF3(_L("Check interface SetChannelMuteL gave error %d (expected %d)"), err, expErr); |
|
4749 if(err != expErr) |
|
4750 { |
|
4751 ret = EFail; |
|
4752 return ret; |
|
4753 } |
|
4754 |
|
4755 // |
|
4756 //VolumeL// |
|
4757 // |
|
4758 TRAP_IGNORE(aMidi->VolumeL()); |
|
4759 err = CompareInterface(_L8("VolumeL")); |
|
4760 INFO_PRINTF3(_L("Check interface VolumeL gave error %d (expected %d)"), err, expErr); |
|
4761 if(err != expErr) |
|
4762 { |
|
4763 ret = EFail; |
|
4764 return ret; |
|
4765 } |
|
4766 |
|
4767 // |
|
4768 //MaxVolumeL// |
|
4769 // |
|
4770 TRAP_IGNORE(aMidi->MaxVolumeL()); |
|
4771 err = CompareInterface(_L8("MaxVolumeL")); |
|
4772 INFO_PRINTF3(_L("Check interface MaxVolumeL gave error %d (expected %d)"), err, expErr); |
|
4773 if(err != expErr) |
|
4774 { |
|
4775 ret = EFail; |
|
4776 return ret; |
|
4777 } |
|
4778 |
|
4779 // |
|
4780 //SetVolumeL// |
|
4781 // |
|
4782 TRAP_IGNORE(aMidi->SetVolumeL(0)); |
|
4783 err = CompareInterface(_L8("SetVolumeL")); |
|
4784 INFO_PRINTF3(_L("Check interface SetVolumeL gave error %d (expected %d)"), err, expErr); |
|
4785 if(err != expErr) |
|
4786 { |
|
4787 ret = EFail; |
|
4788 return ret; |
|
4789 } |
|
4790 |
|
4791 // |
|
4792 //SetVolumeRampL// |
|
4793 // |
|
4794 TRAP_IGNORE(aMidi->SetVolumeRampL(TTimeIntervalMicroSeconds(0))); |
|
4795 err = CompareInterface(_L8("SetVolumeRampL")); |
|
4796 INFO_PRINTF3(_L("Check interface SetVolumeRampL gave error %d (expected %d)"), err, expErr); |
|
4797 if(err != expErr) |
|
4798 { |
|
4799 ret = EFail; |
|
4800 return ret; |
|
4801 } |
|
4802 |
|
4803 // |
|
4804 //GetBalanceL// |
|
4805 // |
|
4806 TRAP_IGNORE(aMidi->GetBalanceL()); |
|
4807 err = CompareInterface(_L8("GetBalanceL")); |
|
4808 INFO_PRINTF3(_L("Check interface GetBalanceL gave error %d (expected %d)"), err, expErr); |
|
4809 if(err != expErr) |
|
4810 { |
|
4811 ret = EFail; |
|
4812 return ret; |
|
4813 } |
|
4814 |
|
4815 // |
|
4816 //SetBalanceL// |
|
4817 // |
|
4818 TRAP_IGNORE(aMidi->SetBalanceL()); |
|
4819 err = CompareInterface(_L8("SetBalanceL")); |
|
4820 INFO_PRINTF3(_L("Check interface SetBalanceL gave error %d (expected %d)"), err, expErr); |
|
4821 if(err != expErr) |
|
4822 { |
|
4823 ret = EFail; |
|
4824 return ret; |
|
4825 } |
|
4826 |
|
4827 // |
|
4828 //SetBankL// |
|
4829 // |
|
4830 TRAP_IGNORE(aMidi->SetBankL(ETrue)); |
|
4831 err = CompareInterface(_L8("SetBankL")); |
|
4832 INFO_PRINTF3(_L("Check interface SetBankL gave error %d (expected %d)"), err, expErr); |
|
4833 if(err != expErr) |
|
4834 { |
|
4835 ret = EFail; |
|
4836 return ret; |
|
4837 } |
|
4838 |
|
4839 // |
|
4840 //IsTrackMuteL// |
|
4841 // |
|
4842 TRAP_IGNORE(aMidi->IsTrackMuteL(0)); |
|
4843 err = CompareInterface(_L8("IsTrackMuteL")); |
|
4844 INFO_PRINTF3(_L("Check interface IsTrackMuteL gave error %d (expected %d)"), err, expErr); |
|
4845 if(err != expErr) |
|
4846 { |
|
4847 ret = EFail; |
|
4848 return ret; |
|
4849 } |
|
4850 |
|
4851 // |
|
4852 //IsChannelMuteL// |
|
4853 // |
|
4854 TRAP_IGNORE(aMidi->IsChannelMuteL(0)); |
|
4855 err = CompareInterface(_L8("IsChannelMuteL")); |
|
4856 INFO_PRINTF3(_L("Check interface IsChannelMuteL gave error %d (expected %d)"), err, expErr); |
|
4857 if(err != expErr) |
|
4858 { |
|
4859 ret = EFail; |
|
4860 return ret; |
|
4861 } |
|
4862 |
|
4863 return ret; |
|
4864 } |
|
4865 |
|
4866 TInt CTestCheckInterface::CompareInterface(const TDesC8& aInterfaceName) |
|
4867 { |
|
4868 TBuf8<40> clientBuf; |
|
4869 TBuf8<40> controllerBuf; |
|
4870 clientBuf.FillZ(40); |
|
4871 controllerBuf.FillZ(40); |
|
4872 |
|
4873 clientBuf.Copy(aInterfaceName); |
|
4874 iSemaphore.Wait(); |
|
4875 controllerBuf = iChunk.Base(); |
|
4876 controllerBuf.SetLength(aInterfaceName.Length()); |
|
4877 |
|
4878 TInt err = clientBuf.Compare(controllerBuf); |
|
4879 |
|
4880 return err; |
|
4881 } |
|
4882 |
|
4883 //-------------------------------------------------------------------------------- |
|
4884 //MS 3.4 File Handles API |
|
4885 //-------------------------------------------------------------------------------- |
|
4886 CTestMidiClntOpenFileByHandle::CTestMidiClntOpenFileByHandle(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TTestStepType aTestType) |
|
4887 :CTestMmfMidiClntStep(aTestName, aTestType), |
|
4888 iPlay(aPlay) |
|
4889 { |
|
4890 iSectName = aSectName; |
|
4891 iKeyName = aKeyName; |
|
4892 } |
|
4893 |
|
4894 CTestMidiClntOpenFileByHandle* CTestMidiClntOpenFileByHandle::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TTestStepType aTestType) |
|
4895 { |
|
4896 CTestMidiClntOpenFileByHandle* self = new(ELeave) CTestMidiClntOpenFileByHandle(aTestName, aSectName, aKeyName, aPlay, aTestType); |
|
4897 return self; |
|
4898 } |
|
4899 |
|
4900 TVerdict CTestMidiClntOpenFileByHandle::DoTestStepL() |
|
4901 { |
|
4902 //[ Local variables ] |
|
4903 TPtrC filename; |
|
4904 TInt expErr = KErrNone; |
|
4905 TVerdict ret = EFail; |
|
4906 |
|
4907 //[ Get the File name from ini file ] |
|
4908 if(!GetStringFromConfig(iSectName,iKeyName,filename)) |
|
4909 { |
|
4910 return EInconclusive; |
|
4911 } |
|
4912 |
|
4913 //[ Expected results ] |
|
4914 switch(iTestType) |
|
4915 { |
|
4916 case ETestValid: |
|
4917 expErr = KErrNone; |
|
4918 break; |
|
4919 case ETestNegative: |
|
4920 expErr = KErrNotSupported; |
|
4921 break; |
|
4922 default: |
|
4923 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
4924 return EInconclusive; |
|
4925 } |
|
4926 |
|
4927 //[ Create CMidiClientUtility - player ] |
|
4928 CMidiClientUtility* player=NULL; |
|
4929 TRAPD(err1, player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality)); |
|
4930 if (err1 != KErrNone) |
|
4931 { |
|
4932 ERR_PRINTF2(_L("Error while creating a CMidiClientUtility : %d"),err1); |
|
4933 return EInconclusive; |
|
4934 } |
|
4935 |
|
4936 if (!player) |
|
4937 { |
|
4938 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
4939 return EInconclusive; |
|
4940 } |
|
4941 CleanupStack::PushL(player); |
|
4942 |
|
4943 TMMFMessageDestinationPckg dummyPckg; |
|
4944 TInt dummyFunc = EDevMidiOff; |
|
4945 TBuf8<8> dummyBuff; |
|
4946 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); |
|
4947 |
|
4948 //[ RFs and RFile ] |
|
4949 RFs rFs; |
|
4950 RFile rFile; |
|
4951 |
|
4952 //[ Connect to File System using RFs ] |
|
4953 User::LeaveIfError(rFs.Connect()); |
|
4954 CleanupClosePushL(rFs); |
|
4955 User::LeaveIfError(rFs.ShareProtected()); |
|
4956 |
|
4957 //[ Open the file using RFile ] |
|
4958 TFileName theDestinationFileName; |
|
4959 theDestinationFileName.Append(filename); |
|
4960 |
|
4961 INFO_PRINTF2(_L("Start : Opening the file : %S by RFile"), &filename); |
|
4962 TInt theRes = rFile.Open(rFs, theDestinationFileName, EFileRead); |
|
4963 User::LeaveIfError(theRes); |
|
4964 CleanupClosePushL(rFile); |
|
4965 INFO_PRINTF2(_L("End : Opening the file : %S by RFile"), &filename); |
|
4966 |
|
4967 //[ API Call ] |
|
4968 player->OpenFile(rFile); |
|
4969 |
|
4970 //[ Wait for Initialisation Callback ] |
|
4971 INFO_PRINTF1(_L("Start : CMidiClientUtility->OpenFile()")); |
|
4972 CActiveScheduler::Start(); |
|
4973 INFO_PRINTF1(_L("End : CMidiClientUtility->OpenFile()")); |
|
4974 |
|
4975 //[ Check for errors ] |
|
4976 if (iError == expErr) |
|
4977 { |
|
4978 INFO_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError); |
|
4979 ret = EPass; |
|
4980 } |
|
4981 else |
|
4982 { |
|
4983 ERR_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError); |
|
4984 ret = EFail; |
|
4985 } |
|
4986 |
|
4987 //[ Clean-up RFs, RFile and CMidiClientUtility ] |
|
4988 CleanupStack::PopAndDestroy(3); |
|
4989 |
|
4990 return ret; |
|
4991 } |
|
4992 |
|
4993 |
|
4994 //------------------------------------------------------------------------ |
|
4995 |
|
4996 CTestMidiClntPlayFileByHandle::CTestMidiClntPlayFileByHandle(const TDesC& aTestName) |
|
4997 :CTestMmfMidiClntStep(aTestName, ETestValid) |
|
4998 { |
|
4999 } |
|
5000 |
|
5001 CTestMidiClntPlayFileByHandle* CTestMidiClntPlayFileByHandle::NewL(const TDesC& aTestName) |
|
5002 { |
|
5003 CTestMidiClntPlayFileByHandle* self = new(ELeave) CTestMidiClntPlayFileByHandle(aTestName); |
|
5004 return self; |
|
5005 } |
|
5006 |
|
5007 TVerdict CTestMidiClntPlayFileByHandle::DoTestL(CMidiClientUtility* aMidi) |
|
5008 { |
|
5009 //[ Local variables ] |
|
5010 TPtrC filename; |
|
5011 |
|
5012 //[ Get the filename ] |
|
5013 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),filename)) |
|
5014 { |
|
5015 return EInconclusive; |
|
5016 } |
|
5017 |
|
5018 INFO_PRINTF1(_L("CMidiClientUtility : Play MIDI File")); |
|
5019 |
|
5020 iCurrentState = EMidiStateClosedDisengaged; |
|
5021 |
|
5022 //[ RFs and RFile ] |
|
5023 RFs rFs; |
|
5024 RFile rFile; |
|
5025 |
|
5026 //[ Connect to File System using RFs ] |
|
5027 User::LeaveIfError(rFs.Connect()); |
|
5028 CleanupClosePushL(rFs); |
|
5029 User::LeaveIfError(rFs.ShareProtected()); |
|
5030 |
|
5031 INFO_PRINTF1(_L("Opening the file : c:\\DoesntExist.mid")); |
|
5032 |
|
5033 //[ Open the file using RFile ] |
|
5034 TInt theRes = rFile.Open(rFs, filename, EFileRead); |
|
5035 if(theRes != KErrNone) |
|
5036 { |
|
5037 INFO_PRINTF2(_L("Cannot open file : %S"), &filename); |
|
5038 } |
|
5039 CleanupClosePushL(rFile); |
|
5040 |
|
5041 //[ Call the OpenFile Method using the File Handle ] |
|
5042 aMidi->OpenFile(rFile); |
|
5043 |
|
5044 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5045 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged |
|
5046 |
|
5047 //[ Clean up RFs and RFile ] |
|
5048 CleanupStack::PopAndDestroy(2); |
|
5049 |
|
5050 if (iCurrentState != EMidiStateOpenDisengaged) |
|
5051 { |
|
5052 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5053 return EFail; |
|
5054 } |
|
5055 aMidi->Play(); |
|
5056 if (iError != KErrNone) |
|
5057 { |
|
5058 ERR_PRINTF2(_L("Play gave error %d"),iError); |
|
5059 return EFail; |
|
5060 } |
|
5061 |
|
5062 INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state...")); |
|
5063 CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying |
|
5064 if (iCurrentState != EMidiStateOpenPlaying) |
|
5065 { |
|
5066 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); |
|
5067 return EFail; |
|
5068 } |
|
5069 |
|
5070 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5071 CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged |
|
5072 if (iCurrentState != EMidiStateOpenEngaged) |
|
5073 { |
|
5074 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5075 return EFail; |
|
5076 } |
|
5077 |
|
5078 return EPass; |
|
5079 } |
|
5080 |
|
5081 |
|
5082 //------------------------------------------------------------------------ |
|
5083 // The purpose of this test is that we can hold more than 10 events in the |
|
5084 // MIDI event queue and none of them gets lost |
|
5085 |
|
5086 CTestMidiClntThirteenMidiEvents::CTestMidiClntThirteenMidiEvents(const TDesC& aTestName, const TTestStepType aTestType) |
|
5087 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
5088 { |
|
5089 // set the current transion to 0, the start point |
|
5090 iCurrentTransion = 0; |
|
5091 } |
|
5092 |
|
5093 |
|
5094 CTestMidiClntThirteenMidiEvents* CTestMidiClntThirteenMidiEvents::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
5095 { |
|
5096 CTestMidiClntThirteenMidiEvents* self = new(ELeave)CTestMidiClntThirteenMidiEvents(aTestName, aTestType); |
|
5097 return self; |
|
5098 } |
|
5099 |
|
5100 void CTestMidiClntThirteenMidiEvents::InitialiseExpectedTransArrayL() |
|
5101 { |
|
5102 User::LeaveIfError(expectedTransitions.Append(EMmcuoTempoChanged)); |
|
5103 User::LeaveIfError(expectedTransitions.Append(EMmcuoVolumeChanged)); |
|
5104 User::LeaveIfError(expectedTransitions.Append(EMmcuoMuteChanged)); |
|
5105 User::LeaveIfError(expectedTransitions.Append(EMmcuoPolyphonyChanged)); |
|
5106 User::LeaveIfError(expectedTransitions.Append(EMmcuoInstrumentChanged)); |
|
5107 User::LeaveIfError(expectedTransitions.Append(EMmcuoMetaDataEntryFound)); |
|
5108 User::LeaveIfError(expectedTransitions.Append(EMmcuoVolumeChanged)); |
|
5109 User::LeaveIfError(expectedTransitions.Append(EMmcuoMuteChanged)); |
|
5110 User::LeaveIfError(expectedTransitions.Append(EMmcuoPolyphonyChanged)); |
|
5111 User::LeaveIfError(expectedTransitions.Append(EMmcuoInstrumentChanged)); |
|
5112 User::LeaveIfError(expectedTransitions.Append(EMmcuoMetaDataEntryFound)); |
|
5113 User::LeaveIfError(expectedTransitions.Append(EMmcuoMipMessageReceived)); |
|
5114 User::LeaveIfError(expectedTransitions.Append(EMmcuoMipMessageReceived)); |
|
5115 |
|
5116 } |
|
5117 |
|
5118 void CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged(TInt /*aMicroBeatsPerMinute*/) |
|
5119 { |
|
5120 if (expectedTransitions[iCurrentTransion] == EMmcuoTempoChanged) |
|
5121 { |
|
5122 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback")); |
|
5123 iCurrentTransion++; |
|
5124 } |
|
5125 else |
|
5126 { |
|
5127 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback not expected")); |
|
5128 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5129 } |
|
5130 } |
|
5131 |
|
5132 void CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged(TInt /*aChannel*/,TReal32 /*aVolumeInDecibels*/) |
|
5133 { |
|
5134 if (expectedTransitions[iCurrentTransion] == EMmcuoVolumeChanged) |
|
5135 { |
|
5136 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback")); |
|
5137 iCurrentTransion++; |
|
5138 } |
|
5139 else |
|
5140 { |
|
5141 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback not expected")); |
|
5142 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5143 } |
|
5144 } |
|
5145 |
|
5146 void CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged(TInt /*aChannel*/,TBool /*aMuted*/) |
|
5147 { |
|
5148 if (expectedTransitions[iCurrentTransion] == EMmcuoMuteChanged) |
|
5149 { |
|
5150 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback")); |
|
5151 iCurrentTransion++; |
|
5152 } |
|
5153 else |
|
5154 { |
|
5155 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback not expected")); |
|
5156 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5157 } |
|
5158 } |
|
5159 |
|
5160 |
|
5161 void CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound(const TInt /*aMetaDataEntryId*/,const TTimeIntervalMicroSeconds& /*aPosition*/) |
|
5162 { |
|
5163 if (expectedTransitions[iCurrentTransion] == EMmcuoMetaDataEntryFound) |
|
5164 { |
|
5165 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback")); |
|
5166 iCurrentTransion++; |
|
5167 } |
|
5168 else |
|
5169 { |
|
5170 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback not expected")); |
|
5171 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5172 } |
|
5173 } |
|
5174 |
|
5175 void CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& /*aEntry*/) |
|
5176 { |
|
5177 if (expectedTransitions[iCurrentTransion] == EMmcuoMipMessageReceived) |
|
5178 { |
|
5179 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback")); |
|
5180 iCurrentTransion++; |
|
5181 } |
|
5182 else |
|
5183 { |
|
5184 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback not expected")); |
|
5185 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5186 } |
|
5187 } |
|
5188 |
|
5189 void CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged(TInt /*aNewPolyphony*/) |
|
5190 { |
|
5191 if (expectedTransitions[iCurrentTransion] == EMmcuoPolyphonyChanged) |
|
5192 { |
|
5193 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback")); |
|
5194 iCurrentTransion++; |
|
5195 } |
|
5196 else |
|
5197 { |
|
5198 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback not expected")); |
|
5199 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5200 } |
|
5201 } |
|
5202 |
|
5203 void CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged(TInt /*aChannel*/,TInt /*aBankId*/,TInt /*aInstrumentId*/) |
|
5204 { |
|
5205 if (expectedTransitions[iCurrentTransion] == EMmcuoInstrumentChanged) |
|
5206 { |
|
5207 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback")); |
|
5208 iCurrentTransion++; |
|
5209 } |
|
5210 else |
|
5211 { |
|
5212 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback not expected")); |
|
5213 expectedTransitions[iCurrentTransion] = EMmcuoInvalid; |
|
5214 } |
|
5215 } |
|
5216 |
|
5217 |
|
5218 TVerdict CTestMidiClntThirteenMidiEvents::DoTestL(CMidiClientUtility* aMidi) |
|
5219 { |
|
5220 TVerdict ret = EPass; |
|
5221 TInt expErr = KErrNone; |
|
5222 |
|
5223 InitialiseExpectedTransArrayL(); |
|
5224 |
|
5225 TPtrC fileName; |
|
5226 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) |
|
5227 { |
|
5228 return EInconclusive; |
|
5229 } |
|
5230 |
|
5231 INFO_PRINTF1(_L("CMidiClientUtility: Play midi file")); |
|
5232 // expected results |
|
5233 switch(iTestType) |
|
5234 { |
|
5235 case ETestValid: |
|
5236 expErr = KErrNone; |
|
5237 break; |
|
5238 case ETestNoPlugin: |
|
5239 expErr = KErrNotSupported; |
|
5240 break; |
|
5241 case ETestInvalidState: |
|
5242 expErr = KErrUnknown; |
|
5243 break; |
|
5244 default: |
|
5245 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
5246 return EInconclusive; |
|
5247 } |
|
5248 |
|
5249 iCurrentState = EMidiStateClosedDisengaged; |
|
5250 aMidi->OpenFile(fileName); |
|
5251 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5252 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged |
|
5253 if (iCurrentState != EMidiStateOpenDisengaged) |
|
5254 { |
|
5255 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5256 expectedTransitions.Close(); |
|
5257 return EFail; |
|
5258 } |
|
5259 |
|
5260 aMidi->Play(); |
|
5261 if (expErr != iError) |
|
5262 { |
|
5263 ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr); |
|
5264 expectedTransitions.Close(); |
|
5265 return EFail; |
|
5266 } |
|
5267 else |
|
5268 { |
|
5269 INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr); |
|
5270 } |
|
5271 |
|
5272 |
|
5273 INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state...")); |
|
5274 CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying |
|
5275 if (iCurrentState != EMidiStateOpenPlaying) |
|
5276 { |
|
5277 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); |
|
5278 expectedTransitions.Close(); |
|
5279 return EFail; |
|
5280 } |
|
5281 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5282 CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged |
|
5283 if (iCurrentState != EMidiStateOpenEngaged) |
|
5284 { |
|
5285 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); |
|
5286 expectedTransitions.Close(); |
|
5287 return EFail; |
|
5288 } |
|
5289 |
|
5290 if (expectedTransitions.Find(EMmcuoInvalid) != KErrNotFound) |
|
5291 { |
|
5292 ERR_PRINTF1(_L("One of the transactions was lost")); |
|
5293 expectedTransitions.Close(); |
|
5294 return EFail; |
|
5295 } |
|
5296 |
|
5297 expectedTransitions.Close(); |
|
5298 |
|
5299 return ret; |
|
5300 } |
|
5301 |
|
5302 //------------------------------------------------------------------ |
|
5303 // TEST 1: Test the transtion from EMidiStateClosedDisengaged to EMidiStateClosedEngaged. |
|
5304 |
|
5305 CTestTrasitionFromEClosedToEClosedEngaged::CTestTrasitionFromEClosedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType) |
|
5306 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
5307 { |
|
5308 } |
|
5309 |
|
5310 CTestTrasitionFromEClosedToEClosedEngaged* CTestTrasitionFromEClosedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
5311 { |
|
5312 CTestTrasitionFromEClosedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEClosedEngaged(aTestName, aTestType); |
|
5313 return self; |
|
5314 } |
|
5315 |
|
5316 TVerdict CTestTrasitionFromEClosedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi) |
|
5317 { |
|
5318 //[ Local variables ] |
|
5319 TVerdict ret = EPass; |
|
5320 TInt expErr = KErrNone; |
|
5321 |
|
5322 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateClosedEngaged")); |
|
5323 //[ Expected results ] |
|
5324 switch(iTestType) |
|
5325 { |
|
5326 case ETestValid: |
|
5327 expErr = KErrNone; |
|
5328 break; |
|
5329 case ETestNoPlugin: |
|
5330 expErr = KErrNotSupported; |
|
5331 break; |
|
5332 case ETestInvalidState: |
|
5333 expErr = KErrUnknown; |
|
5334 break; |
|
5335 default: |
|
5336 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
5337 return EInconclusive; |
|
5338 } |
|
5339 |
|
5340 //[ Set the current state to EMidiStateClosedDisengaged ] |
|
5341 iCurrentState = EMidiStateClosedDisengaged; |
|
5342 |
|
5343 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] |
|
5344 TMidiState MIDIClientState = aMidi->State(); |
|
5345 |
|
5346 if (MIDIClientState == EMidiStateClosedDisengaged) |
|
5347 { |
|
5348 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); |
|
5349 } |
|
5350 else |
|
5351 { |
|
5352 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); |
|
5353 return EFail; |
|
5354 } |
|
5355 |
|
5356 // [ Call Play() ] |
|
5357 aMidi->Play(); |
|
5358 if (expErr != iError) |
|
5359 { |
|
5360 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5361 return EFail; |
|
5362 } |
|
5363 |
|
5364 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateClosedEngaged |
|
5365 |
|
5366 if (iCurrentState != EMidiStateClosedEngaged) |
|
5367 { |
|
5368 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); |
|
5369 return EFail; |
|
5370 } |
|
5371 |
|
5372 MIDIClientState = aMidi->State(); |
|
5373 |
|
5374 if (MIDIClientState == EMidiStateClosedEngaged) |
|
5375 { |
|
5376 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); |
|
5377 } |
|
5378 else |
|
5379 { |
|
5380 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); |
|
5381 return EFail; |
|
5382 } |
|
5383 |
|
5384 return ret; |
|
5385 } |
|
5386 |
|
5387 |
|
5388 //------------------------------------------------------------------ |
|
5389 // TEST 2: Test the transtion from EMidiStateClosedDisengaged to EMidiStateOpenEngaged. |
|
5390 |
|
5391 CTestTrasitionFromEClosedToEOpenEngaged::CTestTrasitionFromEClosedToEOpenEngaged(const TDesC& aTestName, const TTestStepType aTestType) |
|
5392 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
5393 { |
|
5394 } |
|
5395 |
|
5396 CTestTrasitionFromEClosedToEOpenEngaged* CTestTrasitionFromEClosedToEOpenEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
5397 { |
|
5398 CTestTrasitionFromEClosedToEOpenEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEOpenEngaged(aTestName, aTestType); |
|
5399 return self; |
|
5400 } |
|
5401 |
|
5402 TVerdict CTestTrasitionFromEClosedToEOpenEngaged::DoTestL(CMidiClientUtility* aMidi) |
|
5403 { |
|
5404 //[ Local variables ] |
|
5405 TVerdict ret = EPass; |
|
5406 TInt expErr = KErrNone; |
|
5407 |
|
5408 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateOpenEngaged")); |
|
5409 //[ Expected results ] |
|
5410 switch(iTestType) |
|
5411 { |
|
5412 case ETestValid: |
|
5413 expErr = KErrNone; |
|
5414 break; |
|
5415 case ETestNoPlugin: |
|
5416 expErr = KErrNotSupported; |
|
5417 break; |
|
5418 case ETestInvalidState: |
|
5419 expErr = KErrUnknown; |
|
5420 break; |
|
5421 default: |
|
5422 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
5423 return EInconclusive; |
|
5424 } |
|
5425 |
|
5426 //[ Set the current state to EMidiStateClosedDisengaged ] |
|
5427 iCurrentState = EMidiStateClosedDisengaged; |
|
5428 |
|
5429 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] |
|
5430 TMidiState MIDIClientState = aMidi->State(); |
|
5431 |
|
5432 if (MIDIClientState == EMidiStateClosedDisengaged) |
|
5433 { |
|
5434 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); |
|
5435 } |
|
5436 else |
|
5437 { |
|
5438 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); |
|
5439 return EFail; |
|
5440 } |
|
5441 |
|
5442 // [ Call OpenFile() ] |
|
5443 TPtrC fileName; |
|
5444 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) |
|
5445 { |
|
5446 return EInconclusive; |
|
5447 } |
|
5448 aMidi->OpenFile(fileName); |
|
5449 |
|
5450 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged(EMidiStateOpenDisengaged) |
|
5451 if (iCurrentState != EMidiStateOpenDisengaged) |
|
5452 { |
|
5453 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5454 return EFail; |
|
5455 } |
|
5456 |
|
5457 MIDIClientState = aMidi->State(); |
|
5458 if (MIDIClientState == EMidiStateOpenDisengaged) |
|
5459 { |
|
5460 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); |
|
5461 } |
|
5462 else |
|
5463 { |
|
5464 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); |
|
5465 return EFail; |
|
5466 } |
|
5467 |
|
5468 // [ Call Play() ] |
|
5469 aMidi->Play(); |
|
5470 if (expErr != iError) |
|
5471 { |
|
5472 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5473 return EFail; |
|
5474 } |
|
5475 |
|
5476 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying |
|
5477 |
|
5478 if (iCurrentState != EMidiStateOpenPlaying) |
|
5479 { |
|
5480 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); |
|
5481 return EFail; |
|
5482 } |
|
5483 |
|
5484 MIDIClientState = aMidi->State(); |
|
5485 if (MIDIClientState == EMidiStateOpenPlaying) |
|
5486 { |
|
5487 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); |
|
5488 } |
|
5489 else |
|
5490 { |
|
5491 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); |
|
5492 return EFail; |
|
5493 } |
|
5494 |
|
5495 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged |
|
5496 |
|
5497 if (iCurrentState != EMidiStateOpenEngaged) |
|
5498 { |
|
5499 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); |
|
5500 return EFail; |
|
5501 } |
|
5502 |
|
5503 MIDIClientState = aMidi->State(); |
|
5504 |
|
5505 if (MIDIClientState == EMidiStateOpenEngaged) |
|
5506 { |
|
5507 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); |
|
5508 } |
|
5509 else |
|
5510 { |
|
5511 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); |
|
5512 return EFail; |
|
5513 } |
|
5514 |
|
5515 return ret; |
|
5516 } |
|
5517 |
|
5518 |
|
5519 //------------------------------------------------------------------ |
|
5520 // TEST 3: Test the transtion from EMidiStateOpenEngaged to EMidiStateClosedEngaged. |
|
5521 |
|
5522 CTestTrasitionFromEOpenEngagedToEClosedEngaged::CTestTrasitionFromEOpenEngagedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType) |
|
5523 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
5524 { |
|
5525 } |
|
5526 |
|
5527 CTestTrasitionFromEOpenEngagedToEClosedEngaged* CTestTrasitionFromEOpenEngagedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
5528 { |
|
5529 CTestTrasitionFromEOpenEngagedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEOpenEngagedToEClosedEngaged(aTestName, aTestType); |
|
5530 return self; |
|
5531 } |
|
5532 |
|
5533 TVerdict CTestTrasitionFromEOpenEngagedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi) |
|
5534 { |
|
5535 //[ Local variables ] |
|
5536 TVerdict ret = EPass; |
|
5537 TInt expErr = KErrNone; |
|
5538 |
|
5539 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateOpenEngaged to EMidiStateClosedEngaged")); |
|
5540 //[ Expected results ] |
|
5541 switch(iTestType) |
|
5542 { |
|
5543 case ETestValid: |
|
5544 expErr = KErrNone; |
|
5545 break; |
|
5546 case ETestNoPlugin: |
|
5547 expErr = KErrNotSupported; |
|
5548 break; |
|
5549 case ETestInvalidState: |
|
5550 expErr = KErrUnknown; |
|
5551 break; |
|
5552 default: |
|
5553 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
5554 return EInconclusive; |
|
5555 } |
|
5556 |
|
5557 //[ Set the current state to EMidiStateClosedDisengaged ] |
|
5558 iCurrentState = EMidiStateClosedDisengaged; |
|
5559 |
|
5560 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] |
|
5561 TMidiState MIDIClientState = aMidi->State(); |
|
5562 |
|
5563 if (MIDIClientState == EMidiStateClosedDisengaged) |
|
5564 { |
|
5565 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); |
|
5566 } |
|
5567 else |
|
5568 { |
|
5569 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); |
|
5570 return EFail; |
|
5571 } |
|
5572 |
|
5573 // [ Call OpenFile() ] |
|
5574 TPtrC fileName; |
|
5575 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) |
|
5576 { |
|
5577 return EInconclusive; |
|
5578 } |
|
5579 |
|
5580 aMidi->OpenFile(fileName); |
|
5581 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5582 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged |
|
5583 if (iCurrentState != EMidiStateOpenDisengaged) |
|
5584 { |
|
5585 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5586 return EFail; |
|
5587 } |
|
5588 MIDIClientState = aMidi->State(); |
|
5589 |
|
5590 if (MIDIClientState == EMidiStateOpenDisengaged) |
|
5591 { |
|
5592 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); |
|
5593 } |
|
5594 else |
|
5595 { |
|
5596 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); |
|
5597 return EFail; |
|
5598 } |
|
5599 |
|
5600 // [ Call Play() ] |
|
5601 aMidi->Play(); |
|
5602 if (expErr != iError) |
|
5603 { |
|
5604 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5605 return EFail; |
|
5606 } |
|
5607 |
|
5608 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying |
|
5609 |
|
5610 if (iCurrentState != EMidiStateOpenPlaying) |
|
5611 { |
|
5612 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); |
|
5613 return EFail; |
|
5614 } |
|
5615 |
|
5616 MIDIClientState = aMidi->State(); |
|
5617 if (MIDIClientState == EMidiStateOpenPlaying) |
|
5618 { |
|
5619 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); |
|
5620 } |
|
5621 else |
|
5622 { |
|
5623 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); |
|
5624 return EFail; |
|
5625 } |
|
5626 |
|
5627 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged |
|
5628 |
|
5629 if (iCurrentState != EMidiStateOpenEngaged) |
|
5630 { |
|
5631 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); |
|
5632 return EFail; |
|
5633 } |
|
5634 |
|
5635 MIDIClientState = aMidi->State(); |
|
5636 if (MIDIClientState == EMidiStateOpenEngaged) |
|
5637 { |
|
5638 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); |
|
5639 } |
|
5640 else |
|
5641 { |
|
5642 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); |
|
5643 return EFail; |
|
5644 } |
|
5645 |
|
5646 |
|
5647 // [ Call Close() ] |
|
5648 aMidi->Close(); |
|
5649 if (expErr != iError) |
|
5650 { |
|
5651 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5652 return EFail; |
|
5653 } |
|
5654 |
|
5655 CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged |
|
5656 |
|
5657 if (iCurrentState != EMidiStateClosedEngaged) |
|
5658 { |
|
5659 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); |
|
5660 return EFail; |
|
5661 } |
|
5662 |
|
5663 MIDIClientState = aMidi->State(); |
|
5664 if (MIDIClientState == EMidiStateClosedEngaged) |
|
5665 { |
|
5666 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); |
|
5667 } |
|
5668 else |
|
5669 { |
|
5670 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); |
|
5671 return EFail; |
|
5672 } |
|
5673 |
|
5674 return ret; |
|
5675 } |
|
5676 |
|
5677 |
|
5678 |
|
5679 //--------------------------------------------------------------------- |
|
5680 // TEST 4: Test the transtion from EMidiStateClosedEngaged to EMidiStateClosedDisengaged. |
|
5681 |
|
5682 CTestTrasitionFromEClosedEngagedToEClosed::CTestTrasitionFromEClosedEngagedToEClosed(const TDesC& aTestName, const TTestStepType aTestType) |
|
5683 :CTestMmfMidiClntStep(aTestName, aTestType) |
|
5684 { |
|
5685 } |
|
5686 |
|
5687 CTestTrasitionFromEClosedEngagedToEClosed* CTestTrasitionFromEClosedEngagedToEClosed::NewL(const TDesC& aTestName, const TTestStepType aTestType) |
|
5688 { |
|
5689 CTestTrasitionFromEClosedEngagedToEClosed* self = new(ELeave) CTestTrasitionFromEClosedEngagedToEClosed(aTestName, aTestType); |
|
5690 return self; |
|
5691 } |
|
5692 |
|
5693 TVerdict CTestTrasitionFromEClosedEngagedToEClosed::DoTestL(CMidiClientUtility* aMidi) |
|
5694 { |
|
5695 //[ Local variables ] |
|
5696 TVerdict ret = EPass; |
|
5697 TInt expErr = KErrNone; |
|
5698 |
|
5699 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedEngaged to EMidiStateClosedDisengaged")); |
|
5700 //[ Expected results ] |
|
5701 switch(iTestType) |
|
5702 { |
|
5703 case ETestValid: |
|
5704 expErr = KErrNone; |
|
5705 break; |
|
5706 case ETestNoPlugin: |
|
5707 expErr = KErrNotSupported; |
|
5708 break; |
|
5709 case ETestInvalidState: |
|
5710 expErr = KErrUnknown; |
|
5711 break; |
|
5712 default: |
|
5713 ERR_PRINTF1(_L("Error - invalid test step type")); |
|
5714 return EInconclusive; |
|
5715 } |
|
5716 |
|
5717 //[ Set the current state to EMidiStateClosedDisengaged ] |
|
5718 iCurrentState = EMidiStateClosedDisengaged; |
|
5719 |
|
5720 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] |
|
5721 TMidiState MIDIClientState = aMidi->State(); |
|
5722 |
|
5723 if (MIDIClientState == EMidiStateClosedDisengaged) |
|
5724 { |
|
5725 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); |
|
5726 } |
|
5727 else |
|
5728 { |
|
5729 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); |
|
5730 return EFail; |
|
5731 } |
|
5732 |
|
5733 // [ Call OpenFile() ] |
|
5734 TPtrC fileName; |
|
5735 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) |
|
5736 { |
|
5737 return EInconclusive; |
|
5738 } |
|
5739 |
|
5740 aMidi->OpenFile(fileName); |
|
5741 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); |
|
5742 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged |
|
5743 if (iCurrentState != EMidiStateOpenDisengaged) |
|
5744 { |
|
5745 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); |
|
5746 return EFail; |
|
5747 } |
|
5748 |
|
5749 MIDIClientState = aMidi->State(); |
|
5750 if (MIDIClientState == EMidiStateOpenDisengaged) |
|
5751 { |
|
5752 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); |
|
5753 } |
|
5754 else |
|
5755 { |
|
5756 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); |
|
5757 return EFail; |
|
5758 } |
|
5759 |
|
5760 // [ Call Play() ] |
|
5761 aMidi->Play(); |
|
5762 if (expErr != iError) |
|
5763 { |
|
5764 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5765 return EFail; |
|
5766 } |
|
5767 |
|
5768 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying |
|
5769 |
|
5770 if (iCurrentState != EMidiStateOpenPlaying) |
|
5771 { |
|
5772 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); |
|
5773 return EFail; |
|
5774 } |
|
5775 |
|
5776 MIDIClientState = aMidi->State(); |
|
5777 if (MIDIClientState == EMidiStateOpenPlaying) |
|
5778 { |
|
5779 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); |
|
5780 } |
|
5781 else |
|
5782 { |
|
5783 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); |
|
5784 return EFail; |
|
5785 } |
|
5786 |
|
5787 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged |
|
5788 |
|
5789 if (iCurrentState != EMidiStateOpenEngaged) |
|
5790 { |
|
5791 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); |
|
5792 return EFail; |
|
5793 } |
|
5794 |
|
5795 MIDIClientState = aMidi->State(); |
|
5796 |
|
5797 if (MIDIClientState == EMidiStateOpenEngaged) |
|
5798 { |
|
5799 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); |
|
5800 } |
|
5801 else |
|
5802 { |
|
5803 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); |
|
5804 return EFail; |
|
5805 } |
|
5806 |
|
5807 |
|
5808 // [ Call Close() ] |
|
5809 aMidi->Close(); |
|
5810 if (expErr != iError) |
|
5811 { |
|
5812 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5813 return EFail; |
|
5814 } |
|
5815 |
|
5816 CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged |
|
5817 |
|
5818 if (iCurrentState != EMidiStateClosedEngaged) |
|
5819 { |
|
5820 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); |
|
5821 return EFail; |
|
5822 } |
|
5823 |
|
5824 MIDIClientState = aMidi->State(); |
|
5825 if (MIDIClientState == EMidiStateClosedEngaged) |
|
5826 { |
|
5827 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); |
|
5828 } |
|
5829 else |
|
5830 { |
|
5831 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); |
|
5832 return EFail; |
|
5833 } |
|
5834 |
|
5835 // [ Call Stop() ] |
|
5836 TTimeIntervalMicroSeconds fadeOutDuration(0); |
|
5837 aMidi->Stop(fadeOutDuration); |
|
5838 if (expErr != iError) |
|
5839 { |
|
5840 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); |
|
5841 return EFail; |
|
5842 } |
|
5843 |
|
5844 CActiveScheduler::Start(); // EMidiStateClosedEngaged -> EMidiStateClosedDisengaged |
|
5845 |
|
5846 if (iCurrentState != EMidiStateClosedDisengaged) |
|
5847 { |
|
5848 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedDisengaged, received = %d)"), iCurrentState); |
|
5849 return EFail; |
|
5850 } |
|
5851 |
|
5852 MIDIClientState = aMidi->State(); |
|
5853 |
|
5854 if (MIDIClientState == EMidiStateClosedDisengaged) |
|
5855 { |
|
5856 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); |
|
5857 } |
|
5858 else |
|
5859 { |
|
5860 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); |
|
5861 return EFail; |
|
5862 } |
|
5863 return ret; |
|
5864 } |
|
5865 |
|
5866 //------------------------------------------------------------------------ |
|
5867 // This test checks for opening the file using a FileHandle more than |
|
5868 // once. |
|
5869 |
|
5870 |
|
5871 CTestMidiOpenFileHandleRepeat::CTestMidiOpenFileHandleRepeat(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
5872 :CTestMmfMidiClntStep(aTestName, ETestValid), |
|
5873 iPlay(aPlay) |
|
5874 { |
|
5875 iSectName = aSectName; |
|
5876 iKeyName = aKeyName; |
|
5877 } |
|
5878 |
|
5879 CTestMidiOpenFileHandleRepeat* CTestMidiOpenFileHandleRepeat::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
5880 { |
|
5881 CTestMidiOpenFileHandleRepeat* self = new(ELeave) CTestMidiOpenFileHandleRepeat(aTestName, aSectName, aKeyName, aPlay); |
|
5882 return self; |
|
5883 } |
|
5884 |
|
5885 TVerdict CTestMidiOpenFileHandleRepeat::DoTestStepL() |
|
5886 { |
|
5887 TPtrC filename; |
|
5888 if(!GetStringFromConfig(iSectName,iKeyName,filename)) |
|
5889 return EInconclusive; |
|
5890 TVerdict ret = EFail; |
|
5891 INFO_PRINTF1(_L("Test to check whether OpenFile(const RFile& aFile) works fine when opened more than once using the same filehandle ")); |
|
5892 |
|
5893 CMidiClientUtility *midiClient = CMidiClientUtility::NewL(*this); |
|
5894 if (!midiClient) |
|
5895 { |
|
5896 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
5897 return EInconclusive; |
|
5898 } |
|
5899 CleanupStack::PushL(midiClient); |
|
5900 RFs fs; |
|
5901 RFile file; |
|
5902 fs.Connect(); |
|
5903 CleanupClosePushL(fs); |
|
5904 |
|
5905 TMMFMessageDestinationPckg dummyPckg; |
|
5906 TInt dummyFunc = 0; //EDevMidiOff; |
|
5907 TBuf8<8> dummyBuff; |
|
5908 midiClient->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); |
|
5909 TInt err = fs.ShareProtected(); |
|
5910 if ((err = file.Open(fs, filename, EFileRead )) == KErrNone) |
|
5911 { |
|
5912 INFO_PRINTF1(_L("Inside the first call")); |
|
5913 midiClient->OpenFile(file);//opening the file for the first time using the handle |
|
5914 CActiveScheduler::Start(); |
|
5915 midiClient->Close(); |
|
5916 CActiveScheduler::Start(); |
|
5917 file.Close(); |
|
5918 } |
|
5919 err = file.Open(fs, filename, EFileRead);//Opening the file for the second time |
|
5920 if(err==KErrNone) //shouldn't give inuse error at this point |
|
5921 { |
|
5922 INFO_PRINTF1(_L("Inside the second call")); |
|
5923 midiClient->OpenFile(file); |
|
5924 CActiveScheduler::Start(); |
|
5925 midiClient->Close(); |
|
5926 CActiveScheduler::Start(); |
|
5927 file.Close(); |
|
5928 ret=EPass; |
|
5929 } |
|
5930 else |
|
5931 INFO_PRINTF2(_L("Failed to open the file the second time returned with err = %d"),err); |
|
5932 |
|
5933 //To check whether OpenFile(TDesC& aFileName) works fine when opened more than once. |
|
5934 _LIT (KFilename,"c:\\MidiClntITestData\\midi.mid"); |
|
5935 midiClient->OpenFile(KFilename);//First Open(TDesC& aFileName) |
|
5936 // Wait for initialisation callback |
|
5937 INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); |
|
5938 CActiveScheduler::Start(); |
|
5939 if(iError != KErrNone) |
|
5940 { |
|
5941 INFO_PRINTF2(_L("Failed to open the file.Failed with error %d"),err); |
|
5942 } |
|
5943 midiClient->Close(); |
|
5944 CActiveScheduler::Start(); |
|
5945 midiClient->OpenFile(KFilename);//Second Open(TDesC& aFileName) |
|
5946 // Wait for initialisation callback |
|
5947 INFO_PRINTF1(_L("CMidiClientUtility: Opening file for the second time")); |
|
5948 CActiveScheduler::Start(); |
|
5949 if(iError != KErrNone) |
|
5950 { |
|
5951 INFO_PRINTF2(_L("Failed to open the file second time.Failed with error %d"),err); |
|
5952 } |
|
5953 //Opening the file again without calling the close for the previous open |
|
5954 midiClient->OpenFile(KFilename); |
|
5955 INFO_PRINTF1(_L("CMidiClientUtility: Opening file for the second time without close")); |
|
5956 CActiveScheduler::Start(); |
|
5957 if(iError != KErrNone) |
|
5958 { |
|
5959 INFO_PRINTF2(_L("Failed with error %d"),err); |
|
5960 } |
|
5961 midiClient->Close(); |
|
5962 CActiveScheduler::Start(); |
|
5963 |
|
5964 // To check that calling Open twice without closing the file inbetween does return an inuse error |
|
5965 file.Open(fs, filename, EFileRead);//Opening for the first time |
|
5966 User::After(1000000); |
|
5967 err = file.Open(fs, filename, EFileRead);//Opening for the secondtime without closing the previous open, should return KErrInUse |
|
5968 if(err != KErrInUse) |
|
5969 { |
|
5970 ret=EFail; |
|
5971 INFO_PRINTF2(_L("Expected to return error -14, but returned error %d"),err); |
|
5972 } |
|
5973 file.Close(); |
|
5974 CleanupStack::PopAndDestroy(2); // fileServer, midiClient |
|
5975 return ret; |
|
5976 } |
|
5977 |
|
5978 TVerdict CTestMidiOpenFileHandleRepeat::DoTestL(CMidiClientUtility* /*aMidi*/) |
|
5979 { |
|
5980 return EPass; |
|
5981 } |
|
5982 |
|
5983 /* |
|
5984 Playing a midi file without opening a file and checking for its status during call back. |
|
5985 */ |
|
5986 |
|
5987 CTestMidiClntPlayWithoutFile::CTestMidiClntPlayWithoutFile(const TDesC& aTestName) |
|
5988 :CTestMmfMidiClntStep(aTestName, ETestValid) |
|
5989 {} |
|
5990 |
|
5991 CTestMidiClntPlayWithoutFile* CTestMidiClntPlayWithoutFile::NewL(const TDesC& aTestName) |
|
5992 { |
|
5993 CTestMidiClntPlayWithoutFile* self = new(ELeave) CTestMidiClntPlayWithoutFile(aTestName); |
|
5994 return self; |
|
5995 } |
|
5996 |
|
5997 |
|
5998 TVerdict CTestMidiClntPlayWithoutFile::DoTestStepL() |
|
5999 { |
|
6000 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
|
6001 TVerdict ret = EPass; |
|
6002 iError = KErrNone; |
|
6003 |
|
6004 if (!player) |
|
6005 { |
|
6006 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
6007 return EInconclusive; |
|
6008 } |
|
6009 CleanupStack::PushL(player); |
|
6010 |
|
6011 player->Play(); |
|
6012 CActiveScheduler::Start(); |
|
6013 |
|
6014 if (iError != KErrNone) |
|
6015 { |
|
6016 ERR_PRINTF1(_L("Error while playing")); |
|
6017 return EInconclusive; |
|
6018 } |
|
6019 |
|
6020 TTimeIntervalMicroSeconds fadeOutDuration(0); |
|
6021 player->Stop(fadeOutDuration); |
|
6022 CActiveScheduler::Start(); |
|
6023 |
|
6024 // Check for errors. |
|
6025 if (iError != KErrNone) |
|
6026 { |
|
6027 ret = EFail; |
|
6028 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); |
|
6029 } |
|
6030 |
|
6031 INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); |
|
6032 CleanupStack::PopAndDestroy(player); |
|
6033 |
|
6034 return ret; |
|
6035 } |
|
6036 |
|
6037 void CTestMidiClntPlayWithoutFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt aError) |
|
6038 { |
|
6039 iError=aError; |
|
6040 ERR_PRINTF2(_L("Old State: %d "),aOldState); |
|
6041 ERR_PRINTF2(_L("New State : %d "),aNewState); |
|
6042 ERR_PRINTF2(_L("Error Code : %d "),aError); |
|
6043 |
|
6044 if(aError == KErrNone) |
|
6045 { |
|
6046 if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged)) |
|
6047 { |
|
6048 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error")); |
|
6049 } |
|
6050 else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged)) |
|
6051 { |
|
6052 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error")); |
|
6053 } |
|
6054 else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged)) |
|
6055 { |
|
6056 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error")); |
|
6057 } |
|
6058 else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying)) |
|
6059 { |
|
6060 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error")); |
|
6061 } |
|
6062 else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged)) |
|
6063 { |
|
6064 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error")); |
|
6065 } |
|
6066 else |
|
6067 { |
|
6068 INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error")); |
|
6069 } |
|
6070 } |
|
6071 else |
|
6072 { |
|
6073 INFO_PRINTF1(_L("Error during calback")); |
|
6074 } |
|
6075 |
|
6076 CActiveScheduler::Stop(); |
|
6077 } |
|
6078 |
|
6079 //------------------------------------------------------------------ |
|
6080 |
|
6081 /* |
|
6082 Opening a midi file and playing it and checking for its status during call back. |
|
6083 */ |
|
6084 |
|
6085 CTestMidiClntOpenAndPlayFile::CTestMidiClntOpenAndPlayFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName) |
|
6086 :CTestMmfMidiClntStep(aTestName, ETestValid) |
|
6087 { |
|
6088 iSectName = aSectName; |
|
6089 iKeyName = aKeyName; |
|
6090 } |
|
6091 |
|
6092 CTestMidiClntOpenAndPlayFile* CTestMidiClntOpenAndPlayFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName) |
|
6093 { |
|
6094 CTestMidiClntOpenAndPlayFile* self = new(ELeave) CTestMidiClntOpenAndPlayFile(aTestName, aSectName, aKeyName); |
|
6095 return self; |
|
6096 } |
|
6097 |
|
6098 TVerdict CTestMidiClntOpenAndPlayFile::DoTestStepL() |
|
6099 { |
|
6100 TVerdict ret = EPass; |
|
6101 iError = KErrNone; |
|
6102 TPtrC filename; |
|
6103 if(!GetStringFromConfig(iSectName,iKeyName,filename)) |
|
6104 return EInconclusive; |
|
6105 |
|
6106 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
|
6107 if (!player) |
|
6108 { |
|
6109 ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); |
|
6110 return EInconclusive; |
|
6111 } |
|
6112 CleanupStack::PushL(player); |
|
6113 |
|
6114 player->OpenFile(filename); |
|
6115 |
|
6116 // Wait for initialisation callback |
|
6117 INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); |
|
6118 CActiveScheduler::Start(); |
|
6119 |
|
6120 player->Play(); |
|
6121 CActiveScheduler::Start(); |
|
6122 |
|
6123 if (iError != KErrNone) |
|
6124 { |
|
6125 ERR_PRINTF1(_L("Error while playing")); |
|
6126 return EInconclusive; |
|
6127 } |
|
6128 |
|
6129 TTimeIntervalMicroSeconds fadeOutDuration(0); |
|
6130 player->Stop(fadeOutDuration); |
|
6131 CActiveScheduler::Start(); |
|
6132 |
|
6133 // Check for errors. |
|
6134 if (iError != KErrNone) |
|
6135 { |
|
6136 ret = EFail; |
|
6137 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); |
|
6138 } |
|
6139 |
|
6140 INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); |
|
6141 CleanupStack::PopAndDestroy(player); |
|
6142 |
|
6143 return ret; |
|
6144 } |
|
6145 |
|
6146 void CTestMidiClntOpenAndPlayFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt aError) |
|
6147 { |
|
6148 iError=aError; |
|
6149 ERR_PRINTF2(_L("Old State: %d "),aOldState); |
|
6150 ERR_PRINTF2(_L("New State : %d "),aNewState); |
|
6151 ERR_PRINTF2(_L("Error Code : %d "),aError); |
|
6152 |
|
6153 if(aError == KErrNone) |
|
6154 { |
|
6155 if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged)) |
|
6156 { |
|
6157 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error")); |
|
6158 } |
|
6159 else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged)) |
|
6160 { |
|
6161 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error")); |
|
6162 } |
|
6163 else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged)) |
|
6164 { |
|
6165 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error")); |
|
6166 } |
|
6167 else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying)) |
|
6168 { |
|
6169 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error")); |
|
6170 } |
|
6171 else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged)) |
|
6172 { |
|
6173 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error")); |
|
6174 } |
|
6175 else |
|
6176 { |
|
6177 INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error")); |
|
6178 } |
|
6179 } |
|
6180 else |
|
6181 { |
|
6182 INFO_PRINTF1(_L("Error during calback")); |
|
6183 } |
|
6184 |
|
6185 CActiveScheduler::Stop(); |
|
6186 } |
|
6187 |