/** * * TestPlayInit * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDataCap::TestPlayInit() { ResetCallbacks(); iAL->InitialiseActiveListener(); //get buffer from devsound TRAPD(err, iMMFDevSound->PlayInitL()); // Start the active scheduler and catch the callback CActiveScheduler::Start(); if (err) { WARN_PRINTF2 (_L("DevSound PlayInitL left with error = %d"), err); return EFail; } else { if (iCallbackArray[EBuffToFill] != 1) { ERR_PRINTF2 (_L("DevSound BufferToBeFilled was called %d times, expected 1"), iCallbackArray[EBuffToFill]); return EFail; } TInt tot = GetCallbackTotal(); if (tot > 1) { ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), tot); return EFail; } } return EPass; }
/** * * PlayInit * @result TVerdict * */ TVerdict CTestStepSDevSound::PlayInit() { iCallbackArray.Reset(); iAL->InitialiseActiveListener(); //get buffer from devsound TRAPD(err, iMMFDevSound->PlayInitL()); // Start the active scheduler and catch the callback CActiveScheduler::Start(); if (err) { WARN_PRINTF2 (_L("DevSound PlayInitL left with error = %d"), err); return EFail; } else { if (iCallbackArray[EBuffToFill] != 1) { ERR_PRINTF2 (_L("DevSound BufferToBeFilled was called %d times, expected 1"), iCallbackArray[EBuffToFill]); return EFail; } TInt total = 0; for (TInt i = EInitComplete; i < EDeviceMsg; i++) { total += iCallbackArray[i]; } if (total > 1) { ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), total); return EFail; } } return EPass; }
/** * * TestInitialize * @param aDataType * @param aMode * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDataCap::TestInitialize(TMMFState aMode) { TFourCC pcm16(KMMFFourCCCodePCM16); //default to pcm16 data type iCallbackError = KErrNone; iExpectedValue = KErrNone; ResetCallbacks(); iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Initializing DevSound")); // Initialize TRAPD(err, iMMFDevSound->InitializeL(*this, pcm16, aMode)); if (err) { WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); return EInconclusive; } else { CActiveScheduler::Start(); if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EInitComplete] != 1) { ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); return EFail; } } return EPass; }
/** * * InitializeDevSound * @param aDataType * @param aMode * @result TVerdict * */ TVerdict CTestStepSDevSound::InitializeDevSound(TFourCC& aDataType, TMMFState aMode) { iCallbackError = KErrNone; iExpectedValue = KErrNone; iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Initializing DevSound")); // Initialize TRAPD(err, iMMFDevSound->InitializeL(*this, aDataType, aMode)); if (err) { WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); return EInconclusive; } else { CActiveScheduler::Start(); if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EInitComplete] != 1) { ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); return EFail; } } return EPass; }
/** * * DoTestStepL * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDualTone::DoTestStepL() { TInt freq1 = 100; TInt freq2 = 200; TTimeIntervalMicroSeconds dur(2000000); INFO_PRINTF1(_L("Testing Dual Tone Playback")); //Initialize TVerdict initializeOK = InitializeDevSound(EMMFStateTonePlaying); if (initializeOK != EPass) { return EInconclusive; } iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); iExpectedValue = KErrUnderflow; iCallbackError = KErrNone; iCallbackArray.Reset(); // Set request active iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Playing Dual Tone")); TRAPD(err, iMMFDevSound->PlayDualToneL(freq1, freq2, dur)); // Start the active scheduler and catch the callback CActiveScheduler::Start(); if (err) { WARN_PRINTF2 (_L("DevSound PlayDualToneL left with error = %d"), err); return EInconclusive; } else { if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound ToneFinished returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EToneFinished] != 1) { ERR_PRINTF2 (_L("DevSound ToneFinished was called %d times, expected 1"), iCallbackArray[EToneFinished]); return EFail; } TInt total = 0; for (TInt i = EInitComplete; i < EDeviceMsg; i++) { total += iCallbackArray[i]; } if (total > 1) { ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), total); return EFail; } } return EPass; }
/** * * DoTestStepL * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDTMFTones::DoTestStepL() { INFO_PRINTF1(_L("Testing DTMF Playback")); TPtrC dtmfString = (_L("0123456789,abcdef,*#")); //Initialize TVerdict initializeOK = InitializeDevSound(EMMFStateTonePlaying); if (initializeOK != EPass) { return EInconclusive; } iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); iExpectedValue = KErrUnderflow; iCallbackError = KErrNone; iCallbackArray.Reset(); // Set request active iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Playing DTMF String")); TRAPD(err, iMMFDevSound->PlayDTMFStringL(dtmfString)); // Start the active scheduler and catch the callback CActiveScheduler::Start(); if (err) { WARN_PRINTF2 (_L("DevSound PlayDTMFStringL left with error = %d"), err); return EInconclusive; } else { if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound ToneFinished returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EToneFinished] != 1) { ERR_PRINTF2 (_L("DevSound ToneFinished was called %d times, expected 1"), iCallbackArray[EToneFinished]); return EFail; } TInt total = 0; for (TInt i = EInitComplete; i < EDeviceMsg; i++) { total += iCallbackArray[i]; } if (total > 1) { ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), total); return EFail; } } return EPass; }
// Function : doTestStepPreambleL() // Description : // @return :TVerdict EPass/EFail TVerdict CT_ReadFileStep::doTestStepPreambleL() { //call Seek base class doTestStepPreambleL TVerdict ret=CT_SeekFileStep::doTestStepPreambleL(); //Set up seekread if (!GetBoolFromConfig(ConfigSection(),KT_ReadSeek,iSeek)) { //defaulting to constructor value WARN_PRINTF2(_L("Using default seek value: (%d)"), iSeek); } return ret; }
TInt CTestStepSDevSoundClientThreadNoCap::TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur) { iCallbackError = KErrNone; ResetCallbacks(); INFO_PRINTF1(_L("Playing Simple Tone")); TRAPD(err, iMMFDevSound->PlayToneL(aFreq, aDur)); if (err) { WARN_PRINTF2 (_L("DevSound PlayToneL left with error = %d"), err); iCallbackError = err; } return err; }
/** * @return - TVerdict code * Override of base class pure virtual * Our implementation only gets called if the base class doTestStepPreambleL() did * not leave. That being the case, the current test result value will be EPass. */ TVerdict CLbsNrhStateTestSingleStep::doTestStepL() { if (TestStepResult() == EPass) { ReadIniFileValues(); switch (GetTestCaseId()) { case 0: { SingleMtLrL(); break; } case 1: { SingleMoLrL(); break; } case 2: { SingleMoLr_CellL(); break; } case 3: { SingleX3pL(); break; } case 4: { SingleSuplMtLrL(); break; } case 5: { SingleSuplMoLrL(); break; } case 6: { SingleMtLrMaxFixAgeL(); break; } case 7: { SingleMoLrMaxFixAgeL(); break; } case 8: { SingleMtLrRefAfterLocRequestL(); break; } case 9: { SingleEmergencyMtLrL(); break; } case 10:{ SingleEmergencyMtLrLAdviceNotify(); break; } case 11:{ SingleEmergencyNI(); break; } case 12:{ SingleEmergencyNIRefPosBeforeLocReq();break; } case 13:{ SingleMtLrL2(); break; } case 14:{ GenericTestL(); break; } case 15:{ SingleMtLrTimeoutPrivacyL(); break; } case 16:{ SingleMtLrTimeoutLocationL(); break; } case 17:{ NewClientMoLrL(); break; } case 18:{ PreemptedX3pL(); break; } default: { WARN_PRINTF2(_L("CLbsNrhStateTestSingleStep::doTestStepL: Unknown test case Id: %d"), GetTestCaseId()); break; } } } return TestStepResult(); }
/** @return - ETrue if enum was resolved to integral value, else EFalse @param - aSectName Enum file section to be read @param - aKeyName Key/Enum to be read @param - aResult Updated enum's integral value */ TBool CAppfwkDscStoreTestStepBase::GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) { _LIT(KEnumFileNotSet, "EnumFile"); __ASSERT_ALWAYS(iEnumData, User::Panic(KEnumFileNotSet, KErrNotFound)); TBool readResult = EFalse; TPtrC enumString; readResult = GetStringFromConfig(aSectName, aKeyName, enumString); if (readResult) { readResult = iEnumData->FindVar(KEnums, enumString, aResult); } else { _LIT(KEnumKeyNotfound, "EnumKey %S not found"); WARN_PRINTF2(KEnumKeyNotfound, &aKeyName); } return readResult; }
TVerdict CTestMacrosTestStep::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual * Our implementation only gets called if the base class doTestStepPreambleL() did * not leave. That being the case, the current test result value will be EPass. */ { TPtrC macro; GetStringFromConfig(ConfigSection(), KMacro, macro); if (macro == KTest) { TBool parameter; TInt parameter2; TInt expectedResult; GetBoolFromConfig(ConfigSection(), KParameter, parameter); GetIntFromConfig(ConfigSection(), KParameter2, parameter2); GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult); _LIT(KStartInfo, "Start to run %S test of macros TEST(E) & TEST(E)L"); INFO_PRINTF2(KStartInfo, POS_NEG_SEL); TEST(parameter); TESTE(parameter, parameter2); if (expectedResult != TestStepResult()) { ERR_PRINTF2(_L("The %S test of macro TEST(E) test is failed!"), POS_NEG_SEL); SetTestStepResult(EFail); } else { SetTestStepResult(EPass); INFO_PRINTF3(_L("The %S test of macro TEST(E) is passed. Start to run %S test of macro TEST(E)L"), POS_NEG_SEL, POS_NEG_SEL); TRAPD(err, TESTL(parameter)); TRAPD(err1, TESTEL(parameter, parameter2)); if ((expectedResult==EPass && KErrNone!=err) || (expectedResult==EFail && TEST_ERROR_CODE!=err && parameter2!=err1)) { ERR_PRINTF2(_L("The %S test of macro TEST(E)L test is failed!"), POS_NEG_SEL); SetTestStepResult(EFail); } else { INFO_PRINTF2(_L("The %S test of macro TEST(E)L is passed."), POS_NEG_SEL); SetTestStepResult(EPass); } } } else if (macro == KTest1) { TBool parameter; TBool parameter2; TInt parameter3; TInt initState; TInt expectedResult; GetBoolFromConfig(ConfigSection(), KParameter, parameter); GetBoolFromConfig(ConfigSection(), KParameter2, parameter2); GetIntFromConfig(ConfigSection(), KParameter3, parameter3); GetIntFromConfig(ConfigSection(), KInitState, initState); GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult); SetTestStepResult((TVerdict)initState); _LIT(KStartInfo, "Start to run %S test of macros TEST(E)1 & TEST(E)1L"); INFO_PRINTF2(KStartInfo, POS_NEG_SEL); TEST1(parameter, parameter2); TESTE1(parameter, parameter3, parameter2); if (expectedResult != TestStepResult()) { ERR_PRINTF1(_L("Macro TEST(E)1 test failed!")); SetTestStepResult(EFail); } else { SetTestStepResult(EPass); INFO_PRINTF3(_L("The %S test of macro TEST(E)1 has passed. Start to run %S test of macro TEST(E)1L"), POS_NEG_SEL, POS_NEG_SEL); TRAPD(err, TEST1L(parameter, parameter2)); TRAP_IGNORE(TESTE1L(parameter, parameter3, parameter2)); if ((expectedResult==EPass && KErrNone!=err) || ((expectedResult==EFail) && (parameter && ((TEST_ERROR_CODE==err)||(parameter3==err))) || (!parameter && TEST_ERROR_CODE!=err && parameter3!=err))) { ERR_PRINTF1(_L("Macro TEST(E)1L test failed!")); SetTestStepResult(EFail); } else { INFO_PRINTF2(_L("The %S test of macro TEST(E)1L has passed."), POS_NEG_SEL); SetTestStepResult(EPass); } } } else if (macro == KTestCheckL) { TInt parameter; TInt parameter1; TPtrC parameter2; TInt expectedResult; GetIntFromConfig(ConfigSection(), KParameter, parameter1); GetStringFromConfig(ConfigSection(), KParameter2, parameter2); GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult); parameter = (parameter1==expectedResult); INFO_PRINTF3(_L("Start %S test of macro %S"), POS_NEG_SEL, &KTestCheckL()); TRAPD(err, TEST_CHECKL(parameter1, expectedResult, parameter2)); _LIT(KPassInfo, "This test should be passed!"); _LIT(KFailInfo, "This test should be failed!"); if ((KErrNone==err && parameter2==KPassInfo()) || (parameter1==err && parameter2==KFailInfo())) { INFO_PRINTF2(_L("The macro %S test is passed!"), &KTestCheckL()); SetTestStepResult(EPass); } else { ERR_PRINTF2(_L("The macro %S test is failed!"), &KTestCheckL()); SetTestStepResult(EFail); } } else { WARN_PRINTF2(_L("Unrecognized Marco %S"), macro); } return TestStepResult(); }