Ejemplo n.º 1
0
void CPolicyTest::SetTestSecurityInfoL(TInt aSecureId, TInt aVendorId, TUint aCapSet, TRequestStatus& aStatus)
	{
	// Remove excluded capabilities
	for (TInt i = 0 ; i < ECapability_Limit ; ++i)
		{
		if (iExcludedCaps.HasCapability(static_cast<TCapability>(i)))
			{
			aCapSet &= ~ (1 << i);
			}
		}
	
	TBuf<128> commandLine;
	commandLine.AppendFormat(_L("%S %08x "), iTestExe, aCapSet);
	if (aSecureId)
		{
		commandLine.AppendFormat(_L("-SID %08x "), aSecureId);
		}
	if (aVendorId)
		{
		commandLine.AppendFormat(_L("-VID %08x "), aVendorId);
		}
   // commandLine.Append(KTestExeTmpPath);
    iTestExeTmpNewPath = KTestPath;
	iTestExeTmpNewPath.Append(*iTestExe);
	commandLine.Append(iTestExeTmpNewPath);
    
    TBuf<128> isetcapTmpNewPath1; //stores the value of commandline
    TBuf<128> isetcapTmpNewPath;  //stores the value of KsetCapexe2
	isetcapTmpNewPath = KSetCapExe2;
	isetcapTmpNewPath1= commandLine;
	isetcapTmpNewPath.Append(isetcapTmpNewPath1);
	RDebug::RawPrint(isetcapTmpNewPath);
	StartProcessL(KSetCapExe, commandLine, aStatus);
	
	}
Ejemplo n.º 2
0
extern void LogRegion(const TRegion* aRegion)
    {
    TBuf<LogTBufSize> log;
    TTruncateOverflow overflow;
    TInt rectCount = (aRegion == NULL ? 0 : aRegion->Count());
    log.AppendFormat(_L("Fading region: [%d,"), &overflow, rectCount);
    if (rectCount > 0)
        {
        const TRect* rectangles = aRegion->RectangleList();
        TBuf<1> comma;
        for (TInt ii = 0; ii < rectCount; ii++)
            {
            TRect current = rectangles[ii];
            log.AppendFormat(_L("%S{{%d,%d},{%d,%d}}"), &overflow, &comma,
                             current.iTl.iX,current.iTl.iY,current.iBr.iX,current.iBr.iY);
            comma = _L(",");
            }
        }
    else
        {
        log.AppendFormat(_L("NULL"), &overflow);
        }
    log.AppendFormat(_L("]"), &overflow);
    wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
    }
void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ )
    {
    TBuf<256> item;

    _LIT(KBasicFormat, "\t0x%08x\t\t");
    item.Format( KBasicFormat, VTable() );

    // Add modifiers
    _LIT( KModifiers, "%d" );
    _LIT( KBoxedCharFormat, " [%c]" );
    item.AppendFormat( KModifiers, RequestStatusValue() );
    if  ( IsActive() )
        {
        item.AppendFormat( KBoxedCharFormat, 'A' );
        }
    if  ( RequestIsPending() )
        {
        item.AppendFormat( KBoxedCharFormat, 'P' );
        }
    iCaption = item.AllocL();

    // Listbox items
    TPtrC value;

    // Address
    _LIT(KCaption1, "\tAddress\t\t0x%08x");
    item.Format( KCaption1, iAddress );
    AppendL( item );

    // vTable
    _LIT(KCaption2, "\tVTable\t\t0x%08x");
    item.Format( KCaption2, iVTable );
    AppendL( item );

    //
    _LIT(KCaption3, "\tStatus Value\t\t%d");
    item.Format( KCaption3, iRequestStatusValue );
    AppendL( item );

    //
    _LIT(KCaption5, "\tIs Active\t\t%S");
    value.Set( YesNoValue( IsActive() ) );
    item.Format( KCaption5, &value );
    AppendL( item );

    //
    _LIT(KCaption6, "\tRequest Pending\t\t%S");
    value.Set( YesNoValue( RequestIsPending() ) );
    item.Format( KCaption6, &value );
    AppendL( item );

    //
    _LIT(KCaption4, "\tPriority\t\t%d");
    item.Format( KCaption4, iPriority );
    AppendL( item );
    }
// Write and print the time result
TInt CTimerLogger::LogTestStepTime(TUint aOp, TInt aNum)
	{
	if (iTiming)
		return KErrGeneral;
	
	TBuf<100> buf;
	switch (aOp)
		{
		case EOpCreate:
			buf.Append(_L("Create - "));
			break;
		case EOpReplace:
			buf.Append(_L("Replace - "));
			break;
		case EOpChgAttr:
			buf.Append(_L("Change Attribute - "));
			break;
		case EOpRename:
			buf.Append(_L("Rename - "));
			break;
		case EOpWrite:
			buf.Append(_L("Write - "));
			break;
		case EOpResize:
			buf.Append(_L("Resize - "));
			break;
		case EOpDelete:
			buf.Append(_L("Delete - "));
			break;
		case EOpManyChanges:
			buf.AppendFormat(_L("%d Changes on Single File - "), aNum);
			break;
		case EOpManyFiles:
			buf.AppendFormat(_L("Small Changes on %d Files - "), aNum);
			break;
		case EOpCreateDir:
			buf.Append(_L("Create(dir) - "));
			break;
		case EOpRenameDir:
			buf.Append(_L("Rename(dir) - "));
			break;
		case EOpDeleteDir:
			buf.Append(_L("Delete(dir) - "));
			break;
		case EOpMixed:
			buf.AppendFormat(_L("%d Mixed Operations - "), aNum*18);
		default:
			break;
		}
	
	TReal time = (static_cast<TReal>(iTickNumber) * iTickPeriod) / iTimeScale;
	buf.AppendFormat(_L("time: %d ms"), static_cast<TInt>(time));
	return LogAndPrint(buf);
	}
Ejemplo n.º 5
0
//#pragma warning( disable : 4701 )	//local variable 'docPosError' may be used without having been initialized
TBool CLinePaginatorTest::CompareArrays()
	{
	TInt numPages=iCharsPerPage->Count();
	TInt numTestPages=iTestChars->Count();
	TInt numChars;
	TInt numTestChars;
	TBool pagesSame=EFalse;
	TBuf8<128> text;
	TInt prevDocPos=0;
	TInt docPosError=0;

	TBuf<256> buf;
	if (numPages==numTestPages)
		{
 		buf.AppendFormat(_L("Correct Number of Pages = %d\n"), numPages);
 		TESTPRINT(buf);
		pagesSame=ETrue;
		for (TInt i=0; i<numPages; i++)
			{
			numChars=(*iCharsPerPage)[i];
			numTestChars=(*iTestChars)[i]-prevDocPos;
			if(numChars!=numTestChars)
				{
				if (pagesSame)
					docPosError=(*iTestChars)[i];
				pagesSame=EFalse;
				}
			prevDocPos=(*iTestChars)[i];
			}
		if (pagesSame)
			{            
 			TESTPRINT(_L("Correct Number of Characters on Pages -- PASSED\n"));
			}
		else
			{
            TESTPRINT(_L("Incorrect Number of Characters on Pages -- FAILED\n"));            
            buf.Zero();
			buf.AppendFormat(_L("First Error Occurs at Position = %d"), docPosError);
			TESTPRINT(buf);
			}
		}
	else
		{
        TESTPRINT(_L("Incorrect Number of Pages  -- FAILED\n"));
        buf.Zero();
		buf.AppendFormat(_L("Number Calculated	by LinePaginator = %d\n"), numPages);		
		buf.AppendFormat(_L("Number Contained in File = %d\n"), numTestPages);
		TESTPRINT(buf);
		}

	iTestFile.Close();
	return pagesSame;
	}
Ejemplo n.º 6
0
EXPORT_C void CMsvTestUtils::WriteFileDataL(TMsvId aId, const TFileName& aFileName, const TFileName& aLogFilepath, TBool aReplace)
	{
	TParse dirPath;
	RFile attach;

	dirPath.Set(aFileName, NULL, NULL);
	TInt err = KErrNone;
	if (attach.Open(iFs, dirPath.FullName(), KEntryAttNormal) != KErrNone)
		return; // failed to find attachment


	TFileName filename(aLogFilepath);
	filename.Append(KFileNameFiles);
	RFile file;
	if (aReplace)
		err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	else
		err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	if(err==KErrNotFound) // file does not exist - create it
		err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
		
	TInt offset=0;
	__ASSERT_ALWAYS(file.Seek(ESeekEnd, offset)==KErrNone, Panic(KErrGeneral));

	TBuf<100> buf;
	buf.Zero();
	buf.AppendFormat(_L("\n*** %d *************** File Data ***************\n"), aId);
	
	buf.AppendFormat(_L("Filename >>> "));	
	WriteToFileL(file, buf);
	WriteToFileL(file, dirPath.NameAndExt());	
	WriteToFileL(file,_L("\n"));
	
	HBufC8* buffer8 = HBufC8::NewLC(1024);
	TPtr8 buf8 = buffer8->Des();
	do {
		attach.Read(buf8);
		WriteToFileL(file, buf8);
		} while (buf8.Length());
	
	buf.Zero();
	buf.AppendFormat(_L("\n********************* end of File ***********************\n"));
	WriteToFileL(file, buf);
	

	CleanupStack::PopAndDestroy(); // buffer8
	attach.Close();
	file.Close();
	}
Ejemplo n.º 7
0
// ---------------------------------------------------------------------------
// Writes number to log.
// ---------------------------------------------------------------------------
//
void CKmdDebugLogger::LogWriteNum( TUint aNum )
    {
    const TInt KMaxNumLength( 20 );
    TBuf<KMaxNumLength> buf;
    buf.AppendFormat( _L("%u\n"), aNum );  // key Data byte2byte
    LogWrite( buf );
    }
TVerdict CUloggerServerTest2Step::doTestStepL()
	{
	  if (TestStepResult()==EPass)
		{
		TInt errors = 0;
		
		errors += Test1L();//CULoggerSession::NewL
		errors += Test2L();//CULoggerSession::NewLC
		
		
		
			/*
			 * Method CULoggerSession::ServiceL cannot be tested here because it require
			 * of passing RMessage2 reference with valid RMessagePtr (IPC)
			 * If we are going to pass empty RMessage2 system will panic our process with
			 * User Panic 70.
			 * */
			
		//display results
		TBuf<128> res;
		res.AppendFormat(_L("%d errors"), errors);
		INFO_PRINTF1(_L("****Results****"));
		INFO_PRINTF1(res);
		if(errors == 0)  
			SetTestStepResult(EPass);
			else
				SetTestStepResult(EFail);
		}
	  return TestStepResult();
	}
Ejemplo n.º 9
0
void CLinePaginatorTest::WriteOutputFile(TPageLine aLine)
	{
    TBuf<256> buf;
	if (iTestPageBreak)
		{
		buf.AppendFormat(_L("%d\t%d\t%d\t%d\tBREAK\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage);
		TESTPRINT(buf);		
		}
	else
		{
        buf.Zero();        
		buf.AppendFormat(_L("%d\t%d\t%d\t%d\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage);
		TESTPRINT(buf);
		}

	}
Ejemplo n.º 10
0
EXPORT_C void CTestUtils::PrintHex(const TDesC8& aDes)
	{
	TBuf<256> temp;
	TInt pos = 0;
	const TInt len = aDes.Length();

	while (pos < len)
		{
		temp.Zero();
		TPtrC8 ptr = aDes.Mid(pos, Min(KNumberOfHex, len - pos));
		const TInt ptrLen = ptr.Length();

		for (TInt i = 0; i < ptrLen; i++)
			{
			temp.AppendFormat(_L("%2.2x "), ptr[i]);
			}

		if (ptrLen < KNumberOfHex)
			{
			temp.AppendFill(' ', (KNumberOfHex - ptrLen) * 3);
			}

		TBuf<KNumberOfHex> buf16;
		buf16.Copy(ptr);
		temp.Append(buf16);
		Printf(temp);

		pos += KNumberOfHex;
		}
	}
Ejemplo n.º 11
0
static void PrintAuthPolicyL(CPrinter* aPrinter, TAuthorisationPolicy aAuthPolicy)
/**
 Prints the authorisation policy.
 @param aPrinter	The printer object.
 @param aAuthPolicy	The authorisation policy.
 */
	{
	TBuf<80> buf;
	TPtrC authPol;
	switch (aAuthPolicy)
		{
		case EAlwaysCheck:
			authPol.Set(_L("EAlwaysCheck"));
			break;
		case ECheckPostManufacture:
			authPol.Set(_L("ECheckPostManufacture"));
			break;
		case ECheckUnprotectedSids:
			authPol.Set(_L("ECheckUnprotectedSids"));
			break;
		case ECheckIfFailed:
			authPol.Set(_L("ECheckIfFailed"));
			break;
		case ENeverCheck:
			authPol.Set(_L("ENeverCheck"));
			break;
		default:
			authPol.Set(_L("*** UNKNOWN ***"));
			break;
		}
	buf.AppendFormat(_L("     Authorisation Policy: %S\n"), &authPol);
	aPrinter->PrintL(buf);
	}
Ejemplo n.º 12
0
void CPolicyTest::RunTestL(TRequestStatus& aStatus)
	{
	  
	HBufC* hptr16; 
	hptr16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iNameInfo);
	RDebug::Print(KFormat,hptr16);
	delete hptr16;
	
	TDriveUnit sysDrive (RFs::GetSystemDrive());
	TDriveName sysDriveName (sysDrive.Name());
	
	TBuf<128> passScriptFile (sysDriveName);
	passScriptFile.Append(KPassScriptPath);
	
	TBuf<128> failScriptFile (sysDriveName);
	failScriptFile.Append(KFailScriptPath);
			
	TPtrC script = (iTestState == ETestPass) ? passScriptFile : failScriptFile;
	(iTestState == ETestPass) ? RDebug::RawPrint(KPassTestRunning) : RDebug::RawPrint(KFailTestRunning);
  	
	
	TBuf<128> logTmpFile (sysDriveName);
	logTmpFile.Append(KLogTmpPath);
	iFs.Delete(logTmpFile); // ignore errors
	
	TBuf<128> commandLine;
	commandLine.AppendFormat(_L("%S %S"), &script, &logTmpFile);	
	
	StartProcessL(iTestExeTmpNewPath, commandLine, aStatus);
	}
Ejemplo n.º 13
0
void PrintSystemServerSecurity(CPrinter* aPrinter, CPolicy *aPolicy)
/**
Prints the system server security configuration.
*/
	{

	TPtrC p;
	switch (aPolicy->SystemServerSecurity())
		{
	case CPolicy::ESystemServerSecurityPassedOrFailed:
		p.Set(_L("ESystemServerSecurityPassedOrFailed"));
		break;
	case CPolicy::ESystemServerSecurityPassed:
		p.Set(_L("ESystemServerSecurityPassed"));	
		break;
	case CPolicy::ESystemServerSecurityFailed:
		p.Set(_L("ESystemServerSecurityFailed"));
		break;
	default:
		p.Set(_L("*** UNKNOWN ***"));
		break;				
		}
	TBuf<80> buf;
	buf.AppendFormat(_L(" System Server Security: %S\n"), &p);
	aPrinter->PrintL(buf);
	}
TVerdict CFile0Step::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.
 */
	{	
	  if (TestStepResult()==EPass)
		{
		TestNewL();
		TestUnlockResourcesL();
		TestSettingsL();
		TestWriteL();
		
		if(iErrors == 0)
			SetTestStepResult(EPass);
		else
			{
			SetTestStepResult(EFail);
			TBuf<64> buf;
			INFO_PRINTF1(_L("********"));
			buf.AppendFormat(_L("%d errors were found!"), iErrors);
			INFO_PRINTF1(buf); 
			INFO_PRINTF1(_L("********"));
			}
		}
	  return TestStepResult();
	}
/** Function to generate a meaningful hash string from the test attributes

@param aSize the size of the font
@param aAttributes the attributes of the font 
@see TFontEffectsFlags
@param aTypefaceName the typeface name

@return the buffer with a text description, used for inclusion in the hash string
*/
HBufC* CTLinkedFontsComparison::GenerateTestDescriptionLC(TInt aSize,TUint32 aAttributes, const TPtrC &aTypefaceName, const TDesC &aTestDescription)
	{
	TBuf<KLengthOfHashValue> tempBuffer;
		
	//append the name
	tempBuffer.Append(_L("_"));
	tempBuffer.Append(aTypefaceName);
	tempBuffer.Append(_L("_"));
	tempBuffer.Append(aTestDescription);
	tempBuffer.Append(_L("_"));
	
	//append the size 
	tempBuffer.AppendFormat(_L("_size-%d"),aSize);
	if (aAttributes == 0)
		{
		//output no attributes
		tempBuffer.Append(_L("_"));
		tempBuffer.Append(KFontEffectsFlagsString[0]); //no attributes string
		}
	else
		{
		for (TInt counter=0;counter<31;counter++)
			{
			TInt bit = 1<<counter; //1,2,4,8 etc
			if (bit&aAttributes)
				{
				tempBuffer.Append(_L("_"));
				tempBuffer.Append(KFontEffectsFlagsString[counter+1]);
				}
			}
		}
	return tempBuffer.AllocLC();	
	}
Ejemplo n.º 16
0
// ----------------------------------------------------------------------------
// CBluetoothEngine::SetLIAC
// ----------------------------------------------------------------------------
void CBluetoothEngine::SetLIAC(TBool aState) {
	TInt err = KErrNone;

	// Set LIAC for the system    
	err = iProperty.Set(KPropertyUidBluetoothControlCategory,
			KPropertyKeyBluetoothSetLimitedDiscoverableStatus, aState);

	TBuf<KEighty> myMessage;

	myMessage.Zero();

	if (KErrNone == err) {
		if (aState) {
			myMessage.Append(KLIACOn);
		} else {
			myMessage.Append(KLIACOff);
		}
		iLIAC = aState;

		iDeviceDiscoverer->SetLIAC(iLIAC);

	} else {
		myMessage.AppendFormat(KLIACError, err);
	}

	TRAP( err, ShowMessageL( myMessage, ETrue ));
}
Ejemplo n.º 17
0
static void PrintPoliciesL(CPrinter* aPrinter, CPolicyReader* aReader)
/**
 Prints all of the policies returned by a CPolicyReader object.
 @param aPrinter The printer object.
 @param aReader	 The policy reader.
 */
	{
	TPolicyHeader hdr = aReader->Header();
	aPrinter->PrintL(_L("*** Policy Header ***\n"));
	aPrinter->PrintL(_L("            Policy Format: %d\n"), hdr.iFormatVersion);
	aPrinter->PrintL(_L("            Major Version: %d\n"), hdr.iMajorVersion);
	aPrinter->PrintL(_L("            Minor Version: %d\n"), hdr.iMajorVersion);
	aPrinter->PrintL(_L(" Default Policy Evaluator: 0x%08x\n"), hdr.iDefaultPolicyEvaluator);
	aPrinter->PrintL(_L("   Default Dialog Creator: 0x%08x\n"), hdr.iDefaultDialogCreator);	
	PrintAuthPolicyL(aPrinter, hdr.iAuthPolicy);
	aPrinter->PrintL(_L("\n"));
	
	CPolicy* p;
	TInt i = 0;
	while ((p = aReader->NextPolicyL()) != 0)
		{
		TBuf<32> buf;
		buf.AppendFormat(_L("*** Policy %d ***\n"), i);
		aPrinter->PrintL(buf);
		
		PrintPolicy(aPrinter, p);
		delete p;
		++i;
		}	
	}
Ejemplo n.º 18
0
void AvkonMedia::DisplayErrorMessage(TInt aError)
	{
	const TInt KMaxBuffer = 15;
	_LIT(KErrorMessage, "Error: %d");
	TBuf<KMaxBuffer> buffer;
	buffer.AppendFormat(KErrorMessage, aError);
	TRAP_IGNORE(CEikonEnv::Static()->InfoWinL(KNullDesC, buffer));
	}
Ejemplo n.º 19
0
EXPORT_C void CMsvTestUtils::WriteBodyDataL(TMsvId aId, const TFileName& aFilepath, CMsvStore& fileStore, TBool aReplace)
	{
	CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
	CCharFormatLayer* charLayer = CCharFormatLayer::NewL();
	CRichText* body = CRichText::NewL(paraLayer,charLayer);

	fileStore.RestoreBodyTextL(*body);

	HBufC* pBodyText = HBufC::NewLC(body->DocumentLength()+(body->DocumentLength()/70)+1);
	TPtr pBody = pBodyText->Des();
	body->Extract(pBody, 0);

	RFile file;
	TFileName filename(aFilepath);
	filename.Append(KFileNameBodies);
	
	TInt err = KErrNone;
	if (aReplace)
		err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	else
		err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	if(err==KErrNotFound) // file does not exist - create it
		err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);

	TInt offset=0;
	iRTest(file.Seek(ESeekEnd, offset)==KErrNone);

	TBuf<100> buf;
	buf.Zero();
	buf.AppendFormat(_L("*** %d *************** RichText Data ***************\n"), aId);
	buf.AppendFormat(_L("Size >>> %d\n"), body->DocumentLength());	
	WriteToFileL(file, buf);
	
	RemoveRichtextFormating(pBody);
	WriteToFileL(file, pBody);
	
	buf.Zero();
	buf.AppendFormat(_L("\n********************* end of Body ***********************\n"));
	WriteToFileL(file, buf);
	
	CleanupStack::PopAndDestroy(); // pBodyText
	file.Close();
	delete paraLayer;
	delete charLayer;
	delete body;
	}
Ejemplo n.º 20
0
// ===========================================================================
// HELPERS
// ===========================================================================
//
void T_RootServices::__DumpProtocolListL(
    RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList )
    {
    const TInt count = aProtocolList.Count();
    EUNIT_PRINT( _L( "Dumping %d protocols:"), count );

    //Iterate through the list of protocols and dump details
    for( TInt ix = 0; ix < count; ix++ )
        {
        MXIMPProtocolInfo& protocol = *aProtocolList[ ix ];
        MXIMPFeatureInfo* feats = protocol.GetProtocolFeaturesLC();

            {
            TBuf< 1000 > buffer;

            //Print protocol details
            buffer.AppendFormat( _L("  Protocol %d: [%08x] [%S]"),
                                 ix,
                                 protocol.ImplementationUid(),
                                 &protocol.DisplayName() );
            EUNIT_PRINT( buffer );


            //Print feature details
            const MDesC8Array& featureIds = feats->FeatureIds();

            const TInt featCount = featureIds.MdcaCount();
            buffer.Zero();
            buffer.AppendFormat( _L("  Supported features %d: "), featCount );

            for( TInt ix = 0; ix < featCount; ix++ )
                {
                TBuf< 50 > tmpBuf;
                tmpBuf.Copy( featureIds.MdcaPoint( ix ) );
                buffer.AppendFormat( _L("%S "), &tmpBuf );
                }

            EUNIT_PRINT( buffer );
            }

        CleanupStack::PopAndDestroy(); //feats
        }
    }
Ejemplo n.º 21
0
LOCAL_C void CheckL(TInt aValue, TInt aExpected, TInt aLine)
	{
	if(aValue != aExpected)
		{
        TBuf<256> buf;
        buf.AppendFormat(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
        TestStep->print(buf,(TText8*)__FILE__,aLine);
		TestStep->testpoint(EFalse,(TText8*)__FILE__,aLine);
		}
	}
Ejemplo n.º 22
0
void CIpuTestHarness::TestHarnessComplete()
//
//	Test harness completed without failures
	{
	_LIT(KTestCompleteFormat, "Total Tests %d, Failed Tests %d");
	TBuf<50> text;
	text.AppendFormat(KTestCompleteFormat, iTestCount, iFailedTests->Count()); 
	WriteComment(text);
	WriteComment(KTestHarnessCompleted);
	}
Ejemplo n.º 23
0
TBool CLinePaginatorTest::ReadTestFile(TPageLine& aLine)
	{
	TLex8 lex;
	TBuf8<128> textBuffer;
	TBuf8<128> numBuffer;
	TInt startNum;

	iTestFile.Read(iFilePos,textBuffer,128);
	if (textBuffer.Locate('X') != KErrNotFound && textBuffer.Locate('X') < textBuffer.Locate('\r'))
		{
		startNum=textBuffer.Locate('\n')+1;
  		textBuffer.Delete(0,startNum);
		iFilePos+=startNum;
		lex=textBuffer;
		lex.Val(aLine.iDocPos);
		TBuf<254> buf;
		buf.AppendFormat(_L("%d\tX\n"), aLine.iDocPos);
		TESTPRINT(buf);
		return EFalse;
		}

	startNum=textBuffer.Locate('\n')+1;
	textBuffer.Delete(0,startNum);
	iFilePos+=startNum;
	lex=textBuffer;
	lex.Val(aLine.iDocPos);

	startNum=textBuffer.Locate('\t')+1;
	textBuffer.Delete(0,startNum);
	iFilePos+=startNum;
	lex=textBuffer;
	lex.Val(aLine.iLineHeight);

	startNum=textBuffer.Locate('\t')+1;
	textBuffer.Delete(0,startNum);
	iFilePos+=startNum;
	lex=textBuffer;
	lex.Val(aLine.iKeepWithNext);

	startNum=textBuffer.Locate('\t')+1;
	textBuffer.Delete(0,startNum);
	iFilePos+=startNum;
	lex=textBuffer;
	lex.Val(aLine.iStartNewPage);

	if (textBuffer.Locate('\t')<textBuffer.Locate('\r')
		&& textBuffer.Locate('B')!=KErrNotFound
		&& textBuffer.Locate('B')<textBuffer.Locate('\r'))
		iTestPageBreak=ETrue;
	else
		iTestPageBreak=EFalse;

	iFilePos+=textBuffer.Locate('\r')+1;
	return ETrue;
	}
Ejemplo n.º 24
0
static void LogWindowSpriteRedrawEnd(const CWsWindow& aWsWin)
    {
    if (wsDebugLog)
        {
        TBuf<LogTBufSize> log;
        TTruncateOverflow overflow;
        if(aWsWin.Type() == WS_HANDLE_ROOT_WINDOW)
            {
            _LIT(KAnnotateSpriteRedrawEnd, " << MWsDrawAnnotationObserver::WindowSpriteRedrawEnd RootWindow for screen:%d");
            log.AppendFormat(KAnnotateSpriteRedrawEnd, &overflow, aWsWin.Screen()->ScreenNumber());
            }
        else
            {
            _LIT(KAnnotateSpriteRedrawEnd, " << MWsDrawAnnotationObserver::WindowSpriteRedrawEnd [%S][app %d] RWindow[%d]");
            const TDesC& clientName = aWsWin.WsOwner()->Client().FullName();
            log.AppendFormat(KAnnotateSpriteRedrawEnd, &overflow, &clientName, aWsWin.WsOwner()->ConnectionHandle(), aWsWin.LogHandle());
            }
        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
        }
    }
Ejemplo n.º 25
0
void CTextWindow::Draw()
//This function is virtual and so cannot have an 'L' at the end of it's name
	{
	iGc->Clear();
	ResetPrintLine();
	switch(iDrawMode)
		{
	case EDrawModeWordJust:
		User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
		iGc->UseFont(iTmpFont);
		DrawWordJustified(_L("Hello World"));
		DrawWordJustified(_L("One Two Three Four Five Six Seven"));
		DrawWordJustified(_L("AA    B        CC D"));
		DrawWordJustified(_L("ONEWORD"));
		iGc->DiscardFont();
		Client()->iScreen->ReleaseFont(iTmpFont);
		iTmpFont=NULL;
		break;
	case EDrawModeCharJust:
		User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
		iGc->UseFont(iTmpFont);
		DrawCharJustified(_L("Hello World"));
		DrawCharJustified(_L("One Two Three Four Five Six Seven"));
		DrawCharJustified(_L("AA    B        CC D"));
		DrawCharJustified(_L("ONEWORD"));
		iGc->DiscardFont();
		Client()->iScreen->ReleaseFont(iTmpFont);
		iTmpFont=NULL;
		break;
	case EDrawModeFonts:
		{
		TTypefaceSupport typefaceSupport;
		Client()->iScreen->TypefaceSupport(typefaceSupport,iTypeFaceIndex);
		TBuf<0x40> title;
		TBuf16<KMaxTypefaceNameLength> tmpBuf;
		tmpBuf.Copy(typefaceSupport.iTypeface.iName);
		title.Append(tmpBuf);
		title.AppendFormat(TRefByValue<const TDesC>(_L(", Heights (Min=%d, Max=%d, Num=%d)")),typefaceSupport.iMinHeightInTwips,typefaceSupport.iMaxHeightInTwips,typefaceSupport.iNumHeights);
		PrintLine(iFont,title);
		PrintDivider();
		for (TInt tfHeight=0;tfHeight<typefaceSupport.iNumHeights;tfHeight++)
			{
			TFontSpec fspec(typefaceSupport.iTypeface.iName,Client()->iScreen->FontHeightInTwips(iTypeFaceIndex,tfHeight));
			PrintStylesL(_L("Normal, "), fspec, TFontStyle());
			PrintStylesL(_L("Bold, "), fspec, TFontStyle(EPostureUpright,EStrokeWeightBold,EPrintPosNormal));
			PrintStylesL(_L("Italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightNormal,EPrintPosNormal));
			PrintStylesL(_L("Bold/italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightBold,EPrintPosNormal));
			if (iYpos>Size().iHeight)
				break;
			}
		}
		break;
		}
	}
Ejemplo n.º 26
0
static void LogSpriteRedrawEnd(const CWsSpriteBase& aSprite)
    {
    if (wsDebugLog)
        {
        _LIT(KAnnotateSpriteRedrawEnd, "<< MWsDrawAnnotationObserver::FloatingSpriteRedrawEnd [%S][app %d]");
        const TDesC& clientName = aSprite.WsOwner()->Client().FullName();
        TBuf<LogTBufSize> log;
        TTruncateOverflow overflow;
        log.AppendFormat(KAnnotateSpriteRedrawEnd, &overflow, &clientName, aSprite.WsOwner()->ConnectionHandle());
        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
        }
    }
Ejemplo n.º 27
0
extern void LogFadeStart(const CWsWindow* aWsWin)
    {
    if (wsDebugLog && aWsWin->WsOwner())
        {
        _LIT(KLogDrawCommandsStart, ">> CWsRedrawMsgWindow::Fade() [%S][app %d] RWindow[%d]");
        const TDesC& clientName = aWsWin->WsOwner()->Client().FullName();
        TBuf<LogTBufSize> log;
        TTruncateOverflow overflow;
        log.AppendFormat(KLogDrawCommandsStart, &overflow, &clientName, aWsWin->WsOwner()->ConnectionHandle(), aWsWin->LogHandle());
        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
        }
    }
Ejemplo n.º 28
0
static void LogWindowAnimRedrawEnd(const CWsWindow& aWsWin)
    {
    if (wsDebugLog)
        {
        _LIT(KAnnotateWindowAnimRedrawEnd, " << MWsDrawAnnotationObserver::WindowAnimRedrawEnd [%S][app %d] RWindow[%d]");
        const TDesC& clientName = aWsWin.WsOwner()->Client().FullName();
        TBuf<LogTBufSize> log;
        TTruncateOverflow overflow;
        log.AppendFormat(KAnnotateWindowAnimRedrawEnd, &overflow, &clientName, aWsWin.WsOwner()->ConnectionHandle(), aWsWin.LogHandle());
        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, log);
        }
    }
Ejemplo n.º 29
0
void Log::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen)
	{

	TBuf<0x100> buf;
	buf.SetLength(0);
	TInt i = 0;
	const TText* p = aHeader;
	while (aLen>0)
		{
		TInt n = aLen>KHexDumpWidth ? KHexDumpWidth : aLen;
		buf.AppendFormat(_L("%s%04x : "), p, i);
		TInt j;
		for (j=0; j<n; j++)
			buf.AppendFormat(_L("%02x "), aPtr[i+j]);
		while (j++<KHexDumpWidth)
			buf.AppendFormat(_L("   "));
		buf.AppendFormat(_L(" "));
		for (j=0; j<n; j++)
			buf.AppendFormat(_L("%c"), aPtr[i+j]<32 || aPtr[i+j]>126 ? '.' : aPtr[i+j]);
		buf.AppendFormat(_L("\r\n"));
		Log::Write(buf);
		buf.SetLength(0);
		aLen -= n;
		i += n;
		p = aMargin;
		}
	}
Ejemplo n.º 30
0
/**
 This will get called after the view is ready to be used. The only things left to do are clean up
 any resources and stop the active scheduler.
*/
void CStartUp::RunL()
	{
	if (iViewType == ERemoteContactsView) // groups view is empty so don't try to retrieve contacts
		{
		// Get the first 8 contacts like an app would in order to display them in the UI
		// and then get the ninth contacts like an app would if scrolling down one.
		RetrieveContactsL();
		}
	
	// Print results
	_LIT(KStartupTotalText, "Startup Total: %d s %03d\nof which:\n");
	_LIT(KOpenDbText, "    Open database: %d s %03d\n");
	_LIT(KCreateViewText, "    Create view: %d s %03d\n");
	_LIT(KGetFirstTwentyContactsText, "Get first 20 contacts: %d s %03d\n");
	_LIT(KGetTwentyFirstContactText, "Get 21st (scrolldown): %d s %03d\n");

	TBuf<255> buf;
	TInt startupTotal = iTimes[EOpenDatabase]  + iTimes[ECreateView];
	buf.AppendFormat(KStartupTotalText, (startupTotal / 1000000), ((startupTotal / 1000) % 1000));
	buf.AppendFormat(KOpenDbText, (iTimes[EOpenDatabase] / 1000000), ((iTimes[EOpenDatabase] / 1000) % 1000));
	buf.AppendFormat(KCreateViewText, (iTimes[ECreateView] / 1000000), ((iTimes[ECreateView] / 1000) % 1000));
	if (iViewType == ERemoteContactsView)
		{
		buf.AppendFormat(KGetFirstTwentyContactsText, (iTimes[EGetFirstTwenty] / 1000000), ((iTimes[EGetFirstTwenty] / 1000) % 1000));
		buf.AppendFormat(KGetTwentyFirstContactText, (iTimes[EGetTwentyFirst] / 1000000), ((iTimes[EGetTwentyFirst] / 1000) % 1000));

		// Put the time for retrieving the first twenty in the variable passed in 
		// to the DoTestL function to which iMs20FromViewPtr is pointing. Horrid.
		*iNumMsToGet20ItemsFromViewPtr = iTimes[EGetFirstTwenty];
		}
	iTest.Printf(buf);


	// Cleanup: Close the database and remote view
	Cleanup();
		
	// Stop the active scheduler
	CActiveScheduler::Stop();
	}