mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/src/MmfTsPlay_core.cpp
branchRCL_3
changeset 30 ab526b8cacfb
parent 7 709f89d8c047
equal deleted inserted replaced
24:bea5e7625e42 30:ab526b8cacfb
  1932 	TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay;
  1932 	TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay;
  1933 	TBool UsingDefault;
  1933 	TBool UsingDefault;
  1934 
  1934 
  1935 	if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) )
  1935 	if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) )
  1936 		{
  1936 		{
  1937 		TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay;
  1937 		TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay ,UsingNegativeTestCaseDefault;
  1938 		TFileName FileName = FileNamePtr;
  1938 		TFileName FileName = FileNamePtr;
  1939 	//	TInt WindowError;
  1939 	//	TInt WindowError;
  1940 
  1940 
  1941 		iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr);
  1941 		iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr);
  1942 		CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger);
  1942 		CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger);
  1954 		sndPlayer->endPosition = EndPosition;
  1954 		sndPlayer->endPosition = EndPosition;
  1955 		sndPlayer->playWindow = true;
  1955 		sndPlayer->playWindow = true;
  1956 
  1956 
  1957 		ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay);
  1957 		ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay);
  1958 		iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int());
  1958 		iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int());
       
  1959 		
       
  1960 	
       
  1961 		TInt NegativeTestCaseValue = GetIntL(section, KNegativeTag, UsingNegativeTestCaseDefault,0);
       
  1962 		
       
  1963 		if  (NegativeTestCaseValue == 1)
       
  1964 		    {
       
  1965 		     sndPlayer->iNegativePlayBackWindow = true;
       
  1966 		    }
  1959 
  1967 
  1960 		CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition);
  1968 		CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition);
  1961 		CleanupStack::PushL(reportParams);
  1969 		CleanupStack::PushL(reportParams);
  1962 		CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams);
  1970 		CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams);
  1963 
  1971 
  1973 		iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() );
  1981 		iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() );
  1974 
  1982 
  1975 
  1983 
  1976 		TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(EndPosition.Int64()) - I64INT(StartPosition.Int64()));
  1984 		TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(EndPosition.Int64()) - I64INT(StartPosition.Int64()));
  1977 		iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() );
  1985 		iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() );
  1978 
  1986 		
  1979 		if (  Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() )
  1987 	    if((ExpectedDuration > (sndPlayer->GetDuration())) && (sndPlayer->iNegativePlayBackWindow)) 
       
  1988 		   {
       
  1989 		   iLogger->Log(_L("ExpectedDuration is greater than the actual duration of the file"));
       
  1990 		   iLogger->Log(_L("Negative Test was successful"));		   
       
  1991 		   aResult.iResultDes.Copy(KTestCaseResultSuccess());
       
  1992        } 
       
  1993 	    else if (  Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() )
  1980 			{	//Durations too different
  1994 			{	//Durations too different
  1981 			iLogger->Log(_L("The clips duration is too different from the actual duration + position") );
  1995 			iLogger->Log(_L("The clips duration is too different from the actual duration + position") );
  1982 			aResult.iResult = KErrExpectedValueDifferent;
  1996 			aResult.iResult = KErrExpectedValueDifferent;
  1983 			aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent());
  1997 			aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent());
  1984 			}
  1998 			}