LOCAL_C void TestNoDuplicatesL(const CContactViewBase& aView) { const TInt count = aView.CountL(); for (TInt i=0; i < count; ++i) { const TContactItemId id = aView.AtL(i); for (TInt i2=i+1; i2 < count; ++i2) { test(aView.AtL(i2) != id); } } }
/** * Removes contacts from the underlying view based on the data available with contact view update objects */ void CTestContactViewUnderlyingViewUpdateStep::RemoveContactsFromTheUnderLyingViewsL() { for(TInt i = 0; i < iViewUpdateArray.Count(); ++i) { TViewModificationData contactViewValidationObject = iViewUpdateArray[i]; CContactViewBase* contactView = ViewCollectionReference().GetDesiredView (contactViewValidationObject.ViewTypeInStringFormat(), contactViewValidationObject.ViewIndex()); RArray<TContactItemId> contactItemIdArray; CleanupClosePushL(contactItemIdArray); for(TInt j = 0; j < contactViewValidationObject.NumberOfContactsToBeRemoved(); ++j) { TContactItemId contactItemId = contactView->AtL(j); contactItemIdArray.AppendL(contactItemId); } for(TInt j = 0; j < contactItemIdArray.Count(); ++j) { DatabaseReference().DeleteContactL(contactItemIdArray[j]); } CleanupStack::PopAndDestroy(&contactItemIdArray); } }
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); }
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); }