sl@0: sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "TestMidiClientUtility.h" sl@0: #include sl@0: sl@0: sl@0: CTestMidiClntOpenFile::CTestMidiClntOpenFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid), sl@0: iPlay(aPlay) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiClntOpenFile* CTestMidiClntOpenFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: { sl@0: CTestMidiClntOpenFile* self = new(ELeave) CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenFile::DoTestStepL() sl@0: { sl@0: TPtrC filename; sl@0: if(!GetStringFromConfig(iSectName,iKeyName,filename)) sl@0: return EInconclusive; sl@0: sl@0: CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: CleanupStack::PushL(player); sl@0: sl@0: TMMFMessageDestinationPckg dummyPckg; sl@0: TInt dummyFunc = 0; //EDevMidiOff; sl@0: TBuf8<8> dummyBuff; sl@0: player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); sl@0: sl@0: player->OpenFile(filename); sl@0: sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); sl@0: CActiveScheduler::Start(); sl@0: sl@0: TVerdict ret = EFail; sl@0: sl@0: // Check for errors. sl@0: if (iError == KErrNone) sl@0: ret = DoTestL(player); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); sl@0: CleanupStack::PopAndDestroy(player); sl@0: sl@0: if(iError != KErrNone) sl@0: ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenFile::DoTestL(CMidiClientUtility* /*aMidi*/) sl@0: { sl@0: return EPass; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntOpenDes::CTestMidiClntOpenDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid), sl@0: iPlay(aPlay) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiClntOpenDes* CTestMidiClntOpenDes::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: { sl@0: CTestMidiClntOpenDes* self = new(ELeave) CTestMidiClntOpenDes(aTestName, aSectName, aKeyName, aPlay); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenDes::DoTestStepPreambleL() sl@0: { sl@0: TPtrC filename; sl@0: if(!GetStringFromConfig(iSectName, iKeyName, filename)) sl@0: return EInconclusive; sl@0: sl@0: RFs fs; sl@0: RFile file; sl@0: TInt size = 0; sl@0: sl@0: // connect to file system and open file sl@0: User::LeaveIfError(fs.Connect()); sl@0: User::LeaveIfError(file.Open(fs,filename,EFileRead)); sl@0: CleanupClosePushL(file); sl@0: sl@0: // Set HBuf size sl@0: User::LeaveIfError(file.Size(size)); sl@0: INFO_PRINTF2(_L("size of file = %d\n"),size); sl@0: sl@0: iAudio = HBufC8::NewMaxL(size); sl@0: sl@0: // read data into Hbuf sl@0: TPtr8 bufferDes(iAudio->Des()); sl@0: User::LeaveIfError(file.Read(bufferDes)); sl@0: sl@0: CleanupStack::PopAndDestroy(); //file sl@0: return CTestMmfMidiClntStep::DoTestStepPreambleL(); sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenDes::DoTestStepPostambleL() sl@0: { sl@0: delete iAudio; sl@0: iAudio = NULL; sl@0: return CTestMmfMidiClntStep::DoTestStepPostambleL(); sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenDes::DoTestStepL() sl@0: { sl@0: CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: CleanupStack::PushL(player); sl@0: sl@0: TMMFMessageDestinationPckg dummyPckg; sl@0: TInt dummyFunc = EDevMidiOff; sl@0: TBuf8<8> dummyBuff; sl@0: player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); sl@0: sl@0: player->OpenDes(iAudio->Des()); sl@0: sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); sl@0: CActiveScheduler::Start(); sl@0: sl@0: TVerdict ret = EFail; sl@0: sl@0: // Check for errors. sl@0: if (iError == KErrNone) sl@0: ret = DoTestL(player); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); sl@0: CleanupStack::PopAndDestroy(player); sl@0: sl@0: if(iError != KErrNone) sl@0: ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenDes::DoTestL(CMidiClientUtility* /*aMidi*/) sl@0: { sl@0: return EPass; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntOpenUrl::CTestMidiClntOpenUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid), sl@0: iPlay(aPlay) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiClntOpenUrl* CTestMidiClntOpenUrl::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: { sl@0: CTestMidiClntOpenUrl* self = new(ELeave) CTestMidiClntOpenUrl(aTestName, aSectName, aKeyName, aPlay); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenUrl::DoTestStepL() sl@0: { sl@0: TPtrC urlname; sl@0: if(!GetStringFromConfig(iSectName,iKeyName,urlname)) sl@0: return EInconclusive; sl@0: sl@0: CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: CleanupStack::PushL(player); sl@0: sl@0: TMMFMessageDestinationPckg dummyPckg; sl@0: TInt dummyFunc = EDevMidiOff; sl@0: TBuf8<8> dummyBuff; sl@0: player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); sl@0: sl@0: player->OpenUrl(urlname); sl@0: sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening url")); sl@0: CActiveScheduler::Start(); sl@0: sl@0: TVerdict ret = EFail; sl@0: sl@0: // Check for errors. sl@0: if (iError == KErrNone) sl@0: ret = DoTestL(player); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); sl@0: CleanupStack::PopAndDestroy(player); sl@0: sl@0: if(iError != KErrNone) sl@0: ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenUrl::DoTestL(CMidiClientUtility* /*aMidi*/) sl@0: { sl@0: return EPass; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntClose::CTestMidiClntClose(const TDesC& aTestName) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntClose* CTestMidiClntClose::NewL(const TDesC& aTestName) sl@0: { sl@0: CTestMidiClntClose* self = new(ELeave) CTestMidiClntClose(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntClose::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Closing file")); sl@0: aMidi->Close(); sl@0: return EPass; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntPlay::CTestMidiClntPlay(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntPlay* CTestMidiClntPlay::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntPlay* self = new(ELeave) CTestMidiClntPlay(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntPlay::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TInt expErr = KErrNone; sl@0: //TTimeIntervalMicroSeconds fadeOutDuration(0); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Play midi file")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: aMidi->OpenFile(_L("c:\\DoesntExist.mid")); sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr); sl@0: sl@0: return EPass; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntStop::CTestMidiClntStop(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntStop* CTestMidiClntStop::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntStop* self = new(ELeave) CTestMidiClntStop(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntStop::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TTimeIntervalMicroSeconds fadeOutDuration(0); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Stop midi file")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: fadeOutDuration = 20; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: aMidi->Stop(fadeOutDuration); sl@0: if (expErr != KErrNone) sl@0: INFO_PRINTF2(_L("Stop gave error %d"),expErr); sl@0: else sl@0: INFO_PRINTF1(_L("Stopping midi file")); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntGetState::CTestMidiClntGetState(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay) sl@0: :CTestMidiClntOpenFile(aTestName, aSectName, aKeyName, aPlay) sl@0: { sl@0: // NB this inherits from CTestMidiClntOpenFile, NOT from CTestMmfMidiClntStep sl@0: // so we have to set this manually. sl@0: iTestType = aTestType; sl@0: } sl@0: sl@0: CTestMidiClntGetState* CTestMidiClntGetState::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TTestStepType aTestType, const TBool aPlay) sl@0: { sl@0: CTestMidiClntGetState* self = new(ELeave) CTestMidiClntGetState(aTestName, aSectName, aKeyName, aTestType, aPlay); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntGetState::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TMidiState expErr; sl@0: //TTimeIntervalMicroSeconds fadeOutDuration(10); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get current state of midi file")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = EMidiStateOpenDisengaged; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = EMidiStateClosedDisengaged; sl@0: // Close player so we can perform negative test, get state before any initialisation has been done sl@0: aMidi->Close(); sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TMidiState state = aMidi->State(); sl@0: if (expErr != state) sl@0: { sl@0: ERR_PRINTF3(_L("State gave error %d (expected %d)"),state, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("State %d = %d"),state, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntPlayNote::CTestMidiClntPlayNote(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntPlayNote* CTestMidiClntPlayNote::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntPlayNote* self = new(ELeave) CTestMidiClntPlayNote(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntPlayNote::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt channel = 0; sl@0: TInt note = 0; sl@0: TTimeIntervalMicroSeconds duration(10); sl@0: TInt noteOnVelocity = 0; sl@0: TInt noteOffVelocity = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Play midi note")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestZeroDurationOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: duration = 0; sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 16; sl@0: break; sl@0: case ETestNoteHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: note = 128; sl@0: break; sl@0: case ETestNoteLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: note = -1; sl@0: break; sl@0: case ETestAttackHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: noteOnVelocity = 128; sl@0: break; sl@0: case ETestAttackLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: noteOnVelocity = -1; sl@0: break; sl@0: case ETestReleaseHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: noteOffVelocity = 128; sl@0: break; sl@0: case ETestReleaseLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: noteOffVelocity = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: TRAPD(err, aMidi->PlayNoteL(channel, note, duration, noteOnVelocity, noteOffVelocity)); sl@0: sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("State gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("PlayNoteL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntStopNotes::CTestMidiClntStopNotes(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntStopNotes* CTestMidiClntStopNotes::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntStopNotes* self = new(ELeave) CTestMidiClntStopNotes(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntStopNotes::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // The framework will catch the invalid channel and no note available sl@0: TVerdict ret = EPass; sl@0: TInt channel = 0; sl@0: //TInt expErr = KErrNone; sl@0: sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: channel = 16; sl@0: break; sl@0: case ETestNoNoteAvailable: sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Stop midi note")); sl@0: aMidi->StopNotes(channel); sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntNoteOn::CTestMidiClntNoteOn(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntNoteOn* CTestMidiClntNoteOn::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntNoteOn* self = new(ELeave) CTestMidiClntNoteOn(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntNoteOn::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt channel = 0; sl@0: TInt note = 0; sl@0: TInt velocity = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Midi note on")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: channel = 1; sl@0: note = 2; sl@0: velocity = 10; sl@0: break; sl@0: case ETestNoNoteAvailable: sl@0: expErr = KErrArgument; sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 16; sl@0: break; sl@0: case ETestNoteHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: note = 128; sl@0: break; sl@0: case ETestNoteLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: note = -1; sl@0: break; sl@0: case ETestVelocityHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: velocity = 128; sl@0: break; sl@0: case ETestVelocityLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: velocity = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->NoteOnL(channel,note,velocity)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntNoteOff::CTestMidiClntNoteOff(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntNoteOff* CTestMidiClntNoteOff::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntNoteOff* self = new(ELeave) CTestMidiClntNoteOff(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntNoteOff::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt channel = 0; sl@0: TInt note = 0; sl@0: TInt velocity = 0; sl@0: sl@0: // Play Midi Note on channel=0, note=1, velocity=50 sl@0: TRAPD(err, aMidi->NoteOnL(0,1,50)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("NoteOnL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("NoteOnL %d = %d"),err ,expErr); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Midi note off")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: channel = 1; sl@0: note = 2; sl@0: velocity = 10; sl@0: break; sl@0: case ETestNoNoteAvailable: sl@0: expErr = KErrNone; // No error is raised, as per specification sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 16; sl@0: break; sl@0: case ETestDifferentNoteVelocity: sl@0: expErr = KErrArgument; sl@0: note = 1; sl@0: velocity = 127; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err2, aMidi->NoteOffL(channel,note,velocity)); sl@0: if (expErr != err2) sl@0: { sl@0: ERR_PRINTF3(_L("NoteOffL gave error %d (expected %d)"),err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("NoteOffL %d = %d"),err2 ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntReturnPlaybackRate::CTestMidiClntReturnPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntReturnPlaybackRate* CTestMidiClntReturnPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntReturnPlaybackRate* self = new(ELeave) CTestMidiClntReturnPlaybackRate(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntReturnPlaybackRate::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Check playback rate")); sl@0: sl@0: // expected results sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt rate = 0; // fixes warning sl@0: sl@0: // TRAPD(err, rate = aMidi->PlaybackRateL()); sl@0: TRAPD(err, aMidi->PlaybackRateL()); // EABI warning removal sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("PlaybackRateL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("PlaybackRateL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetPlaybackRate::CTestMidiClntSetPlaybackRate(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetPlaybackRate* CTestMidiClntSetPlaybackRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetPlaybackRate* self = new(ELeave) CTestMidiClntSetPlaybackRate(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetPlaybackRate::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt playbackRate = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set playback rate")); sl@0: sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestOutOfRangeHigh: sl@0: // high limit on playback rate is dependant on controller sl@0: // when have a proper controller the value below should be changed sl@0: // to a value higher than the upper limit sl@0: playbackRate = -1; sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestOutOfRangeLow: sl@0: playbackRate = -1; // negative values not supported sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetPlaybackRateL(playbackRate)); sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("SetPlaybackRateL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetPlaybackRateL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntReturnMaxPlayRate::CTestMidiClntReturnMaxPlayRate(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntReturnMaxPlayRate* CTestMidiClntReturnMaxPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntReturnMaxPlayRate* self = new(ELeave) CTestMidiClntReturnMaxPlayRate(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntReturnMaxPlayRate::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Check the max play rate")); sl@0: sl@0: // expected results sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt rate = 0; // fixes warning sl@0: // TRAPD(err, rate = aMidi->MaxPlaybackRateL()); sl@0: TRAPD(err, aMidi->MaxPlaybackRateL()); // EABI warning removal sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("MaxPlayRateL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("MaxPlayRateL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntReturnMinPlayRate::CTestMidiClntReturnMinPlayRate(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntReturnMinPlayRate* CTestMidiClntReturnMinPlayRate::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntReturnMinPlayRate* self = new(ELeave) CTestMidiClntReturnMinPlayRate(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntReturnMinPlayRate::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Check the min play rate")); sl@0: sl@0: // expected results sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // TInt rate = 0; // fixes warning sl@0: // TRAPD(err, rate = aMidi->MinPlaybackRateL()); sl@0: TRAPD(err, aMidi->MinPlaybackRateL()); // EABI warning removal sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("MinPlayRateL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("MinPlayRateL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntTempoMicroBeatsPerMinute::CTestMidiClntTempoMicroBeatsPerMinute(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntTempoMicroBeatsPerMinute* CTestMidiClntTempoMicroBeatsPerMinute::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntTempoMicroBeatsPerMinute* self = new(ELeave) CTestMidiClntTempoMicroBeatsPerMinute(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntTempoMicroBeatsPerMinute::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: // TInt microBeatsPerMinute = 0; // EABI warning removal sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return the tempo micro beats per minute")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // TRAPD(err, microBeatsPerMinute = aMidi->TempoMicroBeatsPerMinuteL()); sl@0: TRAPD(err, aMidi->TempoMicroBeatsPerMinuteL()); // EABI warning removal sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("TempoMicroBeatsPerMinuteL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("TempoMicroBeatsPerMinuteL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetTempo::CTestMidiClntSetTempo(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetTempo* CTestMidiClntSetTempo::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetTempo* self = new(ELeave) CTestMidiClntSetTempo(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetTempo::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt microBeatsPerMinute = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set the tempo micro beats per minute")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: microBeatsPerMinute = 60*1000000; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: microBeatsPerMinute = 80*1000000; sl@0: break; sl@0: case ETestBeatsLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: microBeatsPerMinute = -1*1000000; sl@0: break; sl@0: case ETestBeatsHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: //microBeatsPerMinute = 1000001*1000000; XXX overflow warning sl@0: microBeatsPerMinute = 1000001; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetTempoL(microBeatsPerMinute)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetTempoL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetTempoL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntGetPitchTranspositionCents::CTestMidiClntGetPitchTranspositionCents(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntGetPitchTranspositionCents* CTestMidiClntGetPitchTranspositionCents::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntGetPitchTranspositionCents* self = new(ELeave) CTestMidiClntGetPitchTranspositionCents(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntGetPitchTranspositionCents::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition")); sl@0: // expected results sl@0: sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // TInt pitch = 0; // fixes warning sl@0: // TRAPD(err, pitch = aMidi->PitchTranspositionCentsL()); sl@0: TRAPD(err, aMidi->PitchTranspositionCentsL()); // EABI warning removal - "I see trouble ahead..." sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("PitchTranspositionCentsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("PitchTranspositionCentsL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetPitchTransposition::CTestMidiClntSetPitchTransposition(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetPitchTransposition* CTestMidiClntSetPitchTransposition::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetPitchTransposition* self = new(ELeave) CTestMidiClntSetPitchTransposition(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetPitchTransposition::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt pitchTrans = 1200; // one octave sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set the pitch transposition")); sl@0: // expected results sl@0: sl@0: switch (iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: //According to GM2 spec, the minimum value can be -6499 cents, or at least -1299 cents. sl@0: case ETestOutOfRangeHigh: sl@0: // high limit on pitch transposition is dependant on controller sl@0: // when have a proper controller the value below should be changed sl@0: // to a value higher than the upper limit sl@0: pitchTrans = -6499; //KErrArgument expect by a real controller implementation if out-of-range sl@0: expErr = KErrNone; sl@0: break; sl@0: /*This test has been removed by AD as it was not valid - negative values ARE allowed by MIDI spec sl@0: According to GM2 spec, the minimum value can be -6499 cents, or at least -1299 cents. sl@0: case ETestOutOfRangeLow: sl@0: pitchTrans = -1; // negative values not supported sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: */ sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetPitchTranspositionL(pitchTrans)); sl@0: if(expErr != err) sl@0: { sl@0: ERR_PRINTF3( _L("SetPitchTranspositionL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetPitchTranspositionL %d = %d"), err, expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntDurationMicroSeconds::CTestMidiClntDurationMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntDurationMicroSeconds* CTestMidiClntDurationMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntDurationMicroSeconds* self = new(ELeave) CTestMidiClntDurationMicroSeconds(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntDurationMicroSeconds::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TTimeIntervalMicroSeconds durationMicroSeconds(0); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro seconds")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, durationMicroSeconds = aMidi->DurationMicroSecondsL()); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("DurationMicroSecondsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("DurationMicroSecondsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntDurationMicroBeats::CTestMidiClntDurationMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntDurationMicroBeats* CTestMidiClntDurationMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntDurationMicroBeats* self = new(ELeave) CTestMidiClntDurationMicroBeats(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntDurationMicroBeats::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: //TTimeIntervalMicroSeconds durationMicroSeconds(0); sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get duration in micro beats")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: TRAPD(err, aMidi->DurationMicroBeatsL()); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("DurationMicroBeatsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("DurationMicroBeatsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntNumTracks::CTestMidiClntNumTracks(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntNumTracks* CTestMidiClntNumTracks::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntNumTracks* self = new(ELeave) CTestMidiClntNumTracks(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntNumTracks::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get current number of tracks")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt numOfTracks = 0; sl@0: // TRAPD(err, numOfTracks = aMidi->NumTracksL()); sl@0: TRAPD(err, aMidi->NumTracksL()); // EABI warning removal sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("NumTracksL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("NumTracksL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetTrackMute::CTestMidiClntSetTrackMute(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetTrackMute* CTestMidiClntSetTrackMute::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetTrackMute* self = new(ELeave) CTestMidiClntSetTrackMute(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetTrackMute::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt track = 0; sl@0: TBool muted = ETrue; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set track mute")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: TRAP_IGNORE(track = aMidi->NumTracksL()+1); sl@0: break; sl@0: case ETestInvalidTrack: sl@0: expErr = KErrArgument; sl@0: TRAP_IGNORE(track = aMidi->NumTracksL()+1); sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetTrackMuteL(track, muted)); sl@0: sl@0: // check correct result sl@0: if (iTestType == ETestValid) sl@0: { sl@0: TBool currMuted = EFalse; sl@0: sl@0: // until real MIDI controller IsTrackMuteL is always TRUE sl@0: TRAPD(err2, currMuted = aMidi->IsTrackMuteL(track)); sl@0: sl@0: if(err2 != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("IsTrackMuteL() returned %d"), err2); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: if(currMuted != muted) sl@0: { sl@0: ERR_PRINTF2(_L("Error : expected %d"), muted); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetTrackMuteL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetTrackMuteL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntMimeType::CTestMidiClntMimeType(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntMimeType* CTestMidiClntMimeType::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntMimeType* self = new(ELeave) CTestMidiClntMimeType(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntMimeType::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get mime type")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //TRAPD(err, TDesC8 mimeType = aMidi->MimeTypeL());//XXX: TDesC8 mimeType has to be define above sl@0: TRAPD(err, aMidi->MimeTypeL());//XXX: TDesC8 mimeType has to be define above sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("MimeTypeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("MimeTypeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntReturnPositionMicroSeconds::CTestMidiClntReturnPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntReturnPositionMicroSeconds* CTestMidiClntReturnPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntReturnPositionMicroSeconds* self = new(ELeave) CTestMidiClntReturnPositionMicroSeconds(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntReturnPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get position in micro seconds")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestNoResourcePlaying: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: TTimeIntervalMicroSeconds positionMicroSeconds(0); sl@0: TRAPD(err, positionMicroSeconds = aMidi->PositionMicroSecondsL()); sl@0: if (expErr != err) sl@0: { sl@0: if (KErrNotReady != err) sl@0: { sl@0: ERR_PRINTF3(_L("Get PositionMicroSecondsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: { sl@0: ret = EPass; sl@0: } sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("Get PositionMicroSecondsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetPositionMicroSeconds::CTestMidiClntSetPositionMicroSeconds(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetPositionMicroSeconds* CTestMidiClntSetPositionMicroSeconds::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetPositionMicroSeconds* self = new(ELeave) CTestMidiClntSetPositionMicroSeconds(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetPositionMicroSeconds::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TTimeIntervalMicroSeconds position(0);; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro seconds")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestMicrosecondsHighOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: position = 1008; sl@0: break; sl@0: case ETestMicrosecondsLowOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: position = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetPositionMicroSecondsL(position)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("Set PositionMicroSecondsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("Set PositionMicroSecondsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntReturnsPositionMicroBeats::CTestMidiClntReturnsPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntReturnsPositionMicroBeats* CTestMidiClntReturnsPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntReturnsPositionMicroBeats* self = new(ELeave) CTestMidiClntReturnsPositionMicroBeats(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntReturnsPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return position in micro beats")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestNoResourcePlaying: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: TRAPD(err, aMidi->PositionMicroBeatsL()); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("PositionMicroBeatsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("PositionMicroBeatsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestMidiClntSetPositionMicroBeats::CTestMidiClntSetPositionMicroBeats(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntSetPositionMicroBeats* CTestMidiClntSetPositionMicroBeats::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntSetPositionMicroBeats* self = new(ELeave) CTestMidiClntSetPositionMicroBeats(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntSetPositionMicroBeats::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt64 microBeats = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set position in micro beats")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestMicrobeatsHighOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: microBeats = 1000000; sl@0: break; sl@0: case ETestMicrobeatsLowOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: microBeats = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetPositionMicroBeatsL(microBeats)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetPositionMicroBeatsL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetPositionMicroBeatsL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestSetSyncUpdateCallbackInterval::CTestSetSyncUpdateCallbackInterval(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetSyncUpdateCallbackInterval* CTestSetSyncUpdateCallbackInterval::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetSyncUpdateCallbackInterval* self = new(ELeave) CTestSetSyncUpdateCallbackInterval(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetSyncUpdateCallbackInterval::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TTimeIntervalMicroSeconds microSeconds(0); sl@0: TInt64 microBeats = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set update call back interval")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestMicrosecondsMicrobeatsZero: sl@0: microSeconds = 0; sl@0: microBeats = 0; sl@0: expErr = KErrNotReady; sl@0: break; sl@0: case ETestMicrosecondsLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: microSeconds = -1; sl@0: break; sl@0: case ETestMicrobeatsHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: microBeats = 1000000; sl@0: break; sl@0: case ETestMicrobeatsLowOutOfRange: sl@0: expErr = KErrArgument; sl@0: microBeats = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetSyncUpdateCallbackIntervalL(microSeconds, microBeats)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetSyncUpdateCallbackIntervalL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetSyncUpdateCallbackIntervalL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: CTestSendMessage::CTestSendMessage(const TDesC& aTestName, sl@0: const TTestStepType aTestType, const TDesC8& aMessage) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: iMessage = aMessage; sl@0: } sl@0: sl@0: CTestSendMessage* CTestSendMessage::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType, const TDesC8& aMessage) sl@0: { sl@0: CTestSendMessage* self = new (ELeave) CTestSendMessage(aTestName, sl@0: aTestType, aMessage); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSendMessage::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Send Message")); sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNullMessage: sl@0: expErr = KErrArgument; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestCorrupt: sl@0: expErr = KErrCorrupt; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // TInt byteProcessed; sl@0: // TRAPD(err1, byteProcessed = aMidi->SendMessageL(iMessage)); sl@0: TRAPD(err1, aMidi->SendMessageL(iMessage)); // EABI warning removal sl@0: if(err1 != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("SendMessageL(iMessage) gave error %d (expected %d)"), err1, expErr); sl@0: ret = EFail; sl@0: } sl@0: sl@0: TTimeIntervalMicroSeconds startTime(105); sl@0: // TRAPD(err2, byteProcessed = aMidi->SendMessageL(iMessage, startTime)); sl@0: TRAPD(err2, aMidi->SendMessageL(iMessage, startTime)); // EABI warning removal sl@0: if(err2 != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("SendMessageL(iMessage, startTime) gave error %d (expected %d)"), err1, expErr); sl@0: ret = EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: // CTestSendMessageTime incorporated into CTestSendMessage sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: // aTestType as follows : sl@0: // 0115 : valid sl@0: // 0116 : invalid device ID - REMOVED, API has changed sl@0: // 0117 : null sl@0: // 0118 : unsupported sl@0: // 0119 : unsupported - REMOVED, duplicate sl@0: // 0120 : corrupt sl@0: sl@0: CTestSendMipMessage::CTestSendMipMessage(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSendMipMessage* CTestSendMipMessage::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestSendMipMessage* self = new (ELeave) CTestSendMipMessage(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSendMipMessage::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Send Mip Message")); sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: RArray mipArray; sl@0: TMipMessageEntry mipEntry1; sl@0: TMipMessageEntry mipEntry2; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNullMessage: sl@0: expErr = KErrArgument; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestCorrupt: sl@0: expErr = KErrCorrupt; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: mipEntry1.iChannel = 10; sl@0: mipEntry1.iMIPValue = 20; sl@0: mipEntry2.iChannel = 11; sl@0: mipEntry2.iMIPValue = 21; sl@0: sl@0: mipArray.Append(mipEntry1); sl@0: mipArray.Append(mipEntry2); sl@0: break; sl@0: sl@0: case ETestNullMessage: sl@0: // leave array empty sl@0: // *** NB this will cause a problem in debug mode - causes a server panic! sl@0: break; sl@0: sl@0: case ETestUnsupported: sl@0: // XXX : values defined as unsupported? sl@0: mipEntry1.iChannel = 0; sl@0: mipEntry1.iMIPValue = 0; sl@0: mipEntry2.iChannel = 0; sl@0: mipEntry2.iMIPValue = 0; sl@0: sl@0: mipArray.Append(mipEntry1); sl@0: mipArray.Append(mipEntry2); sl@0: break; sl@0: sl@0: case ETestCorrupt: sl@0: // XXX : values defined as corrupt? sl@0: mipEntry1.iChannel = -1; sl@0: mipEntry1.iMIPValue = -1; sl@0: mipEntry2.iChannel = -1; sl@0: mipEntry2.iMIPValue = -1; sl@0: sl@0: mipArray.Append(mipEntry1); sl@0: mipArray.Append(mipEntry2); sl@0: break; sl@0: } sl@0: sl@0: TRAPD(err1, aMidi->SendMipMessageL(mipArray)); sl@0: if(err1 != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("SendMipMessageL(iMessage) gave error %d (expected %d)"), err1, expErr); sl@0: ret = EFail; sl@0: } sl@0: sl@0: mipArray.Close(); sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestNumberOfBanks::CTestNumberOfBanks(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestNumberOfBanks* CTestNumberOfBanks::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestNumberOfBanks* self = new (ELeave) CTestNumberOfBanks(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestNumberOfBanks::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // to do : test for standard & custom banks sl@0: sl@0: // currently using ETestOverflow to simulate no banks sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrArgument; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt numBanks = 0; sl@0: TRAPD(err1, numBanks = aMidi->NumberOfBanksL(EFalse)); sl@0: if(err1 != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("NumberOfBanksL(EFalse) gave error %d (expected %d)"), err1, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF2(_L("Number of Banks (standard) = %d"), numBanks); sl@0: sl@0: sl@0: TRAPD(err2, numBanks = aMidi->NumberOfBanksL(ETrue)); sl@0: if(err1 != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("NumberOfBanksL(ETrue) gave error %d (expected %d)"), err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF2(_L("Number of Banks (custom) = %d"), numBanks); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestGetBankId::CTestGetBankId(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestGetBankId* CTestGetBankId::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestGetBankId* self = new (ELeave) CTestGetBankId(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestGetBankId::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // currently using ETestOverflow to simulate no banks sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TInt bankNum; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankNum = 54; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrArgument; sl@0: bankNum = -1; sl@0: break; sl@0: case ETestOverflow: sl@0: expErr = KErrArgument; sl@0: bankNum = 12000; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt bankId = 0; sl@0: TRAPD(err1, bankId = aMidi->GetBankIdL(EFalse, bankNum)); sl@0: if(err1 != expErr) sl@0: { sl@0: ERR_PRINTF4(_L("GetBankIdL(EFalse, %d) gave error %d (expected %d)"), bankNum, err1, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("GetBankIdL(EFalse, %d) = %d"), bankNum, bankId); sl@0: sl@0: TRAPD(err2, bankId = aMidi->GetBankIdL(ETrue, bankNum)); sl@0: if(err2 != expErr) sl@0: { sl@0: ERR_PRINTF4(_L("GetBankIdL(ETrue, %d) gave error %d (expected %d)"), bankNum, err2, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("GetBankIdL(ETrue, %d) = %d"), bankNum, bankId); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestLoadCustomBank::CTestLoadCustomBank(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestLoadCustomBank* CTestLoadCustomBank::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestLoadCustomBank* self = new (ELeave) CTestLoadCustomBank(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestLoadCustomBank::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TFileName bankFileName; sl@0: sl@0: _LIT8(KBankFileName, "Bank file name"); sl@0: _LIT8(KBankFileNameInvalid, "Invalid file name"); sl@0: _LIT8(KBankFileNameUnsupported, "Unsupported file name"); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankFileName.Copy(KBankFileName); sl@0: break; sl@0: case ETestNullMessage: sl@0: expErr = KErrArgument; sl@0: bankFileName.Copy(KNullDesC16); sl@0: break; sl@0: case ETestInvalidMessage: sl@0: expErr = KErrArgument; sl@0: bankFileName.Copy(KBankFileNameInvalid); sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: bankFileName.Copy(KBankFileNameUnsupported); sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt bankId = 0; sl@0: sl@0: TRAPD(err1, aMidi->LoadCustomBankL(bankFileName, bankId)); sl@0: INFO_PRINTF3(_L("LoadCustomBankL gave error %d (expected %d)"), err1, expErr); sl@0: if(err1 != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: // see if it's loaded sl@0: TBool loaded = EFalse; sl@0: TRAP(err1, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err1 != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err1); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: if(iTestType == ETestValid) sl@0: { sl@0: if(!loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned false")); sl@0: ret = EFail; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned true")); sl@0: ret = EFail; sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestUnloadCustomBank::CTestUnloadCustomBank(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestUnloadCustomBank* CTestUnloadCustomBank::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestUnloadCustomBank* self = new (ELeave) CTestUnloadCustomBank(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestUnloadCustomBank::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TFileName bankFileName; sl@0: sl@0: _LIT8(KBankFileName, "Bank file name"); sl@0: bankFileName.Copy(KBankFileName); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrNotFound; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt bankId = 0; sl@0: sl@0: // load a known bank sl@0: TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: // ensure it's loaded sl@0: TBool loaded = EFalse; sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(!loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned false")); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: // unload the bank we know is loaded sl@0: TRAP(err, aMidi->UnloadCustomBankL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UnloadCustomBankL gave error %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // ensure it's not loaded sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded")); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // if negative test, try and unload the same bank again sl@0: if(iTestType == ETestValid) sl@0: return ret; sl@0: else sl@0: { sl@0: TRAP(err, aMidi->UnloadCustomBankL(bankId)); sl@0: INFO_PRINTF3(_L("UnloadCustomBankL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: ret = EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestUnloadAllCustomBanks::CTestUnloadAllCustomBanks(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestUnloadAllCustomBanks* CTestUnloadAllCustomBanks::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestUnloadAllCustomBanks* self = new (ELeave) CTestUnloadAllCustomBanks(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestUnloadAllCustomBanks::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TFileName bankFileName; sl@0: sl@0: _LIT8(KBankFileName, "Bank file name"); sl@0: bankFileName.Copy(KBankFileName); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrNotFound; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TInt bankId = 0; sl@0: sl@0: // load a known bank sl@0: TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("LoadCustomBankL gave error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: // ensure it's loaded sl@0: TBool loaded = EFalse; sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(!loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned false")); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: // unload all sl@0: TRAP(err, aMidi->UnloadAllCustomBanksL()); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: loaded = EFalse; sl@0: // ensure our bank is not loaded sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned true -> bank not unloaded")); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // if negative test, try and unload again sl@0: if(iTestType == ETestValid) sl@0: return ret; sl@0: else sl@0: { sl@0: TRAP(err, aMidi->UnloadAllCustomBanksL()); sl@0: INFO_PRINTF3(_L("UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: ret = EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestNumberOfInstruments::CTestNumberOfInstruments(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestNumberOfInstruments* CTestNumberOfInstruments::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestNumberOfInstruments* self = new (ELeave) CTestNumberOfInstruments(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestNumberOfInstruments::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // TO DO : situation where no standard banks exist sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TFileName bankFileName; sl@0: sl@0: _LIT8(KBankFileName, "Bank file name"); sl@0: bankFileName.Copy(KBankFileName); sl@0: TInt bankId = 0; sl@0: TInt numInstruments = 0; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankId = 0; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrNotFound; sl@0: bankId = 0; sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrArgument; sl@0: bankId = -2; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // check a known bank - standard sl@0: // *** TO DO : this will cause a failure with ETestNegative. To be re-done sl@0: // for no standard banks present sl@0: TRAPD(err, numInstruments = aMidi->NumberOfInstrumentsL(bankId, EFalse)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("NumberOfInstrumentsL(bankId, EFalse) gave error %d (expected %d)"), err, expErr); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, EFalse) = %d"), numInstruments); sl@0: sl@0: if(iTestType != ETestInvalidMessage) sl@0: { sl@0: // load a known bank - custom sl@0: TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: // ensure it's loaded sl@0: TBool loaded = EFalse; sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(!loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded")); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: // check the custom bank sl@0: // NB if test type is InvalidId then we haven't bothered to load anything sl@0: TRAP(err, aMidi->NumberOfInstrumentsL(bankId, ETrue)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) gave error %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("NumberOfInstrumentsL(bankId, ETrue) = %d"), numInstruments); sl@0: sl@0: if(iTestType == ETestNegative) sl@0: { sl@0: // negative test :- unload all, then check it again sl@0: TRAP(err, aMidi->UnloadAllCustomBanksL()); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: // check it. it should leave sl@0: TRAP(err, aMidi->NumberOfInstrumentsL(bankId, ETrue)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("NumberOfInstrumentsL gave error %d (expected %d)"), err, expErr); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestGetInstrumentId::CTestGetInstrumentId(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestGetInstrumentId* CTestGetInstrumentId::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestGetInstrumentId* self = new (ELeave) CTestGetInstrumentId(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestGetInstrumentId::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // TO DO : situation where no standard banks exist sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TFileName bankFileName; sl@0: sl@0: _LIT8(KBankFileName, "Bank file name"); sl@0: bankFileName.Copy(KBankFileName); sl@0: TInt bankId = 0; sl@0: TInt instrIndex = 0; sl@0: TInt instrId = 0; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankId = 0; sl@0: instrIndex = 0; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrNotFound; sl@0: bankId = 0; sl@0: instrIndex = 0; sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrArgument; sl@0: bankId = -2; sl@0: instrIndex = 0; sl@0: break; sl@0: case ETestInvalidIndex: sl@0: expErr = KErrArgument; sl@0: bankId = 0; sl@0: instrIndex = -2; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // check a known bank - standard sl@0: // *** TO DO : this will cause a failure with ETestNegative. To be re-done sl@0: // for no standard banks present sl@0: TRAPD(err, instrId = aMidi->GetInstrumentIdL(bankId, EFalse, instrIndex)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) gave error %d (expected %d)"), err, expErr); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("GetInstrumentIdL(bankId, EFalse, instrIndex) = %d"), instrId); sl@0: sl@0: if(iTestType != ETestInvalidId && iTestType != ETestInvalidIndex) sl@0: { sl@0: // load a known bank - custom sl@0: TRAPD(err, aMidi->LoadCustomBankL(bankFileName, bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("LoadCustomBankL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: // ensure it's loaded sl@0: TBool loaded = EFalse; sl@0: TRAP(err, loaded = aMidi->CustomBankLoadedL(bankId)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CustomBankLoadedL left with error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: if(!loaded) sl@0: { sl@0: ERR_PRINTF1(_L("CustomBankLoadedL returned false -> bank not loaded")); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: // check the custom bank sl@0: // NB if test type is InvalidId/Index then we haven't bothered to load anything sl@0: TRAP(err, instrId = aMidi->GetInstrumentIdL(bankId, ETrue, instrIndex)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) gave error %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("GetInstrumentIdL(bankId, ETrue, instrIndex) = %d"), instrId); sl@0: sl@0: if(iTestType == ETestNegative) sl@0: { sl@0: // negative test :- unload all, then check it again sl@0: TRAP(err, aMidi->UnloadAllCustomBanksL()); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UnloadAllCustomBanksL gave error %d"), err); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: // check it. it should leave sl@0: TRAP(err, instrId = aMidi->GetInstrumentIdL(bankId, ETrue, instrIndex)); sl@0: if(err != expErr) sl@0: { sl@0: ERR_PRINTF3(_L("GetInstrumentIdL gave error %d (expected %d)"), err, expErr); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //Check this sl@0: //Change it to return EFail for failing negative test sl@0: //------------------------------------------------------------------ sl@0: CTestReturnsInstrumentName::CTestReturnsInstrumentName(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestReturnsInstrumentName* CTestReturnsInstrumentName::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestReturnsInstrumentName* self = new (ELeave) CTestReturnsInstrumentName(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestReturnsInstrumentName::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: //TFileName bankFileName; sl@0: sl@0: TInt bankId = 0; sl@0: TInt instrId = 0; sl@0: HBufC* instrName = NULL; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankId = 0; sl@0: instrId = 89; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrArgument; sl@0: bankId = 0; sl@0: instrId = -241; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // check a known bank - standard sl@0: // *** TO DO : custom? sl@0: sl@0: TRAPD(err, instrName = aMidi->InstrumentNameL(bankId, EFalse, instrId)); sl@0: INFO_PRINTF3(_L("InstrumentNameL(bankId, EFalse, instrId) gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: //ret = EInconclusive; sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: // don't try and do this for negative test! it'll panic sl@0: if(iTestType == ETestValid) sl@0: INFO_PRINTF2(_L("InstrumentNameL(bankId, EFalse, instrId) = \'%S\'"), instrName); sl@0: sl@0: delete instrName; sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: // Tests that the GetInstrumentL() doesn't return KErrArgument when the sl@0: // channel value is between 0 and 15, but it will return KErrArgument sl@0: // when the channel value is out of range sl@0: sl@0: CTestGetInstrument::CTestGetInstrument(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestGetInstrument* CTestGetInstrument::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestGetInstrument* self = new (ELeave) CTestGetInstrument(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestGetInstrument::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt instrumentId = 0; sl@0: TInt bankId = 0; sl@0: TInt validChannelId = 0; sl@0: TInt invalidChannelId = 16; sl@0: sl@0: TRAPD(err, aMidi->GetInstrumentL(validChannelId, instrumentId, bankId)); sl@0: sl@0: if(err == KErrArgument) sl@0: { sl@0: ERR_PRINTF2(_L("GetInstrumentL(validChannelId, ...) gave an error = %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: TRAPD(err1, aMidi->GetInstrumentL(invalidChannelId, instrumentId, bankId)); sl@0: sl@0: if(err1 != KErrArgument) sl@0: { sl@0: ERR_PRINTF2(_L("GetInstrumentL(invalidChannelId, ...) gave an error = %d"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetInstrument::CTestSetInstrument(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetInstrument* CTestSetInstrument::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestSetInstrument* self = new (ELeave) CTestSetInstrument(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetInstrument::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: //TFileName bankFileName; sl@0: sl@0: TInt bankId = 0; sl@0: TInt channelId = 0; sl@0: TInt instrId = 0; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: bankId = 0; sl@0: channelId = 0; sl@0: instrId = 89; sl@0: break; sl@0: case ETestInvalidChannel: sl@0: expErr = KErrNotFound; sl@0: bankId = 0; sl@0: channelId = -2; sl@0: instrId = 89; sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrNotFound; sl@0: bankId = 0; sl@0: channelId = 0; sl@0: instrId = -241; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // *** TO DO : custom? sl@0: sl@0: TRAPD(err, aMidi->SetInstrumentL(channelId, bankId, instrId)); sl@0: INFO_PRINTF3(_L("SetInstrumentL(channelId, bankId, instrId) gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestLoadCustomInstrument::CTestLoadCustomInstrument(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestLoadCustomInstrument* CTestLoadCustomInstrument::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestLoadCustomInstrument* self = new (ELeave) CTestLoadCustomInstrument(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestLoadCustomInstrument::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // TO DO : need instrument file which we can load, with known bank and instrument IDs sl@0: // Negative tests to be done properly. sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: sl@0: _LIT(KInstrumentFile, "Instrument File Name"); // *** to change sl@0: _LIT(KBadInstrumentFile, "Bad Instrument File Name"); // *** to change sl@0: TFileName instFileName; sl@0: sl@0: TInt fileBankId = 90; sl@0: TInt fileInstrId = 91; sl@0: TInt bankId = 92; sl@0: TInt instrId = 93; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: instFileName.Copy(KInstrumentFile); sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrArgument; sl@0: instFileName.Copy(KInstrumentFile); sl@0: fileBankId = -2; sl@0: break; sl@0: case ETestAlreadyLoaded: sl@0: // ** to do : load once and attempt to load again. sl@0: // when instrument data files are available, this will work sl@0: instFileName.Copy(KInstrumentFile); sl@0: expErr = KErrInUse; sl@0: break; sl@0: case ETestUnsupported: // ** to define test data for this sl@0: instFileName.Copy(KBadInstrumentFile); sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // if testing already loaded, preload the instrument here sl@0: if(iTestType == ETestAlreadyLoaded) sl@0: { sl@0: TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); sl@0: INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err); sl@0: if(err != KErrNone) sl@0: { sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: // load the instrument for real sl@0: TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); sl@0: INFO_PRINTF3(_L("LoadCustomInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestUnloadCustomInstrument::CTestUnloadCustomInstrument(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestUnloadCustomInstrument* CTestUnloadCustomInstrument::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestUnloadCustomInstrument* self = new (ELeave) CTestUnloadCustomInstrument(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestUnloadCustomInstrument::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: sl@0: _LIT(KInstrumentFile, "Instrument File Name"); // *** to change sl@0: TFileName instFileName; sl@0: sl@0: TInt fileBankId = 90; sl@0: TInt fileInstrId = 91; sl@0: TInt bankId = 92; sl@0: TInt instrId = 93; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: instFileName.Copy(KInstrumentFile); sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrNotFound; sl@0: instFileName.Copy(KInstrumentFile); sl@0: bankId = -2; sl@0: break; sl@0: case ETestNotLoaded: sl@0: expErr = KErrNotFound; sl@0: instFileName.Copy(KInstrumentFile); sl@0: break; sl@0: case ETestNotUnloadable: // ** TO DO : define test data for this sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // preload the instrument here sl@0: if(iTestType == ETestValid) sl@0: { sl@0: TRAPD(err, aMidi->LoadCustomInstrumentL(instFileName, fileBankId, fileInstrId, bankId, instrId)); sl@0: INFO_PRINTF2(_L("Preload : LoadCustomInstrumentL gave error %d"), err); sl@0: if(err != KErrNone) sl@0: { sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: // now unload it sl@0: TRAPD(err, aMidi->UnloadCustomInstrumentL(bankId, instrId)); sl@0: INFO_PRINTF3(_L("UnloadCustomInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestPercussionKeyName::CTestPercussionKeyName(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestPercussionKeyName* CTestPercussionKeyName::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestPercussionKeyName* self = new (ELeave) CTestPercussionKeyName(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestPercussionKeyName::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // *** NB the actual arguments do not match those in the current API or test specs sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: //TFileName bankFileName; sl@0: sl@0: TInt bankId = 0; sl@0: TInt instrId = 89; sl@0: TInt keyId = 0; sl@0: HBufC* keyName = NULL; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrNotFound; sl@0: keyId = -2; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // check a known bank - standard sl@0: // *** TO DO : custom? sl@0: sl@0: TRAPD(err, keyName = aMidi->PercussionKeyNameL(keyId, bankId, EFalse, instrId)); sl@0: INFO_PRINTF3(_L("PercussionKeyNameL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: // don't try and do this for negative test! it'll panic sl@0: if(iTestType == ETestValid) sl@0: INFO_PRINTF2(_L("PercussionKeyNameL(keyId, bankId, EFalse, instrId) = \'%S\'"), keyName); sl@0: sl@0: delete keyName; sl@0: return ret; sl@0: } sl@0: sl@0: //Check this// sl@0: //Not sure how to implement 'no opened resource' sl@0: //------------------------------------------------------------------ sl@0: CTestStopTime::CTestStopTime(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestStopTime* CTestStopTime::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestStopTime* self = new (ELeave) CTestStopTime(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestStopTime::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TTimeIntervalMicroSeconds stopTime(0); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: sl@0: // NB no negative test specified sl@0: //Not sure how to implement 'no opened resource' sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->StopTimeL(stopTime)); sl@0: INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("StopTime = %ld"), I64INT(stopTime.Int64())); sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestSetStopTime::CTestSetStopTime(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetStopTime* CTestSetStopTime::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestSetStopTime* self = new (ELeave) CTestSetStopTime(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetStopTime::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TTimeIntervalMicroSeconds stopTime(999); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestOutOfRangeHigh: sl@0: stopTime = 999999999; sl@0: expErr = KErrArgument; sl@0: break; sl@0: case ETestOutOfRangeLow: sl@0: stopTime = -1; sl@0: expErr = KErrArgument; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetStopTimeL(stopTime)); sl@0: INFO_PRINTF3(_L("SetStopTimeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // check set correctly if a valid test sl@0: if (iTestType == ETestValid) sl@0: { sl@0: TTimeIntervalMicroSeconds newStopTime(999); sl@0: TRAP(err, aMidi->StopTimeL(newStopTime)); sl@0: INFO_PRINTF3(_L("StopTimeL gave error %d (expected %d)"), err, expErr); sl@0: sl@0: if(err != expErr) sl@0: { sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("StopTime = %ld"), I64INT(newStopTime.Int64())); sl@0: sl@0: if(newStopTime != stopTime) sl@0: { sl@0: ERR_PRINTF2(_L("Error : expected %ld"), I64INT(stopTime.Int64())); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestSetRepeats::CTestSetRepeats(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetRepeats* CTestSetRepeats::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestSetRepeats* self = new (ELeave) CTestSetRepeats(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetRepeats::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TInt repeats = 0; sl@0: TTimeIntervalMicroSeconds silentTime(1000000); sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: // ** NB these are testing ONE out-of-range argument at a time. Suggest sl@0: // we modify the test spec to go with this? sl@0: case ETestOutOfRange: sl@0: expErr = KErrArgument; sl@0: //repeats = 9999; // ** XXX : max. range of repeats? sl@0: repeats = -1; sl@0: silentTime = 1000000; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetRepeatsL(repeats, silentTime)); sl@0: sl@0: // check set correctly if a valid test sl@0: if (iTestType == ETestValid) sl@0: { sl@0: // check the repeats value sl@0: TInt currRepeats = -1; sl@0: currRepeats = aMidi->GetRepeats(); sl@0: sl@0: INFO_PRINTF2(_L("Repeats = %d"), currRepeats); sl@0: sl@0: if(currRepeats != repeats) sl@0: { sl@0: ERR_PRINTF2(_L("Error : expected %d"), currRepeats); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: INFO_PRINTF3(_L("SetRepeatsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: // This test case has two steps: sl@0: // 1. High Polyphony Song vs. Low Polyphony Midi Utility sl@0: // - a test file has exactly 57 voices from beginning to end sl@0: // - during the instantiation of utility, the Maximum Polyphony is default to 48 implicitly. sl@0: // For this case: sl@0: // MaxPolyphonyL() return value is 48 sl@0: // PolyphonyL() return value is 48 (number of active voice the engine is playing now, sl@0: // this is being limited by the MaxPolyphonyL() number) sl@0: // sl@0: // sl@0: // 2. Low Polyphony Song vs. High Polyphony Midi Utility sl@0: // - a test file has exactly 57 voices from beginning to end sl@0: // - during the instantiation of utility, the Maximum Polyphony is default to 60 implicitly sl@0: // For this case: sl@0: // MaxPolyphonyL() return value is 60 sl@0: // PolyphonyL() return value is 57 sl@0: sl@0: // constants for the test case sl@0: const TUint8 KMaxPolyphonyValue1 = 48; sl@0: const TUint8 KMaxPolyphonyValue2 = 60; sl@0: const TUint8 KPolyphonyValue = 57; sl@0: sl@0: CTestPolyphony::CTestPolyphony(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestPolyphony* CTestPolyphony::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestPolyphony* self = new (ELeave) CTestPolyphony(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestPolyphony::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt poly = 0; sl@0: TInt maxPoly = 0; sl@0: TInt expErr = 0; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: // NB no negative test specified sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // set the maxPolyphony to KMaxPolyphponyValue1 sl@0: TRAPD(err, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue1)); sl@0: if (err != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // verify that the maxPolyphony value was correctly set sl@0: TRAPD(err1, maxPoly = aMidi->MaxPolyphonyL()); sl@0: if (err1 != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue1); sl@0: sl@0: // get the number of the currently active voices. This value is set as sl@0: // KPolyphonyValue, but because the max number of voices that can be handled by the sl@0: // engine is smaller than the currently active voce, PolyphonyL() will sl@0: // return the MaxPolyphony() value sl@0: TRAPD(err2, poly = aMidi->PolyphonyL()); sl@0: sl@0: if (err2 != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KMaxPolyphonyValue1); sl@0: INFO_PRINTF1(_L("----------------------------------------------------------")); sl@0: sl@0: // set the maxPolyphony to KMaxPolyphonyValue2 sl@0: TRAPD(err3, aMidi->SetMaxPolyphonyL(KMaxPolyphonyValue2)); sl@0: if (err3 != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("SetMaxPolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // verify that the maxPolyphony value was correctly set sl@0: TRAPD(err4, maxPoly = aMidi->MaxPolyphonyL()); sl@0: if (err4 != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("MaxPolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF3(_L("The maximum number of simultaneous voices the engine can handle : %d (expected %d)"), maxPoly, KMaxPolyphonyValue2); sl@0: sl@0: // get the number of the currently active voices. This value is set as sl@0: // KPolyphonyValue, but because the max number of voices that can be handled by the sl@0: // engine is smaller than the currently active voce, PolyphonyL() will sl@0: // return the MaxPolyphony() value sl@0: TRAPD(err5, poly = aMidi->PolyphonyL()); sl@0: if (err5 != expErr) sl@0: { sl@0: INFO_PRINTF2(_L("PolyphonyL failed (error = %d)"), err); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF3(_L("The number of currently active voices is: %d (expected %d)"), poly, KPolyphonyValue); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //Check this (0086) // sl@0: //Not sure how to implement 'no opened resource' sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: CTestChannelsSupported::CTestChannelsSupported(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestChannelsSupported* CTestChannelsSupported::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestChannelsSupported* self = new (ELeave) CTestChannelsSupported(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestChannelsSupported::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: TInt numChannels = 0; sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: sl@0: // NB no negative test specified sl@0: sl@0: //Not sure how to implement 'no opened resource' sl@0: case ETestNoResource: sl@0: expErr = KErrNotReady; sl@0: break; sl@0: sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, numChannels = aMidi->ChannelsSupportedL()); sl@0: INFO_PRINTF3(_L("ChannelsSupportedL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: INFO_PRINTF2(_L("Channels supported = %d"), numChannels); sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: // Checks the ChannelVolumeL(...) method behaivior sl@0: // - if the argument passed in is a valid channel, the test should sl@0: // not return any error code, but should return the expected volume sl@0: // value sl@0: // - if the argument passed in is an invalid channel, the test should sl@0: // return KErrArgument sl@0: sl@0: CTestReturnChannelVolume::CTestReturnChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestReturnChannelVolume* CTestReturnChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestReturnChannelVolume* self = new(ELeave) CTestReturnChannelVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestReturnChannelVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TInt channel = 2; sl@0: TInt volume = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume")); sl@0: sl@0: // positive test sl@0: if (iTestType == ETestValid) sl@0: { sl@0: // if the test is valid check that the value returned for the sl@0: // volume is correct sl@0: TInt chanVolume = aMidi->MaxChannelVolumeL() - 10; sl@0: TRAPD(err1, aMidi->SetChannelVolumeL(channel, chanVolume)); sl@0: if (err1 != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("SetChannelVolumeL gave error %d"),err1); sl@0: return EFail; sl@0: } sl@0: sl@0: TRAPD(err, volume = aMidi->ChannelVolumeL(channel)); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrNone)"),err); sl@0: return EFail; sl@0: } sl@0: sl@0: if (volume != chanVolume) sl@0: { sl@0: ERR_PRINTF3(_L("ChannelVolumeL retrieve volume value %d (expected %d)"),volume, chanVolume); sl@0: return EFail; sl@0: } sl@0: return EPass; sl@0: } sl@0: sl@0: // negative test sl@0: if (iTestType == ETestInvalidChannel) sl@0: { sl@0: channel = -1; sl@0: TRAPD(err, aMidi->ChannelVolumeL(channel)); sl@0: if (err != KErrArgument) sl@0: { sl@0: ERR_PRINTF2(_L("ChannelVolumeL gave error %d (expected KErrArgument)"),err); sl@0: return EFail; sl@0: } sl@0: return EPass; sl@0: } sl@0: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: sl@0: //Check This// sl@0: //------------------------------------------------------------------ sl@0: CTestMaxChannelVolume::CTestMaxChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestMaxChannelVolume* CTestMaxChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMaxChannelVolume* self = new(ELeave) CTestMaxChannelVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMaxChannelVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return Maximum channel volume")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TReal32 volume = 0; sl@0: // TRAPD(err, volume = aMidi->MaxChannelVolumeL() ); sl@0: TRAPD(err, aMidi->MaxChannelVolumeL() ); // EABI warning removal sl@0: sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("MaxChannelVolumeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("MaxChannelVolumeL %d = %d "),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetChannelVolume::CTestSetChannelVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetChannelVolume* CTestSetChannelVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetChannelVolume* self = new(ELeave) CTestSetChannelVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetChannelVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt channel = 0; sl@0: TReal32 volume = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 16; sl@0: volume = 10; sl@0: break; sl@0: case ETestVolumeHighOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 0; sl@0: volume = aMidi->MaxChannelVolumeL()+1; sl@0: break; sl@0: case ETestVolumeLowOutOfRange: sl@0: expErr = KErrNone; //real controller may return KErrArgument if out of range sl@0: channel = 0; sl@0: volume = -1; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetChannelVolumeL(channel, volume)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetChannelVolumeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetChannelVolumeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //Check this sl@0: //------------------------------------------------------------------ sl@0: CTestSetChannelMute::CTestSetChannelMute(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetChannelMute* CTestSetChannelMute::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetChannelMute* self = new(ELeave) CTestSetChannelMute(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetChannelMute::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt channel = 0; sl@0: TBool muted = ETrue; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set channel mute")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestInvalidChannelOutOfRange: sl@0: expErr = KErrArgument; sl@0: channel = 16; sl@0: break; sl@0: sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetChannelMuteL(channel, muted)); sl@0: sl@0: // check correct result sl@0: if (iTestType == ETestValid) sl@0: { sl@0: TBool currMuted = EFalse; sl@0: sl@0: // until real MIDI controller IsChannelMuteL is always TRUE sl@0: TRAPD(err2, currMuted = aMidi->IsChannelMuteL(channel)); sl@0: sl@0: if(err2 != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("IsChannelMuteL() returned %d"), err2); sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: sl@0: if(currMuted != muted) sl@0: { sl@0: ERR_PRINTF2(_L("Error : expected %d"), muted); sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetChannelMuteL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetChannelMuteL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestReturnVolume::CTestReturnVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestReturnVolume* CTestReturnVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: sl@0: CTestReturnVolume* self = new(ELeave) CTestReturnVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestReturnVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return channel volume")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt volume = 0; sl@0: // TRAPD(err, volume = aMidi->VolumeL()); sl@0: TRAPD(err, aMidi->VolumeL()); // EABI warning removal sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("VolumeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("VolumeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestReturnMaxVolume::CTestReturnMaxVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestReturnMaxVolume* CTestReturnMaxVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestReturnMaxVolume* self = new(ELeave) CTestReturnMaxVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestReturnMaxVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Return max channel volume")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt volume = 0; sl@0: // TRAPD(err, volume = aMidi->MaxVolumeL()); sl@0: TRAPD(err, aMidi->MaxVolumeL()); // EABI warning removal sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("MaxVolumeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("MaxVolumeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetVolume::CTestSetVolume(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetVolume* CTestSetVolume::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetVolume* self = new(ELeave) CTestSetVolume(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetVolume::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt volume = 0; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: volume = 10; sl@0: break; sl@0: case ETestVolumeHighOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: volume = 9999999; sl@0: break; sl@0: case ETestVolumeLowOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: volume = -9999999; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetVolumeL(volume)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetVolumeL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetVolumeRamp::CTestSetVolumeRamp(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetVolumeRamp* CTestSetVolumeRamp::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetVolumeRamp* self = new(ELeave) CTestSetVolumeRamp(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetVolumeRamp::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TTimeIntervalMicroSeconds rampDuration; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set channel volume ramp")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestRampDurationHighOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: rampDuration = 9999999; sl@0: break; sl@0: case ETestRampDurationLowOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: rampDuration = -9999999; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetVolumeRampL(rampDuration)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetVolumeRampL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetVolumeL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestGetBalance::CTestGetBalance(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestGetBalance* CTestGetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestGetBalance* self = new(ELeave) CTestGetBalance(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestGetBalance::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: //TTimeIntervalMicroSeconds rampDuration; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get balance")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt getBalance = 0; sl@0: // TRAPD(err, getBalance = aMidi->GetBalanceL()); sl@0: TRAPD(err, aMidi->GetBalanceL()); // EABI warning removal sl@0: sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("GetBalanceL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("GetBalanceL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetBalance::CTestSetBalance(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetBalance* CTestSetBalance::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetBalance* self = new(ELeave) CTestSetBalance(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetBalance::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: // TInt balance = 0; // EABI warning removal sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set balance")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestBalanceHighOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: // balance = 101; // EABI warning removal sl@0: break; sl@0: case ETestBalanceLowOutOfRange: sl@0: expErr = KErrNotSupported; sl@0: // balance = -101; // EABI warning removal sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TRAPD(err, aMidi->SetBalanceL()); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetBalanceL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetBalanceL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestSetPriority::CTestSetPriority(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestSetPriority* CTestSetPriority::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestSetPriority* self = new(ELeave) CTestSetPriority(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestSetPriority::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt priority = 0; sl@0: TMdaPriorityPreference pref = EMdaPriorityPreferenceNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Set priority")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestPreferenceConflictsCannotBeResolved: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TMdaPriorityPreference aPref Priority preference to use if there should be contention with another client. sl@0: // We need this to confict and cause PreferenceConflictsCannotBeResolved sl@0: TRAPD(err, aMidi->SetPriorityL(priority, pref)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("SetPriorityL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("SetPriorityL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestNumberOfXmfMetaDataEntries::CTestNumberOfXmfMetaDataEntries(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestNumberOfXmfMetaDataEntries* CTestNumberOfXmfMetaDataEntries::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestNumberOfXmfMetaDataEntries* self = new(ELeave) CTestNumberOfXmfMetaDataEntries(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestNumberOfXmfMetaDataEntries::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Number Of Xmf Meta Data Entries")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: // TInt numberOfXmfMetaDataEntriesL = 0; sl@0: // TRAPD(err, numberOfXmfMetaDataEntriesL = aMidi->NumberOfMetaDataEntriesL()); sl@0: TRAPD(err, aMidi->NumberOfMetaDataEntriesL()); // EABI warning removal sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("NumberOfXmfMetaDataEntriesL gave error %d (expected %d)"),err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("NumberOfXmfMetaDataEntriesL %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestGetXmfMetaDataEntry::CTestGetXmfMetaDataEntry(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestGetXmfMetaDataEntry* CTestGetXmfMetaDataEntry::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestGetXmfMetaDataEntry* self = new(ELeave) CTestGetXmfMetaDataEntry(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestGetXmfMetaDataEntry::DoTestL(CMidiClientUtility* /*aMidi*/) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt err = KErrNone; sl@0: sl@0: TInt expErr = KErrNone; sl@0: // TInt metaDataIndex = 1; // EABI warning removal sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Get Xmf Meta Data Entry")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestUnsupported: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestMetaDataIndexInvalid: sl@0: // metaDataIndex = -1; // EABI warning removal sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // Default constructor. Returns a blank meta data object. To be used when internalizing data into the object. sl@0: // CMMFMetaDataEntry* getXmfMetaDataEntry = CMMFMetaDataEntry::NewL(); sl@0: sl@0: // Causes Access Violation sl@0: // TRAPD(err, CMMFMetaDataEntry* getXmfMetaDataEntry = aMidi->GetMetaDataEntryL(metaDataIndex)); sl@0: if (expErr != err) sl@0: { sl@0: ERR_PRINTF3(_L("GetXmfMetaDataEntry gave error %d (expected %d)"), err, expErr); sl@0: ret = EFail; sl@0: } sl@0: else sl@0: INFO_PRINTF3(_L("GetXmfMetaDataEntry %d = %d"),err ,expErr); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: CTestLoadCustomInstrumentData::CTestLoadCustomInstrumentData(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestLoadCustomInstrumentData* CTestLoadCustomInstrumentData::NewL(const TDesC& aTestName, sl@0: const TTestStepType aTestType) sl@0: { sl@0: CTestLoadCustomInstrumentData* self = new (ELeave) CTestLoadCustomInstrumentData(aTestName, sl@0: aTestType); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestLoadCustomInstrumentData::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: // N.B. Until there is a MIDI controller there is no sense in having any sl@0: // invalid tests since at present LoadCustomInstrumentDataL always returns sl@0: // ETrue [it doesn't actually attempt a load]. When we actually have a sl@0: // proper MIDI instrument this test can be modified to load this instead of sl@0: // the NULL descriptor below. NJ sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr; sl@0: sl@0: TInt memBankId = 90; sl@0: TInt memInstrId = 91; sl@0: TInt bankId = 92; sl@0: TInt instrId = 93; sl@0: sl@0: // change these to real descriptors when we have a MIDI instruments sl@0: const TDesC8* ptrInstrument = &KNullDesC8; sl@0: const TDesC8* ptrBadInstrument = &KNullDesC8; sl@0: sl@0: // XXX::When we have a MIDI instrument / controller load the instrument sl@0: // into the descriptor here. sl@0: sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestInvalidId: sl@0: expErr = KErrArgument; sl@0: bankId = -2; sl@0: break; sl@0: case ETestAlreadyLoaded: sl@0: // ** to do : load once and attempt to load again. sl@0: // when instrument data files are available, this will work sl@0: expErr = KErrInUse; sl@0: break; sl@0: case ETestUnsupported: // ** to define test data for this sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: TInt err = KErrNone; sl@0: sl@0: // bad descriptor test sl@0: if (iTestType == ETestUnsupported) sl@0: { sl@0: // load the bad / unsupported instrument sl@0: TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrBadInstrument, bankId, instrId, memBankId, memInstrId)); sl@0: } sl@0: else sl@0: { sl@0: // if testing already loaded, preload the instrument here sl@0: if(iTestType == ETestAlreadyLoaded) sl@0: { sl@0: TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId)); sl@0: INFO_PRINTF2(_L("Preload : LoadCustomInstrumentDataL gave error %d"), err); sl@0: if(err != KErrNone) sl@0: { sl@0: ret = EInconclusive; sl@0: return ret; sl@0: } sl@0: } sl@0: sl@0: // load the instrument sl@0: TRAP(err, aMidi->LoadCustomInstrumentDataL(*ptrInstrument, bankId, instrId, memBankId, memInstrId)); sl@0: } sl@0: sl@0: INFO_PRINTF3(_L("LoadCustomInstrumentDataL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: _LIT(KMidiClntChunk, "MidiClntChunk"); sl@0: _LIT(KMidiClntSemaphore, "MidiClntSemaphore"); sl@0: sl@0: CTestCheckInterface::CTestCheckInterface(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName,aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestCheckInterface* CTestCheckInterface::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestCheckInterface* self = new (ELeave) CTestCheckInterface(aTestName, aTestType); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CTestCheckInterface::ConstructL() sl@0: { sl@0: User::LeaveIfError(iChunk.CreateGlobal(KMidiClntChunk,20,20)); sl@0: User::LeaveIfError(iSemaphore.CreateGlobal(KMidiClntSemaphore, 0)); sl@0: sl@0: } sl@0: sl@0: CTestCheckInterface::~CTestCheckInterface() sl@0: { sl@0: } sl@0: sl@0: void CTestCheckInterface::Close() sl@0: { sl@0: iChunk.Close(); sl@0: iSemaphore.Close(); sl@0: } sl@0: sl@0: sl@0: TVerdict CTestCheckInterface::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: TInt err = KErrNone; sl@0: sl@0: // sl@0: //PlayNoteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->PlayNoteL(0,0,TTimeIntervalMicroSeconds(0),0,0)); sl@0: err = CompareInterface( _L8("PlayNoteL")); sl@0: INFO_PRINTF3(_L("Check interface PlayNoteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //PlayNoteL(WithStartTime)// sl@0: // sl@0: TRAP_IGNORE(aMidi->PlayNoteL(0,0,TTimeIntervalMicroSeconds(0),TTimeIntervalMicroSeconds(0),0,0)); sl@0: err = CompareInterface(_L8("PlayNoteWithStartTime")); sl@0: INFO_PRINTF3(_L("Check interface PlayNoteL (WithStartTime) gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //StopNotes// sl@0: // sl@0: aMidi->StopNotes(0); sl@0: err = CompareInterface(_L8("StopNotes")); sl@0: INFO_PRINTF3(_L("Check interface StopNotes gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //NoteOnL// sl@0: // sl@0: TRAP_IGNORE(aMidi->NoteOnL(0,0,0)); sl@0: err = CompareInterface(_L8("NoteOnL")); sl@0: INFO_PRINTF3(_L("Check interface NoteOnL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //NoteOffL// sl@0: // sl@0: TRAP_IGNORE(aMidi->NoteOffL(0,0,0)); sl@0: err = CompareInterface(_L8("NoteOffL")); sl@0: INFO_PRINTF3(_L("Check interface NoteOffL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //PlaybackRateL// sl@0: // sl@0: TRAP_IGNORE(aMidi->PlaybackRateL()); sl@0: err = CompareInterface(_L8("PlaybackRateL")); sl@0: INFO_PRINTF3(_L("Check interface PlaybackRateL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetPlaybackRateL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetPlaybackRateL(0)); sl@0: err = CompareInterface(_L8("SetPlaybackRateL")); sl@0: INFO_PRINTF3(_L("Check interface SetPlaybackRateL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //MaxPlaybackRateL// sl@0: // sl@0: TRAP_IGNORE(aMidi->MaxPlaybackRateL()); sl@0: err = CompareInterface(_L8("MaxPlaybackRateL")); sl@0: INFO_PRINTF3(_L("Check interface MaxPlaybackRateL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //MinPlaybackRateL// sl@0: // sl@0: TRAP_IGNORE(aMidi->MinPlaybackRateL()); sl@0: err = CompareInterface(_L8("MinPlaybackRateL")); sl@0: INFO_PRINTF3(_L("Check interface MinPlaybackRateL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //TempoMicroBeatsPerMinuteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->TempoMicroBeatsPerMinuteL()); sl@0: err = CompareInterface(_L8("TempoMicroBeatsPerMinuteL")); sl@0: INFO_PRINTF3(_L("Check interface TempoMicroBeatsPerMinuteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetTempoL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetTempoL(1)); sl@0: err = CompareInterface(_L8("SetTempoL")); sl@0: INFO_PRINTF3(_L("Check interface SetTempoL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //PitchTranspositionCentsL// sl@0: // sl@0: TRAP_IGNORE(aMidi->PitchTranspositionCentsL()); sl@0: err = CompareInterface(_L8("PitchTranspositionCentsL")); sl@0: INFO_PRINTF3(_L("Check interface PitchTranspositionCentsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetPitchTranspositionL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetPitchTranspositionL(0)); sl@0: err = CompareInterface(_L8("SetPitchTranspositionL")); sl@0: INFO_PRINTF3(_L("Check interface SetPitchTranspositionL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //DurationMicroBeatsL// sl@0: // sl@0: TRAP_IGNORE(aMidi->DurationMicroBeatsL()); sl@0: err = CompareInterface(_L8("DurationMicroBeatsL")); sl@0: INFO_PRINTF3(_L("Check interface DurationMicroBeatsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //NumTracksL// sl@0: // sl@0: TRAP_IGNORE(aMidi->NumTracksL()); sl@0: err = CompareInterface(_L8("NumTracksL")); sl@0: INFO_PRINTF3(_L("Check interface NumTracksL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetTrackMuteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetTrackMuteL(0,ETrue)); sl@0: err = CompareInterface(_L8("SetTrackMuteL")); sl@0: INFO_PRINTF3(_L("Check interface SetTrackMuteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //MimeTypeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->MimeTypeL()); sl@0: err = CompareInterface(_L8("MimeTypeL")); sl@0: INFO_PRINTF3(_L("Check interface MimeTypeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //PositionMicroBeatsL// sl@0: // sl@0: TRAP_IGNORE(aMidi->PositionMicroBeatsL()); sl@0: err = CompareInterface(_L8("PositionMicroBeatsL")); sl@0: INFO_PRINTF3(_L("Check interface PositionMicroBeatsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetPositionMicroBeatsL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetPositionMicroBeatsL(0)); sl@0: err = CompareInterface(_L8("SetPositionMicroBeatsL")); sl@0: INFO_PRINTF3(_L("Check interface SetPositionMicroBeatsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetSyncUpdateCallbackIntervalL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetSyncUpdateCallbackIntervalL(TTimeIntervalMicroSeconds(1))); sl@0: err = CompareInterface(_L8("SetSyncUpdateCallbackIntervalL")); sl@0: INFO_PRINTF3(_L("Check interface SetSyncUpdateCallbackIntervalL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SendMessageL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SendMessageL(_L8(""))); sl@0: err = CompareInterface(_L8("SendMessageL")); sl@0: INFO_PRINTF3(_L("Check interface SendMessageL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SendMessageL (WithTimeStamp)// sl@0: // sl@0: TRAP_IGNORE(aMidi->SendMessageL(_L8(""), TTimeIntervalMicroSeconds(0))); sl@0: err = CompareInterface(_L8("SendMessageWithTimeStamp")); sl@0: INFO_PRINTF3(_L("Check interface SendMessageL (WithTimeStamp) gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SendMipMessageL// sl@0: // sl@0: { sl@0: TMipMessageEntry mipEntry; sl@0: mipEntry.iChannel = 10; sl@0: mipEntry.iMIPValue = 20; sl@0: RArray mipArray; sl@0: mipArray.Append(mipEntry); sl@0: sl@0: TRAP_IGNORE(aMidi->SendMipMessageL(mipArray)); sl@0: mipArray.Close(); sl@0: } sl@0: err = CompareInterface(_L8("SendMipMessageL")); sl@0: INFO_PRINTF3(_L("Check interface SendMipMessageL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //NumberOfBanksL// sl@0: // sl@0: TRAP_IGNORE(aMidi->NumberOfBanksL(ETrue)); sl@0: err = CompareInterface(_L8("NumberOfBanksL")); sl@0: INFO_PRINTF3(_L("Check interface NumberOfBanksL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //GetBankIdL// sl@0: // sl@0: TRAP_IGNORE(aMidi->GetBankIdL(ETrue,0)); sl@0: err = CompareInterface(_L8("GetBankIdL")); sl@0: INFO_PRINTF3(_L("Check interface GetBankIdL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //LoadCustomBankL// sl@0: // sl@0: { sl@0: TInt bankId = 0; sl@0: TRAP_IGNORE(aMidi->LoadCustomBankL(_L(""),bankId)); sl@0: } sl@0: err = CompareInterface(_L8("LoadCustomBankL")); sl@0: INFO_PRINTF3(_L("Check interface LoadCustomBankL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //LoadCustomBankDataL// sl@0: // sl@0: { sl@0: TInt bankId = 0; sl@0: TRAP_IGNORE(aMidi->LoadCustomBankDataL(_L8(""),bankId)); sl@0: } sl@0: err = CompareInterface(_L8("LoadCustomBankDataL")); sl@0: INFO_PRINTF3(_L("Check interface LoadCustomBankDataL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //UnloadCustomBankL// sl@0: // sl@0: TRAP_IGNORE(aMidi->UnloadCustomBankL(0)); sl@0: err = CompareInterface(_L8("UnloadCustomBankL")); sl@0: INFO_PRINTF3(_L("Check interface UnloadCustomBankL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //CustomBankLoadedL// sl@0: // sl@0: TRAP_IGNORE(aMidi->CustomBankLoadedL(0)); sl@0: err = CompareInterface(_L8("CustomBankLoadedL")); sl@0: INFO_PRINTF3(_L("Check interface CustomBankLoadedL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //UnloadAllCustomBanksL// sl@0: // sl@0: TRAP_IGNORE(aMidi->UnloadAllCustomBanksL()); sl@0: err = CompareInterface(_L8("UnloadAllCustomBanksL")); sl@0: INFO_PRINTF3(_L("Check interface UnloadAllCustomBanksL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //NumberOfInstrumentsL// sl@0: // sl@0: TRAP_IGNORE(aMidi->NumberOfInstrumentsL(0,ETrue)); sl@0: err = CompareInterface(_L8("NumberOfInstrumentsL")); sl@0: INFO_PRINTF3(_L("Check interface NumberOfInstrumentsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //GetInstrumentIdL// sl@0: // sl@0: TRAP_IGNORE(aMidi->GetInstrumentIdL(0, ETrue, 0)); sl@0: err = CompareInterface(_L8("GetInstrumentIdL")); sl@0: INFO_PRINTF3(_L("Check interface GetInstrumentIdL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //InstrumentNameL// sl@0: // sl@0: { sl@0: HBufC* instrumentName = NULL; sl@0: TRAP_IGNORE(instrumentName = aMidi->InstrumentNameL(0, ETrue, 0)); sl@0: delete instrumentName; sl@0: } sl@0: err = CompareInterface(_L8("InstrumentNameL")); sl@0: INFO_PRINTF3(_L("Check interface InstrumentNameL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //GetInstrumentL// sl@0: // sl@0: { sl@0: TInt instrumentId = 0; sl@0: TInt bankId = 0; sl@0: TRAP_IGNORE(aMidi->GetInstrumentL(0, instrumentId, bankId)); sl@0: } sl@0: err = CompareInterface(_L8("GetInstrumentL")); sl@0: INFO_PRINTF3(_L("Check interface GetInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetInstrumentL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetInstrumentL(0, 0, 0)); sl@0: err = CompareInterface(_L8("SetInstrumentL")); sl@0: INFO_PRINTF3(_L("Check interface SetInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //LoadCustomInstrumentL// sl@0: // sl@0: TRAP_IGNORE(aMidi->LoadCustomInstrumentL(_L(""),0,0,0,0)); sl@0: err = CompareInterface(_L8("LoadCustomInstrumentL")); sl@0: INFO_PRINTF3(_L("Check interface LoadCustomInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //LoadCustomInstrumentDataL// sl@0: // sl@0: TRAP_IGNORE(aMidi->LoadCustomInstrumentDataL(_L8(""),0,0,0,0)); sl@0: err = CompareInterface(_L8("LoadCustomInstrumentDataL")); sl@0: INFO_PRINTF3(_L("Check interface LoadCustomInstrumentDataL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //UnloadCustomInstrumentL// sl@0: // sl@0: TRAP_IGNORE(aMidi->UnloadCustomInstrumentL(0,0)); sl@0: err = CompareInterface(_L8("UnloadCustomInstrumentL")); sl@0: INFO_PRINTF3(_L("Check interface UnloadCustomInstrumentL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //PercussionKeyNameL// sl@0: // sl@0: { sl@0: HBufC* percussionKeyName = NULL; sl@0: TRAP_IGNORE(percussionKeyName = aMidi->PercussionKeyNameL(0,0,0,0)); sl@0: delete percussionKeyName; sl@0: } sl@0: err = CompareInterface(_L8("PercussionKeyNameL")); sl@0: INFO_PRINTF3(_L("Check interface PercussionKeyNameL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //StopTimeL// sl@0: // sl@0: { sl@0: TTimeIntervalMicroSeconds stopTime(0); sl@0: TRAP_IGNORE(aMidi->StopTimeL(stopTime)); sl@0: } sl@0: err = CompareInterface(_L8("StopTimeL")); sl@0: INFO_PRINTF3(_L("Check interface StopTimeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetStopTimeL// sl@0: // sl@0: { sl@0: TTimeIntervalMicroSeconds stopTime(0); sl@0: TRAP_IGNORE(aMidi->SetStopTimeL(stopTime)); sl@0: } sl@0: err = CompareInterface(_L8("SetStopTimeL")); sl@0: INFO_PRINTF3(_L("Check interface SetStopTimeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetRepeatsL// sl@0: // sl@0: { sl@0: TInt repeatNumberOfTimes = 0; sl@0: TTimeIntervalMicroSeconds trailingSilence(0); sl@0: TRAP_IGNORE(aMidi->SetRepeatsL(repeatNumberOfTimes, trailingSilence)); sl@0: } sl@0: err = CompareInterface(_L8("SetRepeatsL")); sl@0: INFO_PRINTF3(_L("Check interface SetRepeatsL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: // sl@0: //GetRepeats// sl@0: // sl@0: TRAP_IGNORE(aMidi->GetRepeats()); sl@0: err = CompareInterface(_L8("GetRepeats")); sl@0: INFO_PRINTF3(_L("Check interface GetRepeats gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: // sl@0: //PolyphonyL// sl@0: // sl@0: TRAP_IGNORE(aMidi->PolyphonyL()); sl@0: err = CompareInterface(_L8("PolyphonyL")); sl@0: INFO_PRINTF3(_L("Check interface PolyphonyL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetMaxPolyphonyL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetMaxPolyphonyL(1)); sl@0: err = CompareInterface(_L8("SetMaxPolyphonyL")); sl@0: INFO_PRINTF3(_L("Check interface SetMaxPolyphonyL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //ChannelsSupportedL// sl@0: // sl@0: TRAP_IGNORE(aMidi->ChannelsSupportedL()); sl@0: err = CompareInterface(_L8("ChannelsSupportedL")); sl@0: INFO_PRINTF3(_L("Check interface ChannelsSupportedL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //ChannelVolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->ChannelVolumeL(0)); sl@0: err = CompareInterface(_L8("ChannelVolumeL")); sl@0: INFO_PRINTF3(_L("Check interface ChannelVolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //MaxChannelVolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->MaxChannelVolumeL()); sl@0: err = CompareInterface(_L8("MaxChannelVolumeL")); sl@0: INFO_PRINTF3(_L("Check interface MaxChannelVolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetChannelVolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetChannelVolumeL(0,0)); sl@0: err = CompareInterface(_L8("SetChannelVolumeL")); sl@0: INFO_PRINTF3(_L("Check interface SetChannelVolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetChannelMuteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetChannelMuteL(0,0)); sl@0: err = CompareInterface(_L8("SetChannelMuteL")); sl@0: INFO_PRINTF3(_L("Check interface SetChannelMuteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //VolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->VolumeL()); sl@0: err = CompareInterface(_L8("VolumeL")); sl@0: INFO_PRINTF3(_L("Check interface VolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //MaxVolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->MaxVolumeL()); sl@0: err = CompareInterface(_L8("MaxVolumeL")); sl@0: INFO_PRINTF3(_L("Check interface MaxVolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetVolumeL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetVolumeL(0)); sl@0: err = CompareInterface(_L8("SetVolumeL")); sl@0: INFO_PRINTF3(_L("Check interface SetVolumeL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetVolumeRampL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetVolumeRampL(TTimeIntervalMicroSeconds(0))); sl@0: err = CompareInterface(_L8("SetVolumeRampL")); sl@0: INFO_PRINTF3(_L("Check interface SetVolumeRampL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //GetBalanceL// sl@0: // sl@0: TRAP_IGNORE(aMidi->GetBalanceL()); sl@0: err = CompareInterface(_L8("GetBalanceL")); sl@0: INFO_PRINTF3(_L("Check interface GetBalanceL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetBalanceL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetBalanceL()); sl@0: err = CompareInterface(_L8("SetBalanceL")); sl@0: INFO_PRINTF3(_L("Check interface SetBalanceL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //SetBankL// sl@0: // sl@0: TRAP_IGNORE(aMidi->SetBankL(ETrue)); sl@0: err = CompareInterface(_L8("SetBankL")); sl@0: INFO_PRINTF3(_L("Check interface SetBankL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //IsTrackMuteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->IsTrackMuteL(0)); sl@0: err = CompareInterface(_L8("IsTrackMuteL")); sl@0: INFO_PRINTF3(_L("Check interface IsTrackMuteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: // sl@0: //IsChannelMuteL// sl@0: // sl@0: TRAP_IGNORE(aMidi->IsChannelMuteL(0)); sl@0: err = CompareInterface(_L8("IsChannelMuteL")); sl@0: INFO_PRINTF3(_L("Check interface IsChannelMuteL gave error %d (expected %d)"), err, expErr); sl@0: if(err != expErr) sl@0: { sl@0: ret = EFail; sl@0: return ret; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TInt CTestCheckInterface::CompareInterface(const TDesC8& aInterfaceName) sl@0: { sl@0: TBuf8<40> clientBuf; sl@0: TBuf8<40> controllerBuf; sl@0: clientBuf.FillZ(40); sl@0: controllerBuf.FillZ(40); sl@0: sl@0: clientBuf.Copy(aInterfaceName); sl@0: iSemaphore.Wait(); sl@0: controllerBuf = iChunk.Base(); sl@0: controllerBuf.SetLength(aInterfaceName.Length()); sl@0: sl@0: TInt err = clientBuf.Compare(controllerBuf); sl@0: sl@0: return err; sl@0: } sl@0: sl@0: //-------------------------------------------------------------------------------- sl@0: //MS 3.4 File Handles API sl@0: //-------------------------------------------------------------------------------- sl@0: CTestMidiClntOpenFileByHandle::CTestMidiClntOpenFileByHandle(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType), sl@0: iPlay(aPlay) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiClntOpenFileByHandle* CTestMidiClntOpenFileByHandle::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntOpenFileByHandle* self = new(ELeave) CTestMidiClntOpenFileByHandle(aTestName, aSectName, aKeyName, aPlay, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenFileByHandle::DoTestStepL() sl@0: { sl@0: //[ Local variables ] sl@0: TPtrC filename; sl@0: TInt expErr = KErrNone; sl@0: TVerdict ret = EFail; sl@0: sl@0: //[ Get the File name from ini file ] sl@0: if(!GetStringFromConfig(iSectName,iKeyName,filename)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Expected results ] sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNegative: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Create CMidiClientUtility - player ] sl@0: CMidiClientUtility* player=NULL; sl@0: TRAPD(err1, player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality)); sl@0: if (err1 != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Error while creating a CMidiClientUtility : %d"),err1); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: CleanupStack::PushL(player); sl@0: sl@0: TMMFMessageDestinationPckg dummyPckg; sl@0: TInt dummyFunc = EDevMidiOff; sl@0: TBuf8<8> dummyBuff; sl@0: player->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); sl@0: sl@0: //[ RFs and RFile ] sl@0: RFs rFs; sl@0: RFile rFile; sl@0: sl@0: //[ Connect to File System using RFs ] sl@0: User::LeaveIfError(rFs.Connect()); sl@0: CleanupClosePushL(rFs); sl@0: User::LeaveIfError(rFs.ShareProtected()); sl@0: sl@0: //[ Open the file using RFile ] sl@0: TFileName theDestinationFileName; sl@0: theDestinationFileName.Append(filename); sl@0: sl@0: INFO_PRINTF2(_L("Start : Opening the file : %S by RFile"), &filename); sl@0: TInt theRes = rFile.Open(rFs, theDestinationFileName, EFileRead); sl@0: User::LeaveIfError(theRes); sl@0: CleanupClosePushL(rFile); sl@0: INFO_PRINTF2(_L("End : Opening the file : %S by RFile"), &filename); sl@0: sl@0: //[ API Call ] sl@0: player->OpenFile(rFile); sl@0: sl@0: //[ Wait for Initialisation Callback ] sl@0: INFO_PRINTF1(_L("Start : CMidiClientUtility->OpenFile()")); sl@0: CActiveScheduler::Start(); sl@0: INFO_PRINTF1(_L("End : CMidiClientUtility->OpenFile()")); sl@0: sl@0: //[ Check for errors ] sl@0: if (iError == expErr) sl@0: { sl@0: INFO_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError); sl@0: ret = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("Expected Error : %d, Actual Error : %d"), expErr, iError); sl@0: ret = EFail; sl@0: } sl@0: sl@0: //[ Clean-up RFs, RFile and CMidiClientUtility ] sl@0: CleanupStack::PopAndDestroy(3); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------------ sl@0: sl@0: CTestMidiClntPlayFileByHandle::CTestMidiClntPlayFileByHandle(const TDesC& aTestName) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid) sl@0: { sl@0: } sl@0: sl@0: CTestMidiClntPlayFileByHandle* CTestMidiClntPlayFileByHandle::NewL(const TDesC& aTestName) sl@0: { sl@0: CTestMidiClntPlayFileByHandle* self = new(ELeave) CTestMidiClntPlayFileByHandle(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntPlayFileByHandle::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: //[ Local variables ] sl@0: TPtrC filename; sl@0: sl@0: //[ Get the filename ] sl@0: if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),filename)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility : Play MIDI File")); sl@0: sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: sl@0: //[ RFs and RFile ] sl@0: RFs rFs; sl@0: RFile rFile; sl@0: sl@0: //[ Connect to File System using RFs ] sl@0: User::LeaveIfError(rFs.Connect()); sl@0: CleanupClosePushL(rFs); sl@0: User::LeaveIfError(rFs.ShareProtected()); sl@0: sl@0: INFO_PRINTF1(_L("Opening the file : c:\\DoesntExist.mid")); sl@0: sl@0: //[ Open the file using RFile ] sl@0: TInt theRes = rFile.Open(rFs, filename, EFileRead); sl@0: if(theRes != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("Cannot open file : %S"), &filename); sl@0: } sl@0: CleanupClosePushL(rFile); sl@0: sl@0: //[ Call the OpenFile Method using the File Handle ] sl@0: aMidi->OpenFile(rFile); sl@0: sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged sl@0: sl@0: //[ Clean up RFs and RFile ] sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: aMidi->Play(); sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Play gave error %d"),iError); sl@0: return EFail; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state...")); sl@0: CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying sl@0: if (iCurrentState != EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged sl@0: if (iCurrentState != EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------------ sl@0: // The purpose of this test is that we can hold more than 10 events in the sl@0: // MIDI event queue and none of them gets lost sl@0: sl@0: CTestMidiClntThirteenMidiEvents::CTestMidiClntThirteenMidiEvents(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: // set the current transion to 0, the start point sl@0: iCurrentTransion = 0; sl@0: } sl@0: sl@0: sl@0: CTestMidiClntThirteenMidiEvents* CTestMidiClntThirteenMidiEvents::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestMidiClntThirteenMidiEvents* self = new(ELeave)CTestMidiClntThirteenMidiEvents(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::InitialiseExpectedTransArrayL() sl@0: { sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoTempoChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoVolumeChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMuteChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoPolyphonyChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoInstrumentChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMetaDataEntryFound)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoVolumeChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMuteChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoPolyphonyChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoInstrumentChanged)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMetaDataEntryFound)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMipMessageReceived)); sl@0: User::LeaveIfError(expectedTransitions.Append(EMmcuoMipMessageReceived)); sl@0: sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged(TInt /*aMicroBeatsPerMinute*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoTempoChanged) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoTempoChanged callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged(TInt /*aChannel*/,TReal32 /*aVolumeInDecibels*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoVolumeChanged) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoVolumeChanged callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged(TInt /*aChannel*/,TBool /*aMuted*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoMuteChanged) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMuteChanged callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound(const TInt /*aMetaDataEntryId*/,const TTimeIntervalMicroSeconds& /*aPosition*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoMetaDataEntryFound) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMetaDataEntryFound callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived(const RArray& /*aEntry*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoMipMessageReceived) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoMipMessageReceived callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged(TInt /*aNewPolyphony*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoPolyphonyChanged) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoPolyphonyChanged callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: void CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged(TInt /*aChannel*/,TInt /*aBankId*/,TInt /*aInstrumentId*/) sl@0: { sl@0: if (expectedTransitions[iCurrentTransion] == EMmcuoInstrumentChanged) sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback")); sl@0: iCurrentTransion++; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("CTestMidiClntThirteenMidiEvents::MmcuoInstrumentChanged callback not expected")); sl@0: expectedTransitions[iCurrentTransion] = EMmcuoInvalid; sl@0: } sl@0: } sl@0: sl@0: sl@0: TVerdict CTestMidiClntThirteenMidiEvents::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: InitialiseExpectedTransArrayL(); sl@0: sl@0: TPtrC fileName; sl@0: if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Play midi file")); sl@0: // expected results sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: aMidi->OpenFile(fileName); sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: expectedTransitions.Close(); sl@0: return EFail; sl@0: } sl@0: sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play gave error %d (expected %d)"),iError, expErr); sl@0: expectedTransitions.Close(); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF3(_L("Play, %d = %d"), iError, expErr); sl@0: } sl@0: sl@0: sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenPlaying state...")); sl@0: CActiveScheduler::Start(); // EMidiStateOpenDisengaged ->EMidiStateOpenPlaying sl@0: if (iCurrentState != EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); sl@0: expectedTransitions.Close(); sl@0: return EFail; sl@0: } sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateOpenPlaying ->EMidiStateOpenEngaged sl@0: if (iCurrentState != EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); sl@0: expectedTransitions.Close(); sl@0: return EFail; sl@0: } sl@0: sl@0: if (expectedTransitions.Find(EMmcuoInvalid) != KErrNotFound) sl@0: { sl@0: ERR_PRINTF1(_L("One of the transactions was lost")); sl@0: expectedTransitions.Close(); sl@0: return EFail; sl@0: } sl@0: sl@0: expectedTransitions.Close(); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: // TEST 1: Test the transtion from EMidiStateClosedDisengaged to EMidiStateClosedEngaged. sl@0: sl@0: CTestTrasitionFromEClosedToEClosedEngaged::CTestTrasitionFromEClosedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestTrasitionFromEClosedToEClosedEngaged* CTestTrasitionFromEClosedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestTrasitionFromEClosedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEClosedEngaged(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestTrasitionFromEClosedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: //[ Local variables ] sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateClosedEngaged")); sl@0: //[ Expected results ] sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Set the current state to EMidiStateClosedDisengaged ] sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: sl@0: //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] sl@0: TMidiState MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call Play() ] sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateClosedEngaged sl@0: sl@0: if (iCurrentState != EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: // TEST 2: Test the transtion from EMidiStateClosedDisengaged to EMidiStateOpenEngaged. sl@0: sl@0: CTestTrasitionFromEClosedToEOpenEngaged::CTestTrasitionFromEClosedToEOpenEngaged(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestTrasitionFromEClosedToEOpenEngaged* CTestTrasitionFromEClosedToEOpenEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestTrasitionFromEClosedToEOpenEngaged* self = new(ELeave) CTestTrasitionFromEClosedToEOpenEngaged(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestTrasitionFromEClosedToEOpenEngaged::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: //[ Local variables ] sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedDisengaged to EMidiStateOpenEngaged")); sl@0: //[ Expected results ] sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Set the current state to EMidiStateClosedDisengaged ] sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: sl@0: //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] sl@0: TMidiState MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call OpenFile() ] sl@0: TPtrC fileName; sl@0: if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: aMidi->OpenFile(fileName); sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged(EMidiStateOpenDisengaged) sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call Play() ] sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying sl@0: sl@0: if (iCurrentState != EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged sl@0: sl@0: if (iCurrentState != EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------ sl@0: // TEST 3: Test the transtion from EMidiStateOpenEngaged to EMidiStateClosedEngaged. sl@0: sl@0: CTestTrasitionFromEOpenEngagedToEClosedEngaged::CTestTrasitionFromEOpenEngagedToEClosedEngaged(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestTrasitionFromEOpenEngagedToEClosedEngaged* CTestTrasitionFromEOpenEngagedToEClosedEngaged::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestTrasitionFromEOpenEngagedToEClosedEngaged* self = new(ELeave) CTestTrasitionFromEOpenEngagedToEClosedEngaged(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestTrasitionFromEOpenEngagedToEClosedEngaged::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: //[ Local variables ] sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateOpenEngaged to EMidiStateClosedEngaged")); sl@0: //[ Expected results ] sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Set the current state to EMidiStateClosedDisengaged ] sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: sl@0: //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] sl@0: TMidiState MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call OpenFile() ] sl@0: TPtrC fileName; sl@0: if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: sl@0: aMidi->OpenFile(fileName); sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call Play() ] sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying sl@0: sl@0: if (iCurrentState != EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged sl@0: sl@0: if (iCurrentState != EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: sl@0: // [ Call Close() ] sl@0: aMidi->Close(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged sl@0: sl@0: if (iCurrentState != EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: sl@0: //--------------------------------------------------------------------- sl@0: // TEST 4: Test the transtion from EMidiStateClosedEngaged to EMidiStateClosedDisengaged. sl@0: sl@0: CTestTrasitionFromEClosedEngagedToEClosed::CTestTrasitionFromEClosedEngagedToEClosed(const TDesC& aTestName, const TTestStepType aTestType) sl@0: :CTestMmfMidiClntStep(aTestName, aTestType) sl@0: { sl@0: } sl@0: sl@0: CTestTrasitionFromEClosedEngagedToEClosed* CTestTrasitionFromEClosedEngagedToEClosed::NewL(const TDesC& aTestName, const TTestStepType aTestType) sl@0: { sl@0: CTestTrasitionFromEClosedEngagedToEClosed* self = new(ELeave) CTestTrasitionFromEClosedEngagedToEClosed(aTestName, aTestType); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestTrasitionFromEClosedEngagedToEClosed::DoTestL(CMidiClientUtility* aMidi) sl@0: { sl@0: //[ Local variables ] sl@0: TVerdict ret = EPass; sl@0: TInt expErr = KErrNone; sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Transition from EMidiStateClosedEngaged to EMidiStateClosedDisengaged")); sl@0: //[ Expected results ] sl@0: switch(iTestType) sl@0: { sl@0: case ETestValid: sl@0: expErr = KErrNone; sl@0: break; sl@0: case ETestNoPlugin: sl@0: expErr = KErrNotSupported; sl@0: break; sl@0: case ETestInvalidState: sl@0: expErr = KErrUnknown; sl@0: break; sl@0: default: sl@0: ERR_PRINTF1(_L("Error - invalid test step type")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: //[ Set the current state to EMidiStateClosedDisengaged ] sl@0: iCurrentState = EMidiStateClosedDisengaged; sl@0: sl@0: //[ Retrieve the MIDI client utility state and check it is EMidiStateClosedDisengaged ] sl@0: TMidiState MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call OpenFile() ] sl@0: TPtrC fileName; sl@0: if(!GetStringFromConfig(_L("SectionOne"),_L("filename"),fileName)) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: sl@0: aMidi->OpenFile(fileName); sl@0: INFO_PRINTF1(_L("Waiting for EMidiStateOpenDisengaged state...")); sl@0: CActiveScheduler::Start(); // EMidiStateClosedDisengaged -> EMidiStateOpenDisengaged sl@0: if (iCurrentState != EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call Play() ] sl@0: aMidi->Play(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenDisengaged -> EMidiStateOpenPlaying sl@0: sl@0: if (iCurrentState != EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenPlaying, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateOpenPlaying) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenPlaying")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenPlaying)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenPlaying -> EMidiStateOpenEngaged sl@0: sl@0: if (iCurrentState != EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateOpenEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateOpenEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateOpenEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateOpenEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: sl@0: // [ Call Close() ] sl@0: aMidi->Close(); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateOpenEngaged -> EMidiStateClosedEngaged sl@0: sl@0: if (iCurrentState != EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedEngaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: if (MIDIClientState == EMidiStateClosedEngaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedEngaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedEngaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: sl@0: // [ Call Stop() ] sl@0: TTimeIntervalMicroSeconds fadeOutDuration(0); sl@0: aMidi->Stop(fadeOutDuration); sl@0: if (expErr != iError) sl@0: { sl@0: ERR_PRINTF3(_L("Play() gave error %d (expected %d)"),iError, expErr); sl@0: return EFail; sl@0: } sl@0: sl@0: CActiveScheduler::Start(); // EMidiStateClosedEngaged -> EMidiStateClosedDisengaged sl@0: sl@0: if (iCurrentState != EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected state (expected = EMidiStateClosedDisengaged, received = %d)"), iCurrentState); sl@0: return EFail; sl@0: } sl@0: sl@0: MIDIClientState = aMidi->State(); sl@0: sl@0: if (MIDIClientState == EMidiStateClosedDisengaged) sl@0: { sl@0: ERR_PRINTF1(_L("MIDI Client Utility ----> EMidiStateClosedDisengaged")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIDI Client Utility unexpected state %d (expected ----> EMidiStateClosedDisengaged)"), MIDIClientState); sl@0: return EFail; sl@0: } sl@0: return ret; sl@0: } sl@0: sl@0: //------------------------------------------------------------------------ sl@0: // This test checks for opening the file using a FileHandle more than sl@0: // once. sl@0: sl@0: sl@0: CTestMidiOpenFileHandleRepeat::CTestMidiOpenFileHandleRepeat(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid), sl@0: iPlay(aPlay) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiOpenFileHandleRepeat* CTestMidiOpenFileHandleRepeat::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) sl@0: { sl@0: CTestMidiOpenFileHandleRepeat* self = new(ELeave) CTestMidiOpenFileHandleRepeat(aTestName, aSectName, aKeyName, aPlay); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiOpenFileHandleRepeat::DoTestStepL() sl@0: { sl@0: TPtrC filename; sl@0: if(!GetStringFromConfig(iSectName,iKeyName,filename)) sl@0: return EInconclusive; sl@0: TVerdict ret = EFail; sl@0: INFO_PRINTF1(_L("Test to check whether OpenFile(const RFile& aFile) works fine when opened more than once using the same filehandle ")); sl@0: sl@0: CMidiClientUtility *midiClient = CMidiClientUtility::NewL(*this); sl@0: if (!midiClient) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: CleanupStack::PushL(midiClient); sl@0: RFs fs; sl@0: RFile file; sl@0: fs.Connect(); sl@0: CleanupClosePushL(fs); sl@0: sl@0: TMMFMessageDestinationPckg dummyPckg; sl@0: TInt dummyFunc = 0; //EDevMidiOff; sl@0: TBuf8<8> dummyBuff; sl@0: midiClient->CustomCommandSyncL(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff); sl@0: TInt err = fs.ShareProtected(); sl@0: if ((err = file.Open(fs, filename, EFileRead )) == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("Inside the first call")); sl@0: midiClient->OpenFile(file);//opening the file for the first time using the handle sl@0: CActiveScheduler::Start(); sl@0: midiClient->Close(); sl@0: CActiveScheduler::Start(); sl@0: file.Close(); sl@0: } sl@0: err = file.Open(fs, filename, EFileRead);//Opening the file for the second time sl@0: if(err==KErrNone) //shouldn't give inuse error at this point sl@0: { sl@0: INFO_PRINTF1(_L("Inside the second call")); sl@0: midiClient->OpenFile(file); sl@0: CActiveScheduler::Start(); sl@0: midiClient->Close(); sl@0: CActiveScheduler::Start(); sl@0: file.Close(); sl@0: ret=EPass; sl@0: } sl@0: else sl@0: INFO_PRINTF2(_L("Failed to open the file the second time returned with err = %d"),err); sl@0: sl@0: //To check whether OpenFile(TDesC& aFileName) works fine when opened more than once. sl@0: _LIT (KFilename,"c:\\MidiClntITestData\\midi.mid"); sl@0: midiClient->OpenFile(KFilename);//First Open(TDesC& aFileName) sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); sl@0: CActiveScheduler::Start(); sl@0: if(iError != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to open the file.Failed with error %d"),err); sl@0: } sl@0: midiClient->Close(); sl@0: CActiveScheduler::Start(); sl@0: midiClient->OpenFile(KFilename);//Second Open(TDesC& aFileName) sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file for the second time")); sl@0: CActiveScheduler::Start(); sl@0: if(iError != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to open the file second time.Failed with error %d"),err); sl@0: } sl@0: //Opening the file again without calling the close for the previous open sl@0: midiClient->OpenFile(KFilename); sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file for the second time without close")); sl@0: CActiveScheduler::Start(); sl@0: if(iError != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("Failed with error %d"),err); sl@0: } sl@0: midiClient->Close(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: // To check that calling Open twice without closing the file inbetween does return an inuse error sl@0: file.Open(fs, filename, EFileRead);//Opening for the first time sl@0: User::After(1000000); sl@0: err = file.Open(fs, filename, EFileRead);//Opening for the secondtime without closing the previous open, should return KErrInUse sl@0: if(err != KErrInUse) sl@0: { sl@0: ret=EFail; sl@0: INFO_PRINTF2(_L("Expected to return error -14, but returned error %d"),err); sl@0: } sl@0: file.Close(); sl@0: CleanupStack::PopAndDestroy(2); // fileServer, midiClient sl@0: return ret; sl@0: } sl@0: sl@0: TVerdict CTestMidiOpenFileHandleRepeat::DoTestL(CMidiClientUtility* /*aMidi*/) sl@0: { sl@0: return EPass; sl@0: } sl@0: sl@0: /* sl@0: Playing a midi file without opening a file and checking for its status during call back. sl@0: */ sl@0: sl@0: CTestMidiClntPlayWithoutFile::CTestMidiClntPlayWithoutFile(const TDesC& aTestName) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid) sl@0: {} sl@0: sl@0: CTestMidiClntPlayWithoutFile* CTestMidiClntPlayWithoutFile::NewL(const TDesC& aTestName) sl@0: { sl@0: CTestMidiClntPlayWithoutFile* self = new(ELeave) CTestMidiClntPlayWithoutFile(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestMidiClntPlayWithoutFile::DoTestStepL() sl@0: { sl@0: CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); sl@0: TVerdict ret = EPass; sl@0: iError = KErrNone; sl@0: sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: CleanupStack::PushL(player); sl@0: sl@0: player->Play(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error while playing")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TTimeIntervalMicroSeconds fadeOutDuration(0); sl@0: player->Stop(fadeOutDuration); sl@0: CActiveScheduler::Start(); sl@0: sl@0: // Check for errors. sl@0: if (iError != KErrNone) sl@0: { sl@0: ret = EFail; sl@0: ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); sl@0: CleanupStack::PopAndDestroy(player); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: void CTestMidiClntPlayWithoutFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt aError) sl@0: { sl@0: iError=aError; sl@0: ERR_PRINTF2(_L("Old State: %d "),aOldState); sl@0: ERR_PRINTF2(_L("New State : %d "),aNewState); sl@0: ERR_PRINTF2(_L("Error Code : %d "),aError); sl@0: sl@0: if(aError == KErrNone) sl@0: { sl@0: if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error")); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Error during calback")); sl@0: } sl@0: sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: //------------------------------------------------------------------ sl@0: sl@0: /* sl@0: Opening a midi file and playing it and checking for its status during call back. sl@0: */ sl@0: sl@0: CTestMidiClntOpenAndPlayFile::CTestMidiClntOpenAndPlayFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName) sl@0: :CTestMmfMidiClntStep(aTestName, ETestValid) sl@0: { sl@0: iSectName = aSectName; sl@0: iKeyName = aKeyName; sl@0: } sl@0: sl@0: CTestMidiClntOpenAndPlayFile* CTestMidiClntOpenAndPlayFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName) sl@0: { sl@0: CTestMidiClntOpenAndPlayFile* self = new(ELeave) CTestMidiClntOpenAndPlayFile(aTestName, aSectName, aKeyName); sl@0: return self; sl@0: } sl@0: sl@0: TVerdict CTestMidiClntOpenAndPlayFile::DoTestStepL() sl@0: { sl@0: TVerdict ret = EPass; sl@0: iError = KErrNone; sl@0: TPtrC filename; sl@0: if(!GetStringFromConfig(iSectName,iKeyName,filename)) sl@0: return EInconclusive; sl@0: sl@0: CMidiClientUtility* player = CMidiClientUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); sl@0: if (!player) sl@0: { sl@0: ERR_PRINTF1(_L("Could not create a CMidiClientUtility")); sl@0: return EInconclusive; sl@0: } sl@0: CleanupStack::PushL(player); sl@0: sl@0: player->OpenFile(filename); sl@0: sl@0: // Wait for initialisation callback sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Opening file")); sl@0: CActiveScheduler::Start(); sl@0: sl@0: player->Play(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (iError != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("Error while playing")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: TTimeIntervalMicroSeconds fadeOutDuration(0); sl@0: player->Stop(fadeOutDuration); sl@0: CActiveScheduler::Start(); sl@0: sl@0: // Check for errors. sl@0: if (iError != KErrNone) sl@0: { sl@0: ret = EFail; sl@0: ERR_PRINTF2( _L("CMidiClientUtility failed with error %d"),iError ); sl@0: } sl@0: sl@0: INFO_PRINTF1(_L("CMidiClientUtility: Destroying")); sl@0: CleanupStack::PopAndDestroy(player); sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: void CTestMidiClntOpenAndPlayFile::MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& /*aTime*/,TInt aError) sl@0: { sl@0: iError=aError; sl@0: ERR_PRINTF2(_L("Old State: %d "),aOldState); sl@0: ERR_PRINTF2(_L("New State : %d "),aNewState); sl@0: ERR_PRINTF2(_L("Error Code : %d "),aError); sl@0: sl@0: if(aError == KErrNone) sl@0: { sl@0: if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateClosedEngaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateClosedEngaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateClosedEngaged) && (aNewState == EMidiStateClosedDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedEngaged to EMidiStateClosedDisengaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateClosedDisengaged) && (aNewState == EMidiStateOpenDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateClosedDisengaged to EMidiStateOpenDisengaged, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateOpenDisengaged) && (aNewState == EMidiStateOpenPlaying)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenDisengaged to EMidiStateOpenPlaying, with no error")); sl@0: } sl@0: else if((aOldState == EMidiStateOpenPlaying) && (aNewState == EMidiStateOpenDisengaged)) sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,change from EMidiStateOpenPlaying to EMidiStateOpenDisengaged, with no error")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("State changed call back occurs,the states remain the same with no error")); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Error during calback")); sl@0: } sl@0: sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: