TVerdict CTestStepSDevSoundPlayDataCap::DoPlayData() { INFO_PRINTF1(_L("Testing Simple Tone Playback")); //Initialize TVerdict initOK = TestInitialize(EMMFStatePlaying); if (initOK != EPass) { return EInconclusive; } TestSetPriority(KDevSoundPriorityLow); initOK = TestPlayInit(); if (initOK != EPass) { return EInconclusive; } TestSetVolume(iMMFDevSound->MaxVolume() / 2); _LIT(KTestFileName, "C:\\sdevsoundinttestdata\\mainTst.wav"); TFileName filename(KTestFileName); return PlayDataFile(filename); }
TVerdict CSecDevSndTS0036::DoPlaySimpleTone() { TInt freq = 100; // arbitrary freq TTimeIntervalMicroSeconds dur(2000000); //play for 2sec TVerdict verdict; TInt err = iMMFDevSound->SetClientThreadInfo(iClientTid); if (err != KErrNone) { verdict = EInconclusive; } else { verdict = TestInitialize(EMMFStateTonePlaying); if (verdict != EPass) { verdict = EInconclusive; } else { TestSetPriority(KDevSoundPriorityLow); TestSetVolume(iMMFDevSound->MaxVolume()); iExpectedValue = KErrUnderflow; verdict = TestPlayTone(freq, dur); } } if (verdict == EInconclusive) { User::RequestComplete(iStatus, KErrGeneral); } return verdict; }
void AngelFight::TestLoop() { TestInitialize(); DEBUG_LOG("AngelFight::Enter Main Loop"); while( m_nWinnerTeam == 0 ) { for( int i = 0; i < PLAYER_COUNT; ++i ) { m_pPlayers[i]->ClearActionState(); } for( int i = 0; i < PLAYER_COUNT; ++i ) { m_pPlayers[i]->AutoAct(); } DEBUG_LOG("AngelFight Current Player ACT Info"); for( int i = 0; i < PLAYER_COUNT; ++i ) { DEBUG_LOG("Player ID:[%u],Action:[%d],Param:[%d]", m_pPlayers[i]->GetUserID(), m_pPlayers[i]->GetActionState(), m_pPlayers[i]->GetASParam() ); } ActionAndNotify(); DEBUG_LOG("AngelFight Current Player ATTR Info"); for( int i = 0; i < PLAYER_COUNT; ++i ) { DEBUG_LOG("Player ID:[%u],HP:[%d],MP:[%d]", m_pPlayers[i]->GetUserID(), m_pPlayers[i]->GetHP(),m_pPlayers[i]->GetMP()); } } DEBUG_LOG("AngelFight::Test Over"); }
TVerdict CTestStepCISampleBuffering::DoTestStep0072L() { iTestStepResult = EFail; TInt err; INFO_PRINTF1(_L("SampleBuffering - MmsbNotifyPlayStarted")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidSampleBufferingTestDevice}; #else TFourCC testUID('T','0','1','2'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidMMMFSampleBuffering MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering)); if (ptr) { CActiveListener* listener = new(ELeave)CActiveListener; listener->InitialiseActiveListener(); ptr->MmsbNotifyPlayStarted(listener->iStatus); // call method CActiveScheduler::Start(); err = listener->iStatus.Int(); delete listener; if (err == KErrNotSupported) { INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted failed with err %d"), err); } } else { INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }
TVerdict CTestStepCISampleBuffering::DoTestStep0071L() { iTestStepResult = EFail; TInt result = KErrGeneral; INFO_PRINTF1(_L("SampleBuffering - MmsbDisableSampleBufferingBeforePlayback")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidSampleBufferingTestDevice}; #else TFourCC testUID('T','0','1','2'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidMMMFSampleBuffering MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering)); if (ptr) { result = ptr->MmsbDisableSampleBufferingBeforePlayback(); // call method if (result == KErrNone) { INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback failed with result %d"), result); } } else { INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }
TVerdict CTestStepCIG711DecoderConfig::DoTestStep0041L() { iTestStepResult = EFail; TInt result = KErrGeneral; INFO_PRINTF1(_L("G711DecoderIntfc - SetDecoderMode")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidG711DecoderConfigTestDevice}; #else TFourCC testUID('T','0','1','5'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidG711DecoderIntfc MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); if (ptr) { result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecULaw); // call method if (result == KErrNone) { INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result); } } else { INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }
TVerdict CTestStepCIG711DecoderConfig::DoTestStep0040L() { iTestStepResult = EFail; INFO_PRINTF1(_L("G711DecoderIntfc - Instantiating")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidG711DecoderConfigTestDevice}; #else TFourCC testUID('T','0','1','5'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidG711DecoderIntfc MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); if (ptr) { INFO_PRINTF1(_L("MG711DecoderIntfc instantiated successfully")); iTestStepResult = EPass; } else { ERR_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); } return iTestStepResult; }
TInt CTestStepSDevSoundClientThreadNoCap::DoPlaySimpleTone() { INFO_PRINTF1(_L("Testing Simple Tone Playback")); TInt freq = 1000; TTimeIntervalMicroSeconds dur(10000000); // play for some period of time, eg 10secs TUid KInvalidCIUid = KUidCustomInterfaceDevSoundFileBlockLength; // use block length CI TAny* tempPtr = NULL; if (iAttemptInitialCI) { // if requested we get a CustomInferface() prior to SetClientThreadInfo. The latter // should then fail since it is called prior to InitializeL tempPtr = iMMFDevSound->CustomInterface(KInvalidCIUid); // request unknown i/f if (tempPtr) { INFO_PRINTF1(_L("CustomInterface() expected to return NULL but did not!")); return KErrGeneral; } } TInt err = iMMFDevSound->SetClientThreadInfo(iServerTid); TInt expectedErr = KErrNone; #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND if (iAttemptInitialCI) { // characterisation says that SetClientThreadInfo() called 2nd returns an error // but the old DevSound works differently expectedErr = KErrNotReady; } #endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND if (err != expectedErr) { // with iAttemptInitialCI we expect KErrNotReady otherwise KErrNone INFO_PRINTF3(_L("Unexpected return from SetClientThreadInfo(%d, not %d)"), err, expectedErr); return err==KErrNone ? KErrGeneral : err; // always return a real error } // always ask for CI after SetClientThreadInfo(). This should be a NOP, and do no harm // call just to make sure no Kern-exec-3 or similar occurs tempPtr = iMMFDevSound->CustomInterface(KInvalidCIUid); // request unknown i/f if (tempPtr) { INFO_PRINTF1(_L("CustomInterface() expected to return NULL but did not!")); return KErrGeneral; } // if iAttemptInitialCI, the SetClientThreadInfo() would have failed with KErrNotReady // return now if (iAttemptInitialCI) { return KErrNone; } //Initialize TVerdict initOK = TestInitialize(EMMFStateTonePlaying); if (initOK != EPass) { return KErrGeneral; } TestSetPriority(KDevSoundPriorityHigh); TestSetVolume(iMMFDevSound->MaxVolume()); iExpectedValue = KErrInUse; return TestPlayTone(freq, dur); }
TVerdict CTestStepCISampleBuffering::DoTestStep0073L() { iTestStepResult = EFail; TInt err; INFO_PRINTF1(_L("SampleBuffering - MmsbCancelNotifyPlayStarted")); TCallBack callback(CTestStepCISampleBuffering::Callback, this); iTimer = CPeriodic::NewL(EPriorityNormal); // Here we use periodic timer to enable us to call MmsbCancelNotifyPlayStarted() after three // seconds of issuing MmsbNotifyPlayStarted(). Ninety seconds is long enough to stop the timer // before sending a second MmsbCancelNotifyPlayStarted() . iTimer->Start(KAfterThreeSeconds, KEveryNinetySeconds, callback); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidSampleBufferingTestDevice}; #else TFourCC testUID('T','0','1','2'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidMMMFSampleBuffering iInterfacePtr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering)); if (iInterfacePtr) { CActiveListener* listener = new(ELeave) CActiveListener; listener->InitialiseActiveListener(); iInterfacePtr->MmsbNotifyPlayStarted(listener->iStatus); // call method CActiveScheduler::Start(); err = listener->iStatus.Int(); delete listener; if (err == KErrCancel) { INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbCancelNotifyPlayStarted Successfully completed")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("Device didn't wait for the expected duration err %d"), err); } } else { INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); iTestStepResult = EInconclusive; } delete iTimer; return iTestStepResult; }
TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L() { iTestStepResult = EFail; TInt result = KErrGeneral; INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidG711EncoderConfigTestDevice}; #else TFourCC testUID('T','0','1','6'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidG711EncoderIntfc MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); if (ptr) { MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw; TInt setEncodeMode = MG711EncoderIntfc::EEncALaw; result = ptr->SetEncoderMode(encodeMode) ; // call method if (result == KErrNone) { // This file is created by the test stub, the plugin device _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt"); ReadFileL(KFileName, setEncodeMode); if (static_cast<MG711EncoderIntfc::TEncodeMode>(setEncodeMode) == encodeMode) { INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode); } } else { ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result); } } else { INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }