//===============================================================================================
// READING entries
//===============================================================================================
void TestReadMinimalContactL(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
	{
	test.Next(_L("Test ReadMinimalContactL"));
	// Successful read of icc entry
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
	syncChecker->ResetMethodCallCountsL();
	CContactItem* item=aDb.ReadMinimalContactLC(aIccId);
	test(syncChecker->ValidateMethodCallCountL() == 1);
	test(item!=NULL);
	CleanupStack::PopAndDestroy(item);
	item=NULL;

	// Unsuccessful read of icc entry because icc locked
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrAccessDenied);
	syncChecker->ResetMethodCallCountsL();
	TRAPD(err,item=aDb.ReadMinimalContactLC(aIccId));
	test(syncChecker->ValidateMethodCallCountL() == 1);
	test(item==NULL);
	test(err==KErrAccessDenied);
	
	// successful read of non-icc entry, even though icc locked
	syncChecker->ResetMethodCallCountsL();
	item=aDb.ReadMinimalContactLC(aNonIccId);
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(item!=NULL);
	CleanupStack::PopAndDestroy(item);
	item=NULL;
	}
Ejemplo n.º 2
0
void CTestResources::PrintReverseViewSortOrderL()
	{
	test.Printf(_L("View Sort reverse order is:\n"));
	TBuf<128> buf;
	for(TInt i=0; i<iLocalReverseView->CountL(); ++i)
		{
		TContactItemId id=iLocalReverseView->AtL(i);
		CContactItem* contact=iDb->ReadMinimalContactLC(id);
	 	CContactItemFieldSet& fieldSet=contact->CardFields();
	 	buf.Format(_L("Id %d : \""), id);
	 	TInt pos=fieldSet.Find(KUidContactFieldGivenName);
		if (pos!=KErrNotFound)
		 	buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\" "));
	 	pos=fieldSet.Find(KUidContactFieldFamilyName);
	 	buf.Append(_L("\""));
		if (pos!=KErrNotFound)
	 		buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\" "));
	 	pos=fieldSet.Find(KUidContactFieldCompanyName);
	 	buf.Append(_L("\""));
		if (pos!=KErrNotFound)
		 	buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\""));
		RDebug::Print(_L("%S\n"),&buf);

		CleanupStack::PopAndDestroy(contact);
		buf.Zero();
		}
	}
Ejemplo n.º 3
0
/** 
 * Verify that the plug-in implementation is called when the 
 * ReadMinimalContactL API is used. 
 * 
 * Tests methods:
 * IMPORT_C CContactItem* ReadMinimalContactL(TContactItemId aContactId);
 * IMPORT_C CContactItem* ReadMinimalContactLC(TContactItemId aContactId);
 * 
 * @param aDb Contact database
 * @param aId Contact item ID to read
 */
void TestReadMinimalContactL(CContactDatabase& aDb, TContactItemId aId)
	{
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
	syncChecker->ResetMethodCallCountsL();
	test(syncChecker->ValidateMethodCallCountL() == 0);	
	CContactItem* item = aDb.ReadMinimalContactLC(aId);
	test(syncChecker->ValidateMethodCallCountL() == 1);	
	CleanupStack::PopAndDestroy(item);

	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrAccessDenied);
	syncChecker->ResetMethodCallCountsL();
	test(syncChecker->ValidateMethodCallCountL() == 0);
	item=NULL;
	//TRAPD(err, item = aDb.ReadMinimalContactLC(aId));
	TRAPD( err, item = ReadItemL( aDb, aId ) );
	delete item;
	test(err==KErrAccessDenied);
	test(syncChecker->ValidateMethodCallCountL() == 1);	
	}