First public contribution.
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".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
17 #include "TestMidiClientUtility.h"
21 CTestMidiClntOpenFile::CTestMidiClntOpenFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
22 :CTestMmfMidiClntStep(aTestName, ETestValid),
25 iSectName = aSectName;
29 CTestMidiClntOpenFile* CTestMidiClntOpenFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
31 CTestMidiClntOpenFile* self = new(ELeave) CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay);
35 TVerdict CTestMidiClntOpenFile::DoTestStepL()
38 if(!GetStringFromConfig(iSectName,iKeyName,filename))
41 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
44 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
47 CleanupStack::PushL(player);
49 TMMFMessageDestinationPckg dummyPckg;
50 TInt dummyFunc = 0; //EDevMidiOff;
52 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
54 player->OpenFile(filename);
56 // Wait for initialisation callback
57 INFO_PRINTF1(_L("CMidiClientUtility: Opening file"));
58 CActiveScheduler::Start();
63 if (iError == KErrNone)
64 ret = DoTestL(player);
66 INFO_PRINTF1(_L("CMidiClientUtility: Destroying"));
67 CleanupStack::PopAndDestroy(player);
69 if(iError != KErrNone)
70 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError );
75 TVerdict CTestMidiClntOpenFile::DoTestL(CMidiClientUtility* /*aMidi*/)
80 //------------------------------------------------------------------
82 CTestMidiClntOpenDes::CTestMidiClntOpenDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
83 :CTestMmfMidiClntStep(aTestName, ETestValid),
86 iSectName = aSectName;
90 CTestMidiClntOpenDes* CTestMidiClntOpenDes::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
92 CTestMidiClntOpenDes* self = new(ELeave) CTestMidiClntOpenDes(aTestName, aSectName, aKeyName, aPlay);
96 TVerdict CTestMidiClntOpenDes::DoTestStepPreambleL()
99 if(!GetStringFromConfig(iSectName, iKeyName, filename))
100 return EInconclusive;
106 // connect to file system and open file
107 User::LeaveIfError(fs.Connect());
108 User::LeaveIfError(file.Open(fs,filename,EFileRead));
109 CleanupClosePushL(file);
112 User::LeaveIfError(file.Size(size));
113 INFO_PRINTF2(_L("size of file = %d\n"),size);
115 iAudio = HBufC8::NewMaxL(size);
117 // read data into Hbuf
118 TPtr8 bufferDes(iAudio->Des());
119 User::LeaveIfError(file.Read(bufferDes));
121 CleanupStack::PopAndDestroy(); //file
122 return CTestMmfMidiClntStep::DoTestStepPreambleL();
125 TVerdict CTestMidiClntOpenDes::DoTestStepPostambleL()
129 return CTestMmfMidiClntStep::DoTestStepPostambleL();
132 TVerdict CTestMidiClntOpenDes::DoTestStepL()
134 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
137 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
138 return EInconclusive;
141 CleanupStack::PushL(player);
143 TMMFMessageDestinationPckg dummyPckg;
144 TInt dummyFunc = EDevMidiOff;
146 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
148 player->OpenDes(iAudio->Des());
150 // Wait for initialisation callback
151 INFO_PRINTF1(_L("CMidiClientUtility: Opening file"));
152 CActiveScheduler::Start();
154 TVerdict ret = EFail;
157 if (iError == KErrNone)
158 ret = DoTestL(player);
160 INFO_PRINTF1(_L("CMidiClientUtility: Destroying"));
161 CleanupStack::PopAndDestroy(player);
163 if(iError != KErrNone)
164 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError );
169 TVerdict CTestMidiClntOpenDes::DoTestL(CMidiClientUtility* /*aMidi*/)
174 //------------------------------------------------------------------
176 CTestMidiClntOpenUrl::CTestMidiClntOpenUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
177 :CTestMmfMidiClntStep(aTestName, ETestValid),
180 iSectName = aSectName;
184 CTestMidiClntOpenUrl* CTestMidiClntOpenUrl::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
186 CTestMidiClntOpenUrl* self = new(ELeave) CTestMidiClntOpenUrl(aTestName, aSectName, aKeyName, aPlay);
190 TVerdict CTestMidiClntOpenUrl::DoTestStepL()
193 if(!GetStringFromConfig(iSectName,iKeyName,urlname))
194 return EInconclusive;
196 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
199 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
200 return EInconclusive;
203 CleanupStack::PushL(player);
205 TMMFMessageDestinationPckg dummyPckg;
206 TInt dummyFunc = EDevMidiOff;
208 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
210 player->OpenUrl(urlname);
212 // Wait for initialisation callback
213 INFO_PRINTF1(_L("CMidiClientUtility: Opening url"));
214 CActiveScheduler::Start();
216 TVerdict ret = EFail;
219 if (iError == KErrNone)
220 ret = DoTestL(player);
222 INFO_PRINTF1(_L("CMidiClientUtility: Destroying"));
223 CleanupStack::PopAndDestroy(player);
225 if(iError != KErrNone)
226 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError );
231 TVerdict CTestMidiClntOpenUrl::DoTestL(CMidiClientUtility* /*aMidi*/)
236 //------------------------------------------------------------------
238 CTestMidiClntClose::CTestMidiClntClose(const TDesC& aTestName)
239 :CTestMmfMidiClntStep(aTestName, ETestValid)
243 CTestMidiClntClose* CTestMidiClntClose::NewL(const TDesC& aTestName)
245 CTestMidiClntClose* self = new(ELeave) CTestMidiClntClose(aTestName);
249 TVerdict CTestMidiClntClose::DoTestL(CMidiClientUtility* aMidi)
251 INFO_PRINTF1(_L("CMidiClientUtility: Closing file"));
256 //------------------------------------------------------------------
258 CTestMidiClntPlay::CTestMidiClntPlay(const TDesC& aTestName, const TTestStepType aTestType)
259 :CTestMmfMidiClntStep(aTestName, aTestType)
263 CTestMidiClntPlay* CTestMidiClntPlay::NewL(const TDesC& aTestName, const TTestStepType aTestType)
265 CTestMidiClntPlay* self = new(ELeave) CTestMidiClntPlay(aTestName, aTestType);
269 TVerdict CTestMidiClntPlay::DoTestL(CMidiClientUtility* aMidi)
271 TInt expErr = KErrNone;
272 //TTimeIntervalMicroSeconds fadeOutDuration(0);
274 INFO_PRINTF1(_L("CMidiClientUtility: Play midi file"));
282 expErr = KErrNotSupported;
284 case ETestInvalidState:
285 expErr = KErrUnknown;
288 ERR_PRINTF1(_L("Error - invalid test step type"));
289 return EInconclusive;
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)
298 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
303 if (expErr != iError)
305 ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr);
309 INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr);
314 //------------------------------------------------------------------
317 CTestMidiClntStop::CTestMidiClntStop(const TDesC& aTestName, const TTestStepType aTestType)
318 :CTestMmfMidiClntStep(aTestName, aTestType)
322 CTestMidiClntStop* CTestMidiClntStop::NewL(const TDesC& aTestName, const TTestStepType aTestType)
324 CTestMidiClntStop* self = new(ELeave) CTestMidiClntStop(aTestName, aTestType);
328 TVerdict CTestMidiClntStop::DoTestL(CMidiClientUtility* aMidi)
330 TVerdict ret = EPass;
331 TInt expErr = KErrNone;
332 TTimeIntervalMicroSeconds fadeOutDuration(0);
334 INFO_PRINTF1(_L("CMidiClientUtility: Stop midi file"));
340 fadeOutDuration = 20;
343 expErr = KErrNotSupported;
345 case ETestNoResource:
346 expErr = KErrNotReady;
349 ERR_PRINTF1(_L("Error - invalid test step type"));
350 return EInconclusive;
353 aMidi->Stop(fadeOutDuration);
354 if (expErr != KErrNone)
355 INFO_PRINTF2(_L("Stop gave error %d"),expErr);
357 INFO_PRINTF1(_L("Stopping midi file"));
362 //------------------------------------------------------------------
365 CTestMidiClntGetState::CTestMidiClntGetState(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay)
366 :CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay)
368 // NB this inherits from CTestMidiClntOpenFile, NOT from CTestMmfMidiClntStep
369 // so we have to set this manually.
370 iTestType = aTestType;
373 CTestMidiClntGetState* CTestMidiClntGetState::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay)
375 CTestMidiClntGetState* self = new(ELeave) CTestMidiClntGetState(aTestName, aSectName, aKeyName, aTestType, aPlay);
379 TVerdict CTestMidiClntGetState::DoTestL(CMidiClientUtility* aMidi)
381 TVerdict ret = EPass;
383 //TTimeIntervalMicroSeconds fadeOutDuration(10);
385 INFO_PRINTF1(_L("CMidiClientUtility: Get current state of midi file"));
390 expErr = EMidiStateOpenDisengaged;
393 expErr = EMidiStateClosedDisengaged;
394 // Close player so we can perform negative test, get state before any initialisation has been done
398 ERR_PRINTF1(_L("Error - invalid test step type"));
399 return EInconclusive;
402 TMidiState state = aMidi->State();
405 ERR_PRINTF3(_L("State gave error %d (expected %d)"),state, expErr);
409 INFO_PRINTF3(_L("State %d = %d"),state, expErr);
414 //------------------------------------------------------------------
416 CTestMidiClntPlayNote::CTestMidiClntPlayNote(const TDesC& aTestName, const TTestStepType aTestType)
417 :CTestMmfMidiClntStep(aTestName, aTestType)
421 CTestMidiClntPlayNote* CTestMidiClntPlayNote::NewL(const TDesC& aTestName, const TTestStepType aTestType)
423 CTestMidiClntPlayNote* self = new(ELeave) CTestMidiClntPlayNote(aTestName, aTestType);
427 TVerdict CTestMidiClntPlayNote::DoTestL(CMidiClientUtility* aMidi)
429 TVerdict ret = EPass;
430 TInt expErr = KErrNone;
433 TTimeIntervalMicroSeconds duration(10);
434 TInt noteOnVelocity = 0;
435 TInt noteOffVelocity = 0;
437 INFO_PRINTF1(_L("CMidiClientUtility: Play midi note"));
444 case ETestZeroDurationOutOfRange:
445 expErr = KErrNotSupported;
448 case ETestInvalidChannelOutOfRange:
449 expErr = KErrArgument;
452 case ETestNoteHighOutOfRange:
453 expErr = KErrArgument;
456 case ETestNoteLowOutOfRange:
457 expErr = KErrArgument;
460 case ETestAttackHighOutOfRange:
461 expErr = KErrArgument;
462 noteOnVelocity = 128;
464 case ETestAttackLowOutOfRange:
465 expErr = KErrArgument;
468 case ETestReleaseHighOutOfRange:
469 expErr = KErrArgument;
470 noteOffVelocity = 128;
472 case ETestReleaseLowOutOfRange:
473 expErr = KErrArgument;
474 noteOffVelocity = -1;
477 ERR_PRINTF1(_L("Error - invalid test step type"));
478 return EInconclusive;
480 TRAPD(err, aMidi->PlayNoteL(channel, note, duration, noteOnVelocity, noteOffVelocity));
484 ERR_PRINTF3(_L("State gave error %d (expected %d)"),err, expErr);
488 INFO_PRINTF3(_L("PlayNoteL %d = %d"),err ,expErr);
493 //------------------------------------------------------------------
495 CTestMidiClntStopNotes::CTestMidiClntStopNotes(const TDesC& aTestName, const TTestStepType aTestType)
496 :CTestMmfMidiClntStep(aTestName, aTestType)
500 CTestMidiClntStopNotes* CTestMidiClntStopNotes::NewL(const TDesC& aTestName, const TTestStepType aTestType)
502 CTestMidiClntStopNotes* self = new(ELeave) CTestMidiClntStopNotes(aTestName, aTestType);
506 TVerdict CTestMidiClntStopNotes::DoTestL(CMidiClientUtility* aMidi)
508 // The framework will catch the invalid channel and no note available
509 TVerdict ret = EPass;
511 //TInt expErr = KErrNone;
517 case ETestInvalidChannelOutOfRange:
520 case ETestNoNoteAvailable:
523 ERR_PRINTF1(_L("Error - invalid test step type"));
524 return EInconclusive;
527 INFO_PRINTF1(_L("CMidiClientUtility: Stop midi note"));
528 aMidi->StopNotes(channel);
532 //------------------------------------------------------------------
535 CTestMidiClntNoteOn::CTestMidiClntNoteOn(const TDesC& aTestName, const TTestStepType aTestType)
536 :CTestMmfMidiClntStep(aTestName, aTestType)
540 CTestMidiClntNoteOn* CTestMidiClntNoteOn::NewL(const TDesC& aTestName, const TTestStepType aTestType)
542 CTestMidiClntNoteOn* self = new(ELeave) CTestMidiClntNoteOn(aTestName, aTestType);
546 TVerdict CTestMidiClntNoteOn::DoTestL(CMidiClientUtility* aMidi)
548 TVerdict ret = EPass;
549 TInt expErr = KErrNone;
554 INFO_PRINTF1(_L("CMidiClientUtility: Midi note on"));
564 case ETestNoNoteAvailable:
565 expErr = KErrArgument;
567 case ETestInvalidChannelOutOfRange:
568 expErr = KErrArgument;
571 case ETestNoteHighOutOfRange:
572 expErr = KErrArgument;
575 case ETestNoteLowOutOfRange:
576 expErr = KErrArgument;
579 case ETestVelocityHighOutOfRange:
580 expErr = KErrArgument;
583 case ETestVelocityLowOutOfRange:
584 expErr = KErrArgument;
588 ERR_PRINTF1(_L("Error - invalid test step type"));
589 return EInconclusive;
592 TRAPD(err, aMidi->NoteOnL(channel,note,velocity));
595 ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr);
599 INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr);
604 //------------------------------------------------------------------
607 CTestMidiClntNoteOff::CTestMidiClntNoteOff(const TDesC& aTestName, const TTestStepType aTestType)
608 :CTestMmfMidiClntStep(aTestName, aTestType)
612 CTestMidiClntNoteOff* CTestMidiClntNoteOff::NewL(const TDesC& aTestName, const TTestStepType aTestType)
614 CTestMidiClntNoteOff* self = new(ELeave) CTestMidiClntNoteOff(aTestName, aTestType);
618 TVerdict CTestMidiClntNoteOff::DoTestL(CMidiClientUtility* aMidi)
620 TVerdict ret = EPass;
621 TInt expErr = KErrNone;
626 // Play Midi Note on channel=0, note=1, velocity=50
627 TRAPD(err, aMidi->NoteOnL(0,1,50));
630 ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr);
634 INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr);
636 INFO_PRINTF1(_L("CMidiClientUtility: Midi note off"));
646 case ETestNoNoteAvailable:
647 expErr = KErrNone; // No error is raised, as per specification
649 case ETestInvalidChannelOutOfRange:
650 expErr = KErrArgument;
653 case ETestDifferentNoteVelocity:
654 expErr = KErrArgument;
659 ERR_PRINTF1(_L("Error - invalid test step type"));
660 return EInconclusive;
663 TRAPD(err2, aMidi->NoteOffL(channel,note,velocity));
666 ERR_PRINTF3(_L("NoteOffL gave error %d (expected %d)"),err2, expErr);
670 INFO_PRINTF3(_L("NoteOffL %d = %d"),err2 ,expErr);
675 //------------------------------------------------------------------
678 CTestMidiClntReturnPlaybackRate::CTestMidiClntReturnPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType)
679 :CTestMmfMidiClntStep(aTestName, aTestType)
683 CTestMidiClntReturnPlaybackRate* CTestMidiClntReturnPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType)
685 CTestMidiClntReturnPlaybackRate* self = new(ELeave) CTestMidiClntReturnPlaybackRate(aTestName, aTestType);
689 TVerdict CTestMidiClntReturnPlaybackRate::DoTestL(CMidiClientUtility* aMidi)
691 TVerdict ret = EPass;
692 TInt expErr = KErrNone;
694 INFO_PRINTF1(_L("CMidiClientUtility: Check playback rate"));
702 case ETestNoResource:
703 expErr = KErrNotReady;
706 ERR_PRINTF1(_L("Error - invalid test step type"));
707 return EInconclusive;
709 // TInt rate = 0; // fixes warning
711 // TRAPD(err, rate = aMidi->PlaybackRateL());
712 TRAPD(err, aMidi->PlaybackRateL()); // EABI warning removal
715 ERR_PRINTF3( _L("PlaybackRateL gave error %d (expected %d)"),err, expErr);
719 INFO_PRINTF3(_L("PlaybackRateL %d = %d"), err, expErr);
724 //------------------------------------------------------------------
727 CTestMidiClntSetPlaybackRate::CTestMidiClntSetPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType)
728 :CTestMmfMidiClntStep(aTestName, aTestType)
732 CTestMidiClntSetPlaybackRate* CTestMidiClntSetPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType)
734 CTestMidiClntSetPlaybackRate* self = new(ELeave) CTestMidiClntSetPlaybackRate(aTestName, aTestType);
738 TVerdict CTestMidiClntSetPlaybackRate::DoTestL(CMidiClientUtility* aMidi)
740 TVerdict ret = EPass;
741 TInt expErr = KErrNone;
742 TInt playbackRate = 0;
744 INFO_PRINTF1(_L("CMidiClientUtility: Set playback rate"));
751 case ETestNoResource:
752 expErr = KErrNotReady;
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
759 expErr = KErrNotSupported;
761 case ETestOutOfRangeLow:
762 playbackRate = -1; // negative values not supported
763 expErr = KErrNotSupported;
766 ERR_PRINTF1(_L("Error - invalid test step type"));
767 return EInconclusive;
770 TRAPD(err, aMidi->SetPlaybackRateL(playbackRate));
773 ERR_PRINTF3( _L("SetPlaybackRateL gave error %d (expected %d)"),err, expErr);
777 INFO_PRINTF3(_L("SetPlaybackRateL %d = %d"), err, expErr);
782 //------------------------------------------------------------------
785 CTestMidiClntReturnMaxPlayRate::CTestMidiClntReturnMaxPlayRate(const TDesC& aTestName, const TTestStepType aTestType)
786 :CTestMmfMidiClntStep(aTestName, aTestType)
790 CTestMidiClntReturnMaxPlayRate* CTestMidiClntReturnMaxPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType)
792 CTestMidiClntReturnMaxPlayRate* self = new(ELeave) CTestMidiClntReturnMaxPlayRate(aTestName, aTestType);
796 TVerdict CTestMidiClntReturnMaxPlayRate::DoTestL(CMidiClientUtility* aMidi)
798 TVerdict ret = EPass;
799 TInt expErr = KErrNone;
801 INFO_PRINTF1(_L("CMidiClientUtility: Check the max play rate"));
809 case ETestNoResource:
810 expErr = KErrNotReady;
813 ERR_PRINTF1(_L("Error - invalid test step type"));
814 return EInconclusive;
816 // TInt rate = 0; // fixes warning
817 // TRAPD(err, rate = aMidi->MaxPlaybackRateL());
818 TRAPD(err, aMidi->MaxPlaybackRateL()); // EABI warning removal
821 ERR_PRINTF3( _L("MaxPlayRateL gave error %d (expected %d)"),err, expErr);
825 INFO_PRINTF3(_L("MaxPlayRateL %d = %d"), err, expErr);
830 //------------------------------------------------------------------
833 CTestMidiClntReturnMinPlayRate::CTestMidiClntReturnMinPlayRate(const TDesC& aTestName, const TTestStepType aTestType)
834 :CTestMmfMidiClntStep(aTestName, aTestType)
838 CTestMidiClntReturnMinPlayRate* CTestMidiClntReturnMinPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType)
840 CTestMidiClntReturnMinPlayRate* self = new(ELeave) CTestMidiClntReturnMinPlayRate(aTestName, aTestType);
844 TVerdict CTestMidiClntReturnMinPlayRate::DoTestL(CMidiClientUtility* aMidi)
846 TVerdict ret = EPass;
847 TInt expErr = KErrNone;
849 INFO_PRINTF1(_L("CMidiClientUtility: Check the min play rate"));
857 case ETestNoResource:
858 expErr = KErrNotReady;
861 ERR_PRINTF1(_L("Error - invalid test step type"));
862 return EInconclusive;
865 // TInt rate = 0; // fixes warning
866 // TRAPD(err, rate = aMidi->MinPlaybackRateL());
867 TRAPD(err, aMidi->MinPlaybackRateL()); // EABI warning removal
870 ERR_PRINTF3( _L("MinPlayRateL gave error %d (expected %d)"),err, expErr);
874 INFO_PRINTF3(_L("MinPlayRateL %d = %d"), err, expErr);
879 //------------------------------------------------------------------
882 CTestMidiClntTempoMicroBeatsPerMinute::CTestMidiClntTempoMicroBeatsPerMinute(const TDesC& aTestName, const TTestStepType aTestType)
883 :CTestMmfMidiClntStep(aTestName, aTestType)
887 CTestMidiClntTempoMicroBeatsPerMinute* CTestMidiClntTempoMicroBeatsPerMinute::NewL(const TDesC& aTestName, const TTestStepType aTestType)
889 CTestMidiClntTempoMicroBeatsPerMinute* self = new(ELeave) CTestMidiClntTempoMicroBeatsPerMinute(aTestName, aTestType);
893 TVerdict CTestMidiClntTempoMicroBeatsPerMinute::DoTestL(CMidiClientUtility* aMidi)
895 TVerdict ret = EPass;
896 TInt expErr = KErrNone;
897 // TInt microBeatsPerMinute = 0; // EABI warning removal
899 INFO_PRINTF1(_L("CMidiClientUtility: Return the tempo micro beats per minute"));
906 case ETestNoResource:
907 expErr = KErrNotReady;
910 ERR_PRINTF1(_L("Error - invalid test step type"));
911 return EInconclusive;
914 // TRAPD(err, microBeatsPerMinute = aMidi->TempoMicroBeatsPerMinuteL());
915 TRAPD(err, aMidi->TempoMicroBeatsPerMinuteL()); // EABI warning removal
918 ERR_PRINTF3(_L("TempoMicroBeatsPerMinuteL gave error %d (expected %d)"),err, expErr);
922 INFO_PRINTF3(_L("TempoMicroBeatsPerMinuteL %d = %d"),err ,expErr);
927 //------------------------------------------------------------------
930 CTestMidiClntSetTempo::CTestMidiClntSetTempo(const TDesC& aTestName, const TTestStepType aTestType)
931 :CTestMmfMidiClntStep(aTestName, aTestType)
935 CTestMidiClntSetTempo* CTestMidiClntSetTempo::NewL(const TDesC& aTestName, const TTestStepType aTestType)
937 CTestMidiClntSetTempo* self = new(ELeave) CTestMidiClntSetTempo(aTestName, aTestType);
941 TVerdict CTestMidiClntSetTempo::DoTestL(CMidiClientUtility* aMidi)
943 TVerdict ret = EPass;
944 TInt expErr = KErrNone;
945 TInt microBeatsPerMinute = 0;
947 INFO_PRINTF1(_L("CMidiClientUtility: Set the tempo micro beats per minute"));
953 microBeatsPerMinute = 60*1000000;
955 case ETestNoResource:
956 expErr = KErrNotReady;
957 microBeatsPerMinute = 80*1000000;
959 case ETestBeatsLowOutOfRange:
960 expErr = KErrArgument;
961 microBeatsPerMinute = -1*1000000;
963 case ETestBeatsHighOutOfRange:
964 expErr = KErrArgument;
965 //microBeatsPerMinute = 1000001*1000000; XXX overflow warning
966 microBeatsPerMinute = 1000001;
969 ERR_PRINTF1(_L("Error - invalid test step type"));
970 return EInconclusive;
973 TRAPD(err, aMidi->SetTempoL(microBeatsPerMinute));
976 ERR_PRINTF3(_L("SetTempoL gave error %d (expected %d)"),err, expErr);
980 INFO_PRINTF3(_L("SetTempoL %d = %d"),err ,expErr);
985 //------------------------------------------------------------------
988 CTestMidiClntGetPitchTranspositionCents::CTestMidiClntGetPitchTranspositionCents(const TDesC& aTestName, const TTestStepType aTestType)
989 :CTestMmfMidiClntStep(aTestName, aTestType)
993 CTestMidiClntGetPitchTranspositionCents* CTestMidiClntGetPitchTranspositionCents::NewL(const TDesC& aTestName, const TTestStepType aTestType)
995 CTestMidiClntGetPitchTranspositionCents* self = new(ELeave) CTestMidiClntGetPitchTranspositionCents(aTestName, aTestType);
999 TVerdict CTestMidiClntGetPitchTranspositionCents::DoTestL(CMidiClientUtility* aMidi)
1001 TVerdict ret = EPass;
1002 TInt expErr = KErrNone;
1004 INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition"));
1012 case ETestNoResource:
1013 expErr = KErrNotReady;
1016 ERR_PRINTF1(_L("Error - invalid test step type"));
1017 return EInconclusive;
1020 // TInt pitch = 0; // fixes warning
1021 // TRAPD(err, pitch = aMidi->PitchTranspositionCentsL());
1022 TRAPD(err, aMidi->PitchTranspositionCentsL()); // EABI warning removal - "I see trouble ahead..."
1025 ERR_PRINTF3( _L("PitchTranspositionCentsL gave error %d (expected %d)"),err, expErr);
1029 INFO_PRINTF3(_L("PitchTranspositionCentsL %d = %d"), err, expErr);
1034 //------------------------------------------------------------------
1037 CTestMidiClntSetPitchTransposition::CTestMidiClntSetPitchTransposition(const TDesC& aTestName, const TTestStepType aTestType)
1038 :CTestMmfMidiClntStep(aTestName, aTestType)
1042 CTestMidiClntSetPitchTransposition* CTestMidiClntSetPitchTransposition::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1044 CTestMidiClntSetPitchTransposition* self = new(ELeave) CTestMidiClntSetPitchTransposition(aTestName, aTestType);
1048 TVerdict CTestMidiClntSetPitchTransposition::DoTestL(CMidiClientUtility* aMidi)
1050 TVerdict ret = EPass;
1051 TInt expErr = KErrNone;
1052 TInt pitchTrans = 1200; // one octave
1054 INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition"));
1062 case ETestNoResource:
1063 expErr = KErrNotReady;
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
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;
1081 ERR_PRINTF1(_L("Error - invalid test step type"));
1082 return EInconclusive;
1085 TRAPD(err, aMidi->SetPitchTranspositionL(pitchTrans));
1088 ERR_PRINTF3( _L("SetPitchTranspositionL gave error %d (expected %d)"),err, expErr);
1092 INFO_PRINTF3(_L("SetPitchTranspositionL %d = %d"), err, expErr);
1097 //------------------------------------------------------------------
1100 CTestMidiClntDurationMicroSeconds::CTestMidiClntDurationMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType)
1101 :CTestMmfMidiClntStep(aTestName, aTestType)
1105 CTestMidiClntDurationMicroSeconds* CTestMidiClntDurationMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1107 CTestMidiClntDurationMicroSeconds* self = new(ELeave) CTestMidiClntDurationMicroSeconds(aTestName, aTestType);
1111 TVerdict CTestMidiClntDurationMicroSeconds::DoTestL(CMidiClientUtility* aMidi)
1113 TVerdict ret = EPass;
1114 TInt expErr = KErrNone;
1115 TTimeIntervalMicroSeconds durationMicroSeconds(0);
1117 INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro seconds"));
1124 case ETestNoResource:
1125 expErr = KErrNotReady;
1128 ERR_PRINTF1(_L("Error - invalid test step type"));
1129 return EInconclusive;
1132 TRAPD(err, durationMicroSeconds = aMidi->DurationMicroSecondsL());
1135 ERR_PRINTF3(_L("DurationMicroSecondsL gave error %d (expected %d)"),err, expErr);
1139 INFO_PRINTF3(_L("DurationMicroSecondsL %d = %d"),err ,expErr);
1144 //------------------------------------------------------------------
1147 CTestMidiClntDurationMicroBeats::CTestMidiClntDurationMicroBeats(const TDesC& aTestName, const TTestStepType aTestType)
1148 :CTestMmfMidiClntStep(aTestName, aTestType)
1152 CTestMidiClntDurationMicroBeats* CTestMidiClntDurationMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1154 CTestMidiClntDurationMicroBeats* self = new(ELeave) CTestMidiClntDurationMicroBeats(aTestName, aTestType);
1158 TVerdict CTestMidiClntDurationMicroBeats::DoTestL(CMidiClientUtility* aMidi)
1160 TVerdict ret = EPass;
1161 TInt expErr = KErrNone;
1162 //TTimeIntervalMicroSeconds durationMicroSeconds(0);
1164 INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro beats"));
1171 case ETestNoResource:
1172 expErr = KErrNotReady;
1175 ERR_PRINTF1(_L("Error - invalid test step type"));
1176 return EInconclusive;
1178 TRAPD(err, aMidi->DurationMicroBeatsL());
1181 ERR_PRINTF3(_L("DurationMicroBeatsL gave error %d (expected %d)"),err, expErr);
1185 INFO_PRINTF3(_L("DurationMicroBeatsL %d = %d"),err ,expErr);
1190 //------------------------------------------------------------------
1193 CTestMidiClntNumTracks::CTestMidiClntNumTracks(const TDesC& aTestName, const TTestStepType aTestType)
1194 :CTestMmfMidiClntStep(aTestName, aTestType)
1198 CTestMidiClntNumTracks* CTestMidiClntNumTracks::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1200 CTestMidiClntNumTracks* self = new(ELeave) CTestMidiClntNumTracks(aTestName, aTestType);
1204 TVerdict CTestMidiClntNumTracks::DoTestL(CMidiClientUtility* aMidi)
1206 TVerdict ret = EPass;
1207 TInt expErr = KErrNone;
1209 INFO_PRINTF1(_L("CMidiClientUtility: Get current number of tracks"));
1217 ERR_PRINTF1(_L("Error - invalid test step type"));
1218 return EInconclusive;
1220 // TInt numOfTracks = 0;
1221 // TRAPD(err, numOfTracks = aMidi->NumTracksL());
1222 TRAPD(err, aMidi->NumTracksL()); // EABI warning removal
1225 ERR_PRINTF3(_L("NumTracksL gave error %d (expected %d)"),err, expErr);
1229 INFO_PRINTF3(_L("NumTracksL %d = %d"),err ,expErr);
1234 //------------------------------------------------------------------
1237 CTestMidiClntSetTrackMute::CTestMidiClntSetTrackMute(const TDesC& aTestName, const TTestStepType aTestType)
1238 :CTestMmfMidiClntStep(aTestName, aTestType)
1242 CTestMidiClntSetTrackMute* CTestMidiClntSetTrackMute::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1244 CTestMidiClntSetTrackMute* self = new(ELeave) CTestMidiClntSetTrackMute(aTestName, aTestType);
1248 TVerdict CTestMidiClntSetTrackMute::DoTestL(CMidiClientUtility* aMidi)
1250 TVerdict ret = EPass;
1251 TInt expErr = KErrNone;
1253 TBool muted = ETrue;
1255 INFO_PRINTF1(_L("CMidiClientUtility: Set track mute"));
1262 case ETestNoResource:
1263 expErr = KErrNotReady;
1264 TRAP_IGNORE(track = aMidi->NumTracksL()+1);
1266 case ETestInvalidTrack:
1267 expErr = KErrArgument;
1268 TRAP_IGNORE(track = aMidi->NumTracksL()+1);
1271 ERR_PRINTF1(_L("Error - invalid test step type"));
1272 return EInconclusive;
1275 TRAPD(err, aMidi->SetTrackMuteL(track, muted));
1277 // check correct result
1278 if (iTestType == ETestValid)
1280 TBool currMuted = EFalse;
1282 // until real MIDI controller IsTrackMuteL is always TRUE
1283 TRAPD(err2, currMuted = aMidi->IsTrackMuteL(track));
1285 if(err2 != KErrNone)
1287 ERR_PRINTF2(_L("IsTrackMuteL() returned %d"), err2);
1288 ret = EInconclusive;
1292 if(currMuted != muted)
1294 ERR_PRINTF2(_L("Error : expected %d"), muted);
1302 ERR_PRINTF3(_L("SetTrackMuteL gave error %d (expected %d)"),err, expErr);
1306 INFO_PRINTF3(_L("SetTrackMuteL %d = %d"),err ,expErr);
1311 //------------------------------------------------------------------
1314 CTestMidiClntMimeType::CTestMidiClntMimeType(const TDesC& aTestName, const TTestStepType aTestType)
1315 :CTestMmfMidiClntStep(aTestName, aTestType)
1319 CTestMidiClntMimeType* CTestMidiClntMimeType::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1321 CTestMidiClntMimeType* self = new(ELeave) CTestMidiClntMimeType(aTestName, aTestType);
1325 TVerdict CTestMidiClntMimeType::DoTestL(CMidiClientUtility* aMidi)
1327 TVerdict ret = EPass;
1328 TInt expErr = KErrNone;
1330 INFO_PRINTF1(_L("CMidiClientUtility: Get mime type"));
1337 case ETestNoResource:
1338 expErr = KErrNotReady;
1341 ERR_PRINTF1(_L("Error - invalid test step type"));
1342 return EInconclusive;
1345 //TRAPD(err, TDesC8 mimeType = aMidi->MimeTypeL());//XXX: TDesC8 mimeType has to be define above
1346 TRAPD(err, aMidi->MimeTypeL());//XXX: TDesC8 mimeType has to be define above
1349 ERR_PRINTF3(_L("MimeTypeL gave error %d (expected %d)"),err, expErr);
1353 INFO_PRINTF3(_L("MimeTypeL %d = %d"),err ,expErr);
1358 //------------------------------------------------------------------
1361 CTestMidiClntReturnPositionMicroSeconds::CTestMidiClntReturnPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType)
1362 :CTestMmfMidiClntStep(aTestName, aTestType)
1366 CTestMidiClntReturnPositionMicroSeconds* CTestMidiClntReturnPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1368 CTestMidiClntReturnPositionMicroSeconds* self = new(ELeave) CTestMidiClntReturnPositionMicroSeconds(aTestName, aTestType);
1372 TVerdict CTestMidiClntReturnPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi)
1374 TVerdict ret = EPass;
1375 TInt expErr = KErrNone;
1377 INFO_PRINTF1(_L("CMidiClientUtility: Get position in micro seconds"));
1384 case ETestNoResource:
1385 expErr = KErrNotReady;
1387 case ETestNoResourcePlaying:
1388 expErr = KErrNotReady;
1391 ERR_PRINTF1(_L("Error - invalid test step type"));
1392 return EInconclusive;
1394 TTimeIntervalMicroSeconds positionMicroSeconds(0);
1395 TRAPD(err, positionMicroSeconds = aMidi->PositionMicroSecondsL());
1398 if (KErrNotReady != err)
1400 ERR_PRINTF3(_L("Get PositionMicroSecondsL gave error %d (expected %d)"),err, expErr);
1409 INFO_PRINTF3(_L("Get PositionMicroSecondsL %d = %d"),err ,expErr);
1414 //------------------------------------------------------------------
1417 CTestMidiClntSetPositionMicroSeconds::CTestMidiClntSetPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType)
1418 :CTestMmfMidiClntStep(aTestName, aTestType)
1422 CTestMidiClntSetPositionMicroSeconds* CTestMidiClntSetPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1424 CTestMidiClntSetPositionMicroSeconds* self = new(ELeave) CTestMidiClntSetPositionMicroSeconds(aTestName, aTestType);
1428 TVerdict CTestMidiClntSetPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi)
1430 TVerdict ret = EPass;
1431 TInt expErr = KErrNone;
1432 TTimeIntervalMicroSeconds position(0);;
1434 INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro seconds"));
1441 case ETestNoResource:
1442 expErr = KErrNotReady;
1444 case ETestMicrosecondsHighOutOfRange:
1445 expErr = KErrNotSupported;
1448 case ETestMicrosecondsLowOutOfRange:
1449 expErr = KErrNotSupported;
1453 ERR_PRINTF1(_L("Error - invalid test step type"));
1454 return EInconclusive;
1457 TRAPD(err, aMidi->SetPositionMicroSecondsL(position));
1460 ERR_PRINTF3(_L("Set PositionMicroSecondsL gave error %d (expected %d)"),err, expErr);
1464 INFO_PRINTF3(_L("Set PositionMicroSecondsL %d = %d"),err ,expErr);
1469 //------------------------------------------------------------------
1472 CTestMidiClntReturnsPositionMicroBeats::CTestMidiClntReturnsPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType)
1473 :CTestMmfMidiClntStep(aTestName, aTestType)
1477 CTestMidiClntReturnsPositionMicroBeats* CTestMidiClntReturnsPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1479 CTestMidiClntReturnsPositionMicroBeats* self = new(ELeave) CTestMidiClntReturnsPositionMicroBeats(aTestName, aTestType);
1483 TVerdict CTestMidiClntReturnsPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi)
1485 TVerdict ret = EPass;
1486 TInt expErr = KErrNone;
1488 INFO_PRINTF1(_L("CMidiClientUtility: Return position in micro beats"));
1495 case ETestNoResource:
1496 expErr = KErrNotReady;
1498 case ETestNoResourcePlaying:
1499 expErr = KErrNotReady;
1502 ERR_PRINTF1(_L("Error - invalid test step type"));
1503 return EInconclusive;
1505 TRAPD(err, aMidi->PositionMicroBeatsL());
1508 ERR_PRINTF3(_L("PositionMicroBeatsL gave error %d (expected %d)"),err, expErr);
1512 INFO_PRINTF3(_L("PositionMicroBeatsL %d = %d"),err ,expErr);
1517 //------------------------------------------------------------------
1520 CTestMidiClntSetPositionMicroBeats::CTestMidiClntSetPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType)
1521 :CTestMmfMidiClntStep(aTestName, aTestType)
1525 CTestMidiClntSetPositionMicroBeats* CTestMidiClntSetPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1527 CTestMidiClntSetPositionMicroBeats* self = new(ELeave) CTestMidiClntSetPositionMicroBeats(aTestName, aTestType);
1531 TVerdict CTestMidiClntSetPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi)
1533 TVerdict ret = EPass;
1534 TInt expErr = KErrNone;
1535 TInt64 microBeats = 0;
1537 INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro beats"));
1544 case ETestNoResource:
1545 expErr = KErrNotReady;
1547 case ETestMicrobeatsHighOutOfRange:
1548 expErr = KErrNotSupported;
1549 microBeats = 1000000;
1551 case ETestMicrobeatsLowOutOfRange:
1552 expErr = KErrNotSupported;
1556 ERR_PRINTF1(_L("Error - invalid test step type"));
1557 return EInconclusive;
1560 TRAPD(err, aMidi->SetPositionMicroBeatsL(microBeats));
1563 ERR_PRINTF3(_L("SetPositionMicroBeatsL gave error %d (expected %d)"),err, expErr);
1567 INFO_PRINTF3(_L("SetPositionMicroBeatsL %d = %d"),err ,expErr);
1572 //------------------------------------------------------------------
1575 CTestSetSyncUpdateCallbackInterval::CTestSetSyncUpdateCallbackInterval(const TDesC& aTestName, const TTestStepType aTestType)
1576 :CTestMmfMidiClntStep(aTestName, aTestType)
1580 CTestSetSyncUpdateCallbackInterval* CTestSetSyncUpdateCallbackInterval::NewL(const TDesC& aTestName, const TTestStepType aTestType)
1582 CTestSetSyncUpdateCallbackInterval* self = new(ELeave) CTestSetSyncUpdateCallbackInterval(aTestName, aTestType);
1586 TVerdict CTestSetSyncUpdateCallbackInterval::DoTestL(CMidiClientUtility* aMidi)
1588 TVerdict ret = EPass;
1589 TInt expErr = KErrNone;
1590 TTimeIntervalMicroSeconds microSeconds(0);
1591 TInt64 microBeats = 0;
1593 INFO_PRINTF1(_L("CMidiClientUtility: Set update call back interval"));
1600 case ETestMicrosecondsMicrobeatsZero:
1603 expErr = KErrNotReady;
1605 case ETestMicrosecondsLowOutOfRange:
1606 expErr = KErrArgument;
1609 case ETestMicrobeatsHighOutOfRange:
1610 expErr = KErrArgument;
1611 microBeats = 1000000;
1613 case ETestMicrobeatsLowOutOfRange:
1614 expErr = KErrArgument;
1618 ERR_PRINTF1(_L("Error - invalid test step type"));
1619 return EInconclusive;
1622 TRAPD(err, aMidi->SetSyncUpdateCallbackIntervalL(microSeconds, microBeats));
1625 ERR_PRINTF3(_L("SetSyncUpdateCallbackIntervalL gave error %d (expected %d)"),err, expErr);
1629 INFO_PRINTF3(_L("SetSyncUpdateCallbackIntervalL %d = %d"),err ,expErr);
1634 CTestSendMessage::CTestSendMessage(const TDesC& aTestName,
1635 const TTestStepType aTestType, const TDesC8& aMessage)
1636 :CTestMmfMidiClntStep(aTestName, aTestType)
1638 iMessage = aMessage;
1641 CTestSendMessage* CTestSendMessage::NewL(const TDesC& aTestName,
1642 const TTestStepType aTestType, const TDesC8& aMessage)
1644 CTestSendMessage* self = new (ELeave) CTestSendMessage(aTestName,
1645 aTestType, aMessage);
1649 TVerdict CTestSendMessage::DoTestL(CMidiClientUtility* aMidi)
1651 INFO_PRINTF1(_L("CMidiClientUtility: Send Message"));
1653 TVerdict ret = EPass;
1654 TInt expErr = KErrNone;
1662 case ETestNullMessage:
1663 expErr = KErrArgument;
1665 case ETestUnsupported:
1666 expErr = KErrNotSupported;
1669 expErr = KErrCorrupt;
1672 ERR_PRINTF1(_L("Error - invalid test step type"));
1673 return EInconclusive;
1676 // TInt byteProcessed;
1677 // TRAPD(err1, byteProcessed = aMidi->SendMessageL(iMessage));
1678 TRAPD(err1, aMidi->SendMessageL(iMessage)); // EABI warning removal
1681 ERR_PRINTF3(_L("SendMessageL(iMessage) gave error %d (expected %d)"), err1, expErr);
1685 TTimeIntervalMicroSeconds startTime(105);
1686 // TRAPD(err2, byteProcessed = aMidi->SendMessageL(iMessage, startTime));
1687 TRAPD(err2, aMidi->SendMessageL(iMessage, startTime)); // EABI warning removal
1690 ERR_PRINTF3(_L("SendMessageL(iMessage, startTime) gave error %d (expected %d)"), err1, expErr);
1697 //------------------------------------------------------------------
1700 // CTestSendMessageTime incorporated into CTestSendMessage
1702 //------------------------------------------------------------------
1704 // aTestType as follows :
1706 // 0116 : invalid device ID - REMOVED, API has changed
1708 // 0118 : unsupported
1709 // 0119 : unsupported - REMOVED, duplicate
1712 CTestSendMipMessage::CTestSendMipMessage(const TDesC& aTestName,
1713 const TTestStepType aTestType)
1714 :CTestMmfMidiClntStep(aTestName, aTestType)
1718 CTestSendMipMessage* CTestSendMipMessage::NewL(const TDesC& aTestName,
1719 const TTestStepType aTestType)
1721 CTestSendMipMessage* self = new (ELeave) CTestSendMipMessage(aTestName,
1726 TVerdict CTestSendMipMessage::DoTestL(CMidiClientUtility* aMidi)
1728 INFO_PRINTF1(_L("CMidiClientUtility: Send Mip Message"));
1730 TVerdict ret = EPass;
1731 TInt expErr = KErrNone;
1733 RArray<TMipMessageEntry> mipArray;
1734 TMipMessageEntry mipEntry1;
1735 TMipMessageEntry mipEntry2;
1743 case ETestNullMessage:
1744 expErr = KErrArgument;
1746 case ETestUnsupported:
1747 expErr = KErrNotSupported;
1750 expErr = KErrCorrupt;
1753 ERR_PRINTF1(_L("Error - invalid test step type"));
1754 return EInconclusive;
1760 mipEntry1.iChannel = 10;
1761 mipEntry1.iMIPValue = 20;
1762 mipEntry2.iChannel = 11;
1763 mipEntry2.iMIPValue = 21;
1765 mipArray.Append(mipEntry1);
1766 mipArray.Append(mipEntry2);
1769 case ETestNullMessage:
1770 // leave array empty
1771 // *** NB this will cause a problem in debug mode - causes a server panic!
1774 case ETestUnsupported:
1775 // XXX : values defined as unsupported?
1776 mipEntry1.iChannel = 0;
1777 mipEntry1.iMIPValue = 0;
1778 mipEntry2.iChannel = 0;
1779 mipEntry2.iMIPValue = 0;
1781 mipArray.Append(mipEntry1);
1782 mipArray.Append(mipEntry2);
1786 // XXX : values defined as corrupt?
1787 mipEntry1.iChannel = -1;
1788 mipEntry1.iMIPValue = -1;
1789 mipEntry2.iChannel = -1;
1790 mipEntry2.iMIPValue = -1;
1792 mipArray.Append(mipEntry1);
1793 mipArray.Append(mipEntry2);
1797 TRAPD(err1, aMidi->SendMipMessageL(mipArray));
1800 ERR_PRINTF3(_L("SendMipMessageL(iMessage) gave error %d (expected %d)"), err1, expErr);
1808 //------------------------------------------------------------------
1811 CTestNumberOfBanks::CTestNumberOfBanks(const TDesC& aTestName,
1812 const TTestStepType aTestType)
1813 :CTestMmfMidiClntStep(aTestName, aTestType)
1817 CTestNumberOfBanks* CTestNumberOfBanks::NewL(const TDesC& aTestName,
1818 const TTestStepType aTestType)
1820 CTestNumberOfBanks* self = new (ELeave) CTestNumberOfBanks(aTestName,
1825 TVerdict CTestNumberOfBanks::DoTestL(CMidiClientUtility* aMidi)
1827 // to do : test for standard & custom banks
1829 // currently using ETestOverflow to simulate no banks
1831 TVerdict ret = EPass;
1832 TInt expErr = KErrNone;
1841 expErr = KErrArgument;
1844 ERR_PRINTF1(_L("Error - invalid test step type"));
1845 return EInconclusive;
1849 TRAPD(err1, numBanks = aMidi->NumberOfBanksL(EFalse));
1852 ERR_PRINTF3(_L("NumberOfBanksL(EFalse) gave error %d (expected %d)"), err1, expErr);
1856 INFO_PRINTF2(_L("Number of Banks (standard) = %d"), numBanks);
1859 TRAPD(err2, numBanks = aMidi->NumberOfBanksL(ETrue));
1862 ERR_PRINTF3(_L("NumberOfBanksL(ETrue) gave error %d (expected %d)"), err2, expErr);
1866 INFO_PRINTF2(_L("Number of Banks (custom) = %d"), numBanks);
1871 //------------------------------------------------------------------
1874 CTestGetBankId::CTestGetBankId(const TDesC& aTestName,
1875 const TTestStepType aTestType)
1876 :CTestMmfMidiClntStep(aTestName, aTestType)
1880 CTestGetBankId* CTestGetBankId::NewL(const TDesC& aTestName,
1881 const TTestStepType aTestType)
1883 CTestGetBankId* self = new (ELeave) CTestGetBankId(aTestName,
1888 TVerdict CTestGetBankId::DoTestL(CMidiClientUtility* aMidi)
1890 // currently using ETestOverflow to simulate no banks
1891 TVerdict ret = EPass;
1903 expErr = KErrArgument;
1907 expErr = KErrArgument;
1911 ERR_PRINTF1(_L("Error - invalid test step type"));
1912 return EInconclusive;
1916 TRAPD(err1, bankId = aMidi->GetBankIdL(EFalse, bankNum));
1919 ERR_PRINTF4(_L("GetBankIdL(EFalse, %d) gave error %d (expected %d)"), bankNum, err1, expErr);
1923 INFO_PRINTF3(_L("GetBankIdL(EFalse, %d) = %d"), bankNum, bankId);
1925 TRAPD(err2, bankId = aMidi->GetBankIdL(ETrue, bankNum));
1928 ERR_PRINTF4(_L("GetBankIdL(ETrue, %d) gave error %d (expected %d)"), bankNum, err2, expErr);
1932 INFO_PRINTF3(_L("GetBankIdL(ETrue, %d) = %d"), bankNum, bankId);
1937 //------------------------------------------------------------------
1940 CTestLoadCustomBank::CTestLoadCustomBank(const TDesC& aTestName,
1941 const TTestStepType aTestType)
1942 :CTestMmfMidiClntStep(aTestName, aTestType)
1946 CTestLoadCustomBank* CTestLoadCustomBank::NewL(const TDesC& aTestName,
1947 const TTestStepType aTestType)
1949 CTestLoadCustomBank* self = new (ELeave) CTestLoadCustomBank(aTestName,
1954 TVerdict CTestLoadCustomBank::DoTestL(CMidiClientUtility* aMidi)
1956 TVerdict ret = EPass;
1958 TFileName bankFileName;
1960 _LIT8(KBankFileName, "Bank file name");
1961 _LIT8(KBankFileNameInvalid, "Invalid file name");
1962 _LIT8(KBankFileNameUnsupported, "Unsupported file name");
1969 bankFileName.Copy(KBankFileName);
1971 case ETestNullMessage:
1972 expErr = KErrArgument;
1973 bankFileName.Copy(KNullDesC16);
1975 case ETestInvalidMessage:
1976 expErr = KErrArgument;
1977 bankFileName.Copy(KBankFileNameInvalid);
1979 case ETestUnsupported:
1980 expErr = KErrNotSupported;
1981 bankFileName.Copy(KBankFileNameUnsupported);
1984 ERR_PRINTF1(_L("Error - invalid test step type"));
1985 return EInconclusive;
1990 TRAPD(err1, aMidi->LoadCustomBankL(bankFileName, bankId));
1991 INFO_PRINTF3(_L("LoadCustomBankL gave error %d (expected %d)"), err1, expErr);
1997 // see if it's loaded
1998 TBool loaded = EFalse;
1999 TRAP(err1, loaded = aMidi->CustomBankLoadedL(bankId));
2000 if(err1 != KErrNone)
2002 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err1);
2006 if(iTestType == ETestValid)
2010 ERR_PRINTF1(_L("CustomBankLoadedL returned false"));
2018 ERR_PRINTF1(_L("CustomBankLoadedL returned true"));
2026 //------------------------------------------------------------------
2029 CTestUnloadCustomBank::CTestUnloadCustomBank(const TDesC& aTestName,
2030 const TTestStepType aTestType)
2031 :CTestMmfMidiClntStep(aTestName, aTestType)
2035 CTestUnloadCustomBank* CTestUnloadCustomBank::NewL(const TDesC& aTestName,
2036 const TTestStepType aTestType)
2038 CTestUnloadCustomBank* self = new (ELeave) CTestUnloadCustomBank(aTestName,
2043 TVerdict CTestUnloadCustomBank::DoTestL(CMidiClientUtility* aMidi)
2045 TVerdict ret = EPass;
2047 TFileName bankFileName;
2049 _LIT8(KBankFileName, "Bank file name");
2050 bankFileName.Copy(KBankFileName);
2059 expErr = KErrNotFound;
2062 ERR_PRINTF1(_L("Error - invalid test step type"));
2063 return EInconclusive;
2068 // load a known bank
2069 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId));
2072 ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err);
2073 ret = EInconclusive;
2077 // ensure it's loaded
2078 TBool loaded = EFalse;
2079 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2082 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2083 ret = EInconclusive;
2088 ERR_PRINTF1(_L("CustomBankLoadedL returned false"));
2089 ret = EInconclusive;
2093 // unload the bank we know is loaded
2094 TRAP(err, aMidi->UnloadCustomBankL(bankId));
2097 ERR_PRINTF2(_L("UnloadCustomBankL gave error %d"), err);
2102 // ensure it's not loaded
2103 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2106 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2107 ret = EInconclusive;
2112 ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded"));
2117 // if negative test, try and unload the same bank again
2118 if(iTestType == ETestValid)
2122 TRAP(err, aMidi->UnloadCustomBankL(bankId));
2123 INFO_PRINTF3(_L("UnloadCustomBankL gave error %d (expected %d)"), err, expErr);
2131 //------------------------------------------------------------------
2134 CTestUnloadAllCustomBanks::CTestUnloadAllCustomBanks(const TDesC& aTestName,
2135 const TTestStepType aTestType)
2136 :CTestMmfMidiClntStep(aTestName, aTestType)
2140 CTestUnloadAllCustomBanks* CTestUnloadAllCustomBanks::NewL(const TDesC& aTestName,
2141 const TTestStepType aTestType)
2143 CTestUnloadAllCustomBanks* self = new (ELeave) CTestUnloadAllCustomBanks(aTestName,
2148 TVerdict CTestUnloadAllCustomBanks::DoTestL(CMidiClientUtility* aMidi)
2150 TVerdict ret = EPass;
2152 TFileName bankFileName;
2154 _LIT8(KBankFileName, "Bank file name");
2155 bankFileName.Copy(KBankFileName);
2164 expErr = KErrNotFound;
2167 ERR_PRINTF1(_L("Error - invalid test step type"));
2168 return EInconclusive;
2173 // load a known bank
2174 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId));
2177 ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err);
2178 ret = EInconclusive;
2182 // ensure it's loaded
2183 TBool loaded = EFalse;
2184 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2187 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2188 ret = EInconclusive;
2193 ERR_PRINTF1(_L("CustomBankLoadedL returned false"));
2194 ret = EInconclusive;
2199 TRAP(err, aMidi->UnloadAllCustomBanksL());
2202 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err);
2208 // ensure our bank is not loaded
2209 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2212 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2213 ret = EInconclusive;
2218 ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded"));
2223 // if negative test, try and unload again
2224 if(iTestType == ETestValid)
2228 TRAP(err, aMidi->UnloadAllCustomBanksL());
2229 INFO_PRINTF3(_L("UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr);
2237 //------------------------------------------------------------------
2240 CTestNumberOfInstruments::CTestNumberOfInstruments(const TDesC& aTestName,
2241 const TTestStepType aTestType)
2242 :CTestMmfMidiClntStep(aTestName, aTestType)
2246 CTestNumberOfInstruments* CTestNumberOfInstruments::NewL(const TDesC& aTestName,
2247 const TTestStepType aTestType)
2249 CTestNumberOfInstruments* self = new (ELeave) CTestNumberOfInstruments(aTestName,
2254 TVerdict CTestNumberOfInstruments::DoTestL(CMidiClientUtility* aMidi)
2256 // TO DO : situation where no standard banks exist
2258 TVerdict ret = EPass;
2260 TFileName bankFileName;
2262 _LIT8(KBankFileName, "Bank file name");
2263 bankFileName.Copy(KBankFileName);
2265 TInt numInstruments = 0;
2275 expErr = KErrNotFound;
2278 case ETestInvalidId:
2279 expErr = KErrArgument;
2283 ERR_PRINTF1(_L("Error - invalid test step type"));
2284 return EInconclusive;
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));
2293 ERR_PRINTF3(_L("NumberOfInstrumentsL(bankId, EFalse) gave error %d (expected %d)"), err, expErr);
2297 INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, EFalse) = %d"), numInstruments);
2299 if(iTestType != ETestInvalidMessage)
2301 // load a known bank - custom
2302 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId));
2305 ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err);
2306 ret = EInconclusive;
2309 // ensure it's loaded
2310 TBool loaded = EFalse;
2311 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2314 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2315 ret = EInconclusive;
2320 ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded"));
2321 ret = EInconclusive;
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));
2331 ERR_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) gave error %d"), err);
2335 INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) = %d"), numInstruments);
2337 if(iTestType == ETestNegative)
2339 // negative test :- unload all, then check it again
2340 TRAP(err, aMidi->UnloadAllCustomBanksL());
2343 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err);
2344 ret = EInconclusive;
2347 // check it. it should leave
2348 TRAP(err, aMidi->NumberOfInstrumentsL(bankId, ETrue));
2351 ERR_PRINTF3(_L("NumberOfInstrumentsL gave error %d (expected %d)"), err, expErr);
2360 //------------------------------------------------------------------
2363 CTestGetInstrumentId::CTestGetInstrumentId(const TDesC& aTestName,
2364 const TTestStepType aTestType)
2365 :CTestMmfMidiClntStep(aTestName, aTestType)
2369 CTestGetInstrumentId* CTestGetInstrumentId::NewL(const TDesC& aTestName,
2370 const TTestStepType aTestType)
2372 CTestGetInstrumentId* self = new (ELeave) CTestGetInstrumentId(aTestName,
2377 TVerdict CTestGetInstrumentId::DoTestL(CMidiClientUtility* aMidi)
2379 // TO DO : situation where no standard banks exist
2381 TVerdict ret = EPass;
2383 TFileName bankFileName;
2385 _LIT8(KBankFileName, "Bank file name");
2386 bankFileName.Copy(KBankFileName);
2388 TInt instrIndex = 0;
2400 expErr = KErrNotFound;
2404 case ETestInvalidId:
2405 expErr = KErrArgument;
2409 case ETestInvalidIndex:
2410 expErr = KErrArgument;
2415 ERR_PRINTF1(_L("Error - invalid test step type"));
2416 return EInconclusive;
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));
2425 ERR_PRINTF3(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) gave error %d (expected %d)"), err, expErr);
2429 INFO_PRINTF2(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) = %d"), instrId);
2431 if(iTestType != ETestInvalidId && iTestType != ETestInvalidIndex)
2433 // load a known bank - custom
2434 TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId));
2437 ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err);
2438 ret = EInconclusive;
2441 // ensure it's loaded
2442 TBool loaded = EFalse;
2443 TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId));
2446 ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err);
2447 ret = EInconclusive;
2452 ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded"));
2453 ret = EInconclusive;
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));
2463 ERR_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) gave error %d"), err);
2467 INFO_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) = %d"), instrId);
2469 if(iTestType == ETestNegative)
2471 // negative test :- unload all, then check it again
2472 TRAP(err, aMidi->UnloadAllCustomBanksL());
2475 ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err);
2476 ret = EInconclusive;
2479 // check it. it should leave
2480 TRAP(err, instrId = aMidi->GetInstrumentIdL(bankId, ETrue, instrIndex));
2483 ERR_PRINTF3(_L("GetInstrumentIdL gave error %d (expected %d)"), err, expErr);
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)
2501 CTestReturnsInstrumentName* CTestReturnsInstrumentName::NewL(const TDesC& aTestName,
2502 const TTestStepType aTestType)
2504 CTestReturnsInstrumentName* self = new (ELeave) CTestReturnsInstrumentName(aTestName,
2509 TVerdict CTestReturnsInstrumentName::DoTestL(CMidiClientUtility* aMidi)
2511 TVerdict ret = EPass;
2513 //TFileName bankFileName;
2517 HBufC* instrName = NULL;
2528 expErr = KErrArgument;
2533 ERR_PRINTF1(_L("Error - invalid test step type"));
2534 return EInconclusive;
2537 // check a known bank - standard
2538 // *** TO DO : custom?
2540 TRAPD(err, instrName = aMidi->InstrumentNameL(bankId, EFalse, instrId));
2541 INFO_PRINTF3(_L("InstrumentNameL(bankId, EFalse, instrId) gave error %d (expected %d)"), err, expErr);
2544 //ret = EInconclusive;
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);
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
2563 CTestGetInstrument::CTestGetInstrument(const TDesC& aTestName,
2564 const TTestStepType aTestType)
2565 :CTestMmfMidiClntStep(aTestName, aTestType)
2569 CTestGetInstrument* CTestGetInstrument::NewL(const TDesC& aTestName,
2570 const TTestStepType aTestType)
2572 CTestGetInstrument* self = new (ELeave) CTestGetInstrument(aTestName,
2577 TVerdict CTestGetInstrument::DoTestL(CMidiClientUtility* aMidi)
2579 TVerdict ret = EPass;
2580 TInt instrumentId = 0;
2582 TInt validChannelId = 0;
2583 TInt invalidChannelId = 16;
2585 TRAPD(err, aMidi->GetInstrumentL(validChannelId, instrumentId, bankId));
2587 if(err == KErrArgument)
2589 ERR_PRINTF2(_L("GetInstrumentL(validChannelId, ...) gave an error = %d"), err);
2594 TRAPD(err1, aMidi->GetInstrumentL(invalidChannelId, instrumentId, bankId));
2596 if(err1 != KErrArgument)
2598 ERR_PRINTF2(_L("GetInstrumentL(invalidChannelId, ...) gave an error = %d"), err);
2606 //------------------------------------------------------------------
2608 CTestSetInstrument::CTestSetInstrument(const TDesC& aTestName,
2609 const TTestStepType aTestType)
2610 :CTestMmfMidiClntStep(aTestName, aTestType)
2614 CTestSetInstrument* CTestSetInstrument::NewL(const TDesC& aTestName,
2615 const TTestStepType aTestType)
2617 CTestSetInstrument* self = new (ELeave) CTestSetInstrument(aTestName,
2622 TVerdict CTestSetInstrument::DoTestL(CMidiClientUtility* aMidi)
2624 TVerdict ret = EPass;
2626 //TFileName bankFileName;
2641 case ETestInvalidChannel:
2642 expErr = KErrNotFound;
2647 case ETestInvalidId:
2648 expErr = KErrNotFound;
2654 ERR_PRINTF1(_L("Error - invalid test step type"));
2655 return EInconclusive;
2658 // *** TO DO : custom?
2660 TRAPD(err, aMidi->SetInstrumentL(channelId, bankId, instrId));
2661 INFO_PRINTF3(_L("SetInstrumentL(channelId, bankId, instrId) gave error %d (expected %d)"), err, expErr);
2671 //------------------------------------------------------------------
2674 CTestLoadCustomInstrument::CTestLoadCustomInstrument(const TDesC& aTestName,
2675 const TTestStepType aTestType)
2676 :CTestMmfMidiClntStep(aTestName, aTestType)
2680 CTestLoadCustomInstrument* CTestLoadCustomInstrument::NewL(const TDesC& aTestName,
2681 const TTestStepType aTestType)
2683 CTestLoadCustomInstrument* self = new (ELeave) CTestLoadCustomInstrument(aTestName,
2688 TVerdict CTestLoadCustomInstrument::DoTestL(CMidiClientUtility* aMidi)
2690 // TO DO : need instrument file which we can load, with known bank and instrument IDs
2691 // Negative tests to be done properly.
2693 TVerdict ret = EPass;
2696 _LIT(KInstrumentFile, "Instrument File Name"); // *** to change
2697 _LIT(KBadInstrumentFile, "Bad Instrument File Name"); // *** to change
2698 TFileName instFileName;
2700 TInt fileBankId = 90;
2701 TInt fileInstrId = 91;
2710 instFileName.Copy(KInstrumentFile);
2712 case ETestInvalidId:
2713 expErr = KErrArgument;
2714 instFileName.Copy(KInstrumentFile);
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);
2723 case ETestUnsupported: // ** to define test data for this
2724 instFileName.Copy(KBadInstrumentFile);
2725 expErr = KErrNotSupported;
2728 ERR_PRINTF1(_L("Error - invalid test step type"));
2729 return EInconclusive;
2732 // if testing already loaded, preload the instrument here
2733 if(iTestType == ETestAlreadyLoaded)
2735 TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId));
2736 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err);
2739 ret = EInconclusive;
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);
2757 //------------------------------------------------------------------
2759 CTestUnloadCustomInstrument::CTestUnloadCustomInstrument(const TDesC& aTestName,
2760 const TTestStepType aTestType)
2761 :CTestMmfMidiClntStep(aTestName, aTestType)
2765 CTestUnloadCustomInstrument* CTestUnloadCustomInstrument::NewL(const TDesC& aTestName,
2766 const TTestStepType aTestType)
2768 CTestUnloadCustomInstrument* self = new (ELeave) CTestUnloadCustomInstrument(aTestName,
2773 TVerdict CTestUnloadCustomInstrument::DoTestL(CMidiClientUtility* aMidi)
2775 TVerdict ret = EPass;
2778 _LIT(KInstrumentFile, "Instrument File Name"); // *** to change
2779 TFileName instFileName;
2781 TInt fileBankId = 90;
2782 TInt fileInstrId = 91;
2791 instFileName.Copy(KInstrumentFile);
2793 case ETestInvalidId:
2794 expErr = KErrNotFound;
2795 instFileName.Copy(KInstrumentFile);
2798 case ETestNotLoaded:
2799 expErr = KErrNotFound;
2800 instFileName.Copy(KInstrumentFile);
2802 case ETestNotUnloadable: // ** TO DO : define test data for this
2803 expErr = KErrNotSupported;
2806 ERR_PRINTF1(_L("Error - invalid test step type"));
2807 return EInconclusive;
2810 // preload the instrument here
2811 if(iTestType == ETestValid)
2813 TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId));
2814 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err);
2817 ret = EInconclusive;
2823 TRAPD(err, aMidi->UnloadCustomInstrumentL(bankId, instrId));
2824 INFO_PRINTF3(_L("UnloadCustomInstrumentL gave error %d (expected %d)"), err, expErr);
2834 //------------------------------------------------------------------
2837 CTestPercussionKeyName::CTestPercussionKeyName(const TDesC& aTestName,
2838 const TTestStepType aTestType)
2839 :CTestMmfMidiClntStep(aTestName, aTestType)
2843 CTestPercussionKeyName* CTestPercussionKeyName::NewL(const TDesC& aTestName,
2844 const TTestStepType aTestType)
2846 CTestPercussionKeyName* self = new (ELeave) CTestPercussionKeyName(aTestName,
2851 TVerdict CTestPercussionKeyName::DoTestL(CMidiClientUtility* aMidi)
2853 // *** NB the actual arguments do not match those in the current API or test specs
2854 TVerdict ret = EPass;
2856 //TFileName bankFileName;
2861 HBufC* keyName = NULL;
2869 case ETestInvalidId:
2870 expErr = KErrNotFound;
2874 ERR_PRINTF1(_L("Error - invalid test step type"));
2875 return EInconclusive;
2878 // check a known bank - standard
2879 // *** TO DO : custom?
2881 TRAPD(err, keyName = aMidi->PercussionKeyNameL(keyId, bankId, EFalse, instrId));
2882 INFO_PRINTF3(_L("PercussionKeyNameL gave error %d (expected %d)"), err, expErr);
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);
2897 //Not sure how to implement 'no opened resource'
2898 //------------------------------------------------------------------
2899 CTestStopTime::CTestStopTime(const TDesC& aTestName,
2900 const TTestStepType aTestType)
2901 :CTestMmfMidiClntStep(aTestName, aTestType)
2905 CTestStopTime* CTestStopTime::NewL(const TDesC& aTestName,
2906 const TTestStepType aTestType)
2908 CTestStopTime* self = new (ELeave) CTestStopTime(aTestName,
2913 TVerdict CTestStopTime::DoTestL(CMidiClientUtility* aMidi)
2915 TVerdict ret = EPass;
2917 TTimeIntervalMicroSeconds stopTime(0);
2926 // NB no negative test specified
2927 //Not sure how to implement 'no opened resource'
2928 case ETestNoResource:
2929 expErr = KErrNotReady;
2933 ERR_PRINTF1(_L("Error - invalid test step type"));
2934 return EInconclusive;
2937 TRAPD(err, aMidi->StopTimeL(stopTime));
2938 INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr);
2944 INFO_PRINTF2(_L("StopTime = %ld"), I64INT(stopTime.Int64()));
2949 //------------------------------------------------------------------
2952 CTestSetStopTime::CTestSetStopTime(const TDesC& aTestName,
2953 const TTestStepType aTestType)
2954 :CTestMmfMidiClntStep(aTestName, aTestType)
2958 CTestSetStopTime* CTestSetStopTime::NewL(const TDesC& aTestName,
2959 const TTestStepType aTestType)
2961 CTestSetStopTime* self = new (ELeave) CTestSetStopTime(aTestName,
2966 TVerdict CTestSetStopTime::DoTestL(CMidiClientUtility* aMidi)
2968 TVerdict ret = EPass;
2970 TTimeIntervalMicroSeconds stopTime(999);
2978 case ETestOutOfRangeHigh:
2979 stopTime = 999999999;
2980 expErr = KErrArgument;
2982 case ETestOutOfRangeLow:
2984 expErr = KErrArgument;
2987 ERR_PRINTF1(_L("Error - invalid test step type"));
2988 return EInconclusive;
2991 TRAPD(err, aMidi->SetStopTimeL(stopTime));
2992 INFO_PRINTF3(_L("SetStopTimeL gave error %d (expected %d)"), err, expErr);
2999 // check set correctly if a valid test
3000 if (iTestType == ETestValid)
3002 TTimeIntervalMicroSeconds newStopTime(999);
3003 TRAP(err, aMidi->StopTimeL(newStopTime));
3004 INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr);
3008 ret = EInconclusive;
3011 INFO_PRINTF2(_L("StopTime = %ld"), I64INT(newStopTime.Int64()));
3013 if(newStopTime != stopTime)
3015 ERR_PRINTF2(_L("Error : expected %ld"), I64INT(stopTime.Int64()));
3024 //------------------------------------------------------------------
3027 CTestSetRepeats::CTestSetRepeats(const TDesC& aTestName,
3028 const TTestStepType aTestType)
3029 :CTestMmfMidiClntStep(aTestName, aTestType)
3033 CTestSetRepeats* CTestSetRepeats::NewL(const TDesC& aTestName,
3034 const TTestStepType aTestType)
3036 CTestSetRepeats* self = new (ELeave) CTestSetRepeats(aTestName,
3041 TVerdict CTestSetRepeats::DoTestL(CMidiClientUtility* aMidi)
3043 TVerdict ret = EPass;
3046 TTimeIntervalMicroSeconds silentTime(1000000);
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; // ** XXX : max. range of repeats?
3060 silentTime = 1000000;
3063 ERR_PRINTF1(_L("Error - invalid test step type"));
3064 return EInconclusive;
3067 TRAPD(err, aMidi->SetRepeatsL(repeats, silentTime));
3069 // check set correctly if a valid test
3070 if (iTestType == ETestValid)
3072 // check the repeats value
3073 TInt currRepeats = -1;
3074 currRepeats = aMidi->GetRepeats();
3076 INFO_PRINTF2(_L("Repeats = %d"), currRepeats);
3078 if(currRepeats != repeats)
3080 ERR_PRINTF2(_L("Error : expected %d"), currRepeats);
3086 INFO_PRINTF3(_L("SetRepeatsL gave error %d (expected %d)"), err, expErr);
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.
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)
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
3111 // MaxPolyphonyL() return value is 60
3112 // PolyphonyL() return value is 57
3114 // constants for the test case
3115 const TUint8 KMaxPolyphonyValue1 = 48;
3116 const TUint8 KMaxPolyphonyValue2 = 60;
3117 const TUint8 KPolyphonyValue = 57;
3119 CTestPolyphony::CTestPolyphony(const TDesC& aTestName,
3120 const TTestStepType aTestType)
3121 :CTestMmfMidiClntStep(aTestName, aTestType)
3125 CTestPolyphony* CTestPolyphony::NewL(const TDesC& aTestName,
3126 const TTestStepType aTestType)
3128 CTestPolyphony* self = new (ELeave) CTestPolyphony(aTestName,
3133 TVerdict CTestPolyphony::DoTestL(CMidiClientUtility* aMidi)
3135 TVerdict ret = EPass;
3146 // NB no negative test specified
3148 ERR_PRINTF1(_L("Error - invalid test step type"));
3149 return EInconclusive;
3152 // set the maxPolyphony to KMaxPolyphponyValue1
3153 TRAPD(err, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue1));
3156 INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err);
3161 // verify that the maxPolyphony value was correctly set
3162 TRAPD(err1, maxPoly = aMidi->MaxPolyphonyL());
3165 INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err);
3169 INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue1);
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());
3179 INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err);
3184 INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KMaxPolyphonyValue1);
3185 INFO_PRINTF1(_L("----------------------------------------------------------"));
3187 // set the maxPolyphony to KMaxPolyphonyValue2
3188 TRAPD(err3, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue2));
3191 INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err);
3196 // verify that the maxPolyphony value was correctly set
3197 TRAPD(err4, maxPoly = aMidi->MaxPolyphonyL());
3200 INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err);
3204 INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue2);
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());
3213 INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err);
3217 INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KPolyphonyValue);
3222 //Check this (0086) //
3223 //Not sure how to implement 'no opened resource'
3224 //------------------------------------------------------------------
3227 CTestChannelsSupported::CTestChannelsSupported(const TDesC& aTestName,
3228 const TTestStepType aTestType)
3229 :CTestMmfMidiClntStep(aTestName, aTestType)
3233 CTestChannelsSupported* CTestChannelsSupported::NewL(const TDesC& aTestName,
3234 const TTestStepType aTestType)
3236 CTestChannelsSupported* self = new (ELeave) CTestChannelsSupported(aTestName,
3241 TVerdict CTestChannelsSupported::DoTestL(CMidiClientUtility* aMidi)
3243 TVerdict ret = EPass;
3245 TInt numChannels = 0;
3254 // NB no negative test specified
3256 //Not sure how to implement 'no opened resource'
3257 case ETestNoResource:
3258 expErr = KErrNotReady;
3262 ERR_PRINTF1(_L("Error - invalid test step type"));
3263 return EInconclusive;
3266 TRAPD(err, numChannels = aMidi->ChannelsSupportedL());
3267 INFO_PRINTF3(_L("ChannelsSupportedL gave error %d (expected %d)"), err, expErr);
3273 INFO_PRINTF2(_L("Channels supported = %d"), numChannels);
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
3282 // - if the argument passed in is an invalid channel, the test should
3283 // return KErrArgument
3285 CTestReturnChannelVolume::CTestReturnChannelVolume(const TDesC& aTestName, const TTestStepType aTestType)
3286 :CTestMmfMidiClntStep(aTestName, aTestType)
3290 CTestReturnChannelVolume* CTestReturnChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3292 CTestReturnChannelVolume* self = new(ELeave) CTestReturnChannelVolume(aTestName, aTestType);
3296 TVerdict CTestReturnChannelVolume::DoTestL(CMidiClientUtility* aMidi)
3301 INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume"));
3304 if (iTestType == ETestValid)
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)
3312 ERR_PRINTF2(_L("SetChannelVolumeL gave error %d"),err1);
3316 TRAPD(err, volume = aMidi->ChannelVolumeL(channel));
3317 if (err != KErrNone)
3319 ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrNone)"),err);
3323 if (volume != chanVolume)
3325 ERR_PRINTF3(_L("ChannelVolumeL retrieve volume value %d (expected %d)"),volume, chanVolume);
3332 if (iTestType == ETestInvalidChannel)
3335 TRAPD(err, aMidi->ChannelVolumeL(channel));
3336 if (err != KErrArgument)
3338 ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrArgument)"),err);
3344 ERR_PRINTF1(_L("Error - invalid test step type"));
3345 return EInconclusive;
3350 //------------------------------------------------------------------
3351 CTestMaxChannelVolume::CTestMaxChannelVolume(const TDesC& aTestName, const TTestStepType aTestType)
3352 :CTestMmfMidiClntStep(aTestName, aTestType)
3356 CTestMaxChannelVolume* CTestMaxChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3358 CTestMaxChannelVolume* self = new(ELeave) CTestMaxChannelVolume(aTestName, aTestType);
3362 TVerdict CTestMaxChannelVolume::DoTestL(CMidiClientUtility* aMidi)
3364 TVerdict ret = EPass;
3365 TInt expErr = KErrNone;
3367 INFO_PRINTF1(_L("CMidiClientUtility: Return Maximum channel volume"));
3376 ERR_PRINTF1(_L("Error - invalid test step type"));
3377 return EInconclusive;
3379 // TReal32 volume = 0;
3380 // TRAPD(err, volume = aMidi->MaxChannelVolumeL() );
3381 TRAPD(err, aMidi->MaxChannelVolumeL() ); // EABI warning removal
3385 ERR_PRINTF3(_L("MaxChannelVolumeL gave error %d (expected %d)"),err, expErr);
3389 INFO_PRINTF3(_L("MaxChannelVolumeL %d = %d "),err ,expErr);
3394 //------------------------------------------------------------------
3396 CTestSetChannelVolume::CTestSetChannelVolume(const TDesC& aTestName, const TTestStepType aTestType)
3397 :CTestMmfMidiClntStep(aTestName, aTestType)
3401 CTestSetChannelVolume* CTestSetChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3403 CTestSetChannelVolume* self = new(ELeave) CTestSetChannelVolume(aTestName, aTestType);
3407 TVerdict CTestSetChannelVolume::DoTestL(CMidiClientUtility* aMidi)
3409 TVerdict ret = EPass;
3410 TInt expErr = KErrNone;
3414 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume"));
3421 case ETestInvalidChannelOutOfRange:
3422 expErr = KErrArgument;
3426 case ETestVolumeHighOutOfRange:
3427 expErr = KErrArgument;
3429 volume = aMidi->MaxChannelVolumeL()+1;
3431 case ETestVolumeLowOutOfRange:
3432 expErr = KErrNone; //real controller may return KErrArgument if out of range
3437 ERR_PRINTF1(_L("Error - invalid test step type"));
3438 return EInconclusive;
3441 TRAPD(err, aMidi->SetChannelVolumeL(channel, volume));
3444 ERR_PRINTF3(_L("SetChannelVolumeL gave error %d (expected %d)"),err, expErr);
3448 INFO_PRINTF3(_L("SetChannelVolumeL %d = %d"),err ,expErr);
3454 //------------------------------------------------------------------
3455 CTestSetChannelMute::CTestSetChannelMute(const TDesC& aTestName, const TTestStepType aTestType)
3456 :CTestMmfMidiClntStep(aTestName, aTestType)
3460 CTestSetChannelMute* CTestSetChannelMute::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3462 CTestSetChannelMute* self = new(ELeave) CTestSetChannelMute(aTestName, aTestType);
3466 TVerdict CTestSetChannelMute::DoTestL(CMidiClientUtility* aMidi)
3468 TVerdict ret = EPass;
3469 TInt expErr = KErrNone;
3471 TBool muted = ETrue;
3473 INFO_PRINTF1(_L("CMidiClientUtility: Set channel mute"));
3480 case ETestInvalidChannelOutOfRange:
3481 expErr = KErrArgument;
3486 ERR_PRINTF1(_L("Error - invalid test step type"));
3487 return EInconclusive;
3490 TRAPD(err, aMidi->SetChannelMuteL(channel, muted));
3492 // check correct result
3493 if (iTestType == ETestValid)
3495 TBool currMuted = EFalse;
3497 // until real MIDI controller IsChannelMuteL is always TRUE
3498 TRAPD(err2, currMuted = aMidi->IsChannelMuteL(channel));
3500 if(err2 != KErrNone)
3502 ERR_PRINTF2(_L("IsChannelMuteL() returned %d"), err2);
3503 ret = EInconclusive;
3507 if(currMuted != muted)
3509 ERR_PRINTF2(_L("Error : expected %d"), muted);
3518 ERR_PRINTF3(_L("SetChannelMuteL gave error %d (expected %d)"),err, expErr);
3522 INFO_PRINTF3(_L("SetChannelMuteL %d = %d"),err ,expErr);
3527 //------------------------------------------------------------------
3529 CTestReturnVolume::CTestReturnVolume(const TDesC& aTestName, const TTestStepType aTestType)
3530 :CTestMmfMidiClntStep(aTestName, aTestType)
3534 CTestReturnVolume* CTestReturnVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3537 CTestReturnVolume* self = new(ELeave) CTestReturnVolume(aTestName, aTestType);
3541 TVerdict CTestReturnVolume::DoTestL(CMidiClientUtility* aMidi)
3543 TVerdict ret = EPass;
3544 TInt expErr = KErrNone;
3546 INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume"));
3554 ERR_PRINTF1(_L("Error - invalid test step type"));
3555 return EInconclusive;
3558 // TRAPD(err, volume = aMidi->VolumeL());
3559 TRAPD(err, aMidi->VolumeL()); // EABI warning removal
3562 ERR_PRINTF3(_L("VolumeL gave error %d (expected %d)"),err, expErr);
3566 INFO_PRINTF3(_L("VolumeL %d = %d"),err ,expErr);
3571 //------------------------------------------------------------------
3573 CTestReturnMaxVolume::CTestReturnMaxVolume(const TDesC& aTestName, const TTestStepType aTestType)
3574 :CTestMmfMidiClntStep(aTestName, aTestType)
3578 CTestReturnMaxVolume* CTestReturnMaxVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3580 CTestReturnMaxVolume* self = new(ELeave) CTestReturnMaxVolume(aTestName, aTestType);
3584 TVerdict CTestReturnMaxVolume::DoTestL(CMidiClientUtility* aMidi)
3586 TVerdict ret = EPass;
3587 TInt expErr = KErrNone;
3589 INFO_PRINTF1(_L("CMidiClientUtility: Return max channel volume"));
3597 ERR_PRINTF1(_L("Error - invalid test step type"));
3598 return EInconclusive;
3601 // TRAPD(err, volume = aMidi->MaxVolumeL());
3602 TRAPD(err, aMidi->MaxVolumeL()); // EABI warning removal
3605 ERR_PRINTF3(_L("MaxVolumeL gave error %d (expected %d)"),err, expErr);
3609 INFO_PRINTF3(_L("MaxVolumeL %d = %d"),err ,expErr);
3614 //------------------------------------------------------------------
3616 CTestSetVolume::CTestSetVolume(const TDesC& aTestName, const TTestStepType aTestType)
3617 :CTestMmfMidiClntStep(aTestName, aTestType)
3621 CTestSetVolume* CTestSetVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3623 CTestSetVolume* self = new(ELeave) CTestSetVolume(aTestName, aTestType);
3627 TVerdict CTestSetVolume::DoTestL(CMidiClientUtility* aMidi)
3629 TVerdict ret = EPass;
3630 TInt expErr = KErrNone;
3633 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume"));
3641 case ETestVolumeHighOutOfRange:
3642 expErr = KErrNotSupported;
3645 case ETestVolumeLowOutOfRange:
3646 expErr = KErrNotSupported;
3650 ERR_PRINTF1(_L("Error - invalid test step type"));
3651 return EInconclusive;
3654 TRAPD(err, aMidi->SetVolumeL(volume));
3657 ERR_PRINTF3(_L("SetVolumeL gave error %d (expected %d)"),err, expErr);
3661 INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr);
3666 //------------------------------------------------------------------
3668 CTestSetVolumeRamp::CTestSetVolumeRamp(const TDesC& aTestName, const TTestStepType aTestType)
3669 :CTestMmfMidiClntStep(aTestName, aTestType)
3673 CTestSetVolumeRamp* CTestSetVolumeRamp::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3675 CTestSetVolumeRamp* self = new(ELeave) CTestSetVolumeRamp(aTestName, aTestType);
3679 TVerdict CTestSetVolumeRamp::DoTestL(CMidiClientUtility* aMidi)
3681 TVerdict ret = EPass;
3682 TInt expErr = KErrNone;
3683 TTimeIntervalMicroSeconds rampDuration;
3685 INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume ramp"));
3692 case ETestRampDurationHighOutOfRange:
3693 expErr = KErrNotSupported;
3694 rampDuration = 9999999;
3696 case ETestRampDurationLowOutOfRange:
3697 expErr = KErrNotSupported;
3698 rampDuration = -9999999;
3701 ERR_PRINTF1(_L("Error - invalid test step type"));
3702 return EInconclusive;
3705 TRAPD(err, aMidi->SetVolumeRampL(rampDuration));
3708 ERR_PRINTF3(_L("SetVolumeRampL gave error %d (expected %d)"),err, expErr);
3712 INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr);
3717 //------------------------------------------------------------------
3719 CTestGetBalance::CTestGetBalance(const TDesC& aTestName, const TTestStepType aTestType)
3720 :CTestMmfMidiClntStep(aTestName, aTestType)
3724 CTestGetBalance* CTestGetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3726 CTestGetBalance* self = new(ELeave) CTestGetBalance(aTestName, aTestType);
3730 TVerdict CTestGetBalance::DoTestL(CMidiClientUtility* aMidi)
3732 TVerdict ret = EPass;
3733 TInt expErr = KErrNone;
3734 //TTimeIntervalMicroSeconds rampDuration;
3736 INFO_PRINTF1(_L("CMidiClientUtility: Get balance"));
3743 case ETestUnsupported:
3744 expErr = KErrNotSupported;
3747 ERR_PRINTF1(_L("Error - invalid test step type"));
3748 return EInconclusive;
3750 // TInt getBalance = 0;
3751 // TRAPD(err, getBalance = aMidi->GetBalanceL());
3752 TRAPD(err, aMidi->GetBalanceL()); // EABI warning removal
3756 ERR_PRINTF3(_L("GetBalanceL gave error %d (expected %d)"),err, expErr);
3760 INFO_PRINTF3(_L("GetBalanceL %d = %d"),err ,expErr);
3765 //------------------------------------------------------------------
3767 CTestSetBalance::CTestSetBalance(const TDesC& aTestName, const TTestStepType aTestType)
3768 :CTestMmfMidiClntStep(aTestName, aTestType)
3772 CTestSetBalance* CTestSetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3774 CTestSetBalance* self = new(ELeave) CTestSetBalance(aTestName, aTestType);
3778 TVerdict CTestSetBalance::DoTestL(CMidiClientUtility* aMidi)
3780 TVerdict ret = EPass;
3781 TInt expErr = KErrNone;
3782 // TInt balance = 0; // EABI warning removal
3784 INFO_PRINTF1(_L("CMidiClientUtility: Set balance"));
3791 case ETestUnsupported:
3792 expErr = KErrNotSupported;
3794 case ETestBalanceHighOutOfRange:
3795 expErr = KErrNotSupported;
3796 // balance = 101; // EABI warning removal
3798 case ETestBalanceLowOutOfRange:
3799 expErr = KErrNotSupported;
3800 // balance = -101; // EABI warning removal
3803 ERR_PRINTF1(_L("Error - invalid test step type"));
3804 return EInconclusive;
3807 TRAPD(err, aMidi->SetBalanceL());
3810 ERR_PRINTF3(_L("SetBalanceL gave error %d (expected %d)"),err, expErr);
3814 INFO_PRINTF3(_L("SetBalanceL %d = %d"),err ,expErr);
3819 //------------------------------------------------------------------
3821 CTestSetPriority::CTestSetPriority(const TDesC& aTestName, const TTestStepType aTestType)
3822 :CTestMmfMidiClntStep(aTestName, aTestType)
3826 CTestSetPriority* CTestSetPriority::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3828 CTestSetPriority* self = new(ELeave) CTestSetPriority(aTestName, aTestType);
3832 TVerdict CTestSetPriority::DoTestL(CMidiClientUtility* aMidi)
3834 TVerdict ret = EPass;
3835 TInt expErr = KErrNone;
3837 TMdaPriorityPreference pref = EMdaPriorityPreferenceNone;
3839 INFO_PRINTF1(_L("CMidiClientUtility: Set priority"));
3846 case ETestPreferenceConflictsCannotBeResolved:
3847 expErr = KErrNotSupported;
3850 ERR_PRINTF1(_L("Error - invalid test step type"));
3851 return EInconclusive;
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));
3858 ERR_PRINTF3(_L("SetPriorityL gave error %d (expected %d)"),err, expErr);
3862 INFO_PRINTF3(_L("SetPriorityL %d = %d"),err ,expErr);
3867 //------------------------------------------------------------------
3869 CTestNumberOfXmfMetaDataEntries::CTestNumberOfXmfMetaDataEntries(const TDesC& aTestName, const TTestStepType aTestType)
3870 :CTestMmfMidiClntStep(aTestName, aTestType)
3874 CTestNumberOfXmfMetaDataEntries* CTestNumberOfXmfMetaDataEntries::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3876 CTestNumberOfXmfMetaDataEntries* self = new(ELeave) CTestNumberOfXmfMetaDataEntries(aTestName, aTestType);
3880 TVerdict CTestNumberOfXmfMetaDataEntries::DoTestL(CMidiClientUtility* aMidi)
3882 TVerdict ret = EPass;
3883 TInt expErr = KErrNone;
3885 INFO_PRINTF1(_L("CMidiClientUtility: Number Of Xmf Meta Data Entries"));
3892 case ETestUnsupported:
3893 expErr = KErrNotSupported;
3896 ERR_PRINTF1(_L("Error - invalid test step type"));
3897 return EInconclusive;
3899 // TInt numberOfXmfMetaDataEntriesL = 0;
3900 // TRAPD(err, numberOfXmfMetaDataEntriesL = aMidi->NumberOfMetaDataEntriesL());
3901 TRAPD(err, aMidi->NumberOfMetaDataEntriesL()); // EABI warning removal
3904 ERR_PRINTF3(_L("NumberOfXmfMetaDataEntriesL gave error %d (expected %d)"),err, expErr);
3908 INFO_PRINTF3(_L("NumberOfXmfMetaDataEntriesL %d = %d"),err ,expErr);
3913 //------------------------------------------------------------------
3915 CTestGetXmfMetaDataEntry::CTestGetXmfMetaDataEntry(const TDesC& aTestName, const TTestStepType aTestType)
3916 :CTestMmfMidiClntStep(aTestName, aTestType)
3920 CTestGetXmfMetaDataEntry* CTestGetXmfMetaDataEntry::NewL(const TDesC& aTestName, const TTestStepType aTestType)
3922 CTestGetXmfMetaDataEntry* self = new(ELeave) CTestGetXmfMetaDataEntry(aTestName, aTestType);
3926 TVerdict CTestGetXmfMetaDataEntry::DoTestL(CMidiClientUtility* /*aMidi*/)
3928 TVerdict ret = EPass;
3929 TInt err = KErrNone;
3931 TInt expErr = KErrNone;
3932 // TInt metaDataIndex = 1; // EABI warning removal
3934 INFO_PRINTF1(_L("CMidiClientUtility: Get Xmf Meta Data Entry"));
3941 case ETestUnsupported:
3942 expErr = KErrNotSupported;
3944 case ETestMetaDataIndexInvalid:
3945 // metaDataIndex = -1; // EABI warning removal
3948 ERR_PRINTF1(_L("Error - invalid test step type"));
3949 return EInconclusive;
3952 // Default constructor. Returns a blank meta data object. To be used when internalizing data into the object.
3953 // CMMFMetaDataEntry* getXmfMetaDataEntry = CMMFMetaDataEntry::NewL();
3955 // Causes Access Violation
3956 // TRAPD(err, CMMFMetaDataEntry* getXmfMetaDataEntry = aMidi->GetMetaDataEntryL(metaDataIndex));
3959 ERR_PRINTF3(_L("GetXmfMetaDataEntry gave error %d (expected %d)"), err, expErr);
3963 INFO_PRINTF3(_L("GetXmfMetaDataEntry %d = %d"),err ,expErr);
3968 //------------------------------------------------------------------
3971 //------------------------------------------------------------------
3973 CTestLoadCustomInstrumentData::CTestLoadCustomInstrumentData(const TDesC& aTestName,
3974 const TTestStepType aTestType)
3975 :CTestMmfMidiClntStep(aTestName, aTestType)
3979 CTestLoadCustomInstrumentData* CTestLoadCustomInstrumentData::NewL(const TDesC& aTestName,
3980 const TTestStepType aTestType)
3982 CTestLoadCustomInstrumentData* self = new (ELeave) CTestLoadCustomInstrumentData(aTestName,
3988 TVerdict CTestLoadCustomInstrumentData::DoTestL(CMidiClientUtility* aMidi)
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
3996 TVerdict ret = EPass;
3999 TInt memBankId = 90;
4000 TInt memInstrId = 91;
4004 // change these to real descriptors when we have a MIDI instruments
4005 const TDesC8* ptrInstrument = &KNullDesC8;
4006 const TDesC8* ptrBadInstrument = &KNullDesC8;
4008 // XXX::When we have a MIDI instrument / controller load the instrument
4009 // into the descriptor here.
4017 case ETestInvalidId:
4018 expErr = KErrArgument;
4021 case ETestAlreadyLoaded:
4022 // ** to do : load once and attempt to load again.
4023 // when instrument data files are available, this will work
4026 case ETestUnsupported: // ** to define test data for this
4027 expErr = KErrNotSupported;
4031 ERR_PRINTF1(_L("Error - invalid test step type"));
4032 return EInconclusive;
4034 TInt err = KErrNone;
4036 // bad descriptor test
4037 if (iTestType == ETestUnsupported)
4039 // load the bad / unsupported instrument
4040 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrBadInstrument, bankId, instrId, memBankId, memInstrId));
4044 // if testing already loaded, preload the instrument here
4045 if(iTestType == ETestAlreadyLoaded)
4047 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId));
4048 INFO_PRINTF2(_L("Preload : LoadCustomInstrumentDataL gave error %d"), err);
4051 ret = EInconclusive;
4056 // load the instrument
4057 TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId));
4060 INFO_PRINTF3(_L("LoadCustomInstrumentDataL gave error %d (expected %d)"), err, expErr);
4071 //------------------------------------------------------------------
4074 //------------------------------------------------------------------
4076 _LIT(KMidiClntChunk, "MidiClntChunk");
4077 _LIT(KMidiClntSemaphore, "MidiClntSemaphore");
4079 CTestCheckInterface::CTestCheckInterface(const TDesC& aTestName, const TTestStepType aTestType)
4080 :CTestMmfMidiClntStep(aTestName,aTestType)
4084 CTestCheckInterface* CTestCheckInterface::NewL(const TDesC& aTestName, const TTestStepType aTestType)
4086 CTestCheckInterface* self = new (ELeave) CTestCheckInterface(aTestName, aTestType);
4087 CleanupStack::PushL(self);
4089 CleanupStack::Pop(self);
4093 void CTestCheckInterface::ConstructL()
4095 User::LeaveIfError(iChunk.CreateGlobal(KMidiClntChunk,20,20));
4096 User::LeaveIfError(iSemaphore.CreateGlobal(KMidiClntSemaphore, 0));
4100 CTestCheckInterface::~CTestCheckInterface()
4104 void CTestCheckInterface::Close()
4111 TVerdict CTestCheckInterface::DoTestL(CMidiClientUtility* aMidi)
4114 TVerdict ret = EPass;
4115 TInt expErr = KErrNone;
4116 TInt err = KErrNone;
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);
4131 //PlayNoteL(WithStartTime)//
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);
4145 aMidi->StopNotes(0);
4146 err = CompareInterface(_L8("StopNotes"));
4147 INFO_PRINTF3(_L("Check interface StopNotes gave error %d (expected %d)"), err, expErr);
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);
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);
4181 TRAP_IGNORE(aMidi->PlaybackRateL());
4182 err = CompareInterface(_L8("PlaybackRateL"));
4183 INFO_PRINTF3(_L("Check interface PlaybackRateL gave error %d (expected %d)"), err, expErr);
4191 //SetPlaybackRateL//
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);
4203 //MaxPlaybackRateL//
4205 TRAP_IGNORE(aMidi->MaxPlaybackRateL());
4206 err = CompareInterface(_L8("MaxPlaybackRateL"));
4207 INFO_PRINTF3(_L("Check interface MaxPlaybackRateL gave error %d (expected %d)"), err, expErr);
4215 //MinPlaybackRateL//
4217 TRAP_IGNORE(aMidi->MinPlaybackRateL());
4218 err = CompareInterface(_L8("MinPlaybackRateL"));
4219 INFO_PRINTF3(_L("Check interface MinPlaybackRateL gave error %d (expected %d)"), err, expErr);
4227 //TempoMicroBeatsPerMinuteL//
4229 TRAP_IGNORE(aMidi->TempoMicroBeatsPerMinuteL());
4230 err = CompareInterface(_L8("TempoMicroBeatsPerMinuteL"));
4231 INFO_PRINTF3(_L("Check interface TempoMicroBeatsPerMinuteL gave error %d (expected %d)"), err, expErr);
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);
4251 //PitchTranspositionCentsL//
4253 TRAP_IGNORE(aMidi->PitchTranspositionCentsL());
4254 err = CompareInterface(_L8("PitchTranspositionCentsL"));
4255 INFO_PRINTF3(_L("Check interface PitchTranspositionCentsL gave error %d (expected %d)"), err, expErr);
4263 //SetPitchTranspositionL//
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);
4275 //DurationMicroBeatsL//
4277 TRAP_IGNORE(aMidi->DurationMicroBeatsL());
4278 err = CompareInterface(_L8("DurationMicroBeatsL"));
4279 INFO_PRINTF3(_L("Check interface DurationMicroBeatsL gave error %d (expected %d)"), err, expErr);
4289 TRAP_IGNORE(aMidi->NumTracksL());
4290 err = CompareInterface(_L8("NumTracksL"));
4291 INFO_PRINTF3(_L("Check interface NumTracksL gave error %d (expected %d)"), err, expErr);
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);
4313 TRAP_IGNORE(aMidi->MimeTypeL());
4314 err = CompareInterface(_L8("MimeTypeL"));
4315 INFO_PRINTF3(_L("Check interface MimeTypeL gave error %d (expected %d)"), err, expErr);
4323 //PositionMicroBeatsL//
4325 TRAP_IGNORE(aMidi->PositionMicroBeatsL());
4326 err = CompareInterface(_L8("PositionMicroBeatsL"));
4327 INFO_PRINTF3(_L("Check interface PositionMicroBeatsL gave error %d (expected %d)"), err, expErr);
4335 //SetPositionMicroBeatsL//
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);
4347 //SetSyncUpdateCallbackIntervalL//
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);
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);
4371 //SendMessageL (WithTimeStamp)//
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);
4386 TMipMessageEntry mipEntry;
4387 mipEntry.iChannel = 10;
4388 mipEntry.iMIPValue = 20;
4389 RArray<TMipMessageEntry> mipArray;
4390 mipArray.Append(mipEntry);
4392 TRAP_IGNORE(aMidi->SendMipMessageL(mipArray));
4395 err = CompareInterface(_L8("SendMipMessageL"));
4396 INFO_PRINTF3(_L("Check interface SendMipMessageL gave error %d (expected %d)"), err, expErr);
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);
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);
4432 TRAP_IGNORE(aMidi->LoadCustomBankL(_L(""),bankId));
4434 err = CompareInterface(_L8("LoadCustomBankL"));
4435 INFO_PRINTF3(_L("Check interface LoadCustomBankL gave error %d (expected %d)"), err, expErr);
4443 //LoadCustomBankDataL//
4447 TRAP_IGNORE(aMidi->LoadCustomBankDataL(_L8(""),bankId));
4449 err = CompareInterface(_L8("LoadCustomBankDataL"));
4450 INFO_PRINTF3(_L("Check interface LoadCustomBankDataL gave error %d (expected %d)"), err, expErr);
4458 //UnloadCustomBankL//
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);
4470 //CustomBankLoadedL//
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);
4482 //UnloadAllCustomBanksL//
4484 TRAP_IGNORE(aMidi->UnloadAllCustomBanksL());
4485 err = CompareInterface(_L8("UnloadAllCustomBanksL"));
4486 INFO_PRINTF3(_L("Check interface UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr);
4494 //NumberOfInstrumentsL//
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);
4506 //GetInstrumentIdL//
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);
4521 HBufC* instrumentName = NULL;
4522 TRAP_IGNORE(instrumentName = aMidi->InstrumentNameL(0, ETrue, 0));
4523 delete instrumentName;
4525 err = CompareInterface(_L8("InstrumentNameL"));
4526 INFO_PRINTF3(_L("Check interface InstrumentNameL gave error %d (expected %d)"), err, expErr);
4537 TInt instrumentId = 0;
4539 TRAP_IGNORE(aMidi->GetInstrumentL(0, instrumentId, bankId));
4541 err = CompareInterface(_L8("GetInstrumentL"));
4542 INFO_PRINTF3(_L("Check interface GetInstrumentL gave error %d (expected %d)"), err, expErr);
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);
4562 //LoadCustomInstrumentL//
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);
4574 //LoadCustomInstrumentDataL//
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);
4586 //UnloadCustomInstrumentL//
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);
4598 //PercussionKeyNameL//
4601 HBufC* percussionKeyName = NULL;
4602 TRAP_IGNORE(percussionKeyName = aMidi->PercussionKeyNameL(0,0,0,0));
4603 delete percussionKeyName;
4605 err = CompareInterface(_L8("PercussionKeyNameL"));
4606 INFO_PRINTF3(_L("Check interface PercussionKeyNameL gave error %d (expected %d)"), err, expErr);
4617 TTimeIntervalMicroSeconds stopTime(0);
4618 TRAP_IGNORE(aMidi->StopTimeL(stopTime));
4620 err = CompareInterface(_L8("StopTimeL"));
4621 INFO_PRINTF3(_L("Check interface StopTimeL gave error %d (expected %d)"), err, expErr);
4632 TTimeIntervalMicroSeconds stopTime(0);
4633 TRAP_IGNORE(aMidi->SetStopTimeL(stopTime));
4635 err = CompareInterface(_L8("SetStopTimeL"));
4636 INFO_PRINTF3(_L("Check interface SetStopTimeL gave error %d (expected %d)"), err, expErr);
4647 TInt repeatNumberOfTimes = 0;
4648 TTimeIntervalMicroSeconds trailingSilence(0);
4649 TRAP_IGNORE(aMidi->SetRepeatsL(repeatNumberOfTimes, trailingSilence));
4651 err = CompareInterface(_L8("SetRepeatsL"));
4652 INFO_PRINTF3(_L("Check interface SetRepeatsL gave error %d (expected %d)"), err, expErr);
4661 TRAP_IGNORE(aMidi->GetRepeats());
4662 err = CompareInterface(_L8("GetRepeats"));
4663 INFO_PRINTF3(_L("Check interface GetRepeats gave error %d (expected %d)"), err, expErr);
4674 TRAP_IGNORE(aMidi->PolyphonyL());
4675 err = CompareInterface(_L8("PolyphonyL"));
4676 INFO_PRINTF3(_L("Check interface PolyphonyL gave error %d (expected %d)"), err, expErr);
4684 //SetMaxPolyphonyL//
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);
4696 //ChannelsSupportedL//
4698 TRAP_IGNORE(aMidi->ChannelsSupportedL());
4699 err = CompareInterface(_L8("ChannelsSupportedL"));
4700 INFO_PRINTF3(_L("Check interface ChannelsSupportedL gave error %d (expected %d)"), err, expErr);
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);
4720 //MaxChannelVolumeL//
4722 TRAP_IGNORE(aMidi->MaxChannelVolumeL());
4723 err = CompareInterface(_L8("MaxChannelVolumeL"));
4724 INFO_PRINTF3(_L("Check interface MaxChannelVolumeL gave error %d (expected %d)"), err, expErr);
4732 //SetChannelVolumeL//
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);
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);
4758 TRAP_IGNORE(aMidi->VolumeL());
4759 err = CompareInterface(_L8("VolumeL"));
4760 INFO_PRINTF3(_L("Check interface VolumeL gave error %d (expected %d)"), err, expErr);
4770 TRAP_IGNORE(aMidi->MaxVolumeL());
4771 err = CompareInterface(_L8("MaxVolumeL"));
4772 INFO_PRINTF3(_L("Check interface MaxVolumeL gave error %d (expected %d)"), err, expErr);
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);
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);
4806 TRAP_IGNORE(aMidi->GetBalanceL());
4807 err = CompareInterface(_L8("GetBalanceL"));
4808 INFO_PRINTF3(_L("Check interface GetBalanceL gave error %d (expected %d)"), err, expErr);
4818 TRAP_IGNORE(aMidi->SetBalanceL());
4819 err = CompareInterface(_L8("SetBalanceL"));
4820 INFO_PRINTF3(_L("Check interface SetBalanceL gave error %d (expected %d)"), err, expErr);
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);
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);
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);
4866 TInt CTestCheckInterface::CompareInterface(const TDesC8& aInterfaceName)
4868 TBuf8<40> clientBuf;
4869 TBuf8<40> controllerBuf;
4870 clientBuf.FillZ(40);
4871 controllerBuf.FillZ(40);
4873 clientBuf.Copy(aInterfaceName);
4875 controllerBuf = iChunk.Base();
4876 controllerBuf.SetLength(aInterfaceName.Length());
4878 TInt err = clientBuf.Compare(controllerBuf);
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),
4890 iSectName = aSectName;
4891 iKeyName = aKeyName;
4894 CTestMidiClntOpenFileByHandle* CTestMidiClntOpenFileByHandle::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TTestStepType aTestType)
4896 CTestMidiClntOpenFileByHandle* self = new(ELeave) CTestMidiClntOpenFileByHandle(aTestName, aSectName, aKeyName, aPlay, aTestType);
4900 TVerdict CTestMidiClntOpenFileByHandle::DoTestStepL()
4902 //[ Local variables ]
4904 TInt expErr = KErrNone;
4905 TVerdict ret = EFail;
4907 //[ Get the File name from ini file ]
4908 if(!GetStringFromConfig(iSectName,iKeyName,filename))
4910 return EInconclusive;
4913 //[ Expected results ]
4920 expErr = KErrNotSupported;
4923 ERR_PRINTF1(_L("Error - invalid test step type"));
4924 return EInconclusive;
4927 //[ Create CMidiClientUtility - player ]
4928 CMidiClientUtility* player=NULL;
4929 TRAPD(err1, player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality));
4930 if (err1 != KErrNone)
4932 ERR_PRINTF2(_L("Error while creating a CMidiClientUtility : %d"),err1);
4933 return EInconclusive;
4938 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
4939 return EInconclusive;
4941 CleanupStack::PushL(player);
4943 TMMFMessageDestinationPckg dummyPckg;
4944 TInt dummyFunc = EDevMidiOff;
4946 player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
4952 //[ Connect to File System using RFs ]
4953 User::LeaveIfError(rFs.Connect());
4954 CleanupClosePushL(rFs);
4955 User::LeaveIfError(rFs.ShareProtected());
4957 //[ Open the file using RFile ]
4958 TFileName theDestinationFileName;
4959 theDestinationFileName.Append(filename);
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);
4968 player->OpenFile(rFile);
4970 //[ Wait for Initialisation Callback ]
4971 INFO_PRINTF1(_L("Start : CMidiClientUtility->OpenFile()"));
4972 CActiveScheduler::Start();
4973 INFO_PRINTF1(_L("End : CMidiClientUtility->OpenFile()"));
4975 //[ Check for errors ]
4976 if (iError == expErr)
4978 INFO_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError);
4983 ERR_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError);
4987 //[ Clean-up RFs, RFile and CMidiClientUtility ]
4988 CleanupStack::PopAndDestroy(3);
4994 //------------------------------------------------------------------------
4996 CTestMidiClntPlayFileByHandle::CTestMidiClntPlayFileByHandle(const TDesC& aTestName)
4997 :CTestMmfMidiClntStep(aTestName, ETestValid)
5001 CTestMidiClntPlayFileByHandle* CTestMidiClntPlayFileByHandle::NewL(const TDesC& aTestName)
5003 CTestMidiClntPlayFileByHandle* self = new(ELeave) CTestMidiClntPlayFileByHandle(aTestName);
5007 TVerdict CTestMidiClntPlayFileByHandle::DoTestL(CMidiClientUtility* aMidi)
5009 //[ Local variables ]
5012 //[ Get the filename ]
5013 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),filename))
5015 return EInconclusive;
5018 INFO_PRINTF1(_L("CMidiClientUtility : Play MIDI File"));
5020 iCurrentState = EMidiStateClosedDisengaged;
5026 //[ Connect to File System using RFs ]
5027 User::LeaveIfError(rFs.Connect());
5028 CleanupClosePushL(rFs);
5029 User::LeaveIfError(rFs.ShareProtected());
5031 INFO_PRINTF1(_L("Opening the file : c:\\DoesntExist.mid"));
5033 //[ Open the file using RFile ]
5034 TInt theRes = rFile.Open(rFs, filename, EFileRead);
5035 if(theRes != KErrNone)
5037 INFO_PRINTF2(_L("Cannot open file : %S"), &filename);
5039 CleanupClosePushL(rFile);
5041 //[ Call the OpenFile Method using the File Handle ]
5042 aMidi->OpenFile(rFile);
5044 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5045 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged
5047 //[ Clean up RFs and RFile ]
5048 CleanupStack::PopAndDestroy(2);
5050 if (iCurrentState != EMidiStateOpenDisengaged)
5052 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
5056 if (iError != KErrNone)
5058 ERR_PRINTF2(_L("Play gave error %d"),iError);
5062 INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state..."));
5063 CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying
5064 if (iCurrentState != EMidiStateOpenPlaying)
5066 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState);
5070 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5071 CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged
5072 if (iCurrentState != EMidiStateOpenEngaged)
5074 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
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
5086 CTestMidiClntThirteenMidiEvents::CTestMidiClntThirteenMidiEvents(const TDesC& aTestName, const TTestStepType aTestType)
5087 :CTestMmfMidiClntStep(aTestName, aTestType)
5089 // set the current transion to 0, the start point
5090 iCurrentTransion = 0;
5094 CTestMidiClntThirteenMidiEvents* CTestMidiClntThirteenMidiEvents::NewL(const TDesC& aTestName, const TTestStepType aTestType)
5096 CTestMidiClntThirteenMidiEvents* self = new(ELeave)CTestMidiClntThirteenMidiEvents(aTestName, aTestType);
5100 void CTestMidiClntThirteenMidiEvents::InitialiseExpectedTransArrayL()
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));
5118 void CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged(TInt /*aMicroBeatsPerMinute*/)
5120 if (expectedTransitions[iCurrentTransion] == EMmcuoTempoChanged)
5122 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback"));
5127 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback not expected"));
5128 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5132 void CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged(TInt /*aChannel*/,TReal32 /*aVolumeInDecibels*/)
5134 if (expectedTransitions[iCurrentTransion] == EMmcuoVolumeChanged)
5136 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback"));
5141 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback not expected"));
5142 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5146 void CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged(TInt /*aChannel*/,TBool /*aMuted*/)
5148 if (expectedTransitions[iCurrentTransion] == EMmcuoMuteChanged)
5150 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback"));
5155 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback not expected"));
5156 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5161 void CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound(const TInt /*aMetaDataEntryId*/,const TTimeIntervalMicroSeconds& /*aPosition*/)
5163 if (expectedTransitions[iCurrentTransion] == EMmcuoMetaDataEntryFound)
5165 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback"));
5170 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback not expected"));
5171 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5175 void CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& /*aEntry*/)
5177 if (expectedTransitions[iCurrentTransion] == EMmcuoMipMessageReceived)
5179 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback"));
5184 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback not expected"));
5185 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5189 void CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged(TInt /*aNewPolyphony*/)
5191 if (expectedTransitions[iCurrentTransion] == EMmcuoPolyphonyChanged)
5193 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback"));
5198 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback not expected"));
5199 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5203 void CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged(TInt /*aChannel*/,TInt /*aBankId*/,TInt /*aInstrumentId*/)
5205 if (expectedTransitions[iCurrentTransion] == EMmcuoInstrumentChanged)
5207 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback"));
5212 INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback not expected"));
5213 expectedTransitions[iCurrentTransion] = EMmcuoInvalid;
5218 TVerdict CTestMidiClntThirteenMidiEvents::DoTestL(CMidiClientUtility* aMidi)
5220 TVerdict ret = EPass;
5221 TInt expErr = KErrNone;
5223 InitialiseExpectedTransArrayL();
5226 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName))
5228 return EInconclusive;
5231 INFO_PRINTF1(_L("CMidiClientUtility: Play midi file"));
5239 expErr = KErrNotSupported;
5241 case ETestInvalidState:
5242 expErr = KErrUnknown;
5245 ERR_PRINTF1(_L("Error - invalid test step type"));
5246 return EInconclusive;
5249 iCurrentState = EMidiStateClosedDisengaged;
5250 aMidi->OpenFile(fileName);
5251 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5252 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged
5253 if (iCurrentState != EMidiStateOpenDisengaged)
5255 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
5256 expectedTransitions.Close();
5261 if (expErr != iError)
5263 ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr);
5264 expectedTransitions.Close();
5269 INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr);
5273 INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state..."));
5274 CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying
5275 if (iCurrentState != EMidiStateOpenPlaying)
5277 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState);
5278 expectedTransitions.Close();
5281 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5282 CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged
5283 if (iCurrentState != EMidiStateOpenEngaged)
5285 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState);
5286 expectedTransitions.Close();
5290 if (expectedTransitions.Find(EMmcuoInvalid) != KErrNotFound)
5292 ERR_PRINTF1(_L("One of the transactions was lost"));
5293 expectedTransitions.Close();
5297 expectedTransitions.Close();
5302 //------------------------------------------------------------------
5303 // TEST 1: Test the transtion from EMidiStateClosedDisengaged to EMidiStateClosedEngaged.
5305 CTestTrasitionFromEClosedToEClosedEngaged::CTestTrasitionFromEClosedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType)
5306 :CTestMmfMidiClntStep(aTestName, aTestType)
5310 CTestTrasitionFromEClosedToEClosedEngaged* CTestTrasitionFromEClosedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType)
5312 CTestTrasitionFromEClosedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEClosedEngaged(aTestName, aTestType);
5316 TVerdict CTestTrasitionFromEClosedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi)
5318 //[ Local variables ]
5319 TVerdict ret = EPass;
5320 TInt expErr = KErrNone;
5322 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateClosedEngaged"));
5323 //[ Expected results ]
5330 expErr = KErrNotSupported;
5332 case ETestInvalidState:
5333 expErr = KErrUnknown;
5336 ERR_PRINTF1(_L("Error - invalid test step type"));
5337 return EInconclusive;
5340 //[ Set the current state to EMidiStateClosedDisengaged ]
5341 iCurrentState = EMidiStateClosedDisengaged;
5343 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ]
5344 TMidiState MIDIClientState = aMidi->State();
5346 if (MIDIClientState == EMidiStateClosedDisengaged)
5348 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged"));
5352 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState);
5358 if (expErr != iError)
5360 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5364 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateClosedEngaged
5366 if (iCurrentState != EMidiStateClosedEngaged)
5368 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState);
5372 MIDIClientState = aMidi->State();
5374 if (MIDIClientState == EMidiStateClosedEngaged)
5376 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged"));
5380 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState);
5388 //------------------------------------------------------------------
5389 // TEST 2: Test the transtion from EMidiStateClosedDisengaged to EMidiStateOpenEngaged.
5391 CTestTrasitionFromEClosedToEOpenEngaged::CTestTrasitionFromEClosedToEOpenEngaged(const TDesC& aTestName, const TTestStepType aTestType)
5392 :CTestMmfMidiClntStep(aTestName, aTestType)
5396 CTestTrasitionFromEClosedToEOpenEngaged* CTestTrasitionFromEClosedToEOpenEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType)
5398 CTestTrasitionFromEClosedToEOpenEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEOpenEngaged(aTestName, aTestType);
5402 TVerdict CTestTrasitionFromEClosedToEOpenEngaged::DoTestL(CMidiClientUtility* aMidi)
5404 //[ Local variables ]
5405 TVerdict ret = EPass;
5406 TInt expErr = KErrNone;
5408 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateOpenEngaged"));
5409 //[ Expected results ]
5416 expErr = KErrNotSupported;
5418 case ETestInvalidState:
5419 expErr = KErrUnknown;
5422 ERR_PRINTF1(_L("Error - invalid test step type"));
5423 return EInconclusive;
5426 //[ Set the current state to EMidiStateClosedDisengaged ]
5427 iCurrentState = EMidiStateClosedDisengaged;
5429 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ]
5430 TMidiState MIDIClientState = aMidi->State();
5432 if (MIDIClientState == EMidiStateClosedDisengaged)
5434 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged"));
5438 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState);
5442 // [ Call OpenFile() ]
5444 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName))
5446 return EInconclusive;
5448 aMidi->OpenFile(fileName);
5450 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged(EMidiStateOpenDisengaged)
5451 if (iCurrentState != EMidiStateOpenDisengaged)
5453 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
5457 MIDIClientState = aMidi->State();
5458 if (MIDIClientState == EMidiStateOpenDisengaged)
5460 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged"));
5464 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState);
5470 if (expErr != iError)
5472 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5476 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying
5478 if (iCurrentState != EMidiStateOpenPlaying)
5480 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState);
5484 MIDIClientState = aMidi->State();
5485 if (MIDIClientState == EMidiStateOpenPlaying)
5487 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying"));
5491 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState);
5495 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged
5497 if (iCurrentState != EMidiStateOpenEngaged)
5499 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState);
5503 MIDIClientState = aMidi->State();
5505 if (MIDIClientState == EMidiStateOpenEngaged)
5507 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged"));
5511 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState);
5519 //------------------------------------------------------------------
5520 // TEST 3: Test the transtion from EMidiStateOpenEngaged to EMidiStateClosedEngaged.
5522 CTestTrasitionFromEOpenEngagedToEClosedEngaged::CTestTrasitionFromEOpenEngagedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType)
5523 :CTestMmfMidiClntStep(aTestName, aTestType)
5527 CTestTrasitionFromEOpenEngagedToEClosedEngaged* CTestTrasitionFromEOpenEngagedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType)
5529 CTestTrasitionFromEOpenEngagedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEOpenEngagedToEClosedEngaged(aTestName, aTestType);
5533 TVerdict CTestTrasitionFromEOpenEngagedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi)
5535 //[ Local variables ]
5536 TVerdict ret = EPass;
5537 TInt expErr = KErrNone;
5539 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateOpenEngaged to EMidiStateClosedEngaged"));
5540 //[ Expected results ]
5547 expErr = KErrNotSupported;
5549 case ETestInvalidState:
5550 expErr = KErrUnknown;
5553 ERR_PRINTF1(_L("Error - invalid test step type"));
5554 return EInconclusive;
5557 //[ Set the current state to EMidiStateClosedDisengaged ]
5558 iCurrentState = EMidiStateClosedDisengaged;
5560 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ]
5561 TMidiState MIDIClientState = aMidi->State();
5563 if (MIDIClientState == EMidiStateClosedDisengaged)
5565 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged"));
5569 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState);
5573 // [ Call OpenFile() ]
5575 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName))
5577 return EInconclusive;
5580 aMidi->OpenFile(fileName);
5581 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5582 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged
5583 if (iCurrentState != EMidiStateOpenDisengaged)
5585 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
5588 MIDIClientState = aMidi->State();
5590 if (MIDIClientState == EMidiStateOpenDisengaged)
5592 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged"));
5596 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState);
5602 if (expErr != iError)
5604 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5608 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying
5610 if (iCurrentState != EMidiStateOpenPlaying)
5612 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState);
5616 MIDIClientState = aMidi->State();
5617 if (MIDIClientState == EMidiStateOpenPlaying)
5619 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying"));
5623 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState);
5627 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged
5629 if (iCurrentState != EMidiStateOpenEngaged)
5631 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState);
5635 MIDIClientState = aMidi->State();
5636 if (MIDIClientState == EMidiStateOpenEngaged)
5638 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged"));
5642 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState);
5649 if (expErr != iError)
5651 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5655 CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged
5657 if (iCurrentState != EMidiStateClosedEngaged)
5659 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState);
5663 MIDIClientState = aMidi->State();
5664 if (MIDIClientState == EMidiStateClosedEngaged)
5666 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged"));
5670 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState);
5679 //---------------------------------------------------------------------
5680 // TEST 4: Test the transtion from EMidiStateClosedEngaged to EMidiStateClosedDisengaged.
5682 CTestTrasitionFromEClosedEngagedToEClosed::CTestTrasitionFromEClosedEngagedToEClosed(const TDesC& aTestName, const TTestStepType aTestType)
5683 :CTestMmfMidiClntStep(aTestName, aTestType)
5687 CTestTrasitionFromEClosedEngagedToEClosed* CTestTrasitionFromEClosedEngagedToEClosed::NewL(const TDesC& aTestName, const TTestStepType aTestType)
5689 CTestTrasitionFromEClosedEngagedToEClosed* self = new(ELeave) CTestTrasitionFromEClosedEngagedToEClosed(aTestName, aTestType);
5693 TVerdict CTestTrasitionFromEClosedEngagedToEClosed::DoTestL(CMidiClientUtility* aMidi)
5695 //[ Local variables ]
5696 TVerdict ret = EPass;
5697 TInt expErr = KErrNone;
5699 INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedEngaged to EMidiStateClosedDisengaged"));
5700 //[ Expected results ]
5707 expErr = KErrNotSupported;
5709 case ETestInvalidState:
5710 expErr = KErrUnknown;
5713 ERR_PRINTF1(_L("Error - invalid test step type"));
5714 return EInconclusive;
5717 //[ Set the current state to EMidiStateClosedDisengaged ]
5718 iCurrentState = EMidiStateClosedDisengaged;
5720 //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ]
5721 TMidiState MIDIClientState = aMidi->State();
5723 if (MIDIClientState == EMidiStateClosedDisengaged)
5725 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged"));
5729 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState);
5733 // [ Call OpenFile() ]
5735 if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName))
5737 return EInconclusive;
5740 aMidi->OpenFile(fileName);
5741 INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state..."));
5742 CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged
5743 if (iCurrentState != EMidiStateOpenDisengaged)
5745 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState);
5749 MIDIClientState = aMidi->State();
5750 if (MIDIClientState == EMidiStateOpenDisengaged)
5752 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged"));
5756 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState);
5762 if (expErr != iError)
5764 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5768 CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying
5770 if (iCurrentState != EMidiStateOpenPlaying)
5772 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState);
5776 MIDIClientState = aMidi->State();
5777 if (MIDIClientState == EMidiStateOpenPlaying)
5779 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying"));
5783 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState);
5787 CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged
5789 if (iCurrentState != EMidiStateOpenEngaged)
5791 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState);
5795 MIDIClientState = aMidi->State();
5797 if (MIDIClientState == EMidiStateOpenEngaged)
5799 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged"));
5803 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState);
5810 if (expErr != iError)
5812 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5816 CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged
5818 if (iCurrentState != EMidiStateClosedEngaged)
5820 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState);
5824 MIDIClientState = aMidi->State();
5825 if (MIDIClientState == EMidiStateClosedEngaged)
5827 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged"));
5831 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState);
5836 TTimeIntervalMicroSeconds fadeOutDuration(0);
5837 aMidi->Stop(fadeOutDuration);
5838 if (expErr != iError)
5840 ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr);
5844 CActiveScheduler::Start(); // EMidiStateClosedEngaged -> EMidiStateClosedDisengaged
5846 if (iCurrentState != EMidiStateClosedDisengaged)
5848 ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedDisengaged, received = %d)"), iCurrentState);
5852 MIDIClientState = aMidi->State();
5854 if (MIDIClientState == EMidiStateClosedDisengaged)
5856 ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged"));
5860 ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState);
5866 //------------------------------------------------------------------------
5867 // This test checks for opening the file using a FileHandle more than
5871 CTestMidiOpenFileHandleRepeat::CTestMidiOpenFileHandleRepeat(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
5872 :CTestMmfMidiClntStep(aTestName, ETestValid),
5875 iSectName = aSectName;
5876 iKeyName = aKeyName;
5879 CTestMidiOpenFileHandleRepeat* CTestMidiOpenFileHandleRepeat::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
5881 CTestMidiOpenFileHandleRepeat* self = new(ELeave) CTestMidiOpenFileHandleRepeat(aTestName, aSectName, aKeyName, aPlay);
5885 TVerdict CTestMidiOpenFileHandleRepeat::DoTestStepL()
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 "));
5893 CMidiClientUtility *midiClient = CMidiClientUtility::NewL(*this);
5896 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
5897 return EInconclusive;
5899 CleanupStack::PushL(midiClient);
5903 CleanupClosePushL(fs);
5905 TMMFMessageDestinationPckg dummyPckg;
5906 TInt dummyFunc = 0; //EDevMidiOff;
5908 midiClient->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
5909 TInt err = fs.ShareProtected();
5910 if ((err = file.Open(fs, filename, EFileRead )) == KErrNone)
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();
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
5922 INFO_PRINTF1(_L("Inside the second call"));
5923 midiClient->OpenFile(file);
5924 CActiveScheduler::Start();
5925 midiClient->Close();
5926 CActiveScheduler::Start();
5931 INFO_PRINTF2(_L("Failed to open the file the second time returned with err = %d"),err);
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)
5941 INFO_PRINTF2(_L("Failed to open the file.Failed with error %d"),err);
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)
5951 INFO_PRINTF2(_L("Failed to open the file second time.Failed with error %d"),err);
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)
5959 INFO_PRINTF2(_L("Failed with error %d"),err);
5961 midiClient->Close();
5962 CActiveScheduler::Start();
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)
5971 INFO_PRINTF2(_L("Expected to return error -14, but returned error %d"),err);
5974 CleanupStack::PopAndDestroy(2); // fileServer, midiClient
5978 TVerdict CTestMidiOpenFileHandleRepeat::DoTestL(CMidiClientUtility* /*aMidi*/)
5984 Playing a midi file without opening a file and checking for its status during call back.
5987 CTestMidiClntPlayWithoutFile::CTestMidiClntPlayWithoutFile(const TDesC& aTestName)
5988 :CTestMmfMidiClntStep(aTestName, ETestValid)
5991 CTestMidiClntPlayWithoutFile* CTestMidiClntPlayWithoutFile::NewL(const TDesC& aTestName)
5993 CTestMidiClntPlayWithoutFile* self = new(ELeave) CTestMidiClntPlayWithoutFile(aTestName);
5998 TVerdict CTestMidiClntPlayWithoutFile::DoTestStepL()
6000 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
6001 TVerdict ret = EPass;
6006 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
6007 return EInconclusive;
6009 CleanupStack::PushL(player);
6012 CActiveScheduler::Start();
6014 if (iError != KErrNone)
6016 ERR_PRINTF1(_L("Error while playing"));
6017 return EInconclusive;
6020 TTimeIntervalMicroSeconds fadeOutDuration(0);
6021 player->Stop(fadeOutDuration);
6022 CActiveScheduler::Start();
6024 // Check for errors.
6025 if (iError != KErrNone)
6028 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError );
6031 INFO_PRINTF1(_L("CMidiClientUtility: Destroying"));
6032 CleanupStack::PopAndDestroy(player);
6037 void CTestMidiClntPlayWithoutFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt 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);
6044 if(aError == KErrNone)
6046 if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged))
6048 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error"));
6050 else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged))
6052 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error"));
6054 else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged))
6056 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error"));
6058 else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying))
6060 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error"));
6062 else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged))
6064 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error"));
6068 INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error"));
6073 INFO_PRINTF1(_L("Error during calback"));
6076 CActiveScheduler::Stop();
6079 //------------------------------------------------------------------
6082 Opening a midi file and playing it and checking for its status during call back.
6085 CTestMidiClntOpenAndPlayFile::CTestMidiClntOpenAndPlayFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName)
6086 :CTestMmfMidiClntStep(aTestName, ETestValid)
6088 iSectName = aSectName;
6089 iKeyName = aKeyName;
6092 CTestMidiClntOpenAndPlayFile* CTestMidiClntOpenAndPlayFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName)
6094 CTestMidiClntOpenAndPlayFile* self = new(ELeave) CTestMidiClntOpenAndPlayFile(aTestName, aSectName, aKeyName);
6098 TVerdict CTestMidiClntOpenAndPlayFile::DoTestStepL()
6100 TVerdict ret = EPass;
6103 if(!GetStringFromConfig(iSectName,iKeyName,filename))
6104 return EInconclusive;
6106 CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
6109 ERR_PRINTF1(_L("Could not create a CMidiClientUtility"));
6110 return EInconclusive;
6112 CleanupStack::PushL(player);
6114 player->OpenFile(filename);
6116 // Wait for initialisation callback
6117 INFO_PRINTF1(_L("CMidiClientUtility: Opening file"));
6118 CActiveScheduler::Start();
6121 CActiveScheduler::Start();
6123 if (iError != KErrNone)
6125 ERR_PRINTF1(_L("Error while playing"));
6126 return EInconclusive;
6129 TTimeIntervalMicroSeconds fadeOutDuration(0);
6130 player->Stop(fadeOutDuration);
6131 CActiveScheduler::Start();
6133 // Check for errors.
6134 if (iError != KErrNone)
6137 ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError );
6140 INFO_PRINTF1(_L("CMidiClientUtility: Destroying"));
6141 CleanupStack::PopAndDestroy(player);
6146 void CTestMidiClntOpenAndPlayFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt 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);
6153 if(aError == KErrNone)
6155 if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged))
6157 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error"));
6159 else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged))
6161 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error"));
6163 else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged))
6165 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error"));
6167 else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying))
6169 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error"));
6171 else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged))
6173 INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error"));
6177 INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error"));
6182 INFO_PRINTF1(_L("Error during calback"));
6185 CActiveScheduler::Stop();