Esempio n. 1
0
void CTestConductor::HandleContactViewEvent(const CContactViewBase &aView, const TContactViewEvent &aEvent)
	{
	if ((aEvent.iEventType == TContactViewEvent::EItemRemoved)
		&& (aEvent.iContactId == iGroupID) && (&aView == igview))
		{
		// Check whether items from imemberArray are in the view
		// checking one item is good enough for this test
		TContactItemId id = (*imemberArray)[0]; 			
		TRAPD(err, igview->FindL(id))				
		if (err == KErrNone)				
			{
				// the view has been updated				
				test.Printf(KViewUpdated);
				CActiveScheduler::Stop(); 	
			}
		}
LOCAL_C void CheckConsistentL
        (CContactDatabase& aDb,
        const CContactGroupView& aGroupView, 
        const CContactViewBase& aBaseView,
        TContactItemId aGroupId)
    {
    const TInt groupViewCount = aGroupView.CountL();
    test(groupViewCount <= aBaseView.CountL());
    CContactGroup* group = static_cast<CContactGroup*>(aDb.ReadContactLC(aGroupId));

    const TInt count = aBaseView.CountL();
    TInt checked = 0;
    for (TInt i=0; i < count; ++i)
        {
        const TContactItemId id = aBaseView.AtL(i);
        if (group->ContainsItem(id))
            {
            test(aGroupView.FindL(id) != KErrNotFound);
            ++checked;
            }
        }
    test(checked == groupViewCount);
    CleanupStack::PopAndDestroy(group);
    }