예제 #1
0
void CGroupViewTester::TestGroupViewSortOrderL(CContactGroupView& aView)
	{
	const TInt numItems=aView.CountL();
	for (TInt ii=0;ii<numItems;++ii)
		{
		if(ii!=numItems-1)//not last item
			{
			TContactIdWithMapping first = (aView.iGroupContacts)[ii];
			TContactIdWithMapping second = (aView.iGroupContacts)[ii+1];
			test(first.iMapping < second.iMapping);
			}
		}
	}
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);
    }
예제 #3
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(); 	
			}
		}