コード例 #1
0
void CGroupViewTester::ExceriseViewL(CContactViewBase& aView)
	{
	TContactItemId lastId=0;
	const TInt numItems=aView.CountL();
	for (TInt ii=0;ii<numItems;++ii)
		{
		if (ii==numItems-1)
			{
			lastId=aView.AtL(ii);
			}
		iDb.ReadContactTextDefL(aView.AtL(ii),iScratchBuf,iTextDef);
		iLog.LogLineNoEcho(iScratchBuf);
		iScratchBuf.SetLength(0);
		}

	test(aView.FindL(lastId)==numItems-1);
	}
コード例 #2
0
/**
check that a field is generated for each view contact and that field matches list of missing of fields
remove generated field from contact item and repopulate contact view repeat until view contact field is null
*/
void CContactViewTest::doMissingFieldTestL(const CContactViewBase &aLView)
	{
	ClosePersistanceL(ETrue);
	TBool end = ETrue;
	TInt length = aLView.CountL();
	TInt manyfields = 0;
	TInt i;
	//iterate through ini file, that stores list of expected field in order
	const TPtrC mfield = GetNextFieldL();
	INTCOMPARE( length , ==,  iContacts, 0, 0 );
	iIterate->Reset();

	for(i = 0; i < length; ++i)
		{
		const TInt loc = aLView.FindL(iIterate->NextL());
		const CViewContact &vcontact = aLView.ContactAtL( loc );
		manyfields = vcontact.FieldCount();
		const TPtrC vfield = vcontact.Field(0);
		INTCOMPARE(  manyfields , ==,  1,  i, 0 );
		
		//compare view contact field to field stored in ini file
		STRINGCOMPARE( vfield, ==, mfield, i, 0 );
		//if view contact field is null, end test
		end = end && (vfield == KNullDesC);
		//find view contact field in contact item and set to null, if field not found, end test
		end = end || !FindAndClearFieldL( vcontact.Id(), vfield );
		}


	if( end )
		{
		iObserver->iMainFunc = NULL;
		iObserver->iDoFunc = NULL;
		iObserver->CleanView();
		}
	else
		{
		//if test not complete, reset view and repopulate
		OpenPersistanceL();
		iObserver->CleanView();
		iObserver->SetView( CreateViewL() );
		}
	}