Ejemplo n.º 1
0
LOCAL_C void TestRemoveContactFromGroupL()
    {
    test.Next(_L("Remove a contact from the group"));

    CTestResources* res = CTestResources::NewLC();

    CheckConsistentL(*res);

    // Need to open and commit the group to get any events from CContactDatabase!
    CContactGroup* group = static_cast<CContactGroup*>(res->iDb->OpenContactLX(res->iGroupId));
    CleanupStack::PushL(group);
    // Commit the group to get group changed event from Contact Db
	res->iDb->CloseContactL(group->Id());

    const TContactItemId contactId = (*group->ItemsContained())[0];
    res->iDb->RemoveContactFromGroupL(contactId, group->Id());
            
    // Listen to the event from the DB
    TContactDbObserverEvent dbEvent;
    test(res->iDbEventQueue->ListenForEvent(2,dbEvent));
    test(dbEvent.iType == EContactDbObserverEventGroupChanged);
    test(dbEvent.iContactId == group->Id());

    // Listen to the event from the group view
    TContactViewEvent groupViewEvent;
    test(res->iGroupViewEventQueue->ListenForEvent(2,groupViewEvent));

    CleanupStack::PopAndDestroy(2);  // group, lock

    // Eat away all events from queue to give iGroupView a chance to update itself
    while (res->iGroupViewEventQueue->ListenForEvent(2,groupViewEvent))
        {
        }
    
    CheckConsistentL(*res);
    CleanupStack::PopAndDestroy(res);
    }
Ejemplo n.º 2
0
//------------------------------------------------------------------------------------------------------------   
void CPerfDbCreator::AddGroupL(const TDesC & aGroupLabel)
	{
	CContactGroup * group = static_cast<CContactGroup *>(iContactsDb->CreateContactGroupLC(aGroupLabel));
 	
 	// Add a number of existing items to the group
 	TInt itemCount = iContactsDb->CountL();
 	TInt contactId;
 	for (TInt i = 0 ; i < KGroupSize; i++)
 		{
 		contactId = Math::Rand(iSeed) % itemCount;
 		iContactsDb->AddContactToGroupL(contactId, group->Id());
 		}
 		
 	CleanupStack::PopAndDestroy(group);
	}
Ejemplo n.º 3
0
void CTestConductor::CreateGroupTestDataL()
	{
	CContactGroup* groupOne = static_cast<CContactGroup*>(iDb->CreateContactGroupL(KGroupOneName));
	CContactIdArray* idsInGroupViewOne = NULL;

	CleanupStack::PushL(groupOne);

	iGroupOneId = groupOne->Id();
	for (TInt ii=1;ii<=KNumContactsInGroupOne;++ii)
		{
		test.Printf(_L("Making Group Contact %d \n"),ii);
		iDb->AddContactToGroupL(ii,iGroupOneId);
		}

	CleanupStack::PopAndDestroy(groupOne);

	groupOne = static_cast<CContactGroup*>(iDb->ReadContactL(iGroupOneId));
	CleanupStack::PushL(groupOne);

	idsInGroupViewOne = groupOne->ItemsContainedLC();
	CleanupStack::PopAndDestroy(idsInGroupViewOne);
	CleanupStack::PopAndDestroy(groupOne);
	}