コード例 #1
0
TVerdict CSysUtilsGetLangSWVersionNoNewLinesStep::doTestStepL()
	{
	TInt err = SetTestPath(ETrue);
	if( err != KErrNone )
		{
		ERR_PRINTF2(_L("Could not turn test path on. Error = %d"), err);
		SetTestStepResult(EAbort);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("Test path turned on."));
	
	err = DeletePSProperties();
	if( err != KErrNone )
		{
		ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
		SetTestStepResult(EAbort);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("Deleted P&S properties successfully."));

	_LIT16(KDummy,"xxxxx");

	TBuf16<KSysUtilVersionTextLength> version;
	version.Insert(0,KDummy);

	err = SysUtil::GetLangSWVersion( version );
	
	if ( err == KErrNone)
		{
		_LIT(KLangSw, "LangSW");
		TPtrC16 line;
		TESTL( GetStringFromConfig(ConfigSection(), KLangSw, line) );
		TBuf16<KSysUtilVersionTextLength> testBuf(line);
		if (version.Compare(testBuf)==0)
			{
			INFO_PRINTF1(_L("Got version "));
			INFO_PRINTF1(version);
			}
		else
			{
			ERR_PRINTF1(_L("Version not correct"));
			INFO_PRINTF1(version);
			SetTestStepResult(EFail);
			}

		}
	else 
		{
		ERR_PRINTF2(_L("Error code = %d"), err);
		SetTestStepResult(EFail);
		}

	return TestStepResult();
	}
/**
@SYMTestCaseID		SYSLIB-BAFL-CT-4022 
@SYMREQ  	    	REQ8170
@SYMDEF			DEF141094
@SYMTestCaseDesc    GetVersionInsufficientBuffer
@SYMTestPriority    HIGH
@SYMTestStatus      Implemented
@SYMTestActions    	Use  the SysUtil::GetSWVersion method with its descriptor 
@SYMTestActions    	parameter’s size smaller than the length of the software version text 
@SYMTestActions    	Repeat for SysUtil::GetLangSWVersion 
@SYMTestExpectedResults KErrTooBig is returned because not all the software version text can 
@SYMTestExpectedResults	be read into the buffer supplied. 
*/
TVerdict CSysUtilsGetVersionInsufficienBufferStep::doTestStepL()
	{
	TInt err=KErrNone;
	const TInt bufSize = 6;
	
	_LIT16(kDummy,"xxxxx");

	TBuf16<bufSize> version;
	version.Insert(0,kDummy);
	
	err = SysUtil::GetSWVersion( version );
	ProcessError(err);
	err = SysUtil::GetLangSWVersion( version );
	ProcessError(err);
	err = SysUtil::GetPRInformation( version );
	ProcessError(err);
	
	return TestStepResult();
	}
コード例 #3
0
TVerdict CSysUtilsGetLangSWVersionUnreadableStep::doTestStepL()
	{
	TInt err = SetTestPath(ETrue);
	if( err != KErrNone )
		{
		ERR_PRINTF2(_L("Could not turn test path on. Error = %d"), err);
		SetTestStepResult(EAbort);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("Test path turned on."));
	
	err = DeletePSProperties();
	if( err != KErrNone )
		{
		ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
		SetTestStepResult(EAbort);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("Deleted P&S properties successfully."));
	
	_LIT16(KDummy,"xxxxx");

	TBuf16<KSysUtilVersionTextLength> version;
	version.Insert(0,KDummy);

	err = SysUtil::GetLangSWVersion( version );
	
	if ( err == KErrCorrupt)
		{
		INFO_PRINTF1(_L("KErrCorrupt returned this is expected"));
		}
	else 
		{
		ERR_PRINTF2(_L("Other error code  = %d"), err);
		SetTestStepResult(EFail);
		}
	return TestStepResult();
	}
コード例 #4
0
TVerdict CSysUtilsGetPRInformationStep::doTestStepL()
	{
	TInt err=KErrNone;
	
	_LIT16(KDummy,"xxxxx");

	TBuf16<KSysUtilVersionTextLength> version;
	version.Insert(0,KDummy);
	
	TInt fileErr = CheckIsFileExist( _L("C:\\versions\\purpose.txt"));
	if(fileErr == KErrNone)
		{
		err = DeletePSProperties();
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
			SetTestStepResult(EAbort);
			return TestStepResult();
			}
		INFO_PRINTF1(_L("Deleted P&S properties successfully."));
		
		err = SetTestPath(ETrue);
		if( err != KErrNone )
			{
			ERR_PRINTF2(_L("Could not turn test path off. Error = %d"), err);
			SetTestStepResult(EAbort);
			return TestStepResult();
			}
		INFO_PRINTF1(_L("Test path turned off."));
		
		err = SysUtil::GetPRInformation( version );
		if ( err != KErrNone )
			{
			ERR_PRINTF2(_L("Get PR Information failed. Error = %d"), err);
			SetTestStepResult(EFail);
			}
		else
			{
			//Get the information from the ini file
			_LIT(KPRInfo, "PRInfo");
			TPtrC16 line;

			TESTL( GetStringFromConfig(ConfigSection(), KPRInfo, line) );
			TBuf16<KSysUtilVersionTextLength> testBuf(line);
		    //Parse the information from the ini file
		    //Replace new-line patterns with real ones
			_LIT(KNewLinePattern, "\\n");
			_LIT( KNewline, "\n" );
			err = testBuf.Find(KNewLinePattern);
	        while (err != KErrNotFound)
	            {
	            // err is a position
	            testBuf.Replace(err, KNewLinePattern().Length(), KNewline );
	            err = testBuf.Find(KNewLinePattern);
	            }
	        if (version.Compare(testBuf)!=0)
				{
				ERR_PRINTF1(_L("PR Information formatted incorrectly"));
				INFO_PRINTF1(_L("From ini file: "));
                INFO_PRINTF1(testBuf);
                INFO_PRINTF1(_L("From txt file: "));
                INFO_PRINTF1(version);
                INFO_PRINTF2(_L("Comparison returned value %d"), version.Compare(testBuf));
				SetTestStepResult(EFail);
				}
			else
				{
				INFO_PRINTF1(_L("PR Information formatted correctly"));
				INFO_PRINTF1(_L("from ini file "));
				INFO_PRINTF1(testBuf);
				INFO_PRINTF1(_L("from txt file "));
				INFO_PRINTF1(version);
				}
			}
		}
	else
		{
		ERR_PRINTF1(_L("purpose.txt is missing, should be included to base packets"));
		SetTestStepResult(EFail);
		}
	
	err = SetTestPath(EFalse);

	return TestStepResult();
	}