558 { |
558 { |
559 TFileName FileName = FileNamePtr; |
559 TFileName FileName = FileNamePtr; |
560 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
560 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
561 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
561 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
562 |
562 |
563 sndPlayer -> CtrImpInfo(); |
|
564 |
|
565 |
|
566 CleanupStack::PushL(sndPlayer); |
563 CleanupStack::PushL(sndPlayer); |
567 iLogger->Log(_L("Starting scheduler")); |
564 iLogger->Log(_L("Starting scheduler")); |
568 |
565 |
569 CActiveScheduler::Start(); |
566 CActiveScheduler::Start(); |
|
567 sndPlayer -> CtrImpInfo(); |
570 |
568 |
571 |
569 |
572 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
570 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
573 aResult.iResult = sndPlayer->iFinalError ; |
571 aResult.iResult = sndPlayer->iFinalError ; |
574 |
572 |
949 } |
947 } |
950 |
948 |
951 TInt CMmfTsPlay::TestCaseGetLoadPercentageL(CStifSectionParser *section, TTestResult & aResult) |
949 TInt CMmfTsPlay::TestCaseGetLoadPercentageL(CStifSectionParser *section, TTestResult & aResult) |
952 { |
950 { |
953 TPtrC FileNamePtr; |
951 TPtrC FileNamePtr; |
954 TTimeIntervalMicroSeconds Position = KDefaultPosition; |
|
955 |
952 |
956 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
953 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
957 { |
954 { |
958 TFileName FileName = FileNamePtr; |
955 TFileName FileName = FileNamePtr; |
959 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
956 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
960 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
957 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
961 CleanupStack::PushL(sndPlayer); |
958 CleanupStack::PushL(sndPlayer); |
962 |
959 |
963 TBool UsingDefault; |
960 CActiveScheduler::Start(); |
964 Position = GetTimeIntervalL(section, KTagPosition, UsingDefault, KDefaultPosition); |
961 sndPlayer -> GetLoad_Percentage(); |
965 |
962 |
966 iLogger->Log(_L("Seting position to: %d"), Position.Int64()); |
|
967 if (UsingDefault) {iLogger->Log(_L("Using default position duration of: (%d)") , KDefaultPosition.Int64());} |
|
968 sndPlayer->iPosition = Position; |
|
969 |
|
970 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
971 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
972 // * ************************************************************** |
|
973 |
|
974 sndPlayer -> GetLoad_Percentage(); |
|
975 iLogger->Log(_L("Starting scheduler")); |
|
976 TTime StartTime,EndTime; |
|
977 StartTime.HomeTime(); |
|
978 CActiveScheduler::Start(); |
|
979 EndTime.HomeTime(); |
|
980 |
|
981 |
|
982 |
|
983 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
984 |
|
985 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
963 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
986 iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() ); |
964 aResult.iResult = sndPlayer->iFinalError; |
987 |
965 if (aResult.iResult) |
988 |
966 { |
989 TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(sndPlayer->GetDuration().Int64()) - I64INT(Position.Int64())); |
967 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
990 iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() ); |
968 aResult.iResultDes.Copy(KTestCaseResultFail()); |
991 |
969 } |
992 if ( Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() ) |
970 else |
993 { //Durations too different |
971 { |
994 iLogger->Log(_L("The clips duration is too different from the actual duration + position") ); |
972 iLogger->Log(_L("Test was successful")); |
995 aResult.iResult = KErrExpectedValueDifferent; |
973 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
996 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
974 } |
997 } |
975 |
998 else |
|
999 { |
|
1000 aResult.iResult = sndPlayer->iFinalError; |
|
1001 if (aResult.iResult) |
|
1002 { |
|
1003 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1004 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
1005 } |
|
1006 else |
|
1007 { |
|
1008 iLogger->Log(_L("Test was successful")); |
|
1009 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
1010 } |
|
1011 } |
|
1012 CleanupStack::PopAndDestroy(sndPlayer); |
976 CleanupStack::PopAndDestroy(sndPlayer); |
1013 return KErrExecuted; |
977 return KErrExecuted; |
1014 } |
978 } |
1015 else |
979 else |
1016 { |
980 { |